Approach for debugging incorrect disassembly location when opening disassembly view #1283
Replies: 3 comments 11 replies
-
You can try to enable verbose logging and try to see whether instructionPointerReference's of the stack frames sent in response to stackTrace request make sense. |
Beta Was this translation helpful? Give feedback.
-
I just attach to the process with... you guessed it, codelldb. |
Beta Was this translation helpful? Give feedback.
-
Answering the original question of "how to debug CodeLLDB", I just hadn't read the documentation well enough:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This is when debugging against a RISC-V instruction set simulator that provides a partial GDB Server interface. Generally the debugging works as expected: halts at breakpoints, shows register contents, shows callstack, shows variables. However opening the disassembly view, e.g. from the context menu on the callstack, fails either by showing the disassembly of a different address or simply results in the disassembly window showing "Disassembly not available". From the gdb-remote log it's evident that a memory read is attempted for incorrect addresses, eg:
send packet: $mffff3e4,7dd#fc
read packet: $EFF#D1
where there is no memory mapped at (or near) that address, and no similar address is visible in the GDBServer traffic.
Now I doubt that this is a bug in codelldb or in vscode. My guess is that it stems from the GDB Server implementation of the ISS, quite likely interacting badly with the LLDB library, e.g. by its incomplete support for some query types or GDB remote protocol extensions. So I'd like to walk through the execution of DebugSession:handle_disassemble(), but I don't how to do that with in the vscode/Electron environment. I've stumbled around in the debugger launched by "Toggle Developer Tools" but I haven't found the codelldb source there (perhaps because it's an extension?) to set a breakpoint.Alternatively I think I could add some output messages/messageboxes to that code to see what variable get set to and which pathways are taken, then build that and install from the .vsix?
There is surely some standard approach for debugging something like codelldb but I didn't find a reference for it (of course the multitude of pages on how to use debuggers drown out pages on how to debug the debugger itself). Any and all advice on this most welcome!
Beta Was this translation helpful? Give feedback.
All reactions