This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 444396ee3780a7f534f4e5546822da97b704b8bd
Author: xuxingliang <[email protected]>
AuthorDate: Wed Aug 28 11:58:40 2024 +0800

    tools/gdb: use os.system to call readelf
    
    Some version of gdb does not support subprocess
    
    Signed-off-by: xuxingliang <[email protected]>
---
 tools/gdb/macros.py | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/tools/gdb/macros.py b/tools/gdb/macros.py
index 667b3db92e..9970c1150a 100644
--- a/tools/gdb/macros.py
+++ b/tools/gdb/macros.py
@@ -39,7 +39,6 @@
 
 import os
 import re
-import subprocess
 import time
 
 PUNCTUATORS = [
@@ -131,19 +130,7 @@ def fetch_macro_info(file):
     cache = os.path.splitext(file)[0] + ".macro"
     if not os.path.isfile(cache):
         start = time.time()
-        with open(cache, "w") as f:
-            # # 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 {}
+        os.system(f"readelf -wm {file} > {cache}")
         print(f"readelf took {time.time() - start:.1f} seconds")
 
     p = re.compile(".*macro[ ]*:[ ]*([\S]+\(.*?\)|[\w]+)[ ]*(.*)")

Reply via email to