🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #537

rs6000 dynamic loading patch

#537
From: Robert Andrew Ryan
Date: Sun, 20 Dec 1992 14:24
123 lines
4534 bytes
The changes below let the user load symbols for objects load(2)ed after
startup.  (The current gdb-4.7 only allows symbols to be loaded for
shared libraries present when the exec finished.)  For this to be useful
you should apply the patch I posted previously for xcoffexec.c.  (It's a
small patch I can send on request if necessary.)

-Rob Ryan

Sun Dec 20 16:01:59 EST 1992  Rob Ryan  (robr@cmu.edu)

	* inftarg.c:  Added CHILD_TO_LOAD macro, indicating a
	function to call to dynamically load a file into the child.
	* rs6000-tdep.c:  Bumped MAX_LOAD_SEGS to 256 from 64.
	Added rs6000_child_to_load, a partial implementation for
	use with the CHILD_TO_LOAD macro referenced in inftarg.c.
	* tm-rs6000.h:  Added extern decl for rs6000_child_to_load.
	Added #define of CHILD_TO_LOAD.


diff -c ./inftarg.c ../changed/inftarg.c
*** ./inftarg.c	Sun Dec 20 16:37:08 1992
--- ../changed/inftarg.c	Sun Dec 20 16:38:27 1992
***************
*** 247,252 ****
--- 247,255 ----
    return(1);
  }
  
+ #ifndef CHILD_TO_LOAD
+ #define CHILD_TO_LOAD 0
+ #endif
  struct target_ops child_ops = {
    "child",			/* to_shortname */
    "Unix child process",		/* to_longname */
***************
*** 270,276 ****
    terminal_ours,		/* to_terminal_ours */
    child_terminal_info,		/* to_terminal_info */
    kill_inferior,		/* to_kill */
!   0,				/* to_load */
    0,				/* to_lookup_symbol */
    child_create_inferior,	/* to_create_inferior */
    child_mourn_inferior,		/* to_mourn_inferior */
--- 273,279 ----
    terminal_ours,		/* to_terminal_ours */
    child_terminal_info,		/* to_terminal_info */
    kill_inferior,		/* to_kill */
!   CHILD_TO_LOAD,		/* to_load */
    0,				/* to_lookup_symbol */
    child_create_inferior,	/* to_create_inferior */
    child_mourn_inferior,		/* to_mourn_inferior */
diff -c ./rs6000-tdep.c ../changed/rs6000-tdep.c
*** ./rs6000-tdep.c	Sun Dec 20 16:37:09 1992
--- ../changed/rs6000-tdep.c	Sun Dec 20 16:38:27 1992
***************
*** 1052,1058 ****
  xcoff_relocate_symtab (pid)
  unsigned int pid;
  {
! #define	MAX_LOAD_SEGS 64		/* maximum number of load segments */
  
      struct ld_info *ldi;
      int temp;
--- 1052,1058 ----
  xcoff_relocate_symtab (pid)
  unsigned int pid;
  {
! #define	MAX_LOAD_SEGS 256		/* maximum number of load segments, bumped
from 64 to 256 Rob Ryan Dec 7, 1992 */
  
      struct ld_info *ldi;
      int temp;
***************
*** 1164,1170 ****
    ++loadinfotextindex;
  }
  
! 
  /* FIXME:  This assumes that the "textorg" and "dataorg" elements
     of a member of this array are correlated with the "toc_offset"
     element of the same member.  But they are sequentially assigned in wildly
--- 1164,1187 ----
    ++loadinfotextindex;
  }
  
! /* FIXME: this enables loading of symbols
!  for objects which have already been read
!  in, but does not actually dynamically load
!  FILE into the running child as the
!  docs say. -Rob Ryan Dec 7,1992*/
! void
! rs6000_child_to_load (arg, from_tty)
!     char *arg;
!     int from_tty;
! {
!   if(inferior_pid > 0) {
!     xcoff_relocate_symtab (inferior_pid);
!   }
!   else {
!     error ("Must have an inferior process to use the load command.");
!   }
!   solib_add (arg, from_tty, (struct target_ops *)0);
! } 
  /* FIXME:  This assumes that the "textorg" and "dataorg" elements
     of a member of this array are correlated with the "toc_offset"
     element of the same member.  But they are sequentially assigned in wildly
diff -c ./tm-rs6000.h ../changed/tm-rs6000.h
*** ./tm-rs6000.h	Sun Dec 20 16:37:10 1992
--- ../changed/tm-rs6000.h	Sun Dec 20 16:38:28 1992
***************
*** 613,618 ****
--- 613,623 ----
    }						\
  }
  
+ extern void rs6000_child_to_load PARAMS((char *arg, int from_tty));
+ /* CHILD_TO_LOAD should be defined to the name
+  of a function to be called for the child target
+  to dynamically load a file into the inferior process */
+ #define CHILD_TO_LOAD rs6000_child_to_load
  
  /* Flag for machine-specific stuff in shared files.  FIXME */
  #define IBM6000_TARGET
Technical Details
Message-ID: <MfBEuxi00WoiFOW1AI@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 dynamic loading patch
Message-ID: <MfBEuxi00WoiFOW1AI@andrew.cmu.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 20 Dec 1992 14:24:29 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 124