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]

Re: [RFA 1/2] Linespec rewrite (update 2)


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);
 	    }

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