This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gprof skips std::ofstream methods

The only function that appears in the profiling results is

std::operator|(std::_Ios_Openmode, std::_Ios_Openmode)

Neither of ofstream::ofstream(), ofstream::write(), or ofstream::close()
appear. Am I missing some options perhaps that would make these appear?

gprof does not handle shared libraries.  gprof has had this deficiency
since its introduction in 1982, more than one quarter of a century ago.
Most of the member functions of ofstream are in the shared library, and not in ./test:

     $ nm ./test  |  c++filt  |  grep stream
                 U std::basic_ostream<char, std::char_traits<char> >::write(char const*, long)@@GLIBCXX_3.4
                 U std::basic_ofstream<char, std::char_traits<char> >::close()@@GLIBCXX_3.4
                 U std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream(char const*, std::_Ios_Openmode)@@GLIBCXX_3.4
                 U std::basic_ofstream<char, std::char_traits<char> >::~basic_ofstream()@@GLIBCXX_3.4

where the " U " means undefined in ./test . In contrast,

     $ nm ./test  |  c++filt  |  grep operator
     00000000004009d0 W std::operator|(std::_Ios_Openmode, std::_Ios_Openmode)

is defined as a Weak symbol (" W ") in ./test.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]