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: Convert siginfo for x32 in gdbserver


On 04/12/2012 09:25 PM, H.J. Lu wrote:

> +/* Is this process 64-bit?  */
> +static int linux_is_elf64;
>  #endif /* __x86_64__ */
>  
>  /* Convert a native/host siginfo object, into/from the siginfo in the
> @@ -934,6 +1111,21 @@ x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
>  
>        return 1;
>      }
> +  /* No fixup for native x32 GDB.  */
> +  else if (!linux_is_elf64 && sizeof (void *) == 8)
> +    {
> +      if (sizeof (siginfo_t) != sizeof (compat_x32_siginfo_t))
> +	fatal ("unexpected difference in siginfo");
> +
> +      if (direction == 0)
> +	compat_x32_siginfo_from_siginfo ((struct compat_x32_siginfo *) inf,
> +					 native);
> +      else
> +	siginfo_from_compat_x32_siginfo (native,
> +					 (struct compat_x32_siginfo *) inf);
> +
> +      return 1;
> +    }
>  #endif
>  
>    return 0;
> @@ -1138,6 +1330,7 @@ x86_arch_setup (void)
>        /* Amd64 has 16 xmm regs.  */
>        num_xmm_registers = 16;
>  
> +      linux_is_elf64 = is_elf64;
>        x86_linux_update_xmltarget ();
>        return;
>      }


This new global is buggy in that in extended-remote mode (gdbserver --multi):
you can start a 64-bit inferior, kill it, then start a 32-bit inferior.
So clear it also in the 32-bit inferior case.  Okay with that change.

This new flag should be made a per-inferior flag, probably as a
new process->private->is_elf64 flag, but the status quo is that
there are other similar globals, so I'm okay with a new one,
and I'll fix them all in the ongoing multi-process+multi-arch
series.

Thanks.

-- 
Pedro Alves


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