1- # Debugging with QEMU
1+ # Debug you software using QEMU + GDB
22
33This toolchain provides ` qemu-system-tricore ` and ` tricore-elf-gdb ` for running
44and 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+
1012The code below uses ELF executable built from
1113[ aurix-cmake-code-sample] ( https://github.com/NoMore201/aurix-cmake-code-sample )
1214in debug mode (no optimizations and debug symbols enabled). It should work with
@@ -56,3 +58,55 @@ Ifx_Ssw_jumpToFunction (fun=<optimized out>)
5658Now 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 )
0 commit comments