Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gdb 101 for 3ds, credits to Stary
1. enable debugger in rosalina menu
go to process list
select a process
2. launch arm-none-eabi-gdb <path to elf>
command "target remote ip:port"
3. command "continue" or "c" to resume execution
4.
"b <func | file:line | *address>" to set a breakpoint
"del <breakpoint number>" to remove a breakpoint
"p <expression>" to print something
"x <expression>" to view memory there
like if you have a pointer or something
"c", "continue"
"s", "step"
"bt" for backtrace with errors
@namkazt

This comment has been minimized.

Copy link

@namkazt namkazt commented Aug 13, 2018

should it have some warning about MakeFile ?
CFLAGS += -ggdb -Og
LIBS := -lcitro3dd -lctrud ( replace )

@Oreo639

This comment has been minimized.

Copy link

@Oreo639 Oreo639 commented Apr 24, 2020

Make sure it is the arm-none-eabi-gdb that comes with devkitARM.
$DEVKITARM/bin/arm-none-eabi-gdb. It would probably be easiest to alias this to something easy to type and remember.
(If you get an error about not having libncurses.so.5, make sure you install libncurses5)

@jtothebell

This comment has been minimized.

Copy link

@jtothebell jtothebell commented Apr 24, 2020

A couple notes that may be helpful for others.

First, you can also do this same process to debug from Citra, just modify step 1 to be

  1. Open Citra Configuration (Emulation-> Configure on windows), then in the General section, open the Debug tab. click on Enable GDB stub, and note the port (change it if you need)
    then in step 2 use "localhost" for the IP, and the port from Citra for the port.
    Remember that Citra will wait for the debugger to attach before running any code, so turn off "Enable GDB Stub" when you are done debugging.

Second, if you are using Visual Studio code, you can use the "Native Debug" extension to attach directly from VS Code, letting you set breakpoints, etc all from VS Code. An example configuration would look something like this (change the executable, target, and gdbpath to match your environment):
"configurations": [ { "type": "gdb", "request": "attach", "name": "Attach to gdbserver", "executable": "path-to-your-app.elf", "target": "{{ip address of 3ds or citra}}:{{port}}", "remote": true, "cwd": "${workspaceRoot}", "valuesFormatting": "parseText", "gdbpath": "C:\\devkitPro\\devkitARM\\bin\\arm-none-eabi-gdb.exe" }

@dealmengor

This comment has been minimized.

Copy link

@dealmengor dealmengor commented Apr 4, 2021

Hi, someone have a example code of .vscode folder for launch.json and tasks.json?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment