???GDB??C????
???????????? ???????[ 2015/8/25 11:21:20 ] ??????????????? .NET
????GDB ???????????????????????????????棺x ???x ???????????????????????檔????Щ?????????????Щ????????????????????????????????????????????????????????????????? GDB ????????? help x??
????& ???????????????????????ζ????????? &i ????? x????????? i ?????????????
????(gdb) x/4xb &i
????0x7fff5fbff584: 0x39 0x05 0x00 0x00
?????????????????????? 4 ?????????????????????????????????????? 4 ??????????? i ??????е??С?? 4 ????????????? i ??????е?????
?????? Intel ?????????????????????????????????????“С??”????棺???????????????????????????????λ?????????????棨??λ?????λ????????
???????????????????????????????? i ??????????????????????????檔
????(gdb) set var i = 0x12345678
????(gdb) x/4xb &i
????0x7fff5fbff584: 0x78 0x56 0x34 0x12
??????? ptype ???????
????ptype ?????????????????????????????? C ??????????????
????(gdb) ptype i
????type = int
????(gdb) ptype &i
????type = int *
????(gdb) ptype main
????type = int (void)
????C ?????е?????????ú???????????? ptype ?????????????????
????????????
??????????C?????????????????????????????д????????????????? GDB ?????У???????????????????????
??????д???μ????array.c:
????int main()
????{
????int a[] = {1??2??3};
????return 0;
????}
??????? -g ????????в??????б????? GDB ?????У???????? next????г?????????
????$ gcc -g arrays.c -o arrays
????$ gdb arrays
????(gdb) break main
????(gdb) run
????(gdb) next
??????????????????????? a ???????????????????
????(gdb) print a
????$1 = {1?? 2?? 3}
????(gdb) ptype a
????type = int [3]
????????????????????? GDB ??????????????????????????????????? x ???? a ????????????????
????(gdb) x/12xb &a
????0x7fff5fbff56c: 0x01 0x00 0x00 0x00 0x02 0x00 0x00 0x00
????0x7fff5fbff574: 0x03 0x00 0x00 0x00
????????????? a ?????濪????? 0x7fff5fbff5dc?????????????洢 a[0]?? ??????????洢 a[1]?? ?????????洢 a[2]??????????????? sizeof ?????a ??????е??С?? 12 ????
????(gdb) print sizeof(a)
????$2 = 12
???????????????????и?????????????????????????????????????????????д洢???????????????Щ????£??????????????????磬???????? a ????????????
????= preserve do
????:escaped
????(gdb) print a + 1
????$3 = (int *) 0x7fff5fbff570
?????????????a+1 ???????? int ?????????? 0x7fff5fbff570???????????÷????????????? x ?????????????????????
????= preserve do
????:escaped
????(gdb) x/4xb a + 1
????0x7fff5fbff570: 0x02 0x00 0x00 0x00
??????? 0x7fff5fbff570 ?? 0x7fff5fbff56c ?? 4???????? a ????????е?????????????? int ?? 4 ????????ζ?? a+1 ??? a[1].
???????????? C ?????????????????????????????a[i] ???? *(a+i)????????? GDB ?г???????
????= preserve do
????:escaped
????(gdb) print a[0]
????$4 = 1
????(gdb) print *(a + 0)
????$5 = 1
????(gdb) print a[1]
????$6 = 2
????(gdb) print *(a + 1)
????$7 = 2
????(gdb) print a[2]
????$8 = 3
????(gdb) print *(a + 2)
????$9 = 3
??????????????????Щ????£?a ?????????????飬?????Щ????±??????????????????????????????????????
???????????????????? C ?????????????????“???”???????????????????????????????????????????????????? sizeof ?????????????????????????? & ???
??????????a ???????????? & ??????“???”???????????????????????????“???”???????? &a ??????????
?????????????????????????????
????= preserve do
????:escaped
????(gdb) x/4xb a
????0x7fff5fbff56c: 0x01 0x00 0x00 0x00
????(gdb) x/4xb &a
????0x7fff5fbff56c: 0x01 0x00 0x00 0x00
???????????????????????????????????? a ??????????? a?????????????????????? int *?????????? &a??????????????? GDB??
????= preserve do
????:escaped
????(gdb) ptype &a
????type = int (*)[3]
??????????????&a ???????? 3 ???????????????????????????? & ???a ????????a ?????????????? int[3]??
?????????????????????????????????????? a ???????? &a ??????????
????= preserve do
????:escaped
????(gdb) print a + 1
????$10 = (int *) 0x7fff5fbff570
????(gdb) print &a + 1
????$11 = (int (*)[3]) 0x7fff5fbff578
????????? a ???? 1 ????? a ???????? 4??????????? &a ???? 1 ????? a ???????? 12??
????????? a ??????????? &a[0];
????= preserve do
????:escaped
????(gdb) print &a[0]
????$11 = (int *) 0x7fff5fbff56c
????????
??????????????????? GDB ???? C ??????????????и????????????????????? print ??????????????? x ???????????????? ptype ??????????????????????
?????????????????????? GDB ?? C ??????г?????????Щ???????£?
????1.?? gdb ??? Ksplice ????????
????2.?о?????????????????д洢??? ???????????????????????
????3.??? GDB ?? disassemble ???????????????????????????????о??????????????ι??????
????4.???? GDB ?? “ tui ”?????????????? GDB ?????????????? ncurses ??(Ncurses ???????????????????????????? OS X ???У????????????????? GDB??
????Alan ?? Hacker School ???????????????л David Albert??Tom Ballinger??Nicholas Bergson-Shilcock ?? Amy Dyer ???????а??????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
C?????????????????????C?????????????C?????????????malloc??realloc????C??????????????8?????????C??????const?????ü?????C?????Ч????????????????C?????????C????д???????????????????????C????????λ?????C??????define???????÷??????C???????pthread???????C???????????????C????λ????ü??????????C???????????????????C?????з????????????????????????C?????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????