博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
指向指针的指针测试
阅读量:4116 次
发布时间:2019-05-25

本文共 2615 字,大约阅读时间需要 8 分钟。

[shidongxue@centossvr testtool]$ vi a.c#include 
int test2(int argc,char** argv){ printf("argc=%d, argv[0]=%s\n",argc,argv[0]); return 0;}int main(int argc,char** argv){ printf("%p\n",argv); printf("sizeof argv=%d\n",sizeof(argv)); return test2(argc,argv);}~~~~~~~~~~~~~~~~~"a.c" 13L, 239C 已写入[shidongxue@centossvr testtool]$ gcc a.c[shidongxue@centossvr testtool]$ gcc a.c -g[shidongxue@centossvr testtool]$ gdbGNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-80.el7Copyright (C) 2013 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law. Type "show copying"and "show warranty" for details.This GDB was configured as "x86_64-redhat-linux-gnu".For bug reporting instructions, please see:
.(gdb) file a.outReading symbols from /home/shidongxue/work/testtool/a.out...done.(gdb) b mainBreakpoint 1 at 0x400570: file a.c, line 9.(gdb) r xStarting program: /home/shidongxue/work/testtool/a.out xBreakpoint 1, main (argc=2, argv=0x7fffffffe4a8) at a.c:99 printf("%p\n",argv);Missing separate debuginfos, use: debuginfo-install glibc-2.17-106.el7_2.8.x86_64 glibc-2.17-157.el7_3.2.x86_64(gdb) s0x7fffffffe4a810 printf("sizeof argv=%d\n",sizeof(argv));(gdb) ssizeof argv=811 return test2(argc,argv);(gdb) x/16c 0x7fffffffe4a80x7fffffffe4a8: -12 '\364' -26 '\346' -1 '\377' -1 '\377' -1 '\377' 127 '\177' 0 '\000' 0 '\000'0x7fffffffe4b0: 25 '\031' -25 '\347' -1 '\377' -1 '\377' -1 '\377' 127 '\177' 0 '\000' 0 '\000'(gdb) x/16x 0x7fffffffe4a80x7fffffffe4a8: 0xf4 0xe6 0xff 0xff 0xff 0x7f 0x00 0x000x7fffffffe4b0: 0x19 0xe7 0xff 0xff 0xff 0x7f 0x00 0x00(gdb) x/32c 0x7fffffffe6f40x7fffffffe6f4: 47 '/' 104 'h' 111 'o' 109 'm' 101 'e' 47 '/' 115 's' 104 'h'0x7fffffffe6fc: 105 'i' 100 'd' 111 'o' 110 'n' 103 'g' 120 'x' 117 'u' 101 'e'0x7fffffffe704: 47 '/' 119 'w' 111 'o' 114 'r' 107 'k' 47 '/' 116 't' 101 'e'0x7fffffffe70c: 115 's' 116 't' 116 't' 111 'o' 111 'o' 108 'l' 47 '/' 97 'a'(gdb) x/32c 0x7fffffffe7190x7fffffffe719: 120 'x' 0 '\000' 88 'X' 68 'D' 71 'G' 95 '_' 83 'S' 69 'E'0x7fffffffe721: 83 'S' 83 'S' 73 'I' 79 'O' 78 'N' 95 '_' 73 'I' 68 'D'0x7fffffffe729: 61 '=' 50 '2' 55 '7' 57 '9' 54 '6' 0 '\000' 72 'H' 79 'O'0x7fffffffe731: 83 'S' 84 'T' 78 'N' 65 'A' 77 'M' 69 'E' 61 '=' 99 'c'(gdb) x/1c 0x7fffffffe7190x7fffffffe719: 120 'x'

转载地址:http://eoypi.baihongyu.com/

你可能感兴趣的文章
Flex 布局教程:语法篇
查看>>
【AngularJS教程】快速入门篇之 双向绑定
查看>>
2019年哪些外快收入可达到2万以上?
查看>>
年薪50万+的90后程序员都经历了什么?
查看>>
【JavaScript 教程】标准库—RegExp 对象
查看>>
2019年哪些外快收入可达到2万以上?
查看>>
【JavaScript 教程】标准库—Date 对象
查看>>
前阿里手淘前端负责人@winter:前端人如何保持竞争力?
查看>>
【JavaScript 教程】面向对象编程——实例对象与 new 命令
查看>>
我在网易做了6年前端,想给求职者4条建议
查看>>
SQL1015N The database is in an inconsistent state. SQLSTATE=55025
查看>>
RQP-DEF-0177
查看>>
Linux查看mac地址
查看>>
Linux修改ip
查看>>
SQL1032N No start database manager command was issued. SQLSTATE=57019
查看>>
Java两个内存参数选项
查看>>
情商5技能
查看>>
用spring做框架,实现通用数据库倒表工具
查看>>
CMMI特定目标(SG)和特定实践(SP)汇总
查看>>
CMMI公共目标(GG)和公共实践(GP)汇总
查看>>