public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Do not capture updated 'pc' in add_local_symbols
@ 2022-03-15 22:17 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2022-03-15 22:17 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8f50b4b574b9f34c4f23ce6d6508f72e9c2f5a59

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:
---
 gdb/tracepoint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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."));


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-15 22:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 22:17 [binutils-gdb] Do not capture updated 'pc' in add_local_symbols Tom Tromey

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).