Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@
import org.eclipse.embedcdt.debug.gdbjtag.core.DebugUtils;
import org.eclipse.embedcdt.debug.gdbjtag.core.dsf.AbstractGnuMcuLaunchConfigurationDelegate;
import org.eclipse.embedcdt.debug.gdbjtag.core.dsf.GnuMcuServerServicesLaunchSequence;
import org.eclipse.swt.widgets.Display;

import com.espressif.idf.debug.gdbjtag.openocd.Activator;
import com.espressif.idf.debug.gdbjtag.openocd.Configuration;
import com.espressif.idf.debug.gdbjtag.openocd.ui.Messages;
import com.espressif.idf.debug.gdbjtag.openocd.ui.ServerTimeoutErrorDialog;

/**
* This class is referred in the plugin.xml as an "org.eclipse.debug.core.launchDelegates" extension point.
Expand Down Expand Up @@ -446,8 +448,22 @@ else if (sessionType == SessionType.CORE)
}
catch (ExecutionException e1)
{
throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
"Error in services launch sequence", e1.getCause())); //$NON-NLS-1$
if (e1.getMessage().contains("Starting OpenOCD timed out."))
{
Display.getDefault().asyncExec(() -> {
ServerTimeoutErrorDialog.openError(Display.getDefault().getActiveShell());

});
// Throwing exception with OK status to terminate launch sequence
throw new DebugException(new Status(IStatus.OK, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
"Error in services launch sequence", e1.getCause())); //$NON-NLS-1$
}
else
{
throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED,
"Error in services launch sequence", e1.getCause())); //$NON-NLS-1$
}

Comment thread
sigmaaa marked this conversation as resolved.
Outdated
}
catch (CancellationException e1)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*******************************************************************************
* Copyright 2024 Espressif Systems (Shanghai) PTE LTD. All rights reserved.
* Use is subject to license terms.
*******************************************************************************/
package com.espressif.idf.debug.gdbjtag.openocd.ui;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.PreferencesUtil;

public class ServerTimeoutErrorDialog extends MessageDialog
{

private static final String ESPRESSIF_PREFERENCES_MAINPAGE_ID = "com.espressif.idf.ui.preferences.mainpage"; //$NON-NLS-1$

public ServerTimeoutErrorDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
int dialogImageType, int defaultIndex, String[] dialogButtonLabels)
{
super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, defaultIndex,
dialogButtonLabels);
}

public static boolean open(int kind, Shell parent, String title, String message, int style)
{
ServerTimeoutErrorDialog dialog = new ServerTimeoutErrorDialog(parent, title, null, message, kind, 0,
new String[] { IDialogConstants.OK_LABEL });
style &= SWT.SHEET;
return dialog.open() == 0;
}

public static void openError(Shell parent)
{
open(ERROR, parent, Messages.getString("ServerTimeoutErrorDialog.title"), //$NON-NLS-1$
Messages.getString("ServerTimeoutErrorDialog.message"), SWT.NONE); //$NON-NLS-1$
}

@Override
protected Control createCustomArea(Composite parent)
{
Link link = new Link(parent, SWT.WRAP);
link.setText(Messages.getString("ServerTimeoutErrorDialog.customAreaMessage")); //$NON-NLS-1$
link.addSelectionListener(new SelectionAdapter()
{
@Override
public void widgetSelected(SelectionEvent e)
{
PreferencesUtil
.createPreferenceDialogOn(parent.getShell(), ESPRESSIF_PREFERENCES_MAINPAGE_ID, null, null)
.open();
}
});
;
return link;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -410,4 +410,9 @@ TabMain_Launch_Config=Launch Configuration:


## Console Messages ##
OpenOCDConsole_ErrorGuideMessage=Please refer to the troubleshooting guide below to identify the problem.
OpenOCDConsole_ErrorGuideMessage=Please refer to the troubleshooting guide below to identify the problem.

## Timeout Exception Dialog ##
ServerTimeoutErrorDialog.customAreaMessage=To increase timeout time visit <a>the Espressif Preference Page</a>.
ServerTimeoutErrorDialog.message=Starting OpenOCD timed out. Try to increase the `GDB server launch timeout`
ServerTimeoutErrorDialog.title=Problem Occurred