10-1-19
转:
http://lists.apple.com/archives/xcode-users/2004/Dec/msg00205.html[自:简而言之,可以先试试:(gdb) print &(foo->bar->baz)
如果不行,则试试:
(gdb) print &(foo->bar->baz)
(gdb) watch *<HEX address returned from the previous command>
注意,表达式没有<>]There isn't a GUI way to do this yet. But you can do it in the gdb console. Just bring up the Debugger log (under the Debug menu), and use the "watch" command.One little subtlety, if you do something like:
(gdb) watch foo->bar->baz
gdb will watch all three locations so you will know if the result of the expression changes for any reason. This is sometimes what you want, and sometimes not. If you know you just want to watch a simple memory location, it is sometimes easier to do:(gdb) print &(foo->bar->baz)
(gdb) watch *<HEX address returned from the previous command>
The * in this case tells gdb that you are giving it an address, and not an expression... And of course, without the <>'s...If you want more help on how to use the gdb console, there are docs in /Developer/Documentation/DeveloperTools/gdb/gdb/gdb_toc.html.Jim
+++++