From: "H.J. Lu" <hjl.tools@gmail.com>
To: Pedro Alves <palves@redhat.com>
Cc: GDB <gdb-patches@sourceware.org>
Subject: Re: PATCH: PR gdb/13969: GDBserver doesn't check unsupported binary
Date: Thu, 12 Apr 2012 15:58:00 -0000 [thread overview]
Message-ID: <CAMe9rOpYBe62K_0X3mFMYiQOC0dQLT9yf5TBNgEqiQUifQgdyQ@mail.gmail.com> (raw)
In-Reply-To: <4F86D411.4000100@redhat.com>
On Thu, Apr 12, 2012 at 6:09 AM, Pedro Alves <palves@redhat.com> wrote:
> On 04/11/2012 08:16 PM, H.J. Lu wrote:
>
>> 2012-04-11 H.J. Lu <hongjiu.lu@intel.com>
>>
>> PR gdb/13969
>> * linux-low.c (linux_pid_exe_is_elf_64_file): Also return the
>> e_machine field.
>> (linux_qxfer_libraries_svr4): Update call to elf_64_file_p.
>>
>> * linux-low.h (linux_pid_exe_is_elf_64_file): Updated.
>>
>> * linux-x86-low.c (linux_is_64bit): New.
>
>
> I don't see a new linux_is_64bit symbol in the patch.
Removed.
>> (x86_arch_setup): Check if GDBserver is compatible with
>> process.
>
>
> These all all logically related changes. Please drop the empty lines.
Done.
>
>> --- a/gdb/gdbserver/linux-x86-low.c
>
>> +++ b/gdb/gdbserver/linux-x86-low.c
>> @@ -1106,17 +1106,28 @@ x86_linux_process_qsupported (const char *query)
>> static void
>> x86_arch_setup (void)
>> {
>> -#ifdef __x86_64__
>> int pid = pid_of (get_thread_lwp (current_inferior));
>> - int use_64bit = linux_pid_exe_is_elf_64_file (pid);
>> + unsigned int machine;
>> + int use_64bit = linux_pid_exe_is_elf_64_file (pid, &machine);
>>
>> + if (sizeof (void *) == 4)
>> + {
>> + if (use_64bit > 0)
>> + error (_("Can't debug 64-bit process with 32-bit GDBserver"));
>> +#ifndef __x86_64__
>> + else if (machine == EM_X86_64)
>> + error (_("Can't debug x86-64 process with 32-bit GDBserver"));
>> +#endif
>> + }
>> +
>> +#ifdef __x86_64__
>> if (use_64bit < 0)
>
>
> Please rename use_64bit to something like is_elf64. The code reads
> now a bit confusingly with "use_64bit". Okay with that change,
> and the ChangeLog entry fixed.
Done. I checked in the updated patch.
> I assume there's no kernel limitation that would prevent a x32
> gdbserver from debugging a 64-bit process?
>
It doesn't work since x32 is a 32-bit process. Although x32
GDBserver can get registers of 64-bit process, it can't handle
64-bit address in 64b-bit process, like setting break points.
--
H.J.
next prev parent reply other threads:[~2012-04-12 15:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-11 20:36 H.J. Lu
2012-04-12 13:52 ` Pedro Alves
2012-04-12 15:58 ` H.J. Lu [this message]
2012-04-12 16:01 ` Pedro Alves
2012-04-12 16:38 ` H.J. Lu
2012-04-12 16:45 ` Pedro Alves
2012-04-12 16:53 ` H.J. Lu
2012-04-12 17:20 ` Pedro Alves
2012-04-12 18:05 ` H.J. Lu
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=CAMe9rOpYBe62K_0X3mFMYiQOC0dQLT9yf5TBNgEqiQUifQgdyQ@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.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