PStack  2.0
Stack trace printer for MSVC and GCC binaries
psystem Namespace Reference

Contains the process examination "system" and basic frameworks. More...

Namespaces

 exception
 All exceptions used by the psystem namespace exist in this namespace.
 
 format
 Formatting facilities for std::ostream output.
 
 internal
 PSystem utilities not meant for external consumption.
 

Classes

class  dbghelp_symbol_engine
 Provide an facility (using DbgHelp) for reading and mapping debugger symbols. More...
 
class  debug_help_dll
 Wraps invocations into the Windows DbgHelp DLL onto a lazily-loaded version. More...
 
struct  default_close_handle
 A simple functor to close handles (for use with RAII handle containers). More...
 
class  dll_export_iterator
 Iterator type for Windows Dynamic Link-Library (DLL) exports. More...
 
class  dll_export_view
 Exposes a DLL's symbol export table. More...
 
struct  has_void_return_type
 A template metafunction to determine if T is a function with a void return type. More...
 
class  image_symbol_iterator
 Iterator type for COFF-format debugging symbols. More...
 
class  module_info
 Contains information about an executable image or shared library. More...
 
class  not_assignable
 Removes the ability to use an assignment operation on derived classes. More...
 
class  not_copyable
 Remove the ability to copy or reassign from derived classes. More...
 
class  process_info
 A container object for a process's information. More...
 
class  shared_handle
 Share management of a single "handle" between multiple owners. More...
 
class  shared_library
 Load shared libraries into the current process for execution. More...
 
struct  stack_allocated
 Disable heap allocation and deallocation. More...
 
class  stack_frame
 Contains data about a single frame in a stack trace. More...
 
class  symbol
 A container for data about a single debugger symbol. More...
 
class  symbol_file_module
 Encapsulates a module (file) for the purpose of gathering debugging symbols. More...
 
class  symbol_view
 Exposes an executable image's debugging symbol data. More...
 
class  thread_info
 A container for a single thread of execution in a process. More...
 
class  unique_handle
 Uniquely manage a single "handle". More...
 
class  unique_handle< T, default_close_handle< T >, kInvalidHandle >
 Uniquely manage a single "handle" with (optimized for the default "deleter"). More...
 
class  unique_handle_impl
 Base unique_handle functionality common to all template specializations. More...
 

Typedefs

typedef DWORD error_t
 Container type for system error codes. More...
 
typedef std::uintptr_t address_t
 Container type for a memory address.
 
typedef std::ptrdiff_t integral_address_t
 A memory address as an integer type (platform specific).
 
typedef DWORD process_id_t
 Data-type that stores a process ID (PID).
 
typedef DWORD thread_id_t
 Data-type that stores a thread ID (TID).
 
typedef std::string tstring
 A std::string implementation based on the UNICODE macro. More...
 
using module_address_map = std::map< psystem::address_t, psystem::module_info, std::greater< psystem::address_t > >
 A mapping of module base-addresses to the psystem::module_info. More...
 

Enumerations

enum  log_level { log_level::none = 0, log_level::error = none | (1 << 0), log_level::info = error | (1 << 1), log_level::debug = error | (1 << 2) }
 Establish a list of possible logging detail levels. More...
 

Functions

void initialize_psystem ()
 Initialize any resources that the psystem functionality needs. More...
 

Variables

debug_help_dll DbgHelp
 The loaded instance of DbgHelp.dll.
 

Associated Free-functions

image_symbol_iterator operator+ (image_symbol_iterator const &it, size_t const count) noexcept
 Create a new iterator placed after it in the container. More...
 
image_symbol_iterator operator+ (size_t const count, image_symbol_iterator const &it) noexcept
 Create a new iterator placed after it in the container (using "n + this" syntax). More...
 

Detailed Description

Contains the process examination "system" and basic frameworks.

Author
Matt Bisson
Date
25 November, 2007
Since
PSystem 1.0
Version
PSystem 2.0
Todo:
Remove iostream when we have a logging facility.

Typedef Documentation

typedef DWORD psystem::error_t

Container type for system error codes.

Todo:
Use this in place of DWORD

A mapping of module base-addresses to the psystem::module_info.

This type maps key representing a shared library or executable image to the psystem object that encapsulates its information. Keys are ordered from largest to smallest so that std::lower_bound can easily determine where a symbol's address exist in terms of the loaded modules.

Author
Matt Bisson
Date
17 November, 2015
Since
PSystem 2.0
Version
PSystem 2.0
typedef std::string psystem::tstring

A std::string implementation based on the UNICODE macro.

The psystem framwork supports character access as both multi-byte and "wide" character. This must be selected at compile-time, by defining the UNICODE macro. For example, an executable compiled with UTF-16 string containers must still support UTF-8, but it will convert the data before doing anything with it.

Enumeration Type Documentation

enum psystem::log_level
strong

Establish a list of possible logging detail levels.

Todo:
Move logging into separate header

Each increasing log level implies that all lesser detail levels are also logged.

Enumerator
none 

Log nothing.

error 

Only log errors.

info 

Information logging as well as error.

debug 

In-depth debug logging.

Function Documentation

void psystem::initialize_psystem ( )

Initialize any resources that the psystem functionality needs.

This method should only be called once, before utilizing any functionality from the psystem namespace.

Exceptions
psystem::exception::system_exceptionif the DbgHelp DLL could not be loaded, or if it does not contain the required exported symbols.
psystem::exception::system_exceptionif the DbgHelp DLL is not a supported version.
Todo:
Better exception
Todo:
Better exception
image_symbol_iterator psystem::operator+ ( image_symbol_iterator const &  it,
size_t const  count 
)
noexcept

Create a new iterator placed after it in the container.

Parameters
[in]itThe iterator instance from which to offset.
[in]countThe number of positions to advance the resulting iterator relative to this one.
Returns
A new iterator at the desired position.
image_symbol_iterator psystem::operator+ ( size_t const  count,
image_symbol_iterator const &  it 
)
noexcept

Create a new iterator placed after it in the container (using "n + this" syntax).

Parameters
[in]itThe iterator instance from which to offset.
[in]countThe number of positions to advance the resulting iterator relative to this one.
Returns
A new iterator at the desired position.