Skip to content

Commit 72fe139

Browse files
committed
Update documentation with VScode debug example
1 parent 72482ba commit 72fe139

File tree

3 files changed

+56
-2
lines changed

3 files changed

+56
-2
lines changed

docs/qemu-debug.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Debugging with QEMU
1+
# Debug you software using QEMU + GDB
22

33
This toolchain provides `qemu-system-tricore` and `tricore-elf-gdb` for running
44
and debugging your code in a simulated environment.
@@ -7,6 +7,8 @@ and debugging your code in a simulated environment.
77
> CPU instruction decode (no interrupts or multi-core) and no peripheral is
88
> available. Only core architecture from tc1.3 up to tc1.6.2 is supported
99
10+
## Setup
11+
1012
The code below uses ELF executable built from
1113
[aurix-cmake-code-sample](https://github.com/NoMore201/aurix-cmake-code-sample)
1214
in debug mode (no optimizations and debug symbols enabled). It should work with
@@ -56,3 +58,55 @@ Ifx_Ssw_jumpToFunction (fun=<optimized out>)
5658
Now you can start debugging your code through QEMU.
5759

5860
![gdb example](./gdb-screen.png)
61+
62+
## Debugging through VSCode
63+
64+
When using VScode with C/C++ extension is it possible to directly run GDB from
65+
the code editor and debug throught the GUI.
66+
67+
All you need to do is provide a custom `launch.json` configuration, making sure
68+
to adjust `program` and `miDebuggerPath` according to your environment.
69+
70+
When using VS Code with the C/C++ extension, you can directly run GDB from the
71+
code editor and debug through the GUI. Simply provide a custom `launch.json`
72+
configuration, ensuring you adjust `program` and `miDebuggerPath` settings
73+
to match your environment.
74+
75+
```json
76+
{
77+
// make sure QEMU is running your executable with gdbstub enabled before
78+
// launching this
79+
"version": "0.2.0",
80+
"configurations": [
81+
{
82+
"name": "tricore-qemu-debug",
83+
"type": "cppdbg",
84+
"request": "launch",
85+
"program": "${workspaceFolder}/out/debug/src/aurix_sample_tc33x.elf",
86+
"args": [],
87+
"stopAtEntry": true,
88+
"cwd": "${fileDirname}",
89+
"environment": [],
90+
"externalConsole": false,
91+
"MIMode": "gdb",
92+
"miDebuggerPath": "/opt/tricore/bin/tricore-elf-gdb",
93+
"miDebuggerServerAddress": "localhost:1234",
94+
"setupCommands": [
95+
{
96+
"description": "Enable pretty-printing for gdb",
97+
"text": "-enable-pretty-printing",
98+
"ignoreFailures": true
99+
},
100+
{
101+
"description": "Set Disassembly Flavor to Intel",
102+
"text": "-gdb-set architecture TriCore:V1_6_2",
103+
"ignoreFailures": false
104+
}
105+
]
106+
}
107+
108+
]
109+
}
110+
```
111+
112+
![vscode debugging session](./vscode-debug-example.png)

docs/vscode-debug-example.png

642 KB
Loading

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ plugins:
3232
nav:
3333
- Home: index.md
3434
- Build: building.md
35-
- Debuggin with QEMU: qemu-debug.md
35+
- Debug with QEMU+GDB: qemu-debug.md
3636
- Changelog: changelog.md

0 commit comments

Comments
 (0)