linux-debuggers.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: Stephen Brennan <stephen.s.brennan@oracle.com>
Cc: "Jon Doron" <arilou@gmail.com>,
	qemu-devel@nongnu.org, linux-debuggers@vger.kernel.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Laszlo Ersek" <lersek@redhat.com>,
	"Discussion list for crash utility usage,
	maintenance and development" <crash-utility@redhat.com>,
	"Lianbo Jiang" <lijiang@redhat.com>,
	"HAGIO KAZUHITO(萩尾 一仁)" <k-hagio-ab@nec.com>
Subject: Re: Concerns regarding e17bebd049 ("dump: Set correct vaddr for ELF dump")
Date: Fri, 22 Sep 2023 11:06:01 +0800	[thread overview]
Message-ID: <CALu+AoTJXtnS8dV-uL_Ov0CEYq1YTX7KTuOSwFdo+1tNB8hqJw@mail.gmail.com> (raw)
In-Reply-To: <87bkdwyc3v.fsf@oracle.com>

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.brennan@oracle.com> wrote:
>
> Stephen Brennan <stephen.s.brennan@oracle.com> writes:
> > Hi Jon,
> >
> > Jon Doron <arilou@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).
>


  reply	other threads:[~2023-09-22  3:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-19 17:39 Concerns regarding e17bebd049 ("dump: Set correct vaddr for ELF dump") Stephen Brennan
2023-09-20  7:49 ` Jon Doron
2023-09-20 17:35   ` Stephen Brennan
2023-09-20 17:43     ` Stephen Brennan
2023-09-22  3:06       ` Dave Young [this message]
2023-09-21  7:49     ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALu+AoTJXtnS8dV-uL_Ov0CEYq1YTX7KTuOSwFdo+1tNB8hqJw@mail.gmail.com \
    --to=dyoung@redhat.com \
    --cc=arilou@gmail.com \
    --cc=crash-utility@redhat.com \
    --cc=k-hagio-ab@nec.com \
    --cc=lersek@redhat.com \
    --cc=lijiang@redhat.com \
    --cc=linux-debuggers@vger.kernel.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stephen.s.brennan@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).