PStack
2.0
Stack trace printer for MSVC and GCC binaries
|
Contains information about an executable image or shared library. More...
#include <module_info.hpp>
Construction / Destruction | |
module_info (psystem::shared_handle<> const &file_handle, CREATE_PROCESS_DEBUG_INFO const &info) noexcept | |
Construct a module_info instance for a process's executable. More... | |
module_info (psystem::shared_handle<> const &file_handle, LOAD_DLL_DEBUG_INFO const &info) noexcept | |
Construct a module_info instance for a shared library. More... | |
module_info (module_info &&o) noexcept | |
Move from an object of this type. More... | |
~module_info () noexcept | |
Clean up resources used by the module_info instance. | |
Public Interface | |
address_t | get_base_of_image () const noexcept |
Access the base memory address for this module. More... | |
std::string const & | get_file_name () const noexcept |
Access the module's full file name. More... | |
std::string const & | get_name () const noexcept |
Access the module's base name. More... | |
Private Utilites | |
static void | init_file_name (HANDLE file_handle, std::string *out) noexcept |
Lazy initialization used by the get_file_name() method. More... | |
static void | init_name (std::string const &file_name, std::string *out) noexcept |
Lazy initialization used by the get_name() method. More... | |
Member Data | |
psystem::shared_handle | m_file_handle |
Shared ownership of the handle to the memory-mapped module. | |
address_t | m_base_of_image |
The base memory address into the module's data. | |
std::string | m_file_name |
The file name of the library / executable that defines this module. More... | |
std::once_flag | m_file_name_lock |
Mutex for lazy generation of module_info::m_file_name. More... | |
std::string | m_name |
The brief name of the module. More... | |
std::once_flag | m_name_lock |
Mutex for lazy generation of module_info::m_name. More... | |
Contains information about an executable image or shared library.
In order to have a useful debugging experience, a debugger needs to be aware of all the modules used by an application, as well as where in memory they reside. This provides information about individual symbols, as well as a more reliable stack trace.
Get module names
Move operations
Pass in needed data to be more platform compatible?
|
explicitnoexcept |
Construct a module_info instance for a process's executable.
[in] | file_handle | The handle to the file that relates to this code module. |
[in] | info | The full set of information about the module. |
|
explicitnoexcept |
Construct a module_info instance for a shared library.
[in] | file_handle | The handle to the file that relates to this code module. |
[in] | info | The full set of information about the module. |
|
noexcept |
Move from an object of this type.
[in,out] | o | The instance from which data will be moved. |
|
noexcept |
Access the base memory address for this module.
This information is useful for determining symbol information based on a memory address (e.g., a PC location in a stack trace). Once the module is determined, the symbol information can be gathered.
|
noexcept |
Access the module's full file name.
|
noexcept |
Access the module's base name.
|
staticprivatenoexcept |
Lazy initialization used by the get_file_name() method.
Given a file handle, this populates the out
parameter with the name of that file.
[in] | file_handle | An open file to examine. |
[in,out] | out | The buffer to receive the name associated with file_handle . This may be nullptr (the method does nothing). |
GetFinalPathNameByHandle()
, a Vista and later API.
|
staticprivatenoexcept |
Lazy initialization used by the get_name() method.
Given a file name, this populates the out
parameter with the module-name associated with the file.
[in] | file_name | The module's file name. |
[in,out] | out | The buffer to receive the module name. This may be nullptr (the method does nothing). |
|
mutableprivate |
The file name of the library / executable that defines this module.
This is expensive to generate, and is only created lazily.
|
mutableprivate |
Mutex for lazy generation of module_info::m_file_name.
The module_info::m_file_name data is generated by the const
member function, get_file_name(). Mutable data altered in a const
context should always be protected by a threading guard.
|
mutableprivate |
The brief name of the module.
The name is generated from m_file_name, so it will be generated lazily.
|
mutableprivate |
Mutex for lazy generation of module_info::m_name.
The module_info::m_name data is generated by the const
member function, get_name(). Mutable data altered in a const
context should always be protected by a threading guard.