Skip to content

Commit 0e685f0

Browse files
committed
gdb server timeout is now 60 seconds with feedback every 5
1 parent 80a8765 commit 0e685f0

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# ChangeLog
22

3+
# V1.13.0-pre7
4+
* Added `overridePreEndSessionCommands` to control how a session ends. If the session does not end your way, we sill end the session the normal way
5+
* We try `monitor exit` to exit the server before we try `target-disconnect` for those servers that do not follow the GDB rules
6+
* During GDB server startup, the timeout is now 60 seconds but every 5 seconds, you will some feedback in the debug console that we are stil waiting
7+
* Added preliminary support for HW/SW breakpoints. There are still issues with GDB not counting HW breakpoints correctly.
8+
39
# V1.13.0-pre6
410
* Make the advanced decoder work properly for RTT. It now allows a dispose.
511
* Both SWO/RTT OUTPUT panels are now recycled instead of creating a new one every time. You can for a new one by supplying a new outputLabel and/or typeName.

debug_attributes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ If the type is marked as `{...}` it means that it is a complex item can have mul
5151
| overrideAttachCommands | string[] | Attach | Override the commands that are normally executed as part of attaching to a running target. In most cases it is preferable to use preAttachCommands and postAttachCommands to customize the GDB attach sequence. |
5252
| overrideGDBServerStartedRegex | string | Both | You can supply a regular expression (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) in the configuration property to override the output from the GDB Server that is looked for to determine if the GDB Server has started. Under most circumstances this will not be necessary - but could be needed as a result of a change in the output of a GDB Server making it incompatible with cortex-debug. This property has no effect for bmp or external GDB Server types. |
5353
| overrideLaunchCommands | string[] | Launch | Override the commands that are normally executed as part of flashing and launching the target. In most cases it is preferable to use preLaunchCommands and postLaunchCommands to customize the GDB launch sequence. |
54+
| overridePreEndSessionCommands | string[] | Both | Override the commands that are normally executed at the start of ending a debug session (e.g. when stopping debugging). |
5455
| overrideResetCommands | string[] | Both | Override the commands that are normally executed as part of reset-ing the target. When undefined the deprecated overrideRestartCommands is used if it exists. |
5556
| postAttachCommands | string[] | Attach | Additional GDB Commands to be executed after the main attach sequence has finished. |
5657
| postLaunchCommands | string[] | Launch | Additional GDB Commands to be executed after the main launch sequence has finished. |

src/backend/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class GDBServer extends EventEmitter {
3636
protected consoleSocket: net.Socket = null;
3737
private initResolve: (result: boolean) => void;
3838
private initReject: (error: any) => void;
39-
public static readonly SERVER_TIMEOUT = 10000;
39+
public static readonly SERVER_TIMEOUT = 60 * 1000;
4040
public static readonly LOCALHOST = '0.0.0.0';
4141
public pid: number = -1;
4242

src/gdb.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,16 @@ export class GDBDebugSession extends LoggingDebugSession {
599599
});
600600
this.usingParentServer = this.args.pvtMyConfigFromParent && !this.args.pvtMyConfigFromParent.detached;
601601
this.getTCPPorts(this.usingParentServer).then(async () => {
602+
function clearTimers() {
603+
if (timeout) {
604+
clearTimeout(timeout);
605+
timeout = null;
606+
}
607+
if (feedbackTimer) {
608+
clearInterval(feedbackTimer);
609+
feedbackTimer = null;
610+
}
611+
}
602612
await this.serverController.allocateRTTPorts(); // Must be done before serverArguments()
603613
const executable = this.usingParentServer ? null : this.serverController.serverExecutable();
604614
const args = this.usingParentServer ? [] : this.serverController.serverArguments();
@@ -655,12 +665,16 @@ export class GDBDebugSession extends LoggingDebugSession {
655665
doResolve();
656666
}, GDBServer.SERVER_TIMEOUT);
657667

668+
let elapsed = 0;
669+
let feedbackTimer = setInterval(() => {
670+
const svrName = this.serverController.name || this.args.servertype;
671+
elapsed += 5;
672+
this.handleMsg('stdout', `Still waiting for ${svrName} GDB Server to be ready, ${elapsed} seconds...\n`);
673+
}, 5 * 1000);
674+
658675
this.serverController.serverLaunchStarted();
659676
this.server.init().then(async (started) => {
660-
if (timeout) {
661-
clearTimeout(timeout);
662-
timeout = null;
663-
}
677+
clearTimers();
664678
const commands = [];
665679
try {
666680
// This is where 4 things meet and they must all finish (in any order) before we can proceed
@@ -773,10 +787,7 @@ export class GDBDebugSession extends LoggingDebugSession {
773787
}
774788
});
775789
}, (error) => {
776-
if (timeout) {
777-
clearTimeout(timeout);
778-
timeout = null;
779-
}
790+
clearTimers
780791
this.sendEvent(new TelemetryEvent(
781792
'Error',
782793
'Launching Server',

0 commit comments

Comments
 (0)