public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Ed Catmur <ed@catmur.uk>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Support DW_TAG_GNU_formal_parameter_pack and DW_TAG_GNU_template_parameter_pack.
Date: Tue, 30 May 2023 11:28:25 -0600	[thread overview]
Message-ID: <871qixwwxy.fsf@tromey.com> (raw)
In-Reply-To: <20230115224242.29922-1-ed@catmur.uk> (Ed Catmur's message of "Sun, 15 Jan 2023 22:42:42 +0000")

>>>>> "Ed" == Ed Catmur <ed@catmur.uk> writes:

Hi.  I'm sorry about the long delay on this review.
Unfortunately in gdb you have to send pings for patches.

Ed> https://sourceware.org/bugzilla/show_bug.cgi?id=17272
Ed> Synthesize type and parameter names as T#n, p#n e.g. Args#1, args#1.

Ed> This is a pretty simple approach but it seems to work OK and is
Ed> compatible with the old style type and parameter names emitted by
Ed> old versions of gcc and when it's writing stabs+ format.

Does stabs even handle template parameter packs?

Also are synthesized names really necessary?  If they aren't required in
DWARF perhaps they can just be nullptr.

Ed> -      attr = dwarf2_attr (die,
Ed> +      struct die_info *line_file_die = die;
Ed> +      if (die->tag == DW_TAG_formal_parameter && die->parent && die->parent->tag == DW_TAG_GNU_formal_parameter_pack)

This line looks too long.  There are other minor formatting issues as
well, for example in the GNU style there is usually a space before an
open paren.

Ed> +	  size = snprintf(NULL, 0, "%s#%d", parent_name, ordinal) + 1;
Ed> +	  name = ((char *) obstack_alloc (&cu->per_objfile->per_bfd->obstack, size));
Ed> +	  snprintf(name, size, "%s#%d", parent_name, ordinal);

gdb doesn't generally use snprintf.  There are other options, like
printing to a string and then copying it.

A patch like this needs a test case.

Also I'm curious if this works ok with the Python API.

Tom

      parent reply	other threads:[~2023-05-30 17:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-15 22:42 Ed Catmur
     [not found] ` <CAJVr-ENd09JAo9qcQHTx2ifERHdJOVM=nAHWdaOOFEWLA8gORg@mail.gmail.com>
2023-01-23 10:00   ` Fwd: " Alexandra Petlanova Hajkova
2023-02-04 16:32   ` Ed Catmur
2023-02-07  5:55     ` Alexandra Petlanova Hajkova
2023-05-30 17:28 ` Tom Tromey [this message]

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=871qixwwxy.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=ed@catmur.uk \
    --cc=gdb-patches@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).