From: "H.J. Lu" <hjl.tools@gmail.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: brobecker@adacore.com, gdb-patches@sourceware.org
Subject: Re: Three weeks to branching (gdb 7.5 release)
Date: Sun, 20 May 2012 21:25:00 -0000 [thread overview]
Message-ID: <CAMe9rOojkLGHcQ3KPn=NmNg+y+jPnL-eB67TL2+xgVUaOftHNQ@mail.gmail.com> (raw)
In-Reply-To: <201205202043.q4KKhRGw022215@glazunov.sibelius.xs4all.nl>
On Sun, May 20, 2012 at 1:43 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>> Date: Sun, 20 May 2012 08:40:26 -0700
>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>
>> On Fri, May 11, 2012 at 11:43 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> > On Fri, May 11, 2012 at 11:17 AM, Joel Brobecker <brobecker@adacore.com> wrote:
>> >> Hello,
>> >>
>> >> Just a quick heads up: The current tentative date for branching
>> >> GDB (7.5 release) is Mon Jun 4th, which is a little over three weeks
>> >> away.
>> >>
>> >> I've created a wiki page for known issues that need to be fixed
>> >> before then:
>> >>
>> >> http://sourceware.org/gdb/wiki/GDB_7.5_Release
>> >>
>> >> When you add an issue, please make sure you add a name so we know
>> >> who is coordinating the effort. If you don't know who can work
>> >> on it, please just post the issue here, and we'll try to find some
>> >> help.
>> >>
>> >> I only know of one issue, which is a noticeable performance degradation
>> >> that was reported a while ago:
>> >>
>> >
>> > I'd like to merge x32 into GDB 7.5. My x32 change is on hjl/x32/master
>> > branch at
>> >
>> > http://sourceware.org/git/?p=gdb.git;a=summary
>> >
>> > The current diff only has 864 lines. One patch:
>> >
>> > http://sourceware.org/ml/gdb-patches/2012-05/msg00097.html
>> >
>> > isn't reviewed yet. I will open a meta bug for x32 integration.
>> >
>>
>> I opened:
>>
>> http://sourceware.org/bugzilla/show_bug.cgi?id=14099
>>
>> Thanks for help from everyone. The full GDBserver x32 support
>> as well as partial GDB x32 support have been checked in. The
>> remaining patches are:
>>
>> http://sourceware.org/ml/gdb-patches/2012-04/msg00195.html
>> http://sourceware.org/ml/gdb-patches/2012-04/msg00191.html
>> http://sourceware.org/ml/gdb-patches/2012-05/msg00744.html
>> http://sourceware.org/ml/gdb-patches/2012-05/msg00531.html
>> http://sourceware.org/ml/gdb-patches/2012-05/msg00533.html
>> http://sourceware.org/ml/gdb-patches/2012-05/msg00489.html
>> http://sourceware.org/ml/gdb-patches/2012-05/msg00438.html
>> http://sourceware.org/ml/gdb-patches/2012-05/msg00097.html
>>
>> I would appreciate help to get them reviewed and approved.
>
> As I wrote before, I don't think adding lots if if-statements is the
> proper way to add a new ABI to GDB. The proper way is to do it like
> the diff below. In that diff, I'm not entirely confident that calling
> amd64_linux_init_abi() from amd64_x32_linux_init_abi() makes all that
> much sense. For example the amd64_linux_record_tdep stuff probably
> isn't right for the x32 ABI. But at least this will give us a
> starting point where we won't end up adding
>
> if (gdbarch_ptr_bit (gdbarch) == 32)
> {
> ...
> }
Please take a look at
http://sourceware.org/ml/gdb-patches/2012-04/msg00195.html
It doesn't add any (gdbarch_ptr_bit (gdbarch) == 32). It just changes
it to bits_per_word. I add one "gdbarch_ptr_bit (gdbarch) == 32" in
amd64_linux_sigtramp_start and I will remove them from
http://sourceware.org/ml/gdb-patches/2012-05/msg00744.html
> else
> {
> }
>
> blocks all over the place.
>
>
>
> Index: amd64-linux-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/amd64-linux-tdep.c,v
> retrieving revision 1.50
> diff -u -p -r1.50 amd64-linux-tdep.c
> --- amd64-linux-tdep.c 12 May 2012 08:54:03 -0000 1.50
> +++ amd64-linux-tdep.c 20 May 2012 20:31:53 -0000
> @@ -1543,6 +1543,24 @@ amd64_linux_init_abi (struct gdbarch_inf
>
> tdep->i386_syscall_record = amd64_linux_syscall_record;
> }
> +
> +static void
> +amd64_x32_linux_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
> +{
> + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> + const struct target_desc *tdesc = info.target_desc;
> +
> + amd64_linux_init_abi (info, gdbarch);
> + amd64_x32_init_abi (info, gdbarch);
> +
> + if (! tdesc_has_registers (tdesc))
> + tdesc = tdesc_amd64_linux;
I assume you meant tdesc_x32_linux here. The problem is
when we reach here, if (! tdesc_has_registers (tdesc)) will always
be false since tdep->tdesc has been set by amd64_linux_init_abi.
> + tdep->tdesc = tdesc;
> +
> + /* GNU/Linux uses SVR4-style shared libraries. */
> + set_solib_svr4_fetch_link_map_offsets
> + (gdbarch, svr4_ilp32_fetch_link_map_offsets);
> +}
>
>
> /* Provide a prototype to silence -Wmissing-prototypes. */
> @@ -1553,6 +1571,8 @@ _initialize_amd64_linux_tdep (void)
> {
> gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
> GDB_OSABI_LINUX, amd64_linux_init_abi);
> + gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x64_32,
> + GDB_OSABI_LINUX, amd64_x32_linux_init_abi);
>
> /* Initialize the Linux target description. */
> initialize_tdesc_amd64_linux ();
> Index: amd64-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/amd64-tdep.c,v
> retrieving revision 1.104
> diff -u -p -r1.104 amd64-tdep.c
> --- amd64-tdep.c 14 May 2012 18:56:40 -0000 1.104
> +++ amd64-tdep.c 20 May 2012 20:31:54 -0000
> @@ -258,7 +258,8 @@ static const char *amd64_word_names[] =
> static const char *amd64_dword_names[] =
> {
> "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
> - "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d"
> + "r8d", "r9d", "r10d", "r11d", "r12d", "r13d", "r14d", "r15d",
> + "eip"
> };
>
> /* Return the name of register REGNUM. */
> @@ -2729,6 +2730,43 @@ amd64_init_abi (struct gdbarch_info info
> set_gdbarch_stap_parse_special_token (gdbarch,
> i386_stap_parse_special_token);
> }
> +
> +
> +static struct type *
> +amd64_x32_pseudo_register_type (struct gdbarch *gdbarch, int regnum)
> +{
> + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> +
> + switch (regnum - tdep->eax_regnum)
> + {
> + case AMD64_RBP_REGNUM: /* %ebp */
> + case AMD64_RSP_REGNUM: /* %esp */
> + return builtin_type (gdbarch)->builtin_data_ptr;
> + case AMD64_RIP_REGNUM: /* %eip */
> + return builtin_type (gdbarch)->builtin_func_ptr;
> + }
> +
> + return i386_pseudo_register_type (gdbarch, regnum);
> +}
> +
> +void
> +amd64_x32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> +{
> + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> + const struct target_desc *tdesc = info.target_desc;
> +
> + amd64_init_abi (info, gdbarch);
> +
> + if (! tdesc_has_registers (tdesc))
> + tdesc = tdesc_x32;
Again, " if (! tdesc_has_registers (tdesc))" will always false
since tdep->tdesc has been set in amd64_init_abi. How
do we solve it? My suggestion is to add a new function
which is similar to amd64_init_abi, but takes a new argument,
const struct target_desc *, as the default tdesc. Both
amd64_init_abi and amd64_x32_init_abi will call this
function. Will it work for you?
Thanks.
--
H.J.
next prev parent reply other threads:[~2012-05-20 21:25 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-11 18:17 Joel Brobecker
2012-05-11 18:43 ` H.J. Lu
2012-05-14 14:45 ` Joel Brobecker
2012-05-20 15:40 ` H.J. Lu
2012-05-20 20:44 ` Mark Kettenis
2012-05-20 21:25 ` H.J. Lu [this message]
2012-05-20 21:39 ` Mark Kettenis
2012-05-20 22:49 ` H.J. Lu
2012-05-25 16:52 ` H.J. Lu
2012-05-28 20:26 ` x32 ABI Support (was Re: Three weeks to branching (gdb 7.5 release)) Mark Kettenis
2012-05-28 21:18 ` H.J. Lu
2012-05-31 18:18 ` H.J. Lu
2012-06-05 12:58 ` H.J. Lu
2012-06-05 13:16 ` Mark Kettenis
2012-06-09 14:30 ` H.J. Lu
2012-06-10 21:52 ` Mark Kettenis
2012-06-11 13:42 ` H.J. Lu
2012-06-12 21:23 ` Mark Kettenis
2012-06-13 20:29 ` x32 ABI Support (committed) Mark Kettenis
2012-06-13 20:41 ` Mark Kettenis
2012-05-12 15:26 ` Three weeks to branching (gdb 7.5 release) Doug Evans
2012-05-20 14:59 ` Doug Evans
2012-06-11 15:35 ` Branching time + 1 week (was: "Re: Three weeks to branching (gdb 7.5 release)") Joel Brobecker
2012-06-11 15:52 ` Doug Evans
2012-06-11 16:00 ` Joel Brobecker
2012-06-21 20:20 ` Joel Brobecker
2012-06-21 20:25 ` Doug Evans
2012-06-22 14:47 ` Jan Kratochvil
2012-06-22 16:32 ` Joel Brobecker
2012-06-22 16:41 ` Jan Kratochvil
2012-06-22 17:38 ` Branching time + 1 week Tom Tromey
2012-06-22 20:31 ` Branching time + 1 week (was: "Re: Three weeks to branching (gdb 7.5 release)") Joel Brobecker
2012-06-24 9:14 ` [commit] gnulib update [Re: Branching time + 1 week] Jan Kratochvil
2012-06-22 16:42 ` Branching time + 1 week (was: "Re: Three weeks to branching (gdb 7.5 release)") H.J. Lu
2012-06-11 15:59 ` H.J. Lu
2012-06-11 16:11 ` Joel Brobecker
2012-06-11 16:20 ` H.J. Lu
2012-05-29 17:17 ` Three weeks to branching (gdb 7.5 release) Jan Kratochvil
2012-05-30 22:04 ` Joel Brobecker
2012-06-07 19:36 ` Maciej W. Rozycki
2012-06-11 14:58 ` Joel Brobecker
2012-06-12 15:39 ` Maciej W. Rozycki
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='CAMe9rOojkLGHcQ3KPn=NmNg+y+jPnL-eB67TL2+xgVUaOftHNQ@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/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