evaluate variable/function in gdb

谁都会走 提交于 2019-12-06 11:52:06

Now that you've answered my question in the comments, I can answer!

The value that you see as the result of the printf is the real address. You are seeing 0 as the value of seg in the debugger because when optimizations are enabled, the compiler is free to do all sorts of weird things (which generally makes step-by-step debugging tricky). The "observable" behaviour should always be correct, though (assuming you're not relying on any undefined behaviour).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!