Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are the backtick symbols in vs user mode debugger

I have the following c++ code compiled into 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 type the following command in the debugger immediate window

x program!*foo*

This gives me the following output

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 the first output is foo's destructor and the third one is foo's constructor. What are the second and fourth ones (the ones with the backticks) ?. More generally, what are the other places where I might see backticks in the user mode debugger?

Interestingly, the backtick functions go away if any of the following are done

  • Remove std::cout statements
  • Remove std::string s
  • Add the throw() keyword in front of the constructor and destructor

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

like image 893
tcb Avatar asked Oct 08 '14 19:10

tcb


1 Answers

These are internal names generated by the Microsoft compiler for "glue" functions that help things fit together, but don't correspond directly to a line of source code. It is normal.

There are other situations where you'll see similar internal names with backticks, such as using lambda functions, or calling a function that's declared inside a struct that's inside another function.

Other compilers have different ways of representing similar nameless blocks of code; the standard doesn't dictate any particular behavior here, and it's only observable via the debugger anyway.

like image 103
StilesCrisis Avatar answered Oct 06 '22 14:10

StilesCrisis