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: Handling corner case in building symbol table when "debug_line" includes compilation directory


On Tue, Apr 10, 2007 at 07:06:37PM -0700, Maxim Grigoriev wrote:
> I think I missed one important detail in my patch.
> Here is an improved version:
> 
> 2007-04-10 Maxim Grigoriev <maxim2405@gmail.com>
> 
>        * buildsym.c (start_subfile): Add handling missing case while
>        building symbol table for a compilation unit.

Sorry I didn't get back to you about this.  The patch is fine, but
still had some formatting issues.  I've applied this version - please
let me know if it does not work for you.

-- 
Daniel Jacobowitz
CodeSourcery

2007-05-14  Maxim Grigoriev  <maxim2405@gmail.com>

	* buildsym.c (start_subfile): Handle absolute pathnames
	while comparing subfile names.

Index: buildsym.c
===================================================================
RCS file: /cvs/src/src/gdb/buildsym.c,v
retrieving revision 1.47
diff -u -p -r1.47 buildsym.c
--- buildsym.c	27 Feb 2007 22:57:42 -0000	1.47
+++ buildsym.c	14 May 2007 13:37:19 -0000
@@ -549,11 +549,27 @@ start_subfile (char *name, char *dirname
 
   for (subfile = subfiles; subfile; subfile = subfile->next)
     {
-      if (FILENAME_CMP (subfile->name, name) == 0)
+      char *subfile_name;
+
+      /* If NAME is an absolute path, and this subfile is not, then
+	 attempt to create an absolute path to compare.  */
+      if (IS_ABSOLUTE_PATH (name)
+	  && !IS_ABSOLUTE_PATH (subfile->name)
+	  && subfile->dirname != NULL)
+	subfile_name = concat (subfile->dirname, SLASH_STRING,
+			       subfile->name, NULL);
+      else
+	subfile_name = subfile->name;
+
+      if (FILENAME_CMP (subfile_name, name) == 0)
 	{
 	  current_subfile = subfile;
+	  if (subfile_name != subfile->name)
+	    xfree (subfile_name);
 	  return;
 	}
+      if (subfile_name != subfile->name)
+	xfree (subfile_name);
     }
 
   /* This subfile is not known.  Add an entry for it. Make an entry


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