From: Pedro Alves <palves@redhat.com>
To: John Baldwin <jhb@FreeBSD.org>, Simon Marchi <simark@simark.ca>,
gdb-patches@sourceware.org
Subject: Re: [PATCH v2 06/11] Add a more general version of lookup_struct_elt_type.
Date: Fri, 08 Mar 2019 00:32:00 -0000 [thread overview]
Message-ID: <3de20033-411d-643b-d120-19a49f8815dc@redhat.com> (raw)
In-Reply-To: <1e84fa17-adf6-186f-843c-e4f7a6dd7e7b@FreeBSD.org>
On 03/08/2019 12:04 AM, John Baldwin wrote:
> On 3/7/19 7:53 AM, Simon Marchi wrote:
>> Not really a big deal, but I find it a bit overkill to define a type
>> just for this, I would have probably just returned the the offset as an
>> output parameter. But maybe this way is better, in that if we want to
>> add something to the return type, we don't have to update the callers.
>
> Honestly, I just modeled this after the similar code in the Linux
> kernel thread patches. Using a reference parameter for the offset
> would be fine and I don't mind making that change. I don't think that
> we are going to add more things to that structure in the future. The
> field generally has everything else you want to know other than the
> offset.
>
Note that you can keep the struct with just the data fields
and no ctor boilerplate if you use brace initialization.
I.e., with just:
struct struct_elt
{
/* The field of the element, or NULL if no element was found. */
struct field *field;
/* The bit offset of the element in the parent structure. */
LONGEST offset;
};
You write:
return {nullptr, 0};
return {&TYPE_FIELD (type, i), TYPE_FIELD_BITPOS (type, i)};
Instead of:
return struct_elt ();
return struct_elt (&TYPE_FIELD (type, i), TYPE_FIELD_BITPOS (type, i));
BTW, I noticed the missing space before parens below:
> - return TYPE_FIELD_TYPE (type, i);
> + return struct_elt (&TYPE_FIELD(type, i), TYPE_FIELD_BITPOS (type, i));
Thanks,
Pedro Alves
next prev parent reply other threads:[~2019-03-08 0:32 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-09 0:42 [PATCH v2 00/11] Support for thread-local variables on FreeBSD John Baldwin
2019-02-09 0:42 ` [PATCH v2 02/11] Support fs_base and gs_base on FreeBSD/i386 John Baldwin
2019-02-09 0:42 ` [PATCH v2 06/11] Add a more general version of lookup_struct_elt_type John Baldwin
2019-02-09 1:08 ` John Baldwin
2019-02-11 10:27 ` Philipp Rudo
2019-02-11 17:44 ` John Baldwin
2019-03-07 15:53 ` Simon Marchi
2019-03-08 0:04 ` John Baldwin
2019-03-08 0:32 ` Pedro Alves [this message]
2019-03-08 18:39 ` John Baldwin
2019-02-09 0:42 ` [PATCH v2 11/11] Support TLS variables on FreeBSD/powerpc John Baldwin
2019-03-07 16:26 ` Simon Marchi
2019-02-09 0:42 ` [PATCH v2 09/11] Support TLS variables on FreeBSD/i386 John Baldwin
2019-02-09 0:42 ` [PATCH v2 03/11] Handle an edge case for minisym TLS variable lookups John Baldwin
2019-02-09 0:42 ` [PATCH v2 07/11] Add a helper function to resolve TLS variable addresses for FreeBSD John Baldwin
2019-03-07 16:18 ` Simon Marchi
2019-02-09 0:42 ` [PATCH v2 01/11] Support the fs_base and gs_base registers on i386 John Baldwin
2019-02-09 0:42 ` [PATCH v2 08/11] Support TLS variables on FreeBSD/amd64 John Baldwin
2019-02-09 0:50 ` [PATCH v2 10/11] Support TLS variables on FreeBSD/riscv John Baldwin
2019-02-09 0:50 ` [PATCH v2 04/11] Add a new gdbarch method to resolve the address of TLS variables John Baldwin
2019-03-07 16:08 ` Simon Marchi
2019-03-07 23:50 ` John Baldwin
2019-03-08 2:55 ` Simon Marchi
2019-03-08 18:39 ` John Baldwin
2019-02-09 0:50 ` [PATCH v2 05/11] Remove code disabled since at least 1999 from lookup_struct_elt_type John Baldwin
2019-03-07 16:25 ` Simon Marchi
2019-02-22 17:22 ` [PING][PATCH v2 00/11] Support for thread-local variables on FreeBSD John Baldwin
2019-03-12 20:21 ` Simon Marchi
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=3de20033-411d-643b-d120-19a49f8815dc@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jhb@FreeBSD.org \
--cc=simark@simark.ca \
/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