-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add Debug Context Selector #133
base: main
Are you sure you want to change the base?
Conversation
Because these changes impact their work, notifying @asimgunes and @jonahgraham |
Thanks for the contribution, @WyoTwT ! I appreciate where this is going. And that this is something we need for allowing contexts on windows like this, e.g. in multi-core debug scenarios. For the obvious reason that the amalgamator allows the use of context, it is very much tailored for that debug adapter. I am just curious if there have been any efforts yet to drive such extensions into the Microsoft DAP protocol? (Apologies, I don't know all the history of the amalgamator and its development yet). |
That is a good question, @jreineckearm . I've been operating under the assumption that the Microsoft DAP protocol is fairly rigid and hard to change. You make a great point. For instance, including an optional context for a read/write operation makes sense from a multi-core or multi-thread perspective so maybe this should be a change to the DAP protocol. Our downstream implementation differs from the Amalgamator but leverages this same PR with slight changes. Our implementation is a multi-core, single DAP instance which defines different threads for each core. In this case, the context is the thread. Context made sense for both our implementation (multi-thread, single DAP) and the Amalgamator case (multiple, single-threaded DAPs). Unfortunately, I don't know the history of the Amalgamator either but my understanding from eclipse-cdt-cloud/cdt-gdb-vscode/#110 was that the issue preventing us from using Memory Inspector instead of the Thank you for your insight! |
In principle, I think that this should be something the DAP would be open to, since it would be an optional extension to an existing request with clear parallels in other requests, but it doesn't look like an issue that has been explicitly raised for ReadMemory or WriteMemory requests. |
I'd also suspect that this is something worth to follow up on. Especially considering that looking into multi-core debug in general is on the New Initiatives list in CDT Cloud: https://github.com/eclipse-cdt-cloud/cdt-cloud/wiki/CDT-Cloud-Meetings I am out of office for the rest of the week. But will get back to this PR here after if no one else did until then. :-) |
a80eb95
to
d2fef45
Compare
cc4f6b0
to
9ecd716
Compare
Rebased on top of current Memory Inspector changes. Removed the Amalgamator additions from |
9ecd716
to
e400b97
Compare
As we've discussed a bit downstream, the word 'context' is now fairly polyvalent in this repo. The three kinds I see from a casual search are:
Each is distinct, so I think it makes sense to keep them separate. In particular, the On the other hand, labeling them all as I'd be in favor of renaming |
child: Context; | ||
} | ||
|
||
export class AmalgamatorSessionManager extends VariableTracker implements AdapterCapabilities { |
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.
It sounds like we likely want to move this over to the Amalgamator repository and make it dependent on this plugin (or at least propose it).
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.
I agree with @colin-grant-work . I think this is a great example of how a custom adapter implementation could look like.
But ideally it would be contributed by the debug adapter. Or was the intention to use it in a downstream version of the Memory Inspector, @WyoTwT ?
Maybe we can build some "how to implement your own adapter contribution" docs around it in https://github.com/eclipse-cdt-cloud/vscode-memory-inspector?tab=readme-ov-file#the-memory-provider ? It could be a nice story to demonstrate this with two Eclipse CDT Cloud components.
Another thing this PR shows me is that we may want to consider to somehow provide access to the default adapter implementation for reuse in custom implementations. Beyond asking developers to include the according sources from this repo.
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.
It doesn't appear there is an easy way to get access to the AdapterCapabilities, AdapterVariableTracker, and VariableTracker if this code is moved to the Amalgamator repository.
I could duplicate the interfaces in Amalgamator which is what I did with the Context because that wasn't shared from the Amalgamator. Would restructuring the code differently facilitate future movement of some parts into a form that could be reused for custom implementations?
I'm rather new to this so all suggestions to better structure the code are welcome but I may need additional clarification.
I think ultimately the added context is a
In fact there are some arguments on my mind when it comes to this. Among them are apparently address regions, address spaces, but also physical access parameters interpreted by the involved debug logic or translated into bus signals issued to the target memory system. Some could be covered by qualifiers in memory references. But others not so much. See for example #104 |
I see your point about the Amalgamator view using a I'm not against picking Either way, I like using *Arguments to better describe the additional arguments that are passed. Whatever is decided, I'm happy to use. |
e400b97
to
cad3f0b
Compare
Rebased on latest |
Since the ReadMemory/WriteMemory may be dependent upon the DAPs, move into the adapter-capabilities.ts file. Signed-off-by: Thor Thayer <[email protected]>
Populate the Context Dropdown from the different debug Contexts if available so different DAPs can be addressed. Add an optional Context to queries so the query can be directed to the appropriate handler. Add support for cdt-amalgamator. Signed-off-by: Thor Thayer <[email protected]>
Match current context id with one of the elements of the Contexts array. Signed-off-by: Thor Thayer <[email protected]>
cad3f0b
to
b5d212b
Compare
@WyoTwT In my opinion, this extension should be completely agnostic from any underlying debugger and not have any knowledge of the debugger its driving (apart from capabilities we have defined, e.g. the memory read and write functionality). To that end, I wouldn't expect any mention of adapters (e.g. amalgamater) and in order to add support, any functionality should be added to the adapter itself where possible. If there are certain areas we need additional functionality (e.g. dealing with multiple debug sessions in a compound or amalgamation), these should be implemented in a generic way so any other adapters can also take advantage of this support. This could be exposed as some sort of extension contribution point, optional API or similar. |
What it does
This PR fixes #67.
In a system with multiple children such as the
cdt-gdb-amalgamator
, the Memory Inspector needs a way to select the correct context (as thecdt-gdb-vscode
Memory Browser does).This PR has a dependency on
cdt-gdb-amalgamator
PR 20 which puts the assignment of the Child IDs in thecdt-gdb-amalgamator
instead of the Memory Inspector and also uses thereadMemory
since the data returned is in the correct format for Memory Inspector.How to test
Run this branch of the
vscode-memory-inspector
with the mainlinecdt-gdb-vscode
andcdt-gdb-adapter
along with the modifiedcdt-gdb-amalgamator
in PR 20.Start the debugger as a Desktop Extension. In the newly launched VSCode, open the cdt-amalgamator/sampleWorkspace folder and place a breakpoint at the first instruction in empty1.c's main and empty2.c's main. Start debugging with
Amalgamator Example
and you should run to the breakpoints. Open a new Memory Inspector with the Command Palette'sMemory: Show Memory Inspector
to open a new view. The dropdown should list bothproc1
andproc2
listed in the Call Stack.Select the appropriate
proc
by clicking on the corresponding main in the call stack. View the variable value in memory by typing:&local_in_main
into theAddress
textfield and pressing theGo
button. Go back to the corresponding C file (empty1.c or empty2.c) and single step. The value of theLocal
variable in theVariables
view will update. Open theMemory
tab and theData
should have changed as well to match theVariables
view.Review checklist
Reminder for reviewers