Skip to content

Commit f135704

Browse files
author
roman_yakovenko
committed
adding documentation
1 parent d89cc32 commit f135704

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

pygccxml/binary_parsers/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@
66
"""
77
contains classes that allows to extract different information from binary files
88
( .pdb, .map, .dll, .bsc, .so ) and integrate it with existing declarations tree
9+
10+
The main function of this package is "merge_information"
911
"""
1012

1113
import undname
1214
from parsers import merge_information
1315

1416
def undecorate_blob( blob ):
15-
"""returns undecorated\unmangled string, created from blob"""
17+
"""returns undecorated\unmangled string, created from blob(exported symbol name)"""
1618
return undname.undname_creator_t().undecorate_blob( blob )
1719

1820
def format_decl( decl, hint=None ):
19-
"""returns string, that represents formatted decl, according to some rules"""
21+
"""returns string, that represents formatted declaration, according to some rules
22+
hint valid values are: "msvc" and "nm"
23+
"""
2024
return undname.undname_creator_t().format_decl( decl, hint=hint )

pygccxml/binary_parsers/parsers.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
"""
88
defines few simple classes( parsers ), which deals with .dll, .map, .so files.
99
10-
Those classes extract decorated\mangled names from the files. Later, they undecorate
11-
the name and extract the functions calling convention.
10+
Those classes extract decorated\mangled names from the files. Later the extracted
11+
symbols are used for:
12+
* building "dynamic library" public interface
13+
* extracting function calling convention
1214
"""
1315

1416
import os
@@ -80,13 +82,13 @@ def merge( self, symbol):
8082
raise NotImplementedError()
8183

8284
def parse( self ):
83-
"""main class method
85+
"""the main method of the class
8486
8587
loads information from the binary file and merges it into the declarations
8688
tree.
8789
88-
The return value of the function is dictionary, where key is decorated
89-
declaration name and value is a declaration.
90+
The return value of the function is dictionary, where the key is
91+
decorated/mangled declaration name and the value is a declaration.
9092
"""
9193
self.__loaded_symbols = self.load_symbols()
9294
result = {}
@@ -103,7 +105,7 @@ def parse( self ):
103105
CCTS = declarations.CALLING_CONVENTION_TYPES
104106

105107
class formated_mapping_parser_t( libparser_t ):
106-
"""base parser class for few MSVC binary files"""
108+
"""convenience class, which formats existing declarations"""
107109
def __init__( self, global_ns, binary_file, hint ):
108110
libparser_t.__init__( self, global_ns, binary_file )
109111
self.__formated_decls = {}
@@ -209,6 +211,7 @@ def merge( self, smbl ):
209211

210212

211213
class so_file_parser_t( formated_mapping_parser_t ):
214+
"""parser for Linux .so file"""
212215
nm_executable = 'nm'
213216
#numeric-sort used for mapping between mangled and unmangled name
214217
cmd_mangled = '%(nm)s --extern-only --dynamic --defined-only --numeric-sort %(lib)s'

pygccxml/binary_parsers/undname.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ class UNDECORATE_NAME_OPTIONS:
5858
SHORT_UNIQUE_NAME = UNDNAME_NO_MS_KEYWORDS | UNDNAME_NO_ACCESS_SPECIFIERS | UNDNAME_NO_ECSU
5959

6060
class undname_creator_t:
61-
"""formats declarations string representation and exported symbols, so they
61+
"""implementation details - should not be used directly
62+
63+
formats declarations string representation and exported symbols, so they
6264
could be matched later.
6365
6466
The class formats variables, free and member functions, symbols exported from

0 commit comments

Comments
 (0)