Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Debugging with GDB

48 views
Skip to first unread message

Joshua Otto

unread,
May 17, 2016, 6:00:08 PM5/17/16
to
Hi all! My partner and I managed to get remote debugging with GDB working
using the RedBoot GDB stubs. This makes it possible to step through the
kernel, examine register contents, set breakpoints, etc. while running it on
the actual hardware in the lab. Here's the setup we worked out:

1) You'll need a multi-arch build of GDB available on your local machine. My
partner and I both use Ubuntu, so we installed the 'gdb-multiarch' package.

2) You'll need the IP address of the box you're going to be running on. This
is printed to the RedBoot console on every reset.

3) You'll need a local copy of your .elf binary (compiled with debugging
symbols) and source code.

4) You'll need to make TCP port 9000 of the box accessible to your local
machine somehow. Plugging into the ethernet in the lab permits this directly,
but if you can't do that we also had success with forwarding the port through
the student Linux environment.

5) To start a debugging session:

> gdb-multiarch your-kernel.elf
target remote tcp:<IP of the box>:9000 load

If everything went well, you should be at the beginning of your program and
ready to run it with 'continue'. Dumping the registers with 'info reg' should
show pc pointing to the first instruction of main, etc.

We needed to compile with the gcc-4.9 build posted about earlier to get
working backtraces, but it should mostly work with 4.0.2.

Ben Cassell

unread,
May 17, 2016, 10:31:07 PM5/17/16
to
Thanks for posting this!

Once you get tired of typing "target remote tcp..." every time, remember
that you can add it to the .gdbinit file in whatever directory you are
running gdb from.

Ben

"Joshua Otto" wrote in message news:nhg443$ln5$1...@rumours.uwaterloo.ca...

Theo Belaire

unread,
May 20, 2016, 12:24:41 PM5/20/16
to

>
> 5) To start a debugging session:
>
> > gdb-multiarch your-kernel.elf
> target remote tcp:<IP of the box>:9000
> load

Do not put those on the same line. You need load on a different line for it to work.

0 new messages