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 2/2] amd64-linux: expose system register FS_BASE and GS_BASE for Linux.


On Thursday, November 03, 2016 10:47:25 AM Walfred Tedeschi wrote:
> diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
> index 3f2a92b..a8a0b79 100644
> --- a/gdb/amd64-linux-tdep.c
> +++ b/gdb/amd64-linux-tdep.c
> @@ -1872,6 +1881,18 @@ amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
>      tdesc = tdesc_amd64_linux;
>    tdep->tdesc = tdesc;
>  
> +  feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.segments");
> +  if (feature != NULL)
> +    {
> +      struct tdesc_arch_data *tdesc_data_segments
> +      = (struct tdesc_arch_data *) info.tdep_info;
> +
> +      tdesc_numbered_register (feature, tdesc_data_segments,
> +			       AMD64_FSBASE_REGNUM, "fs_base");
> +      tdesc_numbered_register (feature, tdesc_data_segments,
> +			       AMD64_GSBASE_REGNUM, "gs_base");
> +    }
> +
>    feature = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.linux");
>    if (feature == NULL)
>      return;

Should this be done in the OS-independent amd64_init_abi() instead?
FreeBSD also has ptrace operations to get/set the FS and GS base
registers (which I will add as a followup once this series is
committed).

-- 
John Baldwin


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