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: [PATCH] Listing cpp source code in mainless binaries


On Thu, 2008-06-26 at 10:17 -0400, Daniel Jacobowitz wrote:
> On Tue, Jun 10, 2008 at 03:28:45PM -0300, Luis Machado wrote:
> > -  /* All right; find the last file in the symtab list (ignoring .h's).  */
> > +  /* All right; find the last file in the symtab list (ignoring .h's)
> > +     and namespace symtabs.  */
> 
> That should be inside the parentheses :-)
> 
> > @@ -260,7 +261,8 @@
> >  	{
> >  	  const char *name = s->filename;
> >  	  int len = strlen (name);
> > -	  if (!(len > 2 && strcmp(&name[len - 2], ".h") == 0))
> > +	  if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
> > +	      || strcmp (name, "<<C++-namespaces>>") == 0)))
> >  	    current_source_symtab = s;
> >  	}
> >      }
> > 
> 
> Also, the same check is needed a few lines down.  Otherwise OK.
> 

Checked the following in with comment fixes.

Thanks!
Luis


2008-06-30  Luis Machado  <luisgpm@br.ibm.com>

	* source.c (select_source_symtab): Make sure we skip namespace
	symtabs when showing cpp source code.

Index: gdb/source.c
===================================================================
--- gdb.orig/source.c	2008-05-19 08:50:10.000000000 -0700
+++ gdb/source.c	2008-06-30 06:36:26.000000000 -0700
@@ -250,7 +250,8 @@
 	return;
     }
 
-  /* All right; find the last file in the symtab list (ignoring .h's).  */
+  /* Alright; find the last file in the symtab list (ignoring .h's
+     and namespace symtabs).  */
 
   current_source_line = 1;
 
@@ -260,14 +261,15 @@
 	{
 	  const char *name = s->filename;
 	  int len = strlen (name);
-	  if (!(len > 2 && strcmp(&name[len - 2], ".h") == 0))
+	  if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
+	      || strcmp (name, "<<C++-namespaces>>") == 0)))
 	    current_source_symtab = s;
 	}
     }
   if (current_source_symtab)
     return;
 
-  /* Howabout the partial symbol tables? */
+  /* How about the partial symbol tables?  */
 
   for (ofp = object_files; ofp != NULL; ofp = ofp->next)
     {
@@ -275,7 +277,8 @@
 	{
 	  const char *name = ps->filename;
 	  int len = strlen (name);
-	  if (!(len > 2 && strcmp (&name[len - 2], ".h") == 0))
+	  if (!(len > 2 && (strcmp (&name[len - 2], ".h") == 0
+	      || strcmp (name, "<<C++-namespaces>>") == 0)))
 	    cs_pst = ps;
 	}
     }


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