mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
tools/gdb: use os.system to call readelf
Some version of gdb does not support subprocess Signed-off-by: xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
+1
-14
@@ -39,7 +39,6 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
PUNCTUATORS = [
|
PUNCTUATORS = [
|
||||||
@@ -131,19 +130,7 @@ def fetch_macro_info(file):
|
|||||||
cache = os.path.splitext(file)[0] + ".macro"
|
cache = os.path.splitext(file)[0] + ".macro"
|
||||||
if not os.path.isfile(cache):
|
if not os.path.isfile(cache):
|
||||||
start = time.time()
|
start = time.time()
|
||||||
with open(cache, "w") as f:
|
os.system(f"readelf -wm {file} > {cache}")
|
||||||
# # os.system(f"readelf -wm {file} > {output}")
|
|
||||||
process = subprocess.Popen(
|
|
||||||
f"readelf -wm {file}", shell=True, stdout=f, stderr=subprocess.STDOUT
|
|
||||||
)
|
|
||||||
|
|
||||||
process.communicate()
|
|
||||||
errcode = process.returncode
|
|
||||||
|
|
||||||
f.close()
|
|
||||||
|
|
||||||
if errcode != 0:
|
|
||||||
return {}
|
|
||||||
print(f"readelf took {time.time() - start:.1f} seconds")
|
print(f"readelf took {time.time() - start:.1f} seconds")
|
||||||
|
|
||||||
p = re.compile(".*macro[ ]*:[ ]*([\S]+\(.*?\)|[\w]+)[ ]*(.*)")
|
p = re.compile(".*macro[ ]*:[ ]*([\S]+\(.*?\)|[\w]+)[ ]*(.*)")
|
||||||
|
|||||||
Reference in New Issue
Block a user