@@ -390,28 +390,36 @@ def llvm_nm_multiple(files):
390
390
# for each individual file.
391
391
392
392
filename = llvm_nm_files [0 ]
393
- file_start = 0
394
- i = 0
395
-
396
- while True :
397
- nl = results .find ('\n ' , i )
398
- if nl < 0 :
399
- break
400
- colon = results .rfind (':' , i , nl )
401
- if colon >= 0 and results [colon + 1 ] == '\n ' : # New file start?
402
- nm_cache [filename ] = parse_symbols (results [file_start :i - 1 ])
403
- filename = results [i :colon ].strip ()
404
- file_start = colon + 2
405
- i = nl + 1
406
-
407
- nm_cache [filename ] = parse_symbols (results [file_start :])
393
+
394
+ # When we dispatched more than one file, we must manually parse
395
+ # the file result delimiters (like shown structured above)
396
+ if len (llvm_nm_files ) > 1 :
397
+ file_start = 0
398
+ i = 0
399
+
400
+ while True :
401
+ nl = results .find ('\n ' , i )
402
+ if nl < 0 :
403
+ break
404
+ colon = results .rfind (':' , i , nl )
405
+ if colon >= 0 and results [colon + 1 ] == '\n ' : # New file start?
406
+ nm_cache [filename ] = parse_symbols (results [file_start :i - 1 ])
407
+ filename = results [i :colon ].strip ()
408
+ file_start = colon + 2
409
+ i = nl + 1
410
+
411
+ nm_cache [filename ] = parse_symbols (results [file_start :])
412
+ else :
413
+ # We only dispatched a single file, we can just parse that directly
414
+ # to the output.
415
+ nm_cache [filename ] = parse_symbols (results )
408
416
409
417
# Any files that failed llvm-nm (e.g. they did not have any
410
418
# symbols) will be not present in the above, so fill in dummies
411
419
# for those.
412
420
for f in files :
413
421
if f not in nm_cache :
414
- nm_cache [f ] = ObjectFileInfo ( 1 , '' )
422
+ nm_cache [f ] = llvm_nm ( f )
415
423
416
424
return [nm_cache [f ] for f in files ]
417
425
0 commit comments