public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* "info locals" -- is variable initialized
@ 2005-09-02  7:58 Vladimir Prus
  2005-09-02  9:28 ` Ramana Radhakrishnan
  0 siblings, 1 reply; 7+ messages in thread
From: Vladimir Prus @ 2005-09-02  7:58 UTC (permalink / raw)
  To: gdb


Hello,
I'm thinking about adding pretty-printing for STL and KDE structures in
KDevelop, and run into this problem. Consider the program:

   int main()
   {
        int i1;
        ....
        KURL i2;
   }

When entering this function, KDevelop asks gdb via "info locals" what locals
vars are there. But, gdb reports all variables, even though at the function
entry 'i2' is not initialized (or, from C++ point of view, not even visible
yet). For pretty priting 'i2', I have to evaluate 'i2.prettyURL(0)', which
will just crash. I can use "set unwindonsignal on", but generally, calling
methods on uninitialized object can damage random memory.

So:
1. Can I determine, for a given variable, if it's in scope already?
2. Can I make "info local" return only the variables that are already in
scope?
3. If no, any ideas how the above can be implemented?

- Volodya

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-09-02 13:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-02  7:58 "info locals" -- is variable initialized Vladimir Prus
2005-09-02  9:28 ` Ramana Radhakrishnan
2005-09-02  9:57   ` Vladimir Prus
2005-09-02 13:13     ` Daniel Jacobowitz
2005-09-02 13:19       ` Vladimir Prus
2005-09-02 13:21         ` Daniel Jacobowitz
2005-09-02 13:28           ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).