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]

Re: offset of a struct field (qSymbol)


Mukesh Rathor wrote:
Hi,
 I've written a gdbserver (gdbsx) for xen to debug guests. I'm trying to figure out if there's a way to figure offset of a field from gdbserver.

Thus, init_mm is a struct, and I can do qSymbol on init_mm, but not init_mm.pgd. I am wondering if there's anyway to do that at present, or get gdb to do "print &(init_mm.pgd) somehow and send me the value.

thanks a lot,
Mukesh

OK, if I understand you, you want to know the offset of a field within a struct. Or perhaps you want the address of a field within a struct, but you can get that by adding the offset to the base address.

No, there's nothing presently, but...

There is a syntax for gdb to send an expression to the
server, and have the server evaluate it.  Perhaps we could
simply reverse that syntax, so that the server could send
an expression to gdb, and have gdb evaluate it and send
back the answer?

The kind of  expression that I usually use to compute
a field offset is something like:

&(((struct init_mm *) 0).pgd)


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