qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH] linux-user: Support gdb 'qOffsets' query for


From: Josh Kunz
Subject: Re: [Qemu-trivial] [PATCH] linux-user: Support gdb 'qOffsets' query for ELF
Date: Fri, 16 Aug 2019 16:36:36 -0700

+cc: address@hidden, I typoed the email on the first go.

On Fri, Aug 16, 2019 at 4:34 PM Josh Kunz <address@hidden> wrote:
This is needed to support debugging PIE ELF binaries running under QEMU
user mode. Currently, `code_offset` and `data_offset` remain unset for
all ELF binaries, so GDB is unable to correctly locate the position of
the binary's text and data.

The fields `code_offset`, and `data_offset` were originally added way
back in 2006 to support debugging of bFMT executables (978efd6aac6),
and support was just never added for ELF. Since non-PIE binaries are
loaded at exactly the address specified in the binary, GDB does not need
to relocate any symbols, so the buggy behavior is not normally observed.

Buglink: https://bugs.launchpad.net/qemu/+bug/1528239
Signed-off-by: Josh Kunz <address@hidden>
---
 linux-user/elfload.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 3365e192eb..ceac035208 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2380,6 +2380,8 @@ static void load_elf_image(const char *image_name, int image_fd,
     }

     info->load_bias = load_bias;
+    info->code_offset = load_bias;
+    info->data_offset = load_bias;
     info->load_addr = load_addr;
     info->entry = ehdr->e_entry + load_bias;
     info->start_code = -1;
--
2.23.0.rc1.153.gdeed80330f-goog


reply via email to

[Prev in Thread] Current Thread [Next in Thread]