???GDB??C????
???????????? ???????[ 2015/8/25 11:21:20 ] ??????????????? .NET
??????????Щ???и????????????磺 Ruby??Scheme??Haskell ???????????????? C ????????????????????????? C ?????????????????????????????????????????? REPL ( Read-Eval-Print Loop ) ??????????????????????????????? REPL ?????????????????????????“??д-????-????”???????????е?????????
???????????????????? GDB ????? C ?????α REPL????????????? GDB ????? C ??????????????????????????? C ??????????????????
????????????????????????? GDB ????????????? C ?????????????????????????Щ??????? GDB ???????????????????????? GDB ????? C ??????????????????????????????????????
????GDB ???
???????????????? C ???????minimal.c:
????int main()
????{
????int i = 1337;
????return 0;
????}
????????????????????κ????飬?????????????????? GDB ?? C ?????????????????
??????? -g ???????б??????????????Щ?????? debug??gdb ????????????????????? GDB ??????????
????$ gcc -g minimal.c -o minimal
????$ gdb minimal
??????????????????????? GDB ????С?????????????????? REPL?????????????????
????(gdb) print 1 + 2
????$1 = 3
??????????棡 print ?? GDB ??????????????????????? C ?????????????????????????? GDB ?????????????????? GDB ????????????? help??
????????????????????????
????(gbd) print (int) 2147483648
????$2 = -2147483648
?????????????????? 2147483648 == -2147483648???????????????????????????? C ??????????к?????GDB ?????????? C ?????е?????????
????????????????????????????????????????г???
????(gdb) break main
????(gdb) run
?????????????? 3 ?д???????????? i ???г???????????????????? i ????б????????????????????? print ?????????????
????(gdb) print i
????$3 = 32767
?????? C ?????У????δ??????????????????????ж????????????? GDB ?????????????????????????
????????????? next ????????е?????????У?
????(gdb) next
????(gdb) print i
????$4 = 1337
??????? x ?????????
?????? C ?????б?????????????????????????????????????????????????????????
???????????????????????????
?????????С????λ???????????????????С???????????????
????C ?????????????????????????????????????????檔?????? & ?????????????????????????? sizeof ???????????????С??
??????????? GDB ?в???????????????
????(gdb) print &i
????$5 = (int *) 0x7fff5fbff584
????(gdb) print sizeof(i)
????$6 = 4
?????????????i ????????????? 0x7fff5fbff5b4?????? 4 ??????
??????????????????????е??С??????????????????????? sizeof ?????????????????
????(gdb) print sizeof(int)
????$7 = 4
????(gdb) print sizeof(double)
????$8 = 8
?????????????ζ?????????????????? int ????? 4 ???????double ????? 8 ??????
??????
???·???
??????????????????
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