@@ -216,20 +216,19 @@ class so_file_parser_t( formated_mapping_parser_t ):
216
216
"""parser for Linux .so file"""
217
217
nm_executable = 'nm'
218
218
#numeric-sort used for mapping between mangled and unmangled name
219
- cmd_mangled = '%(nm)s --extern-only --dynamic --defined-only --numeric-sort %(lib)s'
220
- cmd_demangled = '%(nm)s --extern-only --dynamic --defined-only --demangle --numeric-sort %(lib)s'
219
+ cmd_mangled = '%(nm)s --extern-only --dynamic --defined-only --numeric-sort %(lib)s' .split ()
220
+ cmd_demangled = '%(nm)s --extern-only --dynamic --defined-only --demangle --numeric-sort %(lib)s' .split ()
221
+
221
222
entry = re .compile ( r'^(?P<address>(?:\w|\d)+)\s\w\s(?P<symbol>.+)$' )
222
223
223
224
def __init__ ( self , global_ns , binary_file ):
224
225
formated_mapping_parser_t .__init__ ( self , global_ns , binary_file , 'nm' )
225
226
226
227
def __execute_nm ( self , cmd ):
227
228
process = subprocess .Popen ( args = cmd
228
- , shell = True
229
229
, stdin = subprocess .PIPE
230
230
, stdout = subprocess .PIPE
231
- , stderr = subprocess .STDOUT
232
- , cwd = os .path .dirname ( self .binary_file ) )
231
+ , stderr = subprocess .STDOUT )
233
232
process .stdin .close ()
234
233
235
234
output = []
@@ -254,8 +253,9 @@ def __extract_symbols( self, cmd ):
254
253
255
254
def load_symbols ( self ):
256
255
tmpl_args = dict ( nm = self .nm_executable , lib = self .binary_file )
257
- mangled_smbls = self .__extract_symbols ( self .cmd_mangled % tmpl_args )
258
- demangled_smbls = self .__extract_symbols ( self .cmd_demangled % tmpl_args )
256
+ mangled_smbls = self .__extract_symbols ( [part % tmpl_args for part in self .cmd_mangled ] )
257
+ demangled_smbls = self .__extract_symbols ( [part % tmpl_args for part in self .cmd_demangled ] )
258
+
259
259
result = []
260
260
for address , blob in mangled_smbls .iteritems ():
261
261
if address in demangled_smbls :
0 commit comments