Classes | Public Types | Public Member Functions | List of all members
crashpad::MachOImageSymbolTableReader Class Reference

A reader for symbol tables in Mach-O images mapped into another process. More...

#include "snapshot/mac/mach_o_image_symbol_table_reader.h"


struct  SymbolInformation
 Information about a symbol in a module’s symbol table. More...

Public Types

using SymbolInformationMap = std::map< std::string, SymbolInformation >

Public Member Functions

bool Initialize (ProcessReaderMac *process_reader, const process_types::symtab_command *symtab_command, const process_types::dysymtab_command *dysymtab_command, const MachOImageSegmentReader *linkedit_segment, const std::string &module_info)
 Reads the symbol table from another process. More...
const SymbolInformationLookUpExternalDefinedSymbol (const std::string &name) const
 Looks up a symbol in the image’s symbol table. More...

Detailed Description

A reader for symbol tables in Mach-O images mapped into another process.

Member Function Documentation

◆ Initialize()

bool crashpad::MachOImageSymbolTableReader::Initialize ( ProcessReaderMac process_reader,
const process_types::symtab_command *  symtab_command,
const process_types::dysymtab_command *  dysymtab_command,
const MachOImageSegmentReader linkedit_segment,
const std::string &  module_info 

Reads the symbol table from another process.

This method must only be called once on an object. This method must be called successfully before any other method in this class may be called.

[in]process_readerThe reader for the remote process.
[in]symtab_commandThe LC_SYMTAB load command that identifies the symbol table.
[in]dysymtab_commandThe LC_DYSYMTAB load command that identifies dynamic symbol information within the symbol table. This load command is not present in all modules, and this parameter may be nullptr for modules that do not have this information. When present, dysymtab_command is an optimization that allows the symbol table reader to only examine symbol table entries known to be relevant for its purposes.
[in]linkedit_segmentThe __LINKEDIT segment. This segment should contain the data referenced by symtab_command and dysymtab_command. This may be any segment in the module, but by convention, the name __LINKEDIT is used for this purpose.
[in]module_infoA string to be used in logged messages. This string is for diagnostic purposes only, and may be empty.
true if the symbol table was read successfully. false otherwise, with an appropriate message logged.

◆ LookUpExternalDefinedSymbol()

const MachOImageSymbolTableReader::SymbolInformation * crashpad::MachOImageSymbolTableReader::LookUpExternalDefinedSymbol ( const std::string &  name) const

Looks up a symbol in the image’s symbol table.

The returned information captures the symbol as it exists in the image’s symbol table, not adjusted for any “slide.”

[in]nameThe name of the symbol to look up, “mangled” or “decorated” appropriately. For example, use "_main" to look up the symbol for the C main() function, and use "__Z4Funcv" to look up the symbol for the C++ Func() function.
A SymbolInformation* object with information about the symbol if it was found, or nullptr if the symbol was not found or if an error occurred. On error, a warning message will also be logged. The caller does not take ownership; the lifetime of the returned object is scoped to the lifetime of this MachOImageSymbolTableReader object.
Symbol values returned via this interface are not adjusted for “slide.” For slide-adjusted values, use the higher-level MachOImageReader::LookUpExternalDefinedSymbol() interface.

The documentation for this class was generated from the following files: