|
Boost : |
From: Neal D. Becker (nbecker_at_[hidden])
Date: 2002-08-21 08:04:59
>>>>> "David" == David Abrahams <dave_at_[hidden]> writes:
David> They haven't done the typeinfo::name() decoding job I started analyzing
David> here:
Is this what you want?
------------------------
#include <libcw/sysd.h> // This must be the first header file
// This line should actually be part of a custom "debug.h" file. See tutorial 2.
#include <libcw/debug.h>
#include <string>
template<typename T>
void f() {
libcw::debug::location_ct location ((char*) __builtin_return_address (0) + libcw::debug::builtin_return_address_offset);
std::string demangled_function_name;
libcw::debug::demangle_symbol (location.mangled_function_name(), demangled_function_name);
Dout (dc::notice, "called from: " << demangled_function_name);
Dout (dc::notice, location_ct((char*)__builtin_return_address (0) + libcw::debug::builtin_return_address_offset));
Dout (dc::notice, "Called f<" << type_info_of<T>().demangled_name() << ">");
}
int main(void)
{
Debug( dc::notice.on() ); // Turn on the NOTICE Debug Channel.
Debug( libcw_do.on() ); // Turn on the default Debug Object.
Dout(dc::notice, "Hello World");
f<int>();
return 0;
}
-----------------------
Hello
NOTICE : Hello World
NOTICE : called from: main
NOTICE : Hello.cc:25
NOTICE : Called f<int>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk