What are the backtick characters in a user mode debugger

I have the following C ++ code compiled in Program.exe using vs12

 class foo { public: foo() { std::cout << "in ctor\n"; } ~foo() { std::cout << "in dtor\n"; } std::string s; }; int main() { foo f{}; } 

Then I go to Tools-> Launch Under Debugger ... "and enter the following command in the nearest debugger window

 x program!*foo* 

This gives me the following conclusion

 0:000> x program!*foo* 00007ff6`11ce4b00 Program!foo::~foo (void) 00007ff6`11ceaef0 Program!`foo::~foo'::`1'::dtor$0 (void) 00007ff6`11ce48f0 Program!foo::foo (void) 00007ff6`11ceae90 Program!`foo::foo'::`1'::dtor$0 (void) 

I understand that the first output is the foo destructor, and the third is the foo constructor. What are the second and fourth (those that have return lines)? More generally, what are the other places where I can see inverse images in a user mode debugger?

Interestingly, the return functions disappear if one of the following actions is performed:

  • Delete std::cout instructions
  • Delete std::string s
  • Add throw() keyword before constructor and destructor

This seems to suggest that the backtick functions have something to do with exception handling

+5
source share
1 answer

These are internal names generated by the Microsoft compiler for the “glue” functions that help put things together, but don't match the direct line of source code. This is normal.

There are other situations where you will see similar internal names with reverse measures, for example, using lambda functions or calling a function declared inside a structure that is inside another function.

Other compilers have different ways of representing similar anonymous blocks of code; the standard does not dictate any specific behavior here, and it can only be observed through the debugger.

+2
source

Source: https://habr.com/ru/post/1204280/


All Articles