[Top] [All Lists]

Debugging the MIPS processor using GDB

Subject: Debugging the MIPS processor using GDB
From: TriKri <>
Date: Tue, 12 Aug 2008 06:23:57 -0700 (PDT)
Original-recipient: rfc822;
The questions are many, and I don't really know where to begin, but I shall
make a try.

I am developing software to debug a MIPS processor in an embedded system
using an EJTAG probe. Currently I have software to tell the processor to
perform certain instructions, and read/write from/to certain register
addresses. Now, I don't really know how to continue from here; I'm trying to
find out how to make GDB benefit from these functions in order to be able to
debug the processor.

I know that GDB needs a gdb-stub, but I don't really know what it is and
what it does, or why GDB needs it. The GDB manual suggests taking a look at
sparc-stub.c coming along with GDB, since it's the best organized. Not
finding any main function in it, I'm having a hard time figuring out to what
it does. How should this stub be implemented and how do I know what to write
in the stub file I'm going to write?

There is also something called gdb-hook, which I don't really know what it
is either. Do I need it?

Finally, there's a program called gdbserver, which comes with GDB. If I
write a remote stub, do I need this program? Where should it be run? Where
should my program be run? Since the stub is a c file, but lacks of a main
function, how do I compile it?

There are just so many unanswered questions, I don't know where to start
working or where to start looking for information. I haven't used GDB before
either, possibly contributing to some of the confusion; I hope I'll get this
straight soon, though.

View this message in context:
Sent from the linux-mips main mailing list archive at

<Prev in Thread] Current Thread [Next in Thread>