Skip to contentSkip to conversation

Minor fixes for the Python GDB plugins

PATCH In review David Edmondson 2 participants 5 messages Feb 21, 2022 – Mar 29, 2022

lore
Share & tools
lore
#0 lore raw

cover Minor fixes for the Python GDB plugins

In attempting to use the Python GDB plugins a couple of problems were encountered.

David Edmondson (2):
scripts/qemu-gdb/mtree.py: Int128 are decimal rather than hex scripts/qemu-gdb/timers.py: the 'last' attribute is no more

 scripts/qemugdb/mtree.py  | 2 +-
 scripts/qemugdb/timers.py | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 scripts/qemu-gdb/mtree.py: Int128 are decimal rather than hex

When parsing QEMU's native Int128 type, do not attempt to convert from hexadecimal.

Fixes 8037fa55ac ("scripts/qemugdb/mtree.py: fix up mtree dump")
---
 scripts/qemugdb/mtree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qemugdb/mtree.py +1 -1
index 8fe42c3c12..c1557d44fa 100644
@@ -25,7 +25,7 @@ def int128(p):
     if p.type.code == gdb.TYPE_CODE_STRUCT:
         return int(p['lo']) + (int(p['hi']) << 64)
     else:
-        return int(("%s" % p), 16)
+        return int("%s" % p)
 
 class MtreeCommand(gdb.Command):
     '''Display the memory tree hierarchy'''
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/2] scripts/qemu-gdb/mtree.py: Int128 are decimal rather than hex

Ping?

Quoted 14 lines · David Edmondson

When parsing QEMU's native Int128 type, do not attempt to convert from hexadecimal.

Fixes 8037fa55ac ("scripts/qemugdb/mtree.py: fix up mtree dump")
---
 scripts/qemugdb/mtree.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/qemugdb/mtree.py +0 -0
index 8fe42c3c12..c1557d44fa 100644

scripts/qemugdb/mtree.py def int128(p): · line 31

Quoted 8 lines
scripts/qemugdb/mtree.py +1 -1
@@ -25,7 +25,7 @@ def int128(p):
     if p.type.code == gdb.TYPE_CODE_STRUCT:
         return int(p['lo']) + (int(p['hi']) << 64)
     else:
-        return int(("%s" % p), 16)
+        return int("%s" % p)
 
 class MtreeCommand(gdb.Command):
     '''Display the memory tree hierarchy'''

dme.

Signature · 1 line
The band is just fantastic, that is really what I think.
#3 lore raw

PATCH 2/2 scripts/qemu-gdb/timers.py: the 'last' attribute is no more

In reply to David Edmondson

The 'last' member of QEMUClock was removed some time ago, but the python gdb helper did not notice.

Fixes 3c2d4c8aa6 ("timer: last, remove last bits of last")
---
 scripts/qemugdb/timers.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
scripts/qemugdb/timers.py +2 -3
index 46537b27cf..0538677288 100644
@@ -37,10 +37,9 @@ def dump_timers(self, timer):
 
     def process_timerlist(self, tlist, ttype):
         gdb.write("Processing %s timers\n" % (ttype))
-        gdb.write("  clock %s is enabled:%s, last:%s\n" % (
+        gdb.write("  clock %s is enabled:%s\n" % (
             tlist['clock']['type'],
-            tlist['clock']['enabled'],
-            tlist['clock']['last']))
+            tlist['clock']['enabled']))
         if int(tlist['active_timers']) > 0:
             self.dump_timers(tlist['active_timers'])
 
Signature · 1 line
2.34.1
Reviewed-by on v1 2/2
#4 lore raw

Re: [PATCH 2/2] scripts/qemu-gdb/timers.py: the 'last' attribute is no more

Quoted 8 lines · David Edmondson

The 'last' member of QEMUClock was removed some time ago, but the python gdb helper did not notice.

Fixes 3c2d4c8aa6 ("timer: last, remove last bits of last")
---
  scripts/qemugdb/timers.py | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)

Ouch, 2+ years.