我有一个程序:
此时,正如预期的那样,程序崩溃了。
堆栈的内容打印为行:
以下是示例输出:
ubuntu@ubuntu:~/Desktop$ ./main first_arg second_arg third_arg
argv[0]./main bfd445d1 0xbfd441f4
argv[1]first_arg bfd445d8 0xbfd441f8
argv[2]second_arg bfd445e2 0xbfd441fc
argv[3]third_arg bfd445ed 0xbfd44200
env[0]ORBIT_SOCKETDIR=/tmp/orbit-ubuntu bfd445f7 0xbfd44208
env[1]SSH_AGENT_PID=4294 bfd445f7 0xbfd4420c
env[2]TERM=xterm bfd445f7 0xbfd44210
env[3]SHELL=/bin/bash bfd445f7 0xbfd44214
env[4]XDG_SESSION_COOKIE=b16da184017a223e33dfbc7700000025-1316532826.4763-1998941864 bfd445f7 0xbfd44218
env[5]WINDOWID=60817444 bfd445f7 0xbfd4421c
env[6]GNOME_KEYRING_CONTROL=/tmp/keyring-PF9cWq bfd445f7 0xbfd44220
env[7]GTK_MODULES=canberra-gtk-module bfd445f7 0xbfd44224
env[8]USER=ubuntu bfd445f7 0xbfd44228
env[9]LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36: bfd445f7 0xbfd4422c
env[a]SSH_AUTH_SOCK=/tmp/keyring-PF9cWq/ssh bfd445f7 0xbfd44230
env[b]SESSION_MANAGER=local/ubuntu:@/tmp/.ICE-unix/4253,unix/ubuntu:/tmp/.ICE-unix/4253 bfd445f7 0xbfd44234
env[c]USERNAME=ubuntu bfd445f7 0xbfd44238
env[d]DEFAULTS_PATH=/usr/share/gconf/gnome.default.path bfd445f7 0xbfd4423c
env[e]XDG_CONFIG_DIRS=/etc/xdg/xdg-gnome:/etc/xdg bfd445f7 0xbfd44240
env[f]PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games bfd445f7 0xbfd44244
env[10]DESKTOP_SESSION=gnome bfd445f7 0xbfd44248
env[11]PWD=/home/ubuntu/Desktop bfd445f7 0xbfd4424c
env[12]GDM_KEYBOARD_LAYOUT=us bfd445f7 0xbfd44250
env[13]LANG=en_US.UTF-8 bfd445f7 0xbfd44254
env[14]GDM_LANG=en_US.UTF-8 bfd445f7 0xbfd44258
env[15]MANDATORY_PATH=/usr/share/gconf/gnome.mandatory.path bfd445f7 0xbfd4425c
env[16]UBUNTU_MENUPROXY=libappmenu.so bfd445f7 0xbfd44260
env[17]COMPIZ_CONFIG_PROFILE=ubuntu bfd445f7 0xbfd44264
env[18]GDMSESSION=gnome bfd445f7 0xbfd44268
env[19]SHLVL=1 bfd445f7 0xbfd4426c
env[1a]HOME=/home/ubuntu bfd445f7 0xbfd44270
env[1b]LANGUAGE=en_US:en bfd445f7 0xbfd44274
env[1c]GNOME_DESKTOP_SESSION_ID=this-is-deprecated bfd445f7 0xbfd44278
env[1d]LOGNAME=ubuntu bfd445f7 0xbfd4427c
env[1e]XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/ bfd445f7 0xbfd44280
env[1f]DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-DTbn1HNZFU,guid=3b2a0c2f55352a2d70678ffc000000a3 bfd445f7 0xbfd44284
env[20]LESSOPEN=| /usr/bin/lesspipe %s bfd445f7 0xbfd44288
env[21]WINDOWPATH=7 bfd445f7 0xbfd4428c
env[22]DISPLAY=:0.0 bfd445f7 0xbfd44290
env[23]LESSCLOSE=/usr/bin/lesspipe %s %s bfd445f7 0xbfd44294
env[24]RUNNING_UNDER_GDM=yes bfd445f7 0xbfd44298
env[25]COLORTERM=gnome-terminal bfd445f7 0xbfd4429c
env[26]XAUTHORITY=/var/run/gdm/auth-for-ubuntu-Za0Xwx/database bfd445f7 0xbfd442a0
env[27]_=./main bfd445f7 0xbfd442a4
env[28]OLDPWD=/home/ubuntu bfd445f7 0xbfd442a8
001 0xbfd4411e 48 45 52 45 5f 49 53 5f 53 54 41 52 54 00 00 f0 HERE_IS_START???
002 0xbfd4412e fc e2 35 ad 28 00 f4 7f 3b 00 00 00 00 00 00 00 ??5?(???;???????
003 0xbfd4413e 00 00 60 8d 04 08 00 00 00 00 c8 41 d4 bf 37 1e ??`????????A??7?
004 0xbfd4414e 27 00 04 00 00 00 f4 41 d4 bf 08 42 d4 bf 14 44 '??????A???B???D
005 0xbfd4415e 85 00 ff ff ff ff f4 9f b7 00 f4 84 04 08 01 00 ????????????????
006 0xbfd4416e 00 00 b0 41 d4 bf 31 aa b6 00 d0 aa b7 00 30 86 ???A??1???????0?
007 0xbfd4417e 8c b7 01 00 00 00 f4 7f 3b 00 00 00 00 00 00 00 ????????;???????
008 0xbfd4418e 00 00 c8 41 d4 bf c1 93 97 8b be ca 2e 6d 00 00 ???A????????.m??
009 0xbfd4419e 00 00 00 00 00 00 00 00 00 00 04 00 00 00 60 87 ??????????????`?
010 0xbfd441ae 04 08 00 00 00 00 40 0c b7 00 5b 1d 27 00 f4 9f ??????@???[?'???
011 0xbfd441be b7 00 04 00 00 00 60 87 04 08 00 00 00 00 81 87 ??????`?????????
012 0xbfd441ce 04 08 14 88 04 08 04 00 00 00 f4 41 d4 bf 60 8d ???????????A??`?
013 0xbfd441de 04 08 c0 8d 04 08 50 ba b6 00 ec 41 d4 bf 18 a9 ??????P????A????
014 0xbfd441ee b7 00 04 00 00 00 d1 45 d4 bf d8 45 d4 bf e2 45 ???????E???E???E
015 0xbfd441fe d4 bf ed 45 d4 bf 00 00 00 00 f7 45 d4 bf 19 46 ???E???????E???F
016 0xbfd4420e d4 bf 2c 46 d4 bf 37 46 d4 bf 47 46 d4 bf 96 46 ??,F??7F??GF???F
017 0xbfd4421e d4 bf a8 46 d4 bf d2 46 d4 bf f2 46 d4 bf fe 46 ???F???F???F???F
018 0xbfd4422e d4 bf ee 4b d4 bf 14 4c d4 bf 66 4c d4 bf 76 4c ???K???L??fL??vL
019 0xbfd4423e d4 bf a8 4c d4 bf d4 4c d4 bf 21 4d d4 bf 37 4d ???L???L??!M??7M
020 0xbfd4424e d4 bf 50 4d d4 bf 67 4d d4 bf 78 4d d4 bf 8d 4d ??PM??gM??xM???M
021 0xbfd4425e d4 bf c2 4d d4 bf e1 4d d4 bf fe 4d d4 bf 0f 4e ???M???M???M???N
022 0xbfd4426e d4 bf 17 4e d4 bf 29 4e d4 bf 3b 4e d4 bf 67 4e ???N??)N??;N??gN
023 0xbfd4427e d4 bf 76 4e d4 bf b3 4e d4 bf 15 4f d4 bf 35 4f ??vN???N???O??5O
024 0xbfd4428e d4 bf 42 4f d4 bf 4f 4f d4 bf 71 4f d4 bf 87 4f ??BO??OO??qO???O
025 0xbfd4429e d4 bf a0 4f d4 bf d8 4f d4 bf e1 4f d4 bf 00 00 ???O???O???O????
026 0xbfd442ae 00 00 20 00 00 00 14 44 85 00 21 00 00 00 00 40 ?? ????D??!????@
027 0xbfd442be 85 00 10 00 00 00 bf f3 8b 07 06 00 00 00 00 10 ????????????????
028 0xbfd442ce 00 00 11 00 00 00 64 00 00 00 03 00 00 00 34 80 ??????d???????4?
029 0xbfd442de 04 08 04 00 00 00 20 00 00 00 05 00 00 00 09 00 ?????? ?????????
030 0xbfd442ee 00 00 07 00 00 00 00 d0 b5 00 08 00 00 00 00 00 ????????????????
031 0xbfd442fe 00 00 09 00 00 00 60 87 04 08 0b 00 00 00 e7 03 ??????`?????????
032 0xbfd4430e 00 00 0c 00 00 00 e7 03 00 00 0d 00 00 00 e7 03 ????????????????
033 0xbfd4431e 00 00 0e 00 00 00 e7 03 00 00 17 00 00 00 00 00 ????????????????
034 0xbfd4432e 00 00 19 00 00 00 5b 43 d4 bf 1f 00 00 00 f5 4f ??????[C???????O
035 0xbfd4433e d4 bf 0f 00 00 00 6b 43 d4 bf 00 00 00 00 00 00 ??????kC????????
036 0xbfd4434e 00 00 00 00 00 00 00 00 00 00 00 00 00 f0 fc e2 ????????????????
037 0xbfd4435e 43 99 8a 11 5f 85 d2 1d 7b 09 fc 02 c6 69 36 38 C???_???{????i68
038 0xbfd4436e 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6???????????????
039 0xbfd4437e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
040 0xbfd4438e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
041 0xbfd4439e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
042 0xbfd443ae 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
043 0xbfd443be 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
044 0xbfd443ce 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
045 0xbfd443de 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
046 0xbfd443ee 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
047 0xbfd443fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
048 0xbfd4440e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
049 0xbfd4441e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
050 0xbfd4442e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
051 0xbfd4443e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
052 0xbfd4444e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
053 0xbfd4445e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
054 0xbfd4446e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
055 0xbfd4447e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
056 0xbfd4448e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
057 0xbfd4449e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
058 0xbfd444ae 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
059 0xbfd444be 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
060 0xbfd444ce 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
061 0xbfd444de 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
062 0xbfd444ee 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
063 0xbfd444fe 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
064 0xbfd4450e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
065 0xbfd4451e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
066 0xbfd4452e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
067 0xbfd4453e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
068 0xbfd4454e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
069 0xbfd4455e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
070 0xbfd4456e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
071 0xbfd4457e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
072 0xbfd4458e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
073 0xbfd4459e 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
074 0xbfd445ae 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
075 0xbfd445be 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ????????????????
076 0xbfd445ce 00 00 00 2e 2f 6d 61 69 6e 00 66 69 72 73 74 5f ???./main?first_
077 0xbfd445de 61 72 67 00 73 65 63 6f 6e 64 5f 61 72 67 00 74 arg?second_arg?t
078 0xbfd445ee 68 69 72 64 5f 61 72 67 00 4f 52 42 49 54 5f 53 hird_arg?ORBIT_S
079 0xbfd445fe 4f 43 4b 45 54 44 49 52 3d 2f 74 6d 70 2f 6f 72 OCKETDIR=/tmp/or
080 0xbfd4460e 62 69 74 2d 75 62 75 6e 74 75 00 53 53 48 5f 41 bit-ubuntu?SSH_A
081 0xbfd4461e 47 45 4e 54 5f 50 49 44 3d 34 32 39 34 00 54 45 GENT_PID=4294?TE
082 0xbfd4462e 52 4d 3d 78 74 65 72 6d 00 53 48 45 4c 4c 3d 2f RM=xterm?SHELL=/
083 0xbfd4463e 62 69 6e 2f 62 61 73 68 00 58 44 47 5f 53 45 53 bin/bash?XDG_SES
084 0xbfd4464e 53 49 4f 4e 5f 43 4f 4f 4b 49 45 3d 62 31 36 64 SION_COOKIE=b16d
085 0xbfd4465e 61 31 38 34 30 31 37 61 32 32 33 65 33 33 64 66 a184017a223e33df
086 0xbfd4466e 62 63 37 37 30 30 30 30 30 30 32 35 2d 31 33 31 bc7700000025-131
087 0xbfd4467e 36 35 33 32 38 32 36 2e 34 37 36 33 2d 31 39 39 6532826.4763-199
088 0xbfd4468e 38 39 34 31 38 36 34 00 57 49 4e 44 4f 57 49 44 8941864?WINDOWID
089 0xbfd4469e 3d 36 30 38 31 37 34 34 34 00 47 4e 4f 4d 45 5f =60817444?GNOME_
090 0xbfd446ae 4b 45 59 52 49 4e 47 5f 43 4f 4e 54 52 4f 4c 3d KEYRING_CONTROL=
091 0xbfd446be 2f 74 6d 70 2f 6b 65 79 72 69 6e 67 2d 50 46 39 /tmp/keyring-PF9
092 0xbfd446ce 63 57 71 00 47 54 4b 5f 4d 4f 44 55 4c 45 53 3d cWq?GTK_MODULES=
093 0xbfd446de 63 61 6e 62 65 72 72 61 2d 67 74 6b 2d 6d 6f 64 canberra-gtk-mod
094 0xbfd446ee 75 6c 65 00 55 53 45 52 3d 75 62 75 6e 74 75 00 ule?USER=ubuntu?
095 0xbfd446fe 4c 53 5f 43 4f 4c 4f 52 53 3d 72 73 3d 30 3a 64 LS_COLORS=rs=0:d
096 0xbfd4470e 69 3d 30 31 3b 33 34 3a 6c 6e 3d 30 31 3b 33 36 i=01;34:ln=01;36
097 0xbfd4471e 3a 6d 68 3d 30 30 3a 70 69 3d 34 30 3b 33 33 3a :mh=00:pi=40;33:
098 0xbfd4472e 73 6f 3d 30 31 3b 33 35 3a 64 6f 3d 30 31 3b 33 so=01;35:do=01;3
099 0xbfd4473e 35 3a 62 64 3d 34 30 3b 33 33 3b 30 31 3a 63 64 5:bd=40;33;01:cd
100 0xbfd4474e 3d 34 30 3b 33 33 3b 30 31 3a 6f 72 3d 34 30 3b =40;33;01:or=40;
101 0xbfd4475e 33 31 3b 30 31 3a 73 75 3d 33 37 3b 34 31 3a 73 31;01:su=37;41:s
102 0xbfd4476e 67 3d 33 30 3b 34 33 3a 63 61 3d 33 30 3b 34 31 g=30;43:ca=30;41
103 0xbfd4477e 3a 74 77 3d 33 30 3b 34 32 3a 6f 77 3d 33 34 3b :tw=30;42:ow=34;
104 0xbfd4478e 34 32 3a 73 74 3d 33 37 3b 34 34 3a 65 78 3d 30 42:st=37;44:ex=0
105 0xbfd4479e 31 3b 33 32 3a 2a 2e 74 61 72 3d 30 31 3b 33 31 1;32:*.tar=01;31
106 0xbfd447ae 3a 2a 2e 74 67 7a 3d 30 31 3b 33 31 3a 2a 2e 61 :*.tgz=01;31:*.a
107 0xbfd447be 72 6a 3d 30 31 3b 33 31 3a 2a 2e 74 61 7a 3d 30 rj=01;31:*.taz=0
108 0xbfd447ce 31 3b 33 31 3a 2a 2e 6c 7a 68 3d 30 31 3b 33 31 1;31:*.lzh=01;31
109 0xbfd447de 3a 2a 2e 6c 7a 6d 61 3d 30 31 3b 33 31 3a 2a 2e :*.lzma=01;31:*.
110 0xbfd447ee 74 6c 7a 3d 30 31 3b 33 31 3a 2a 2e 74 78 7a 3d tlz=01;31:*.txz=
111 0xbfd447fe 30 31 3b 33 31 3a 2a 2e 7a 69 70 3d 30 31 3b 33 01;31:*.zip=01;3
112 0xbfd4480e 31 3a 2a 2e 7a 3d 30 31 3b 33 31 3a 2a 2e 5a 3d 1:*.z=01;31:*.Z=
113 0xbfd4481e 30 31 3b 33 31 3a 2a 2e 64 7a 3d 30 31 3b 33 31 01;31:*.dz=01;31
114 0xbfd4482e 3a 2a 2e 67 7a 3d 30 31 3b 33 31 3a 2a 2e 6c 7a :*.gz=01;31:*.lz
115 0xbfd4483e 3d 30 31 3b 33 31 3a 2a 2e 78 7a 3d 30 31 3b 33 =01;31:*.xz=01;3
116 0xbfd4484e 31 3a 2a 2e 62 7a 32 3d 30 31 3b 33 31 3a 2a 2e 1:*.bz2=01;31:*.
117 0xbfd4485e 62 7a 3d 30 31 3b 33 31 3a 2a 2e 74 62 7a 3d 30 bz=01;31:*.tbz=0
118 0xbfd4486e 31 3b 33 31 3a 2a 2e 74 62 7a 32 3d 30 31 3b 33 1;31:*.tbz2=01;3
119 0xbfd4487e 31 3a 2a 2e 74 7a 3d 30 31 3b 33 31 3a 2a 2e 64 1:*.tz=01;31:*.d
120 0xbfd4488e 65 62 3d 30 31 3b 33 31 3a 2a 2e 72 70 6d 3d 30 eb=01;31:*.rpm=0
121 0xbfd4489e 31 3b 33 31 3a 2a 2e 6a 61 72 3d 30 31 3b 33 31 1;31:*.jar=01;31
122 0xbfd448ae 3a 2a 2e 72 61 72 3d 30 31 3b 33 31 3a 2a 2e 61 :*.rar=01;31:*.a
123 0xbfd448be 63 65 3d 30 31 3b 33 31 3a 2a 2e 7a 6f 6f 3d 30 ce=01;31:*.zoo=0
124 0xbfd448ce 31 3b 33 31 3a 2a 2e 63 70 69 6f 3d 30 31 3b 33 1;31:*.cpio=01;3
125 0xbfd448de 31 3a 2a 2e 37 7a 3d 30 31 3b 33 31 3a 2a 2e 72 1:*.7z=01;31:*.r
126 0xbfd448ee 7a 3d 30 31 3b 33 31 3a 2a 2e 6a 70 67 3d 30 31 z=01;31:*.jpg=01
127 0xbfd448fe 3b 33 35 3a 2a 2e 6a 70 65 67 3d 30 31 3b 33 35 ;35:*.jpeg=01;35
128 0xbfd4490e 3a 2a 2e 67 69 66 3d 30 31 3b 33 35 3a 2a 2e 62 :*.gif=01;35:*.b
129 0xbfd4491e 6d 70 3d 30 31 3b 33 35 3a 2a 2e 70 62 6d 3d 30 mp=01;35:*.pbm=0
130 0xbfd4492e 31 3b 33 35 3a 2a 2e 70 67 6d 3d 30 31 3b 33 35 1;35:*.pgm=01;35
131 0xbfd4493e 3a 2a 2e 70 70 6d 3d 30 31 3b 33 35 3a 2a 2e 74 :*.ppm=01;35:*.t
132 0xbfd4494e 67 61 3d 30 31 3b 33 35 3a 2a 2e 78 62 6d 3d 30 ga=01;35:*.xbm=0
133 0xbfd4495e 31 3b 33 35 3a 2a 2e 78 70 6d 3d 30 31 3b 33 35 1;35:*.xpm=01;35
134 0xbfd4496e 3a 2a 2e 74 69 66 3d 30 31 3b 33 35 3a 2a 2e 74 :*.tif=01;35:*.t
135 0xbfd4497e 69 66 66 3d 30 31 3b 33 35 3a 2a 2e 70 6e 67 3d iff=01;35:*.png=
136 0xbfd4498e 30 31 3b 33 35 3a 2a 2e 73 76 67 3d 30 31 3b 33 01;35:*.svg=01;3
137 0xbfd4499e 35 3a 2a 2e 73 76 67 7a 3d 30 31 3b 33 35 3a 2a 5:*.svgz=01;35:*
138 0xbfd449ae 2e 6d 6e 67 3d 30 31 3b 33 35 3a 2a 2e 70 63 78 .mng=01;35:*.pcx
139 0xbfd449be 3d 30 31 3b 33 35 3a 2a 2e 6d 6f 76 3d 30 31 3b =01;35:*.mov=01;
140 0xbfd449ce 33 35 3a 2a 2e 6d 70 67 3d 30 31 3b 33 35 3a 2a 35:*.mpg=01;35:*
141 0xbfd449de 2e 6d 70 65 67 3d 30 31 3b 33 35 3a 2a 2e 6d 32 .mpeg=01;35:*.m2
142 0xbfd449ee 76 3d 30 31 3b 33 35 3a 2a 2e 6d 6b 76 3d 30 31 v=01;35:*.mkv=01
143 0xbfd449fe 3b 33 35 3a 2a 2e 6f 67 6d 3d 30 31 3b 33 35 3a ;35:*.ogm=01;35:
144 0xbfd44a0e 2a 2e 6d 70 34 3d 30 31 3b 33 35 3a 2a 2e 6d 34 *.mp4=01;35:*.m4
145 0xbfd44a1e 76 3d 30 31 3b 33 35 3a 2a 2e 6d 70 34 76 3d 30 v=01;35:*.mp4v=0
146 0xbfd44a2e 31 3b 33 35 3a 2a 2e 76 6f 62 3d 30 31 3b 33 35 1;35:*.vob=01;35
147 0xbfd44a3e 3a 2a 2e 71 74 3d 30 31 3b 33 35 3a 2a 2e 6e 75 :*.qt=01;35:*.nu
148 0xbfd44a4e 76 3d 30 31 3b 33 35 3a 2a 2e 77 6d 76 3d 30 31 v=01;35:*.wmv=01
149 0xbfd44a5e 3b 33 35 3a 2a 2e 61 73 66 3d 30 31 3b 33 35 3a ;35:*.asf=01;35:
150 0xbfd44a6e 2a 2e 72 6d 3d 30 31 3b 33 35 3a 2a 2e 72 6d 76 *.rm=01;35:*.rmv
151 0xbfd44a7e 62 3d 30 31 3b 33 35 3a 2a 2e 66 6c 63 3d 30 31 b=01;35:*.flc=01
152 0xbfd44a8e 3b 33 35 3a 2a 2e 61 76 69 3d 30 31 3b 33 35 3a ;35:*.avi=01;35:
153 0xbfd44a9e 2a 2e 66 6c 69 3d 30 31 3b 33 35 3a 2a 2e 66 6c *.fli=01;35:*.fl
154 0xbfd44aae 76 3d 30 31 3b 33 35 3a 2a 2e 67 6c 3d 30 31 3b v=01;35:*.gl=01;
155 0xbfd44abe 33 35 3a 2a 2e 64 6c 3d 30 31 3b 33 35 3a 2a 2e 35:*.dl=01;35:*.
156 0xbfd44ace 78 63 66 3d 30 31 3b 33 35 3a 2a 2e 78 77 64 3d xcf=01;35:*.xwd=
157 0xbfd44ade 30 31 3b 33 35 3a 2a 2e 79 75 76 3d 30 31 3b 33 01;35:*.yuv=01;3
158 0xbfd44aee 35 3a 2a 2e 63 67 6d 3d 30 31 3b 33 35 3a 2a 2e 5:*.cgm=01;35:*.
159 0xbfd44afe 65 6d 66 3d 30 31 3b 33 35 3a 2a 2e 61 78 76 3d emf=01;35:*.axv=
160 0xbfd44b0e 30 31 3b 33 35 3a 2a 2e 61 6e 78 3d 30 31 3b 33 01;35:*.anx=01;3
161 0xbfd44b1e 35 3a 2a 2e 6f 67 76 3d 30 31 3b 33 35 3a 2a 2e 5:*.ogv=01;35:*.
162 0xbfd44b2e 6f 67 78 3d 30 31 3b 33 35 3a 2a 2e 61 61 63 3d ogx=01;35:*.aac=
163 0xbfd44b3e 30 30 3b 33 36 3a 2a 2e 61 75 3d 30 30 3b 33 36 00;36:*.au=00;36
164 0xbfd44b4e 3a 2a 2e 66 6c 61 63 3d 30 30 3b 33 36 3a 2a 2e :*.flac=00;36:*.
165 0xbfd44b5e 6d 69 64 3d 30 30 3b 33 36 3a 2a 2e 6d 69 64 69 mid=00;36:*.midi
166 0xbfd44b6e 3d 30 30 3b 33 36 3a 2a 2e 6d 6b 61 3d 30 30 3b =00;36:*.mka=00;
167 0xbfd44b7e 33 36 3a 2a 2e 6d 70 33 3d 30 30 3b 33 36 3a 2a 36:*.mp3=00;36:*
168 0xbfd44b8e 2e 6d 70 63 3d 30 30 3b 33 36 3a 2a 2e 6f 67 67 .mpc=00;36:*.ogg
169 0xbfd44b9e 3d 30 30 3b 33 36 3a 2a 2e 72 61 3d 30 30 3b 33 =00;36:*.ra=00;3
170 0xbfd44bae 36 3a 2a 2e 77 61 76 3d 30 30 3b 33 36 3a 2a 2e 6:*.wav=00;36:*.
171 0xbfd44bbe 61 78 61 3d 30 30 3b 33 36 3a 2a 2e 6f 67 61 3d axa=00;36:*.oga=
172 0xbfd44bce 30 30 3b 33 36 3a 2a 2e 73 70 78 3d 30 30 3b 33 00;36:*.spx=00;3
173 0xbfd44bde 36 3a 2a 2e 78 73 70 66 3d 30 30 3b 33 36 3a 00 6:*.xspf=00;36:?
174 0xbfd44bee 53 53 48 5f 41 55 54 48 5f 53 4f 43 4b 3d 2f 74 SSH_AUTH_SOCK=/t
175 0xbfd44bfe 6d 70 2f 6b 65 79 72 69 6e 67 2d 50 46 39 63 57 mp/keyring-PF9cW
176 0xbfd44c0e 71 2f 73 73 68 00 53 45 53 53 49 4f 4e 5f 4d 41 q/ssh?SESSION_MA
177 0xbfd44c1e 4e 41 47 45 52 3d 6c 6f 63 61 6c 2f 75 62 75 6e NAGER=local/ubun
178 0xbfd44c2e 74 75 3a 40 2f 74 6d 70 2f 2e 49 43 45 2d 75 6e tu:@/tmp/.ICE-un
179 0xbfd44c3e 69 78 2f 34 32 35 33 2c 75 6e 69 78 2f 75 62 75 ix/4253,unix/ubu
180 0xbfd44c4e 6e 74 75 3a 2f 74 6d 70 2f 2e 49 43 45 2d 75 6e ntu:/tmp/.ICE-un
181 0xbfd44c5e 69 78 2f 34 32 35 33 00 55 53 45 52 4e 41 4d 45 ix/4253?USERNAME
182 0xbfd44c6e 3d 75 62 75 6e 74 75 00 44 45 46 41 55 4c 54 53 =ubuntu?DEFAULTS
183 0xbfd44c7e 5f 50 41 54 48 3d 2f 75 73 72 2f 73 68 61 72 65 _PATH=/usr/share
184 0xbfd44c8e 2f 67 63 6f 6e 66 2f 67 6e 6f 6d 65 2e 64 65 66 /gconf/gnome.def
185 0xbfd44c9e 61 75 6c 74 2e 70 61 74 68 00 58 44 47 5f 43 4f ault.path?XDG_CO
186 0xbfd44cae 4e 46 49 47 5f 44 49 52 53 3d 2f 65 74 63 2f 78 NFIG_DIRS=/etc/x
187 0xbfd44cbe 64 67 2f 78 64 67 2d 67 6e 6f 6d 65 3a 2f 65 74 dg/xdg-gnome:/et
188 0xbfd44cce 63 2f 78 64 67 00 50 41 54 48 3d 2f 75 73 72 2f c/xdg?PATH=/usr/
189 0xbfd44cde 6c 6f 63 61 6c 2f 73 62 69 6e 3a 2f 75 73 72 2f local/sbin:/usr/
190 0xbfd44cee 6c 6f 63 61 6c 2f 62 69 6e 3a 2f 75 73 72 2f 73 local/bin:/usr/s
191 0xbfd44cfe 62 69 6e 3a 2f 75 73 72 2f 62 69 6e 3a 2f 73 62 bin:/usr/bin:/sb
192 0xbfd44d0e 69 6e 3a 2f 62 69 6e 3a 2f 75 73 72 2f 67 61 6d in:/bin:/usr/gam
193 0xbfd44d1e 65 73 00 44 45 53 4b 54 4f 50 5f 53 45 53 53 49 es?DESKTOP_SESSI
194 0xbfd44d2e 4f 4e 3d 67 6e 6f 6d 65 00 50 57 44 3d 2f 68 6f ON=gnome?PWD=/ho
195 0xbfd44d3e 6d 65 2f 75 62 75 6e 74 75 2f 44 65 73 6b 74 6f me/ubuntu/Deskto
196 0xbfd44d4e 70 00 47 44 4d 5f 4b 45 59 42 4f 41 52 44 5f 4c p?GDM_KEYBOARD_L
197 0xbfd44d5e 41 59 4f 55 54 3d 75 73 00 4c 41 4e 47 3d 65 6e AYOUT=us?LANG=en
198 0xbfd44d6e 5f 55 53 2e 55 54 46 2d 38 00 47 44 4d 5f 4c 41 _US.UTF-8?GDM_LA
199 0xbfd44d7e 4e 47 3d 65 6e 5f 55 53 2e 55 54 46 2d 38 00 4d NG=en_US.UTF-8?M
200 0xbfd44d8e 41 4e 44 41 54 4f 52 59 5f 50 41 54 48 3d 2f 75 ANDATORY_PATH=/u
201 0xbfd44d9e 73 72 2f 73 68 61 72 65 2f 67 63 6f 6e 66 2f 67 sr/share/gconf/g
202 0xbfd44dae 6e 6f 6d 65 2e 6d 61 6e 64 61 74 6f 72 79 2e 70 nome.mandatory.p
203 0xbfd44dbe 61 74 68 00 55 42 55 4e 54 55 5f 4d 45 4e 55 50 ath?UBUNTU_MENUP
204 0xbfd44dce 52 4f 58 59 3d 6c 69 62 61 70 70 6d 65 6e 75 2e ROXY=libappmenu.
205 0xbfd44dde 73 6f 00 43 4f 4d 50 49 5a 5f 43 4f 4e 46 49 47 so?COMPIZ_CONFIG
206 0xbfd44dee 5f 50 52 4f 46 49 4c 45 3d 75 62 75 6e 74 75 00 _PROFILE=ubuntu?
207 0xbfd44dfe 47 44 4d 53 45 53 53 49 4f 4e 3d 67 6e 6f 6d 65 GDMSESSION=gnome
208 0xbfd44e0e 00 53 48 4c 56 4c 3d 31 00 48 4f 4d 45 3d 2f 68 ?SHLVL=1?HOME=/h
209 0xbfd44e1e 6f 6d 65 2f 75 62 75 6e 74 75 00 4c 41 4e 47 55 ome/ubuntu?LANGU
210 0xbfd44e2e 41 47 45 3d 65 6e 5f 55 53 3a 65 6e 00 47 4e 4f AGE=en_US:en?GNO
211 0xbfd44e3e 4d 45 5f 44 45 53 4b 54 4f 50 5f 53 45 53 53 49 ME_DESKTOP_SESSI
212 0xbfd44e4e 4f 4e 5f 49 44 3d 74 68 69 73 2d 69 73 2d 64 65 ON_ID=this-is-de
213 0xbfd44e5e 70 72 65 63 61 74 65 64 00 4c 4f 47 4e 41 4d 45 precated?LOGNAME
214 0xbfd44e6e 3d 75 62 75 6e 74 75 00 58 44 47 5f 44 41 54 41 =ubuntu?XDG_DATA
215 0xbfd44e7e 5f 44 49 52 53 3d 2f 75 73 72 2f 73 68 61 72 65 _DIRS=/usr/share
216 0xbfd44e8e 2f 67 6e 6f 6d 65 3a 2f 75 73 72 2f 6c 6f 63 61 /gnome:/usr/loca
217 0xbfd44e9e 6c 2f 73 68 61 72 65 2f 3a 2f 75 73 72 2f 73 68 l/share/:/usr/sh
218 0xbfd44eae 61 72 65 2f 00 44 42 55 53 5f 53 45 53 53 49 4f are/?DBUS_SESSIO
219 0xbfd44ebe 4e 5f 42 55 53 5f 41 44 44 52 45 53 53 3d 75 6e N_BUS_ADDRESS=un
220 0xbfd44ece 69 78 3a 61 62 73 74 72 61 63 74 3d 2f 74 6d 70 ix:abstract=/tmp
221 0xbfd44ede 2f 64 62 75 73 2d 44 54 62 6e 31 48 4e 5a 46 55 /dbus-DTbn1HNZFU
222 0xbfd44eee 2c 67 75 69 64 3d 33 62 32 61 30 63 32 66 35 35 ,guid=3b2a0c2f55
223 0xbfd44efe 33 35 32 61 32 64 37 30 36 37 38 66 66 63 30 30 352a2d70678ffc00
224 0xbfd44f0e 30 30 30 30 61 33 00 4c 45 53 53 4f 50 45 4e 3d 0000a3?LESSOPEN=
225 0xbfd44f1e 7c 20 2f 75 73 72 2f 62 69 6e 2f 6c 65 73 73 70 | /usr/bin/lessp
226 0xbfd44f2e 69 70 65 20 25 73 00 57 49 4e 44 4f 57 50 41 54 ipe %s?WINDOWPAT
227 0xbfd44f3e 48 3d 37 00 44 49 53 50 4c 41 59 3d 3a 30 2e 30 H=7?DISPLAY=:0.0
228 0xbfd44f4e 00 4c 45 53 53 43 4c 4f 53 45 3d 2f 75 73 72 2f ?LESSCLOSE=/usr/
229 0xbfd44f5e 62 69 6e 2f 6c 65 73 73 70 69 70 65 20 25 73 20 bin/lesspipe %s
230 0xbfd44f6e 25 73 00 52 55 4e 4e 49 4e 47 5f 55 4e 44 45 52 %s?RUNNING_UNDER
231 0xbfd44f7e 5f 47 44 4d 3d 79 65 73 00 43 4f 4c 4f 52 54 45 _GDM=yes?COLORTE
232 0xbfd44f8e 52 4d 3d 67 6e 6f 6d 65 2d 74 65 72 6d 69 6e 61 RM=gnome-termina
233 0xbfd44f9e 6c 00 58 41 55 54 48 4f 52 49 54 59 3d 2f 76 61 l?XAUTHORITY=/va
234 0xbfd44fae 72 2f 72 75 6e 2f 67 64 6d 2f 61 75 74 68 2d 66 r/run/gdm/auth-f
235 0xbfd44fbe 6f 72 2d 75 62 75 6e 74 75 2d 5a 61 30 58 77 78 or-ubuntu-Za0Xwx
236 0xbfd44fce 2f 64 61 74 61 62 61 73 65 00 5f 3d 2e 2f 6d 61 /database?_=./ma
237 0xbfd44fde 69 6e 00 4f 4c 44 50 57 44 3d 2f 68 6f 6d 65 2f in?OLDPWD=/home/
238 0xbfd44fee 75 62 75 6e 74 75 00 2e 2f 6d 61 69 6e 00 00 00 ubuntu?./main???
239 0xbfd44ffe 00 00 Segmentation fault (core dumped)
目前,我已经想出了以下事项(从第001行开始):
我有两个问题:
供参考,这是我正在使用的代码:
#include <iostream>
#include <locale>
#include <unistd.h>
int main(int argc, char* argv[], char* env[]) {
char tekst[] = "HERE_IS_START";
for (int i = 0; i < argc; i++) {
std::cout << "argv[" << i << "]" << argv[i] << " " << std::hex <<
(int) argv[i] << " " << &argv[i] << std::endl;
}
int z = 0;
for (char** env_ = env; *env_ != 0; env_++) {
std::cout << "env[" << z++ << "]" << *env_ << " " << std::hex <<
(int) *env << " " << &(*env_) << std::endl;
}
int row = 16;
char* wsk = tekst;
for (int i = 0;; i++) {
if (i + 1 < 10)std::cout << 0;
if (i + 1 < 100)std::cout << 0;
std::cout << std::dec << (i + 1) << " 0x" << std::hex << (int) wsk << " ";
for (int j = 0; j < row; j++) {
if ((unsigned int) (unsigned char) (wsk[j]) < 16)
std::cout << 0;
std::cout << (unsigned int) (unsigned char) (wsk[j]) <<
" " << std::flush;
}
for (int j = 0; j < row; j++) {
if (isprint((char) (wsk[j])))
std::cout << (char) (wsk[j]);
else
std::cout << '?';
}
std::cout << std::endl;
wsk = wsk + row;
}
return 0;
}
该程序在Ubuntu 11.04中编译和测试。
答案 0 :(得分:1)
您如何期望突破for
循环?您没有给它重复条件,并且您在循环内的任何位置都没有明确的break
或return
。据推测,这种分段错误是由于超过堆栈末尾进入你不允许访问的内存造成的。
答案 1 :(得分:0)
在main
启动之前,有两件事会把东西放在堆栈上:操作系统本身,以及编译器生成的运行时库和启动代码。您不应该直接使用任何此类信息,因此通常不会记录。