gdb 如何知道指针指向 int
或 struct
或任何其他数据类型?
最佳答案
whatis expr
Print the data type of expression expr. expr is not actually evaluated, and any side-effecting operations (such as assignments or function calls) inside it do not take place. See section Expressions.
ptype expr
ptype
Print a description of the type of expression expr. ptype differs from whatis by printing a detailed description, instead of just the name of the type. For example, for this variable declaration:
struct complex {double real; double imag;} v;
这两个命令给出了这个输出:
(gdb) whatis v
type = struct complex
(gdb) ptype v
type = struct complex {
double real;
double imag;
}
关于c - 给定一个指针,gdb 如何获取它的类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6132922/