How to understand 2 main() functions after using uftrace to profile the C++ program? -


i trying uftrace profile following simple c++ program:

#include <iostream>  class { public:         a() {std::cout << "a created" << std::endl;}         ~a() {std::cout << "a destroyed" << std::endl;} };  int main() {         a;         return 0; } 

the profile result this:

# uftrace a.out created destroyed # duration    tid     function    2.026 [ 4828] | __cxa_atexit();             [ 4828] | main() {             [ 4828] |   __static_initialization_and_destruction_0() {   89.397 [ 4828] |     std::ios_base::init::init();    0.768 [ 4828] |     __cxa_atexit();   93.029 [ 4828] |   } /* __static_initialization_and_destruction_0 */   94.425 [ 4828] | } /* main */             [ 4828] | main() {             [ 4828] |   a::a() {   11.104 [ 4828] |     std::operator <<();   10.825 [ 4828] |     std::basic_ostream::operator <<();   24.514 [ 4828] |   } /* a::a */             [ 4828] |   a::~a() {    0.978 [ 4828] |     std::operator <<();    1.676 [ 4828] |     std::basic_ostream::operator <<();    4.819 [ 4828] |   } /* a::~a */   31.428 [ 4828] | } /* main */    2.095 [ 4828] | std::ios_base::init::~init(); 

what confuses me there 2 main() functions. traces, guess related iostream initialization, though, think there should 1 main() entry every executable file. how interpret it?

uftrace used remove prefix in symbol demangler may confuse users submitted patch keep , it's merged - https://github.com/namhyung/uftrace/pull/87

so if update uftrace current master. see first main() _global__sub_i_main().

thanks feedback!


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -