* info addr foo [where foo is a static global in multiple files]
@ 2008-04-02 19:53 Doug Evans
2008-04-02 20:02 ` Michael Snyder
0 siblings, 1 reply; 2+ messages in thread
From: Doug Evans @ 2008-04-02 19:53 UTC (permalink / raw)
To: gdb
If I want to find the addresses of all variables named foo, it seems
like there should be an easy way to do this. "info addr foo" will
only print one. There's also the issue that if I only want one it may
not print the one I want. Should it print all of them?
The user could study the output of "info var foo" and do things like
"p/x &'file.c'::foo" for each variable, but that seems a bit clumsy
(and doesn't work if the files all happen to have the same name).
[As a workaround, the user could do "maint print symbols", but I
wonder if "info addr" should change.]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: info addr foo [where foo is a static global in multiple files]
2008-04-02 19:53 info addr foo [where foo is a static global in multiple files] Doug Evans
@ 2008-04-02 20:02 ` Michael Snyder
0 siblings, 0 replies; 2+ messages in thread
From: Michael Snyder @ 2008-04-02 20:02 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb
On Wed, 2008-04-02 at 12:52 -0700, Doug Evans wrote:
> If I want to find the addresses of all variables named foo, it seems
> like there should be an easy way to do this. "info addr foo" will
> only print one. There's also the issue that if I only want one it may
> not print the one I want. Should it print all of them?
>
> The user could study the output of "info var foo" and do things like
> "p/x &'file.c'::foo" for each variable, but that seems a bit clumsy
> (and doesn't work if the files all happen to have the same name).
>
> [As a workaround, the user could do "maint print symbols", but I
> wonder if "info addr" should change.]
Hmmm... good question.
By the same token, the mirror image of "info addr" is
"info symbol". It takes an address, and finds a symbol
that matches. In some corner cases, there might be more
than one symbol at the same address, but I assume info
symbol will only show the first one found. Maybe that
should be addressed too (no pun intended).
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-04-02 20:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-02 19:53 info addr foo [where foo is a static global in multiple files] Doug Evans
2008-04-02 20:02 ` Michael Snyder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox