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 96a518af35401f86a9a42c0f2c6d90bfeb11ddee
Author: xuxingliang <[email protected]>
AuthorDate: Mon Sep 23 11:01:06 2024 +0800

    tools/gdb: fix elf file with special character
    
    Make sure file name is surrounded by \"
    
    Signed-off-by: xuxingliang <[email protected]>
---
 tools/gdb/nuttxgdb/gcore.py  | 4 ++--
 tools/gdb/nuttxgdb/macros.py | 2 +-
 tools/gdb/nuttxgdb/utils.py  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/gdb/nuttxgdb/gcore.py b/tools/gdb/nuttxgdb/gcore.py
index f15a436b1a..532d6da7c1 100644
--- a/tools/gdb/nuttxgdb/gcore.py
+++ b/tools/gdb/nuttxgdb/gcore.py
@@ -129,8 +129,8 @@ class NXGcore(gdb.Command):
             os.remove(section)
 
         gdb.execute(f"file {tmpfile.name}")
-        gdb.execute(f"gcore {corefile}")
-        gdb.execute(f"file {elffile}")
+        gdb.execute(f'gcore "{corefile}"')
+        gdb.execute(f'file "{elffile}"')
         tmpfile.close()
 
         print(f"Please run gdbserver.py to parse {corefile}")
diff --git a/tools/gdb/nuttxgdb/macros.py b/tools/gdb/nuttxgdb/macros.py
index 6ce8f917fe..bf7b960eb3 100644
--- a/tools/gdb/nuttxgdb/macros.py
+++ b/tools/gdb/nuttxgdb/macros.py
@@ -135,7 +135,7 @@ def fetch_macro_info(file):
     cache = path.join(path.dirname(path.abspath(file)), f"{hash}.macro")
     if not path.isfile(cache):
         start = time.time()
-        os.system(f"readelf -wm {file} > {cache}")
+        os.system(f'readelf -wm "{file}" > "{cache}"')
         print(f"readelf took {time.time() - start:.1f} seconds")
         print(f"Cache macro info to {cache}")
     else:
diff --git a/tools/gdb/nuttxgdb/utils.py b/tools/gdb/nuttxgdb/utils.py
index 985c89d0b4..740012e535 100644
--- a/tools/gdb/nuttxgdb/utils.py
+++ b/tools/gdb/nuttxgdb/utils.py
@@ -196,7 +196,7 @@ def get_symbol_value(name, locspec="nx_start", 
cacheable=True):
     # in order to use the list command to set the scope.
     if len(gdb.inferiors()) == 1:
         gdb.execute(
-            f"add-inferior -exec {gdb.objfiles()[0].filename} -no-connection",
+            f'add-inferior -exec "{gdb.objfiles()[0].filename}" 
-no-connection',
             to_string=True,
         )
         g_symbol_cache = {}

Reply via email to