Search code examples
c++eclipsegdbeclipse-cdt

difference between this and this@entry?


I've recently started to use Eclipse-CDT and was curious about 'this' and 'this@entry' in the variables window in the debugging perspective. They both have the same memory address and look identical but then why include both? Is 'this@entry' meant to represent the state of 'this' at some breakpoint within a function? Do the values represented under 'this@entry' go out of scope, so to speak, and update 'this' when the function returns?

They both have the same memory address but...

team1,2 and currentMatch are global variables to the class I am debugging, and the breakpoints are in a member function of that class.


Solution

  • The @entry form refers to the value of the parameter when the function was entered. This isn't always available, but sometimes it is -- there is a DWARF extension for it, and GCC emits this when possible.

    There's some information here:

    https://sourceware.org/gdb/onlinedocs/gdb/Variables.html

    IIRC in gdb's CLI we decided on a format that only shows "@entry" in backtraces when it differs from the current value. But MI (what Eclipse uses) is different and from what you say it seems to always show it.