开发者

Eclipse gdb expression: what is shown in "default"?

开发者 https://www.devze.com 2023-04-07 19:13 出处:网络
Stepping through C code in gdb using Eclipse, I noticed that for a variable char* sval gdb prints (in Expressions tab):

Stepping through C code in gdb using Eclipse, I noticed that for a variable char* sval gdb prints (in Expressions tab):

  • Expression: sval
  • Type: char*
  • Value: 0x7fffd9d79840 "BIDPRICE"

However I know that the value should be something different (say, "BIDZSPD") because it was assigned a few lines above. Indeed, the value of sval[3] is 'Z', as expected.

Then I noticed the following in the expressions view, same as in 开发者_开发技巧mouse-over on a variable:

Name : sval
Details:0x7fffd9d79840 "BIDZSPD"
Default:0x7fffd9d79840 "BIDPRICE"
Decimal:140736848173120
Hex:0x7fffd9d79840
Binary:11111111111111111011001110101111001100001000000
Octal:03777773165714100

Looks like different representations of char pointer, but why Details is different from Default? Should I interpret "Default" as previous value? Why Default is shown as expression value, and not current value?


Full build fixed it. This is one of the things one needs to keep in mind when working with C++: if things look really screwy (like gdb reporting different values by the same address), you have to bite the bullet and do a full build.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号