* offset of a struct field (qSymbol)
@ 2008-10-01 1:51 Mukesh Rathor
2008-10-01 11:55 ` Daniel Jacobowitz
2008-10-01 22:20 ` Michael Snyder
0 siblings, 2 replies; 5+ messages in thread
From: Mukesh Rathor @ 2008-10-01 1:51 UTC (permalink / raw)
To: gdb
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
_________________________________________________________________
Want to do more with Windows Live? Learn “10 hidden secrets” from Jamie.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: offset of a struct field (qSymbol)
2008-10-01 1:51 offset of a struct field (qSymbol) Mukesh Rathor
@ 2008-10-01 11:55 ` Daniel Jacobowitz
2008-10-01 22:20 ` Michael Snyder
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2008-10-01 11:55 UTC (permalink / raw)
To: Mukesh Rathor; +Cc: gdb
On Wed, Oct 01, 2008 at 01:50:48AM +0000, 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.
No, not presently.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: offset of a struct field (qSymbol)
2008-10-01 1:51 offset of a struct field (qSymbol) Mukesh Rathor
2008-10-01 11:55 ` Daniel Jacobowitz
@ 2008-10-01 22:20 ` Michael Snyder
2008-10-01 22:25 ` Daniel Jacobowitz
1 sibling, 1 reply; 5+ messages in thread
From: Michael Snyder @ 2008-10-01 22:20 UTC (permalink / raw)
To: Mukesh Rathor; +Cc: gdb
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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: offset of a struct field (qSymbol)
2008-10-01 22:20 ` Michael Snyder
@ 2008-10-01 22:25 ` Daniel Jacobowitz
2008-10-02 0:24 ` Mukesh Rathor
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2008-10-01 22:25 UTC (permalink / raw)
To: Michael Snyder; +Cc: Mukesh Rathor, gdb
On Wed, Oct 01, 2008 at 03:19:04PM -0700, Michael Snyder wrote:
> 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?
IMO this is a bad idea. It's too ambiguous, and it will breed remote
servers that rely on quirks in a particular version of the GDB
expression parser.
I've worked with some other debug tools that worked this way and it
was a terrible headache.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: offset of a struct field (qSymbol)
2008-10-01 22:25 ` Daniel Jacobowitz
@ 2008-10-02 0:24 ` Mukesh Rathor
0 siblings, 0 replies; 5+ messages in thread
From: Mukesh Rathor @ 2008-10-02 0:24 UTC (permalink / raw)
To: gdb
----------------------------------------
> Date: Wed, 1 Oct 2008 18:25:10 -0400
> From: drow@false.org
> To: msnyder@vmware.com
> CC: todfod@hotmail.com; gdb@sourceware.org
> Subject: Re: offset of a struct field (qSymbol)
>
> On Wed, Oct 01, 2008 at 03:19:04PM -0700, Michael Snyder wrote:
>> 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?
>
> IMO this is a bad idea. It's too ambiguous, and it will breed remote
> servers that rely on quirks in a particular version of the GDB
> expression parser.
>
> I've worked with some other debug tools that worked this way and it
> was a terrible headache.
I managed to get by. Basically, I ask the user to lookup the value manually, and then use monitor to send the info to gdbserver. The monitor cmd really helped simplify things.
>
> --
> Daniel Jacobowitz
> CodeSourcery
_________________________________________________________________
See how Windows Mobile brings your life together—at home, work, or on the go.
http://clk.atdmt.com/MRT/go/msnnkwxp1020093182mrt/direct/01/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-02 0:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-01 1:51 offset of a struct field (qSymbol) Mukesh Rathor
2008-10-01 11:55 ` Daniel Jacobowitz
2008-10-01 22:20 ` Michael Snyder
2008-10-01 22:25 ` Daniel Jacobowitz
2008-10-02 0:24 ` Mukesh Rathor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox