6#ifndef LIBCWD_CLASS_LOCATION_INL
7#define LIBCWD_CLASS_LOCATION_INL
27 LIBCWD_TSD_DECLARATION;
58 LIBCWD_TSD_DECLARATION;
86 LIBCWD_TSD_DECLARATION;
88 __libcwd_tsd.format = format;
94template <
class OSTREAM>
95void print_location_on(OSTREAM& os, Location
const& location)
99 LIBCWD_TSD_DECLARATION;
101 os << location.object_file_name_->filename() <<
':';
103 os << location.function_name_ <<
':';
105 os << location.filepath_.get() <<
':' << std::dec << location.line_;
107 os << location.filename_ <<
':' << std::dec << location.line_;
109 else if (location.object_file_name_)
110 os << location.object_file_name_->filename() <<
':' << location.function_name_;
112 os <<
"<unknown object file> (at " << location.unknown_pc() <<
')';
117#if !(__GNUC__ == 3 && __GNUC_MINOR__ < 4)
130 _private_::print_location_on(os, location);
A source file location.
Definition Location.h:58
unsigned int line_
The line number of this location.
Definition Location.h:74
ObjectFileName const * object_file_name_
Definition Location.h:60
void clear()
Clear the current object (set the location to 'unknown').
Definition location.cxx:168
void pc_location(void const *pc)
Initialize the current object with the location that corresponds with pc.
Definition Location.inl.h:55
unsigned int line() const
Return the line number; only valid if is_known() returns true.
Definition Location.inl.h:73
std::string file() const
The source file name (without path).
Definition Location.inl.h:67
bool is_known() const
Returns false if no source-file:line-number information is known for this location (or when it is uni...
Definition Location.inl.h:62
char const * mangled_function_name() const
Returns the mangled function name or unknown_function_c when no function could be found.
Definition Location.inl.h:79
bool known_
Set when filepath_ (and filename_) point to valid data and line_ contains a valid line number.
Definition Location.h:75
Location()
The default constructor.
Definition Location.inl.h:48
~Location()
Destructor.
Definition Location.inl.h:43
char const * filename_
Points inside filepath_ just after the last '/' or to the beginning.
Definition Location.h:67
char const * function_name_
Pointer to static string containing the mangled function name of this location.
Definition Location.h:62
This is the header file that third-party library headers should include.