[rfa/symtab] Fix breakpoints by full path

Daniel Jacobowitz drow@false.org
Mon Sep 20 00:17:00 GMT 2004


This patch fixes a bug in setting breakpoints by full path.  The problem is
two dangling users of source_full_path_of; the right way to set
pst->fullname now is to use psymtab_to_fullname, which takes advantage of
pst->dirname if it was available.  source_full_path_of only considers the
search path, which is less useful.

Without the patch, this sequence would fail:
  cd tmp
  gcc -o tmp tmp.c
  cd ..
  gdb ./tmp/tmp
  break /path/to/tmp/tmp.c:1

But this one would succeed:
  cd tmp
  gcc -o tmp tmp.c
  cd ..
  gdb ./tmp/tmp
  interpreter-exec mi -file-list-exec-source-files
  break /path/to/tmp/tmp.c:1

(because -file-list-exec-source-files initialized fullname correctly).

Tested on i386-pc-linux-gnu, no regressions, fixes the new failure in
fullname.exp.  OK?

-- 
Daniel Jacobowitz

2004-09-19  Daniel Jacobowitz  <dan@debian.org>

	* symtab.c (lookup_partial_symtab): Use psymtab_to_fullname.
	(lookup_partial_symtab): Use symtab_to_fullname.

Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.137
diff -u -p -r1.137 symtab.c
--- symtab.c	19 Sep 2004 22:49:23 -0000	1.137
+++ symtab.c	19 Sep 2004 23:32:40 -0000
@@ -272,8 +272,7 @@ lookup_partial_symtab (const char *name)
        this symtab and use its absolute path.  */
     if (full_path != NULL)
       {
-	if (pst->fullname == NULL)
-	  source_full_path_of (pst->filename, &pst->fullname);
+	psymtab_to_fullname (pst);
 	if (pst->fullname != NULL
 	    && FILENAME_CMP (full_path, pst->fullname) == 0)
 	  {
@@ -284,8 +283,7 @@ lookup_partial_symtab (const char *name)
     if (real_path != NULL)
       {
         char *rp = NULL;
-	if (pst->fullname == NULL)
-	  source_full_path_of (pst->filename, &pst->fullname);
+	psymtab_to_fullname (pst);
         if (pst->fullname != NULL)
           {
             rp = gdb_realpath (pst->fullname);



More information about the Gdb-patches mailing list