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.


Hi Pedro,

I just returned from vacations. Sorry for the delay.

Just comparing addr_low for re-using object-files when loading a new SO might indeed be incorrect.
But one may consider the current behavior of GDB as a feature, e.g.: the user knows something additional
and want to overwrite the default mapping. So I would not change GDB.

To me, the remove-symbol-file command should remove the file even if it is currently
shared because the user might have a good reason for doing this. 

Regards,

Nicolas
 

> 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.

Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052


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