1/1

|
Or1ksim and GDB
by ag09 on Aug 24, 2011 |
ag09
Posts: 38 Joined: Aug 22, 2010 Last seen: Jan 13, 2012 |
||
|
Hallo,
I want to debug a program(let me say HelloWorld.c) running on or1ksim using gdb. May someone reference me to a document or contribution how can I use gdb to debug a program after setting up the or1ksim configuration file? P.S.: Both the latest versions of or1ksim and toolchain are installed on my machine. |
|||
|
RE: Or1ksim and GDB
by jeremybennett on Aug 24, 2011 |
jeremybennett
Posts: 815 Joined: May 29, 2008 Last seen: Jun 13, 2019 |
||
|
Hallo, I want to debug a program(let me say HelloWorld.c) running on or1ksim using gdb. Hi ag09, This must be written down somewhere, but I can't find it. I'll add a short note on the Wiki later. For now I'm assuming you have compiled your program something like this: or32-elf-gcc -g HelloWorld.c -o HelloWorld Remember to use -g so debug information is included. It doesn't affect program performance, but makes for a much richer debug experience. May someone reference me to a document or contribution how can I use gdb to debug a program after setting up the or1ksim configuration file? P.S.: Both the latest versions of or1ksim and toolchain are installed on my machine. Simplest way is to use the built in Or1ksim within GDB. By default that gives you a simple config with 8M of memory. or32-elf-gdb HelloWorld ... (gdb) target sim (gdb) load (gdb) run ... If you want to use Or1ksim standalone (perhaps with a more complex configuration), then start it up, specifying a port for debug connection. You can either do this within the config file (it is the rsp_port parameter), or specify it on the command line: or32-elf-sim --srv=51000 ... This sets up GDB to use port 51000 to communicate on. You can specify any value up to 65535, although you should definitely avoid values below 1024. If you don't specify a value, Or1ksim will select a port at random and tell you. In a separate window on the same machine start up GDB or32-elf-gdb HelloWorld ... (gdb) target remote :51000 (gdb) load (gdb) continue ... Note that the usage is slightly different, you are connecting to a model that is already "started", so you just continue execution. Don't worry, connecting stalls the model, while loading the image sets the PC to its entry point, so you will continue at the right place. HTH Jeremy
-- |
|||
|
RE: Or1ksim and GDB
by jeremybennett on Aug 24, 2011 |
jeremybennett
Posts: 815 Joined: May 29, 2008 Last seen: Jun 13, 2019 |
||
1/1

