From: Tom de Vries Date: Mon, 5 Jan 2026 20:56:55 +0000 (+0100) Subject: [gdb/testsuite] Fix gdb.python/py-corefile.py with m32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d1314ef9595d6d423c897408debdbebf056000a;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Fix gdb.python/py-corefile.py with m32 With target board unix/-m32 and test-case gdb.python/py-corefile.exp I run into: ... FAIL: $exp: test mapped files data: diff input and output one ... due to differences like 0x0000000008048000 vs 0x08048000. Fix this in gdb.python/py-corefile.py by detecting and handling the ptr_size == 4 case. Tested on x86_64-linux. Approved-By: Andrew Burgess PR testsuite/33728 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33728 --- diff --git a/gdb/testsuite/gdb.python/py-corefile.py b/gdb/testsuite/gdb.python/py-corefile.py index 421f42d5630..43b64085117 100644 --- a/gdb/testsuite/gdb.python/py-corefile.py +++ b/gdb/testsuite/gdb.python/py-corefile.py @@ -41,9 +41,14 @@ class Mapping: def info_proc_mappings(): + ptr_size = gdb.lookup_type("void").pointer().sizeof + print("Mapped address spaces:") print("") - format_str = "%-18s %-18s %-18s %-18s %s " + if ptr_size == 4: + format_str = "%-10s %-10s %-10s %-10s %s " + else: + format_str = "%-18s %-18s %-18s %-18s %s " print(format_str % ("Start Addr", "End Addr", "Size", "Offset", "File")) core = gdb.selected_inferior().corefile @@ -57,16 +62,23 @@ def info_proc_mappings(): result.sort(key=lambda x: x.start) for r in result: sz = r.end - r.start - print( - format_str - % ( + if ptr_size == 4: + t = ( + "0x%08x" % r.start, + "0x%08x" % r.end, + "0x%-8x" % sz, + "0x%-8x" % r.offset, + "%s" % r.filename, + ) + else: + t = ( "0x%016x" % r.start, "0x%016x" % r.end, "0x%-16x" % sz, "0x%-16x" % r.offset, "%s" % r.filename, ) - ) + print(format_str % t) class InfoProcPyMappings(gdb.Command):