pygccxml.binary_parsers API¶
Overview¶
contains classes that allows to extract different information from binary files ( .map, .dll, .so ) and integrate it with existing declarations tree
The main function of this package is
pygccxml.binary_parsers.parsers.merge_information()
.
-
pygccxml.binary_parsers.
format_decl
(decl, hint=None)¶ returns string, that represents formatted declaration, according to some rules :param hint: valid values are: “msvc” and “nm”
-
pygccxml.binary_parsers.
undecorate_blob
(blob)¶ Returns undecorated/unmangled string, created from blob(exported symbol name)
Modules¶
parsers¶
defines few simple classes( parsers ), which deals with .dll, .map, .so files.
Those classes extract decoratedmangled names from the files. Later the extracted symbols are used for:
- building “dynamic library” public interface
- extracting function calling convention
-
class
pygccxml.binary_parsers.parsers.
dll_file_parser_t
(global_ns, map_file_path)¶ Bases:
pygccxml.binary_parsers.parsers.formated_mapping_parser_t
parser for Windows .dll file
-
load_symbols
()¶
-
merge
(smbl)¶
-
-
class
pygccxml.binary_parsers.parsers.
dylib_file_parser_t
(global_ns, binary_file)¶ Bases:
pygccxml.binary_parsers.parsers.formated_mapping_parser_t
parser for Darwin .dylib file
-
cmd_demangled
= ['-c', '%(nm)s -gfUn %(lib)s | sed "s/ _/ /" | c++filt']¶
-
cmd_mangled
= ['-c', '%(nm)s -gfUn %(lib)s | sed "s/ _/ /"']¶
-
entry
= <_sre.SRE_Pattern object>¶
-
load_symbols
()¶
-
merge
(smbl)¶
-
nm_executable
= 'nm'¶
-
-
class
pygccxml.binary_parsers.parsers.
formated_mapping_parser_t
(global_ns, binary_file, hint)¶ Bases:
pygccxml.binary_parsers.parsers.libparser_t
convenience class, which formats existing declarations
-
formated_decls
¶
-
formatter
(decl, hint)¶
-
-
class
pygccxml.binary_parsers.parsers.
libparser_t
(global_ns, binary_file)¶ Bases:
object
base class for .dll, .map, .so parser classes
-
binary_file
¶ binary file path
-
global_ns
¶ reference to global namespace
-
load_symbols
()¶ loads public( shared ) symbols from the binary file.
This method should be overridden in the derived classes.
-
loaded_symbols
¶ list of symbols, which were loaded from the binary file. The actual type of return value defined by the derived class
-
merge
(symbol)¶ extracts and merges information from the symbol to the declarations tree.
This method should be overridden in the derived classes.
-
parse
()¶ the main method of the class
loads information from the binary file and merges it into the declarations tree.
The return value of the function is dictionary, where the key is decorated/mangled declaration name and the value is a declaration.
-
-
class
pygccxml.binary_parsers.parsers.
map_file_parser_t
(global_ns, map_file_path)¶ Bases:
pygccxml.binary_parsers.parsers.formated_mapping_parser_t
parser for MSVC .map file
-
c_entry
= <_sre.SRE_Pattern object>¶
-
cpp_entry
= <_sre.SRE_Pattern object>¶
-
load_symbols
()¶ returns dictionary { decorated symbol : original declaration name }
-
merge
(smbl)¶
-
-
pygccxml.binary_parsers.parsers.
merge_information
(global_ns, fname, runs_under_unittest=False)¶ high level function - select the appropriate binary file parser and integrates the information from the file to the declarations tree.
-
class
pygccxml.binary_parsers.parsers.
so_file_parser_t
(global_ns, binary_file)¶ Bases:
pygccxml.binary_parsers.parsers.formated_mapping_parser_t
parser for Linux .so file
-
cmd_demangled
= ['%(nm)s', '--extern-only', '--dynamic', '--defined-only', '--demangle', '--numeric-sort', '%(lib)s']¶
-
cmd_mangled
= ['%(nm)s', '--extern-only', '--dynamic', '--defined-only', '--numeric-sort', '%(lib)s']¶
-
entry
= <_sre.SRE_Pattern object>¶
-
load_symbols
()¶
-
merge
(smbl)¶
-
nm_executable
= 'nm'¶
-