Skip to content

Commit 6de25ed

Browse files
committed
Enhancing ImageAndSymbols to load several binaries
Signed-off-by: Florent Vion <[email protected]>
1 parent cd740cd commit 6de25ed

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

src/GDBTargetDebugSession.ts

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,26 +79,40 @@ export interface TargetLaunchArguments extends TargetAttachArguments {
7979
cwd?: string;
8080
}
8181

82-
export interface ImageAndSymbolArguments {
82+
export interface SymbolFileAndOffset {
8383
// If specified, a symbol file to load at the given (optional) offset
84+
file: string;
85+
offset?: string;
86+
}
87+
88+
export interface ImageFileAndOffset {
89+
// If specified, an image file to load at the given (optional) offset
90+
file: string;
91+
offset?: string;
92+
}
93+
94+
export interface ImageAndSymbolsArguments {
95+
symbolFilesAndOffset?: SymbolFileAndOffset[];
96+
imageFilesAndOffset?: ImageFileAndOffset[];
97+
// Deprecated, use symbolFilesAndOffset instead. If specified, a symbol file to load at the given (optional) offset
8498
symbolFileName?: string;
8599
symbolOffset?: string;
86-
// If specified, an image file to load at the given (optional) offset
100+
// Deprecated, use imageFilesAndOffset instead. If specified, an image file to load at the given (optional) offset
87101
imageFileName?: string;
88102
imageOffset?: string;
89103
}
90104

91105
export interface TargetAttachRequestArguments extends RequestArguments {
92106
target?: TargetAttachArguments;
93-
imageAndSymbols?: ImageAndSymbolArguments;
107+
imageAndSymbols?: ImageAndSymbolsArguments;
94108
// Optional commands to issue between loading image and resuming target
95109
preRunCommands?: string[];
96110
}
97111

98112
export interface TargetLaunchRequestArguments
99113
extends TargetAttachRequestArguments {
100114
target?: TargetLaunchArguments;
101-
imageAndSymbols?: ImageAndSymbolArguments;
115+
imageAndSymbols?: ImageAndSymbolsArguments;
102116
// Optional commands to issue between loading image and resuming target
103117
preRunCommands?: string[];
104118
}
@@ -453,6 +467,7 @@ export class GDBTargetDebugSession extends GDBDebugSession {
453467
await this.gdb.sendEnablePrettyPrint();
454468
if (args.imageAndSymbols) {
455469
if (args.imageAndSymbols.symbolFileName) {
470+
// Deprecated
456471
if (args.imageAndSymbols.symbolOffset) {
457472
await this.gdb.sendAddSymbolFile(
458473
args.imageAndSymbols.symbolFileName,
@@ -463,6 +478,13 @@ export class GDBTargetDebugSession extends GDBDebugSession {
463478
args.imageAndSymbols.symbolFileName
464479
);
465480
}
481+
} else {
482+
const symFiles: SymbolFileAndOffset[] =
483+
args.imageAndSymbols.symbolFilesAndOffset ?? [];
484+
for (const symF of symFiles) {
485+
const offset: string = symF.offset ? symF.offset : '';
486+
await this.gdb.sendAddSymbolFile(symF.file, offset);
487+
}
466488
}
467489
}
468490

@@ -511,10 +533,17 @@ export class GDBTargetDebugSession extends GDBDebugSession {
511533

512534
if (args.imageAndSymbols) {
513535
if (args.imageAndSymbols.imageFileName) {
536+
// Deprecated
514537
await this.gdb.sendLoad(
515538
args.imageAndSymbols.imageFileName,
516539
args.imageAndSymbols.imageOffset
517540
);
541+
} else {
542+
const imgFiles: ImageFileAndOffset[] =
543+
args.imageAndSymbols.imageFilesAndOffset ?? [];
544+
for (const imgF of imgFiles) {
545+
await this.gdb.sendLoad(imgF.file, imgF.offset);
546+
}
518547
}
519548
}
520549
await this.gdb.sendCommands(args.preRunCommands);

0 commit comments

Comments
 (0)