@@ -79,10 +79,21 @@ export interface ChildDapContents {
7979 children ?: string [ ] ;
8080}
8181
82+ export interface ChildDapFull {
83+ children ?: {
84+ name : string ;
85+ id : number ;
86+ } [ ] ;
87+ }
88+
8289export interface ChildDapResponse extends Response {
8390 body : ChildDapContents ;
8491}
8592
93+ export interface ChildDapFullResponse extends Response {
94+ body : ChildDapFull ;
95+ }
96+
8697export class StoppedEvent extends Event implements DebugProtocol . StoppedEvent {
8798 public body : {
8899 reason : string ;
@@ -689,6 +700,16 @@ export class AmalgamatorSession extends LoggingDebugSession {
689700 children : this . childDapNames ,
690701 } as ChildDapContents ;
691702 this . sendResponse ( response ) ;
703+ } else if ( command === 'cdt-amalgamator/getChildDaps' ) {
704+ const fullDapResponse = response as ChildDapFullResponse ;
705+ const [ , threads ] = await this . collectChildTheads ( ) ;
706+ fullDapResponse . body = {
707+ children : threads . map ( ( child ) => ( {
708+ name : child . name ,
709+ id : child . id ,
710+ } ) ) ,
711+ } ;
712+ this . sendResponse ( fullDapResponse ) ;
692713 } else if ( command === 'cdt-amalgamator/Memory' ) {
693714 if ( typeof args . address !== 'string' ) {
694715 throw new Error (
@@ -710,6 +731,35 @@ export class AmalgamatorSession extends LoggingDebugSession {
710731 ] . customRequest ( 'cdt-gdb-adapter/Memory' , args ) ;
711732 response . body = childResponse . body ;
712733 this . sendResponse ( response ) ;
734+ } else if ( command === 'cdt-amalgamator/readMemory' ) {
735+ try {
736+ const childThreadID = args . child ?. id ;
737+ if ( typeof childThreadID !== 'number' ) {
738+ throw new Error (
739+ `Invalid type for 'child.id', expected number, got ${ typeof childThreadID } `
740+ ) ;
741+ }
742+ // Convert from ThreadID to Child array index.
743+ const [ childIndex , ] = await this . getThreadInfo (
744+ childThreadID
745+ ) ;
746+ if ( typeof childIndex === 'undefined' || childIndex >= this . childDaps . length ) {
747+ throw new Error (
748+ `Invalid value for 'child.id' or out of bounds [${ childIndex } ]`
749+ ) ;
750+ }
751+ const childResponse = await this . childDaps [
752+ childIndex
753+ ] . customRequest ( 'readMemory' , args ) ;
754+ response . body = childResponse . body ;
755+ this . sendResponse ( response ) ;
756+ } catch ( err ) {
757+ this . sendErrorResponse (
758+ response ,
759+ 1 ,
760+ err instanceof Error ? err . message : String ( err )
761+ ) ;
762+ }
713763 } else if (
714764 command === 'cdt-amalgamator/resumeAll' ||
715765 command === 'cdt-amalgamator/suspendAll'
0 commit comments