This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Patch: 4.3+trunk, C/C++: fix call to start_source_file


Andreas Schwab noticed some gdb test suite regressions using gcc 4.3:

    http://sourceware.org/ml/gdb/2008-06/msg00075.html

I tracked this down to a bug revealed by the switch to mapped
locations.

The bug is that we pass a source_location to the start_source_file
debug hook -- but this is supposed to take a line number.

This patch fixes the problem.  Bootstrapped and regtested on x86-64
(compile farm).  I also ran the gdb test suite against a local (x86)
build with this patch, and this fixed the gdb test suite failures.

Ok for 4.3 and trunk?

Tom

gcc/ChangeLog:
2008-06-10  Tom Tromey  <tromey@redhat.com>

	* c-lex.c (fe_file_change): Pass SOURCE_LINE to start_source_file
	debug hook.

Index: gcc/c-lex.c
===================================================================
--- gcc/c-lex.c	(revision 136205)
+++ gcc/c-lex.c	(working copy)
@@ -205,10 +205,13 @@
 	 we already did in compile_file.  */
       if (!MAIN_FILE_P (new_map))
 	{
-	  int included_at = LAST_SOURCE_LINE_LOCATION (new_map - 1);
+	  unsigned int included_at = LAST_SOURCE_LINE_LOCATION (new_map - 1);
+	  int line = 0;
+	  if (included_at > BUILTINS_LOCATION)
+	    line = SOURCE_LINE (new_map - 1, included_at);
 
 	  input_location = new_map->start_location;
-	  (*debug_hooks->start_source_file) (included_at, new_map->to_file);
+	  (*debug_hooks->start_source_file) (line, new_map->to_file);
 #ifndef NO_IMPLICIT_EXTERN_C
 	  if (c_header_level)
 	    ++c_header_level;


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