-
Notifications
You must be signed in to change notification settings - Fork 133
IEP-1265: Debug Process Hangs #1023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
24988ac
d595bee
88a2c15
de00153
03c8344
2ac0d8a
e0fa1a5
a926bd6
d07c76f
2c91af0
63705af
abe20e5
122d853
f1d737c
ea0c653
9fde565
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -93,8 +93,7 @@ public static String[] getGdbServerCommandLineArray(ILaunchConfiguration configu | |
| lst.add(executable); | ||
|
|
||
| int port = PortChecker | ||
| .getAvailablePort(configuration.getAttribute(ConfigurationAttributes.GDB_SERVER_GDB_PORT_NUMBER, | ||
| DefaultPreferences.GDB_SERVER_GDB_PORT_NUMBER_DEFAULT)); | ||
| .getAvailablePort(DefaultPreferences.GDB_SERVER_GDB_PORT_NUMBER_DEFAULT); | ||
|
|
||
|
||
| lst.add("-c"); //$NON-NLS-1$ | ||
| lst.add("gdb_port " + port); //$NON-NLS-1$ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| /******************************************************************************* | ||
|
Check warning on line 1 in bundles/com.espressif.idf.debug.gdbjtag.openocd/src/com/espressif/idf/debug/gdbjtag/openocd/dsf/Launch.java
|
||
| * Copyright (c) 2013 Liviu Ionescu. | ||
| * | ||
| * This program and the accompanying materials | ||
|
|
@@ -70,7 +70,7 @@ | |
| System.out.println("openocd.Launch.launch(" + launchConfiguration.getName() + "," + mode + ") " + this); | ||
| } | ||
|
|
||
| fConfig = launchConfiguration; | ||
|
Check warning on line 73 in bundles/com.espressif.idf.debug.gdbjtag.openocd/src/com/espressif/idf/debug/gdbjtag/openocd/dsf/Launch.java
|
||
| fExecutor = (DefaultDsfExecutor) getDsfExecutor(); | ||
| fSession = getSession(); | ||
| } | ||
|
|
@@ -147,9 +147,10 @@ | |
| fDefaultPreferences.getGdbClientExecutable()); | ||
| } | ||
|
|
||
| int availableRemotePort = PortChecker.getAvailablePort(config.getAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, | ||
| DefaultPreferences.GDB_SERVER_GDB_PORT_NUMBER_DEFAULT)); | ||
| config.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, availableRemotePort); | ||
| if (Configuration.getDoStartGdbServer(config)) | ||
| { | ||
| config.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, DefaultPreferences.GDB_SERVER_GDB_PORT_NUMBER_DEFAULT); | ||
| } | ||
|
Comment on lines
+166
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Port handling logic needs improvement The current implementation sets a fixed default port when the GDB server starts, but according to PR feedback, this doesn't handle port conflicts effectively. When the default port (3333) is occupied, the system should retry with alternative ports. Consider implementing a more robust port selection mechanism: if (Configuration.getDoStartGdbServer(config))
{
- config.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, DefaultPreferences.GDB_SERVER_GDB_PORT_NUMBER_DEFAULT);
+ int port = PortChecker.findAvailablePort(DefaultPreferences.GDB_SERVER_GDB_PORT_NUMBER_DEFAULT);
+ if (port == -1) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
+ "Unable to find available port for GDB server"));
+ }
+ config.setAttribute(IGDBJtagConstants.ATTR_PORT_NUMBER, port);
}
|
||
|
|
||
| config.setAttribute(DebugPlugin.ATTR_PROCESS_FACTORY_ID, CustomIdfProcessFactory.ID); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Catch Specific Exceptions Instead of Generic
ExceptionCatching the generic
Exceptioncan mask other unintended exceptions and make debugging harder. It's better to catch the more specificIOException, which is the expected exception type for socket operations.Apply this diff to catch
IOExceptionspecifically:📝 Committable suggestion