This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: gprof skips std::ofstream methods
- From: John Reiser <jreiser at bitwagon dot com>
- To: binutils at sourceware dot org
- Date: Sat, 24 Apr 2010 20:01:13 -0700
- Subject: Re: gprof skips std::ofstream methods
- References: <BAY110-W47225E1E0B37292A6F3E4196050@phx.gbl>
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
libstdc++.so.6, 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.
--