This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: "info locals" -- is variable initialized
- From: Ramana Radhakrishnan <ramana dot radhakrishnan at codito dot com>
- To: Vladimir Prus <ghost at cs dot msu dot su>
- Cc: gdb at sources dot redhat dot com
- Date: Fri, 02 Sep 2005 14:57:15 +0530
- Subject: Re: "info locals" -- is variable initialized
- References: <df90k9$tm7$1@sea.gmane.org>
- Reply-to: ramana dot radhakrishnan at codito dot com
>
> 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.
GDB puts a breakpoint after the prologue of a function. Which means that
all locals in scope have been created / allocated space for . Hence you
would see i2 , right ?
cheers
Ramana