This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

[Fwd: Re: problems loading shared libraries - with attached test case]


This should have gone to gdb-patches.

-------- Original Message --------
Subject: Re: problems loading shared libraries - with attached test case
Date: Wed, 29 Mar 2000 23:03:45 -0500
From: Christopher Blizzard <blizzard@mozilla.org>
Organization: All Mozilla, all the time.
To: gdb@sourceware.cygnus.com
CC: jimb@redhat.com
References: <38DFD84E.9F330EC1@mozilla.org>

Christopher Blizzard wrote:
> 
> I'm using "set auto-solib-add 0" after main has been called.  If I use
> "shar" to load a shared library manually once I can't use it again to
> load another shared library later.  Please see the attached log for an
> example of how to reproduce the problem.
> 

I've got a patch for this problem ( attached. )  The problem is in
solib_add().

--Chris

-- 
------------
Christopher Blizzard
http://people.redhat.com/blizzard/
Chiseling through a wall of stone isn't my idea of fun.  But chiseling
through a wall of cheese -- now *there's* a party.
------------
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.207
diff -u -r1.207 ChangeLog
--- ChangeLog	2000/03/30 03:03:23	1.207
+++ ChangeLog	2000/03/30 03:53:33
@@ -1,3 +1,12 @@
+2000-03-29  Christopher Blizzard  <blizzard@redhat.com>
+
+	* solib.c (solib_add): If a library is in gdb's shared object map
+	and its symbols aren't loaded and the pattern of shared objects to
+	load matches the path name of the shared object in question, load
+	the symbols in the shared object.  This fixes the problem when
+	shared libraries are being loaded only on demand that the
+	"sharedlibrary" command can only be run once.
+
 2000-03-29  Daniel Berlin  <dan@cgsoftware.com>
 
 	* minsyms.c (add_minsym_to_demangled_hash_table): New function.
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.7
diff -u -r1.7 solib.c
--- solib.c	2000/03/24 23:49:10	1.7
+++ solib.c	2000/03/30 03:53:39
@@ -1298,6 +1298,26 @@
 	  i = *i_link;
 	}
 
+      /* Check to see whether or not this shared object was added to
+         gdb's shared object list without the symbols being loaded.
+         If it was and it matches the pattern for the shared object
+         that needs to be loaded, load it. */
+      if (!gdb->symbols_loaded)
+	{
+	  if (!pattern || re_exec(gdb->so_name))
+	    {
+	      if (catch_errors(symbol_add_stub, gdb,
+			       "Error while reading shared library symbols:\n",
+			       RETURN_MASK_ALL))
+		{
+		  if (from_tty)
+		    printf_unfiltered ("Loaded symbols for %s\n",
+				       gdb->so_name);
+		  gdb->symbols_loaded = 1;
+		}
+	    }
+	}
+
       /* If the shared object appears on the inferior's list too, then
          it's still loaded, so we don't need to do anything.  Delete
          it from the inferior's list, and leave it on GDB's list.  */


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