在 gdb 中有什么方法可以获取结构的基本数据类型?
假设以下结构
typedef struct _trial
{
int i;
double j;
}trial_t;
在 gdb 中
(gdb) whatis trial_t
type = struct _trial
(gdb) whatis _trial
No symbol "_trial" in current context.
(gdb)
任何解决方法?
我知道这适用于简单的 typedef
typedef unsigned char BYTE;
BYTE var;
(gdb)whatis var
type = BYTE
(gdb)whatis BYTE
BYTE = unsigned char
最佳答案
你可能需要ptype
ptype accepts the same arguments as whatis, but prints a detailed description of the type, instead of just the name of the type.
(gdb) ptype struct _trial
甚至:
(gdb) ptype trial_t
Contrary to whatis, ptype always unrolls any typedefs in its argument declaration
关于c - 如何在gdb中获取结构的基本数据类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11976218/