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 1/3] Added command remove-symbol-file.


So what is the desirable behavior for when the user does
add-symbol-file and then the program loads the same file,
and then the user removes the file she added.  GDB drops
symbols until the next DSO event or next "sharedlibrary"
command invocation?  The fact that GDB reuses the same file
when the addr_low happens to match looks quite brittle (it
doesn't check the section offsets (passed to add-symbol-file)
are the same, for instance).  I wonder whether this sharing is
supposed to be a valid use case, and whether it wouldn't be better
and simpler to disable it, that is,

	  /* Have we already loaded this shared object?  */
	  ALL_OBJFILES (so->objfile)
	    {
	      if (filename_cmp (so->objfile->name, so->so_name) == 0
		  && so->objfile->addr_low == so->addr_low
-		  && so->objfile->addr_low == so->addr_low)
+                  && !(so->objfile->flags & OBJF_USERLOADED))
		break;
	    }

...

-	  /* Unless the user loaded it explicitly, free SO's objfile.  */
-	  if (gdb->objfile && ! (gdb->objfile->flags & OBJF_USERLOADED)
-	      && !solib_used (gdb))
-	    free_objfile (gdb->objfile);


In a way, treat manually added objfiles list and the dynamic SO list
separate lists.

-- 
Pedro Alves


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