Visual Studio Code Debugging Topic is solved

New to XMOS and XCore? Get started here.
pmaksa
Newbie
Posts: 1
Joined: Wed Nov 13, 2024 2:21 pm

Visual Studio Code Debugging

Post by pmaksa »

Hi Everyone!
I just joined the forum, and I did not find any topic related to this. Did anyone try to debug on gui via Visual Studio Code + GDB?

I have been trying for a few weeks with no much success. I do not have a board yet, so I am trying to do it with simulator. With normal gdb setup (using xgdb) it sets up everything but does not actually seem to run. It does not stop at any breakpoint in main. It shows threads as running (same in gdb console), but nothing is actually happening. When I press pause and check the address, it does not seem that it had done anything at all.

I tried to add "load" gdb command at initialization, because if I do it in terminal for myself, that actually makes it hit the breakpoint. Corresponding launch.json part for reference:

"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Simulator",
"text": "connect -s",
"ignoreFailures": true
}
{
"description": "Load",
"text": "load",
"ignoreFailures": true
}
],

What happens after this? xgdb this the breakpoint, but VSCode exits for some reason:

1: (420) <--exec-continue
1: (420) ->^running
1: (420) ->*running,thread-id="1"
1: (420) ->*running,thread-id="2"
1: (420) ->(gdb)
1: (437) ->~"[Inferior 2 (tile[1]) exited normally]\n"
1: (437) ->=thread-exited,id="2",group-id="i2"
1: (437) ->=thread-group-exited,id="i2",exit-code="0"
1: (437) ->~"[Switching to 1.1 (tile[0] core[0])]\n"
[Inferior 2 (tile[1]) exited normally]
1: (437) Send Event AD7ThreadDestroyEvent
[Switching to 1.1 (tile[0] core[0])]
1: (438) ->=breakpoint-modified,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0008011c",func="main",file="/Users/I544652/Development/pmaksa.org/Gainlab/ExampleXCommonCMake/src/main.c",fullname="/Users/I544652/Development/pmaksa.org/Gainlab/ExampleXCommonCMake/src/main.c",line="9",thread-groups=["i1"],times="1",original-location="main.c:9"}
1: (438) ->~"\n"
1: (438) ->~"Thread 1.1 hit Breakpoint 2, main () at /Users/I544652/Development/pmaksa.org/Gainlab/ExampleXCommonCMake/src/main.c:9\n"
1: (438) ->~"9\t printf(\"Hello\\n\");\n"
1: (438) ->*stopped,reason="exited-normally",reason="breakpoint-hit",disp="keep",bkptno="2",frame={addr="0x0008011c",func="main",args=[],file="/Users/I544652/Development/pmaksa.org/Gainlab/ExampleXCommonCMake/src/main.c",fullname="/Users/I544652/Development/pmaksa.org/Gainlab/ExampleXCommonCMake/src/main.c",line="9",arch="xs3_reva"},thread-id="1",stopped-threads="all"

Thread 1.1 hit Breakpoint 2, main () at /Users/I544652/Development/pmaksa.org/Gainlab/ExampleXCommonCMake/src/main.c:9
9 printf("Hello\n");
1: (439) <--gdb-exit
1: (439) ->^exit
1: (439) ->=thread-exited,id="1",group-id="i1"
1: (439) ->=thread-group-exited,id="i1"
1: (440) <-logout
1: (441) Send Event AD7ProgramDestroyEvent
The program '/Users/I544652/Development/pmaksa.org/Gainlab/ExampleXCommonCMake/bin/example.xe' has exited with code 0 (0x00000000).
1: (444) Send Event AD7ThreadDestroyEvent


Any idea how I could make it work?
View Solution
pmjobin
New User
Posts: 2
Joined: Sat Oct 26, 2019 7:40 am

Post by pmjobin »

Hello,

Apologies for reviving an old thread, but I’m running into the same issue as pmaksa. Has anyone found a solution to make debugging work in VS Code? Since xTimeComposer seems to have been discontinued and VS Code is now recommended as the IDE of choice in the XTC Tools Guide, it would be helpful if the documentation included more detailed instructions for configuring VS Code for xgdb debugging. Has anyone managed to make this work? If so, help would be truly appreciated.

Thanks,
P-M
CiaranW
Verified
Member
Posts: 15
Joined: Tue Jun 28, 2022 10:58 am

Post by CiaranW »

Hi, unfortunately there is currently no way to get xgdb to play nicely with VS Code beyond simple single-tile applications. We are looking into the best way to make this possible, so please watch this space.

Until then, it might be worth looking at the 'gdb tui', which provides a more visual experience than the plain command line https://www.xmos.com/documentation/XM-0 ... -interface