相关疑难解决方法(0)

即使使用-g3或-ggdb3或-gdwarf-4,gdb宏符号也不存在

我有这个C文件(sample.c):

#include <stdio.h>
#define M 42
#define ADD(x) (M + x)
int main ()
{
  printf("%d\n", M);
  printf("%d\n", ADD(2));
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

我编译的是:

$ gcc -O0 -Wall -g3 sample.c -o sample
Run Code Online (Sandbox Code Playgroud)

然后调试

$ gdb ./sample
GNU gdb (Gentoo 7.3.1 p2) 7.3.1
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type …
Run Code Online (Sandbox Code Playgroud)

c debugging gdb

7
推荐指数
1
解决办法
3751
查看次数

标签 统计

c ×1

debugging ×1

gdb ×1