10#ifndef LIBCWD_CLASS_LOCATION_H
11#define LIBCWD_CLASS_LOCATION_H
33template <
class OSTREAM>
34void print_location_on(OSTREAM& os, Location
const& location);
63 lockable_auto_ptr<char, true>
80 static char const uninitialized_location[];
81 static char const pre_libcwd_initialization[];
82 static char const cleared_location[];
87 explicit Location(
void const* addr, LIBCWD_TSD_PARAM);
138 void pc_location(
void const* pc, LIBCWD_TSD_PARAM);
159 std::string
file()
const;
162 unsigned int line()
const;
189 template <
class OSTREAM>
190 friend void _private_::print_location_on(OSTREAM& os,
Location const& location);
191#if (__GNUC__ == 3 && __GNUC_MINOR__ < 4)
196 _private_::print_location_on(os, location);
203 void const* unknown_pc()
const
A source file location.
Definition Location.h:58
unsigned int line_
The line number of this location.
Definition Location.h:74
void print_filepath_on(std::ostream &os) const
Write the full path to an ostream.
Definition location.cxx:213
size_t filepath_length() const
The size of the full path name.
Definition Location.h:175
ObjectFileName const * object_file_name_
Definition Location.h:60
void print_filename_on(std::ostream &os) const
Write the file name to an ostream.
Definition location.cxx:219
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
lockable_auto_ptr< char, true > filepath_
The full source file name of this location. Allocated in `pc_location' using new [].
Definition Location.h:64
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
void const * initialization_delayed_
Definition Location.h:68
bool known_
Set when filepath_ (and filename_) point to valid data and line_ contains a valid line number.
Definition Location.h:75
ObjectFileName const * object_file() const
Corresponding object file.
Definition Location.h:182
Location & operator=(Location const &location)
Assignment operator.
Definition location.cxx:194
void const * unknown_pc_
Definition Location.h:71
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
size_t filename_length() const
The size of the file name.
Definition Location.h:173
Location(void const *addr)
Construct a location for address addr.
Definition Location.inl.h:25
char const * function_name_
Pointer to static string containing the mangled function name of this location.
Definition Location.h:62
void lock_ownership()
Keep ownership of the stored path in this object.
Definition Location.h:126
An object representing the main executable or a shared library.
Definition ObjectFileName.h:38