Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the base type of a variable using GDB/MI

Tags:

c

types

gdb

Using the GDB machine interface, is there a way to get the base type for a specific variable? For example, if I have a variable whose type is a uint32_t (from types.h) is there a way to get GDB to tell me that either that variable's basic type is an unsigned long int, or alternatively, that uint32_t is typedef'ed to an unsigned long int?

like image 621
Ryan Avatar asked Dec 22 '22 10:12

Ryan


1 Answers

You can use "whatis" command

suppose you have

typedef unsigned char BYTE;
BYTE var;

(gdb)whatis var
type = BYTE
(gdb)whatis BYTE
BYTE = unsigned char
like image 111
Kamath Avatar answered Jan 08 '23 01:01

Kamath