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 <aburgess@redhat.com>
PR testsuite/33728
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33728
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
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):