Article View: gnu.gdb.bug
Article #582rs6000 shared library/dynamic object improvements
From: Robert Andrew Ryan
Date: Wed, 06 Jan 1993 11:30
Date: Wed, 06 Jan 1993 11:30
177 lines
5596 bytes
5596 bytes
The following patch allows the user to treat load(2)ed modules just like
shared libraries. (e.g. reading symbols for them with the sharedlibrary
command) The xcoffexec.c patch is the same one I posted previously.
This supercedes my last post which added a partial implementation of the
load command to achieve the same basic goal.
-Rob
Wed Jan 06 16:17:55 EST 1993 Rob Ryan (robr@cmu.edu)
* tm-rs6000.h: Added SOLIB_UPDATE_LIBRARIES macro, used
by info sharedlibrary and sharedlibrary commands to update
the list of loaded modules before performing the requested
functions. Modified SIGTRAP_STOP_AFTER_LOAD to keep a
count of the loaded objects, so that the module list only
gets updated when more modules have been loaded.
* xcoffexec.c: Fixed bug which would cause the wrong
modules to be relocated when the sharedlibrary command
was used on modules with no archive elements.
* xcoffsolib.c: Added use of SOLIB_UPDATE_LIBRARIES macro.
Also added definition of xcoffloadcount used to detect
when the module list needs to be updated.
*** tm-rs6000.h.orig Tue Dec 22 14:33:42 1992
--- tm-rs6000.h Tue Jan 5 14:12:08 1993
***************
*** 122,127 ****
--- 122,128 ----
once. */
extern int loadinfotextindex;
+ extern int xcoffloadcount;
#define SOLIB_CREATE_INFERIOR_HOOK(PID) \
do { \
***************
*** 128,135 ****
if (loadinfotextindex == 0) \
xcoff_relocate_symtab (PID); \
} while (0)
-
/* Number of trap signals we need to skip over, once the inferior process
starts running. */
--- 129,147 ----
if (loadinfotextindex == 0) \
xcoff_relocate_symtab (PID); \
} while (0)
+ /* called just before the shared-library and
+ info sharedlibrary commands scan for shared
+ libraries.
+ -Rob Ryan Dec 22,1992 */
+ #define SOLIB_UPDATE_LIBRARIES \
+ do { \
+ if (inferior_pid>0 && xcoffloadcount>0) { \
+ xcoffloadcount=0; \
+ xcoff_relocate_symtab (inferior_pid); \
+ } \
+ } while (0)
+
/* Number of trap signals we need to skip over, once the inferior process
starts running. */
***************
*** 143,152 ****
#define SIGTRAP_STOP_AFTER_LOAD(W) \
if ( (W) == 0x57c || (W) == 0x7f) { \
! if ((W)==0x57c && breakpoints_inserted) { \
! mark_breakpoints_out (); \
! insert_breakpoints (); \
! insert_step_breakpoint (); \
} \
resume (0, 0); \
continue; \
--- 155,167 ----
#define SIGTRAP_STOP_AFTER_LOAD(W) \
if ( (W) == 0x57c || (W) == 0x7f) { \
! if ((W)==0x57c) { \
! if (breakpoints_inserted) { \
! mark_breakpoints_out (); \
! insert_breakpoints (); \
! insert_step_breakpoint (); \
! } \
! xcoffloadcount++; \
} \
resume (0, 0); \
continue; \
*** xcoffexec.c.orig Wed Oct 7 20:31:53 1992
--- xcoffexec.c Tue Dec 22 13:56:39 1992
***************
*** 392,398 ****
} else if (vp->member[0]) {
/* no match, and member present, not this one. */
continue;
! } else {
struct stat si;
FILE *io;
--- 392,401 ----
} else if (vp->member[0]) {
/* no match, and member present, not this one. */
continue;
! } else if (vip) {
! /* if we weren't given a stat structure
! that doesn't mean any old bfd will match...
! -Rob Ryan 11/5/92*/
struct stat si;
FILE *io;
***************
*** 408,417 ****
if (fstat(fileno(io), &si) < 0)
fatal("cannot fstat BFD for sym");
! if (vip && (si.st_dev != vip->st_dev
|| si.st_ino != vip->st_ino))
continue;
! }
if (vp->tstart != old_start) {
--- 411,420 ----
if (fstat(fileno(io), &si) < 0)
fatal("cannot fstat BFD for sym");
! if ((si.st_dev != vip->st_dev
|| si.st_ino != vip->st_ino))
continue;
! } else continue;
if (vp->tstart != old_start) {
*** xcoffsolib.c.orig Tue Dec 22 16:28:29 1992
--- xcoffsolib.c Tue Dec 22 17:15:12 1992
***************
*** 28,33 ****
--- 28,41 ----
extern struct symtab *current_source_symtab;
extern int current_source_line;
+ /* this will be incremented by SIGTRAP_AFTER_LOAD
+ when new modules are loaded. SOLIB_UPDATE_LIBRARIES
+ will update gdb's list of loaded modules when this
+ count is >0
+ -Rob Ryan Dec 22, 1992
+ */
+ int xcoffloadcount=0;
+
/* The real work of adding a shared library file to the symtab and
the section list. */
***************
*** 46,51 ****
--- 54,61 ----
int loaded = 0; /* true if any shared obj loaded */
int matched = 0; /* true if any shared obj matched */
+ SOLIB_UPDATE_LIBRARIES;
+
if (arg_string == 0)
re_comp (".");
else if (val = (char *) re_comp (arg_string)) {
***************
*** 148,153 ****
--- 158,165 ----
struct vmap *vp = vmap;
+ SOLIB_UPDATE_LIBRARIES;
+
if (!vp || !vp->nxt) {
printf("No shared libraries loaded at this time.\n");
return;
Technical Details
Message-ID:
<UfGoy3i00Woi1Tzls5@andrew.cmu.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!andrew.cmu.edu!rr2b+Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!andrew.cmu.edu!rr2b+ From: rr2b+@andrew.cmu.edu (Robert Andrew Ryan) Subject: rs6000 shared library/dynamic object improvements Message-ID: <UfGoy3i00Woi1Tzls5@andrew.cmu.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Wed, 6 Jan 1993 11:30:43 GMT Approved: bug-gdb@prep.ai.mit.edu Lines: 178