ROSE  0.11.145.0
Public Types | Public Member Functions | List of all members
Rose::BinaryAnalysis::Demangler Class Reference

Description

Demangle mangled names.

Definition at line 10 of file Demangler.h.

#include <Rose/BinaryAnalysis/Demangler.h>

Public Types

typedef Sawyer::Container::Map< std::string, std::string > NameMap
 

Public Member Functions

void fillCache (const std::vector< std::string > &mangledNames)
 Demangle lots of names. More...
 
std::string demangle (const std::string &mangledName)
 Demangle one name. More...
 
void clear ()
 Clear the cache. More...
 
size_t size () const
 Number of items in the cache. More...
 
const NameMapallNames () const
 Map of all cached names. More...
 
void insert (const std::string &mangledName, const std::string &demangledName)
 Insert a mangled/demangled pair. More...
 
const boost::filesystem::path & cxxFiltExe () const
 Property: Name of c++filt program. More...
 
void cxxFiltExe (const boost::filesystem::path &p)
 Property: Name of c++filt program. More...
 
const std::string & compiler () const
 Property: Format of mangled names. More...
 
void compiler (const std::string &s)
 Property: Format of mangled names. More...
 

Member Function Documentation

const boost::filesystem::path& Rose::BinaryAnalysis::Demangler::cxxFiltExe ( ) const
inline

Property: Name of c++filt program.

This is the name of the c++filt command that gets run to convert mangled names to demangled names. If it's not an absolute name then the normal executable search is performed (i.e., $PATH variable).

Definition at line 26 of file Demangler.h.

void Rose::BinaryAnalysis::Demangler::cxxFiltExe ( const boost::filesystem::path &  p)
inline

Property: Name of c++filt program.

This is the name of the c++filt command that gets run to convert mangled names to demangled names. If it's not an absolute name then the normal executable search is performed (i.e., $PATH variable).

Definition at line 27 of file Demangler.h.

const std::string& Rose::BinaryAnalysis::Demangler::compiler ( ) const
inline

Property: Format of mangled names.

Each compiler has slightly different rules for how names are mangled. This property controls the format and should be one of the following strings:

  • "auto" (or empty string): automatic selection based on c++filt executable (this is the default).
  • "gnu": format used by GNU C++ compiler (g++).
  • "lucid": format used by the Lucid compiler (lcc).
  • "arm": format used by the C++ Annotated Reference Manual.
  • "hp": format used by the HP compiler (aCC).
  • "edg": format used by EDG-based compilers.
  • "gnu-v3": format used by the GNU C++ compiler (g++) with the V3 ABI.
  • "java": format used by the GNU Java compiler (gcj).
  • "gnat": format used by the GNU Ada compiler (GNAT).

ROSE itself does not check these strings, so if your c++filt supports other values for its "-s" switch they will work.

Definition at line 48 of file Demangler.h.

void Rose::BinaryAnalysis::Demangler::compiler ( const std::string &  s)
inline

Property: Format of mangled names.

Each compiler has slightly different rules for how names are mangled. This property controls the format and should be one of the following strings:

  • "auto" (or empty string): automatic selection based on c++filt executable (this is the default).
  • "gnu": format used by GNU C++ compiler (g++).
  • "lucid": format used by the Lucid compiler (lcc).
  • "arm": format used by the C++ Annotated Reference Manual.
  • "hp": format used by the HP compiler (aCC).
  • "edg": format used by EDG-based compilers.
  • "gnu-v3": format used by the GNU C++ compiler (g++) with the V3 ABI.
  • "java": format used by the GNU Java compiler (gcj).
  • "gnat": format used by the GNU Ada compiler (GNAT).

ROSE itself does not check these strings, so if your c++filt supports other values for its "-s" switch they will work.

Definition at line 49 of file Demangler.h.

void Rose::BinaryAnalysis::Demangler::fillCache ( const std::vector< std::string > &  mangledNames)

Demangle lots of names.

The most efficient way to invoke this analyzer is to provide it with as many names as possible. It will send them all to the c++filt program (cxxFiltExe property) all at once and cache the results to query later.

std::string Rose::BinaryAnalysis::Demangler::demangle ( const std::string &  mangledName)

Demangle one name.

If the name is already cached, then return the cached value. Otherwise invoke c++filt to demangle this one name and cache the result. A name that cannot be demangled is returned in its original form.

It is not efficient to fill the cache one name at a time; use fillCache first if possible, and then call this function to retrieve the results.

void Rose::BinaryAnalysis::Demangler::clear ( )
inline

Clear the cache.

Definition at line 68 of file Demangler.h.

References Sawyer::Container::Map< K, T, Cmp, Alloc >::clear().

size_t Rose::BinaryAnalysis::Demangler::size ( ) const
inline

Number of items in the cache.

Definition at line 71 of file Demangler.h.

References Sawyer::Container::Map< K, T, Cmp, Alloc >::size().

const NameMap& Rose::BinaryAnalysis::Demangler::allNames ( ) const
inline

Map of all cached names.

Definition at line 74 of file Demangler.h.

void Rose::BinaryAnalysis::Demangler::insert ( const std::string &  mangledName,
const std::string &  demangledName 
)

Insert a mangled/demangled pair.

Adds (or modifies) the mangled/demangled pair to the cache.


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