Last active
August 9, 2024 16:56
-
-
Save LiquidFenrir/d110f3e7755ffbe82672eda49ae21af2 to your computer and use it in GitHub Desktop.
gdb 101 for 3ds, credits to Stary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Hi, someone have a example code of .vscode folder for launch.json and tasks.json?
since oreo639 helped me, i will just summerize for noobs like me:
start msys2
do cd to the folder of your .elf of the homebrew application (on pc)
write $DEVKITARM/bin/arm-none-eabi-gdb and then your-apps-name.elf
now go into homebrew menu or where you launch it from
open rosalina menu by L+down+select
go to debugger options->Enable Debugger and Force-debug next application on launch
make note of the port, and check the ip in the right top corner
Go out of rosalina menu
Start your app
Go to your pc and in msys2/terminal do target remote ip:port
it should say something like 0x00100000 in _start ()
then write c and hit enter
write backtrace or bt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
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" }