Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [gdb/symtab] Factor out new_symbol_file_line
Date: Wed, 22 Apr 2026 10:51:32 -0600	[thread overview]
Message-ID: <87jytzq6p7.fsf@tromey.com> (raw)
In-Reply-To: <20260421160307.1655903-1-tdevries@suse.de> (Tom de Vries's message of "Tue, 21 Apr 2026 18:03:07 +0200")

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

Tom> I was looking at a patch [1] modifying the DW_AT_decl_file / DW_AT_call_file
Tom> handling of new_symbol, and noticed that:
Tom> - the code is fairly nested, and
Tom> - the patch adds another nesting layer.

Tom> Factor out function new_symbol_file_line out of new_symbol, handling both the
Tom> DW_AT_decl_file / DW_AT_call_file and DW_AT_call_line / DW_AT_decl_line
Tom> attributes.

Thanks for doing this.

I think new_symbol really needs to be split up, the way it is now is
pretty bad, and your patch is a nice step in that direction.

Tom> Having factored out the code, simplify it using return, and modernize it using
Tom> bool and nullptr.

Tom> +  struct attribute *attr = nullptr;
Tom> +
Tom> +  bool inlined_func = (die->tag == DW_TAG_inlined_subroutine);
Tom> +
Tom> +  /* Handle DW_AT_call_line / DW_AT_decl_line.  */
Tom> +  attr = dwarf2_attr (die,
Tom> +		      inlined_func ? DW_AT_call_line : DW_AT_decl_line,
Tom> +		      cu);

This line could be combined with the declaration and then the
initialization removed like

attribute *attr = dwarf2_attr (...)

Approved-By: Tom Tromey <tom@tromey.com>

Tom

  reply	other threads:[~2026-04-22 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-21 16:03 Tom de Vries
2026-04-22 16:51 ` Tom Tromey [this message]
2026-04-23 13:01   ` Tom de Vries

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=87jytzq6p7.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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