This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[5/5] RFC filter label symbols in linespec


This patch fixes these regressions introduced by patch #1

gdb.cp/cplabel.exp: break foo::bar:get_out_of_here: PASS => FAIL
gdb.cp/cplabel.exp: break foo::bar:to_the_top: PASS => FAIL
gdb.cp/cplabel.exp: break foo::baz:get_out_of_here: PASS => FAIL
gdb.cp/cplabel.exp: break foo::baz:to_the_top: PASS => FAIL

The issue here is that the function and label in question appear in both
a PU and a CU.  So, the breakpoint gets two locations:

    (gdb) break foo::bar:to_the_top
    Breakpoint 2 at 0x400503: foo::bar:to_the_top. (2 locations)

What is especially wacky is that both locations are at the same place:

    (gdb) info b
    Num     Type           Disp Enb Address            What
    1       breakpoint     keep y   <MULTIPLE>         
    1.1                         y     0x000000000040051c foo::bar:get_out_of_here
    1.2                         y     0x000000000040051c foo::bar:get_out_of_here

This happens due to the weird way we run "dwz -m".
It's unclear to me that this would ever happen for real code.

While I think this borders on "diminishing returns" territory, the fix
is pretty straightforward: use the existing address-filtering function
in linespec to also filter when looking at labels.

Built and regtested (both ways) on x86-64 Fedora 16.

Tom

	* linespec.c (convert_linespec_to_sals): Use maybe_add_address
	when adding label symbols.

---
 gdb/ChangeLog  |    5 +++++
 gdb/linespec.c |    5 ++++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/gdb/linespec.c b/gdb/linespec.c
index 2e98db7..4bb64b5 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1884,7 +1884,10 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
 
       for (i = 0; VEC_iterate (symbolp, ls->labels.label_symbols, i, sym); ++i)
 	{
-	  if (symbol_to_sal (&sal, state->funfirstline, sym))
+	  struct program_space *pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
+
+	  if (symbol_to_sal (&sal, state->funfirstline, sym)
+	      && maybe_add_address (state->addr_set, pspace, sal.pc))
 	    add_sal_to_sals (state, &sals, &sal,
 			     SYMBOL_NATURAL_NAME (sym), 0);
 	}
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]