The ysyx-sdb-tui is a extension for NEMU or NPC SDB debugging tool. It can make the SDB support TUI mode in Visual Studio Code.
It can highlight the source code and disassembly code.
- support highlight the specific line in the source file and disassembly file, but not support trace disassembly source file
- support breakpoint in the source file
- high performance, real-time response
- parameters can be set by the user
- the port of the socket server
- the gdb cross-compiler toolchain
- the color of the highlight line
To use this extension, you need to add interface to NEMU or NPC. The source code and guide is in another repository.
And you should use apt install gdb-multiarch
to install the gdb-multiarch tool.
NOTE: the extension is tested in the following environment: user:~$ gdb-multiarch --version GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
For other versions of gdb or other Linux distributions, the compatibility is not guaranteed. The extension use GDB/MI, so as long as the commands and output are the same, it should be work.
If you have any problems, please submit an issue.
- Install this extension from the marketplace. Search for
ysyx-sdb-tui
. - Type
Ctrl+Shift+P
to open the command palette.- Type
ysyx sdb tui Enable
and pressEnter
to enable the extension. - Type
ysyx sdb tui Disable
and pressEnter
to disable the extension.
- Type
- Run you NEMU or NPC program in the VSCode terminal in SDB debug mode. To enable TUI mode for NEMU or NPC, please refer to this repository.
After you enable the extension, it will open a socket server in the background. You can send the following commands to the server for control.
init [disas|gdb] file-path
: set the disassembly file path and elf file path. Note that the elf file shall contain the debug information, you can add-g
or-ggdb
option when you compile the program.- file-path: the absolute path of the file.
hl [disas|src|all] addr
: highlight the disassembly code or source code based on the address.- addr: the address of the
pc
register. - all: concurrently execute the
hl disas addr
andhl src addr
commands. Recommended! Performance is better.
- addr: the address of the
The extension use the socket.io-server
to communicate with other programs. You can use the socket.io-client
to send the commands.
You can refer to the following links for more information:
In fact, you can use your own socket.io
client to send the commands to the server. See the SOCKET.IO
documentation for more information.
You can use the following order:
First, initialize the socket.io
client and connect to the server.
Second, send commands to the server.
-
init disas file-path
: set the disassembly file path. -
init gdb file-path
: set the elf file path, note that the elf file shall contain the debug information. -
hl disas addr
orhl src addr
: set them to the proper location.
Finally, close the connection.
You can set the socket server port in the settings.json
file, default is 49159.
{
"ysyxSdbTui.serverPort": 49159
}
If you modify the port, you should restart the extension and modify the client port in the NEMU or NPC.
If you have any problems, please let me know.
The initial release of ysyx-sdb-tui.
The first release of ysyx-sdb-tui. Maybe it's not perfect, but it's a start.
Add icon and description.
Optimize the performance.
-
Use GDB/MI to communicate with the GDB. It has better compatibility and performance.
-
Add
breakpoint
support.- You can set the breakpoint in the source code and disassembly code in VS Code. And it will send the information to the client.
- The information of all breakpoints will be stored in the
breakpoints.json
file in thebuild
directory that is the same as the elf file. So you can recover the breakpoints when you restart the program.
You should install the socket.io
package in your project.
npm install socket.io
npm install @types/socket.io
TODO ...