This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GDB interactions with GCC


Dear all,

I apologize if this is in the wrong mailing-list, I tried to determine
if this was more a GCC question than a GDB and decided to start out
with the GDB mailing list.

I'm currently helping a port of GDB to a new architecture and I am
having trouble understanding the interaction between GCC and GDB
regarding how GDB keeps track of what's on the stack, how to
backtrace, what variable is stored where.

For example, on my architecture, the return address is passed in one
register that the function can push on the stack if it's necessary (if
a call happens) but not if it's a leaf function. The local variables
are also sent via registers and therefore, potentially are never
stored on the stack.

I admit I've never worked in the GDB-GCC interaction so I'm really
only starting to read documentation and understanding what does what.
I'm normally only in the GCC port so I've never ventured this far out.

Can anyone give me a simple break-down of what does what in this interaction?

And if someone can answer these questions:

- It seems to me that GCC outputs debug information that helps GDB
follow the course of the program:
   - With this information, is GDB able to follow where the local
variables are kept (register or stack) depending on what the program
is doing ?
   - Does GCC need to output anything in particular to allow GDB to
give the information of the backtrace for example?

In other words:

- Does the ABI need to store the stack pointer for each frame in order
for GDB to give all the backtrace, variable information? Or does GDB
keep track of this independantly of the ABI.

- Does GDB require that the ABI store arguments at some point on the
stack in order to provide information about a function calls
arguments? I would assume not because otherwise register-based ABIs
would have to redundantly copy things on the stack for GDB use...

- Are there other documents than the GDB-internals and Bennet's HowTo ?

Thanks a lot,
Jc


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]