This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR gdb/13969: GDBserver doesn't check unsupported binary


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.

> 	(x86_arch_setup): Check if GDBserver is compatible with
> 	process.


These all all logically related changes.  Please drop the empty lines.


> --- 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.

I assume there's no kernel limitation that would prevent a x32
gdbserver from debugging a 64-bit process?

-- 
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]