This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 1/2] Linespec rewrite (update 2)
- From: Keith Seitz <keiths at redhat dot com>
- To: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Date: Mon, 23 Jul 2012 10:56:53 -0700
- Subject: Re: [RFA 1/2] Linespec rewrite (update 2)
- References: <4F70F8F7.503@redhat.com> <87zkb0wj1x.fsf@fleche.redhat.com> <4F74B583.6090008@redhat.com> <87obrertls.fsf@fleche.redhat.com> <4F75D859.1010907@redhat.com> <87r4waqc38.fsf@fleche.redhat.com> <20120330170913.GT2701@adacore.com> <87fwcqq8gl.fsf@fleche.redhat.com> <4F75F5F5.8070105@redhat.com> <4F7B8610.9070302@redhat.com> <m2394jsiaj.fsf@igel.home>
On 07/22/2012 12:32 PM, Andreas Schwab wrote:
Keith Seitz <keiths@redhat.com> writes:
+ for (i = 0; VEC_iterate (symbolp, ls->labels.label_symbols, i, sym); ++i)
+ {
+ symbol_to_sal (&sal, state->funfirstline, sym);
+ add_sal_to_sals (state, &sals, &sal,
+ SYMBOL_NATURAL_NAME (sym));
If symbol_to_sal returns 0 then sal is uninitialized.
Nice catch, Andreas.
I propose the attached patch.
I guess this should be considered for inclusion on 7.5. [What say ye?]
Keith
ChangeLog
2012-07-23 Keith Seitz <keiths@redhat.com>
* linespec.c (convert_linespec_to_sal): Don't add
any symbols to the result vector if symbol_to_sal
returns zero.
Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.162
diff -u -p -r1.162 linespec.c
--- linespec.c 18 Jul 2012 20:38:18 -0000 1.162
+++ linespec.c 23 Jul 2012 17:54:48 -0000
@@ -1860,9 +1860,9 @@ convert_linespec_to_sals (struct linespe
for (i = 0; VEC_iterate (symbolp, ls->labels.label_symbols, i, sym); ++i)
{
- symbol_to_sal (&sal, state->funfirstline, sym);
- add_sal_to_sals (state, &sals, &sal,
- SYMBOL_NATURAL_NAME (sym), 0);
+ if (symbol_to_sal (&sal, state->funfirstline, sym))
+ add_sal_to_sals (state, &sals, &sal,
+ SYMBOL_NATURAL_NAME (sym), 0);
}
}
else if (ls->function_symbols != NULL || ls->minimal_symbols != NULL)
@@ -1886,8 +1886,8 @@ convert_linespec_to_sals (struct linespe
{
pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
set_current_program_space (pspace);
- symbol_to_sal (&sal, state->funfirstline, sym);
- if (maybe_add_address (state->addr_set, pspace, sal.pc))
+ 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);
}