using getopt with gdb

て烟熏妆下的殇ゞ 提交于 2019-11-30 21:10:49

Probably related: Bug 13800 - gdb does not print right values of getopt-related values

Also notice ie:

(gdb) n
opt: 111, arg, 
0x804a040
0x804a034
0x804a020
0x804a030

(gdb) printf "%p\n%p\n%p\n%p\n", &optarg, &opterr, &optind, &optopt
0x2ae760
0x2ab0f4
0x2ab0f8
0x2ab0f0

Where:

(gdb) l
6   int main(int argc, char *argv[])
7   {
8       int c;
9       while ((c = getopt(argc, argv, ":abf:o:")) != -1) {
10          printf("opt: %d, %s, \n"
11              "%p\n%p\n%p\n%p\n",
12              c, optarg,
13              &optarg, &opterr, &optind, &optopt);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!