size of non local variables

Anmol P. Paralkar anmol@freescale.com
Mon Nov 30 23:18:00 GMT 2009


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.



More information about the Gdb mailing list