This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: size of non local variables
thanks.
But the problem is that I am debugging a large code.
It contains many non local variables.
It is said that 2 global variables are of large size(char arrays).
I cant do 'print sizeof' on all non local variables.
Isn't there another method.
Thanks in advance.
On 12/1/09, Anmol P. Paralkar <anmol@freescale.com> wrote:
> On Tue, 1 Dec 2009, ranjith kumar wrote:
>
>> Hi,
>> I know that gdb will print non local variable names and file name in
>> which they are defined ,
>> when we run 'info variables' command.
>>
>> Is it possible to print the size of the non local varibles also?
>> like the size of 'int global[100]' is 400bytes ...like that????
>>
>> thanks in advance.
>
> Hello Ranjith Kumar,
>
> You could do:
>
> (gdb) print sizeof(global)
> $1 = 400
>
> --
>
> - that's an instance of GDB's functionality to evaluate expressions in the
> source language with the 'print' command.
>
> See 'Examining Data' in the User Manual:
> http://sourceware.org/gdb/current/onlinedocs/gdb/Data.html#Data
>
> Best Regards,
> Anmol.
>