Not sure if crash people subscribed to linux-debuggers, let's add more cc for awareness about this thread.
On Thu, 21 Sept 2023 at 01:45, Stephen Brennan <stephen.s.bren...@oracle.com> wrote: > > Stephen Brennan <stephen.s.bren...@oracle.com> writes: > > Hi Jon, > > > > Jon Doron <ari...@gmail.com> writes: > >> Hi Stephen, > >> Like you have said the reason is as I wrote in the commit message, > >> without "fixing" the vaddr GDB is messing up mapping and working with > >> the generated core file. > > > > For the record I totally love this workaround :) > > > > It's clever and gets the job done and I would have done it in a > > heartbeat. It's just that it does end up making vmcores that have > > incorrect data, which is a pain for debuggers that are actually designed > > to look at kernel core dumps. > > > >> This patch is almost 4 years old, perhaps some changes to GDB has been > >> introduced to resolve this, I have not checked since then. > > > > Program Headers: > > Type Offset VirtAddr PhysAddr > > FileSiz MemSiz Flags Align > > NOTE 0x0000000000000168 0x0000000000000000 0x0000000000000000 > > 0x0000000000001980 0x0000000000001980 0x0 > > LOAD 0x0000000000001ae8 0x0000000000000000 0x0000000000000000 > > 0x0000000080000000 0x0000000080000000 0x0 > > LOAD 0x0000000080001ae8 0x0000000000000000 0x00000000fffc0000 > > 0x0000000000040000 0x0000000000040000 0x0 > > > > (gdb) info files > > Local core dump file: > > `/home/stepbren/repos/test_code/elf/dumpfile', file type > > elf64-x86-64. > > 0x0000000000000000 - 0x0000000080000000 is load1 > > 0x0000000000000000 - 0x0000000000040000 is load2 > > > > $ gdb --version > > GNU gdb (GDB) Red Hat Enterprise Linux 10.2-10.0.2.el9 > > Copyright (C) 2021 Free Software Foundation, Inc. > > License GPLv3+: GNU GPL version 3 or later > > <http://gnu.org/licenses/gpl.html> > > This is free software: you are free to change and redistribute it. > > There is NO WARRANTY, to the extent permitted by law. > > > > > > It doesn't *look like* anything has changed in this version of GDB. But > > I'm not really certain that GDB is expected to use the physical > > addresses in the load segments: it's not a kernel debugger. > > > > I think hacking the p_vaddr field _is_ the way to get GDB to behave in > > the way you want: allow you to read physical memory addresses. > > > >> As I'm no longer using this feature and have not worked and tested it > >> in a long while, so I have no obligations to this change, but perhaps > >> someone else might be using it... > > > > I definitely think it's valuable for people to continue being able to > > use QEMU vmcores generated with paging=off in GDB, even if GDB isn't > > desgined for it. It seems like a useful hack that appeals to the lowest > > common denominator: most people have GDB and not a purpose-built kernel > > debugger. But maybe we could point to a program like the below that will > > tweak the p_paddr field after the fact, in order to appeal to GDB's > > sensibilities? > > And of course I sent the wrong copy of the file. Attached is the program > I intended to send (which properly handles endianness and sets the vaddr > as expected). >