public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: Tom Tromey <tom@tromey.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Use function view when iterating over block symbols
Date: Tue, 15 Mar 2022 16:17:42 -0600	[thread overview]
Message-ID: <87pmmm273t.fsf@tromey.com> (raw)
In-Reply-To: <bd25bef7-d3da-5cd4-92dc-469d194ddf79@polymtl.ca> (Simon Marchi's message of "Tue, 15 Mar 2022 10:54:53 -0400")

... forgot to actually append the patch.

Tom

commit 8f50b4b574b9f34c4f23ce6d6508f72e9c2f5a59
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Mar 15 16:13:57 2022 -0600

    Do not capture updated 'pc' in add_local_symbols
    
    Simon pointed out that commit 13835d88 ("Use function view when
    iterating over block symbols") caused a regression.  The bug is that
    the new closure captures 'pc' by reference, but later code updates
    this variable -- but the earlier code did not update the callback
    structure with the new value.
    
    This patch restores the old behavior by using a new varible name in an
    inner scope.

diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 67b31182880..c45a9611abd 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -1082,8 +1082,8 @@ collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
     }
   else
     {
-      pc = get_pc_function_start (pc);
-      block = block_for_pc (pc);
+      CORE_ADDR fn_pc = get_pc_function_start (pc);
+      block = block_for_pc (fn_pc);
       if (block == NULL)
 	{
 	  warning (_("Can't collect args; no symbol table info available."));

      parent reply	other threads:[~2022-03-15 22:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04 23:40 Tom Tromey
2022-03-06 16:27 ` Simon Marchi
2022-03-15 14:54 ` Simon Marchi
2022-03-15 22:17   ` Tom Tromey
2022-03-15 22:17   ` 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=87pmmm273t.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).