[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Patch for GDB



OK, I tested this build of gdb, and it seems to be behaving... although it 
still doesn't support threads (the thread patch seems to be applied during the 
build and is named i386-threads.patch - ick). I may look at it and see if it 
will apply cleanly to PowerPC, but I would be getting a bit out of my depth in 
doing so...

 This patch basically fixes a bunch of header macros, so it should be fairly 
safe (it is, in any case, confined to Linux/PowerPC-specific files. The one 
change that bothers me (ie, I couldn't see a real clean way to do it) was 
get_saved_register. I just removed it from the ppclinux-tdep.c (commented it, 
actually) since it conflicts with an identical definition in findvars.c - 
setting USE_GENERIC_DUMMY_FRAMES too0 would also have removed the ppclinux 
definition, but I'm not sure what all else that would have done so I took what 
I hope was the safe way out.

Anyway, here is the patch, and binary debs are/will be available on 
http://southpole.penguinpowered.com/
diff -ur gdb-4.18.19990928.old/gdb/Makefile.in gdb-4.18.19990928/gdb/Makefile.in
--- gdb-4.18.19990928.old/gdb/Makefile.in	Tue Sep 28 15:57:41 1999
+++ gdb-4.18.19990928/gdb/Makefile.in	Mon Feb 21 08:55:07 2000
@@ -220,9 +220,11 @@
 INSTALLED_LIBS=-lbfd -lreadline -lopcodes -liberty \
 	$(TERMCAP) $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
 	-lmmalloc -lintl -liberty
+# This fix is strictly correcting a typo in the makefile.in - $(LIBIBERTY) 
+# is/was  listed twice in CLIBS
 CLIBS = $(SIM) $(BFD) $(READLINE) $(OPCODES) $(INTL) $(LIBIBERTY) \
 	$(TERMCAP) $(XM_CLIBS) $(TM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ \
-	$(MMALLOC) $(LIBIBERTY) $(WIN32LIBS)
+	$(MMALLOC) $(WIN32LIBS)
 CDEPS = $(XM_CDEPS) $(TM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE) \
 	$(OPCODES) $(MMALLOC) $(INTL_DEPS) $(LIBIBERTY) @CONFIG_DEPS@
 
diff -ur gdb-4.18.19990928.old/gdb/config/powerpc/tm-linux.h gdb-4.18.19990928/gdb/config/powerpc/tm-linux.h
--- gdb-4.18.19990928.old/gdb/config/powerpc/tm-linux.h	Mon Feb 21 08:21:57 2000
+++ gdb-4.18.19990928/gdb/config/powerpc/tm-linux.h	Mon Feb 21 09:51:03 2000
@@ -42,11 +42,29 @@
 /* Offset to saved PC in sigcontext, from <linux/signal.h>.  */
 #define SIGCONTEXT_PC_OFFSET 184
 
+/* Advance PC across any function entry prologue instructions
+ *    to reach some "real" code.  */
+
+/* added macro and prototype to direct into new ppclinux_skip_prologue */
+extern CORE_ADDR ppclinux_skip_prologue PARAMS ((CORE_ADDR));
+#undef SKIP_PROLOGUE
+#define SKIP_PROLOGUE(pc) (ppclinux_skip_prologue (pc))
+
+extern CORE_ADDR skip_prologue PARAMS ((CORE_ADDR, struct rs6000_framedata *));
+
 /* Avoid warning from redefinition in tm-sysv4.h */
 #undef SKIP_TRAMPOLINE_CODE
 
 /* We need this file for the SOLIB_TRAMPOLINE stuff. */
 #include "tm-sysv4.h"
+
+/* Linux/PowerPC seems to be the only platform whose function was named push_arguments instead of 
+ * <platform>_push_arguments. Renamed it, and defined the needed macro to call it's instead of the
+ * definition in tm-rs6000.h */
+#undef PUSH_ARGUMENTS
+#define PUSH_ARGUMENTS(nargs, args, sp, struct_return, struct_addr) \
+  (ppclinux_push_arguments((nargs), (args), (sp), (struct_return), (struct_addr)))
+extern CORE_ADDR ppclinux_push_arguments PARAMS ((int, struct value **, CORE_ADDR, int, CORE_ADDR));
 
 /* BREAKPOINT_FROM_PC uses the program counter value to determine the
    breakpoint that should be used */
diff -ur gdb-4.18.19990928.old/gdb/ppclinux-tdep.c gdb-4.18.19990928/gdb/ppclinux-tdep.c
--- gdb-4.18.19990928.old/gdb/ppclinux-tdep.c	Mon Feb 21 08:21:57 2000
+++ gdb-4.18.19990928/gdb/ppclinux-tdep.c	Mon Feb 21 10:05:21 2000
@@ -54,6 +54,18 @@
 
 extern struct obstack frame_cache_obstack;
 
+/* Again, there seemed to have been a movement toward 
+ * <platform>_skip_prologue, which called a generic function
+ * This code was copied from rs6000-tdep.c */
+CORE_ADDR
+ppclinux_skip_prologue (pc)
+	     CORE_ADDR pc;
+{
+	  struct rs6000_framedata frame;
+	    pc = skip_prologue (pc, &frame);
+	      return pc;
+}
+
 struct frame_extra_info
 {
   /* Functions calling alloca() change the value of the stack
@@ -550,7 +562,8 @@
    starting from r4. */
 
 CORE_ADDR
-push_arguments (nargs, args, sp, struct_return, struct_addr)
+/* renamed from push_arguments to ppclinux_push_arguments */
+ppclinux_push_arguments (nargs, args, sp, struct_return, struct_addr)
     int nargs;
     value_ptr *args;
     CORE_ADDR sp;
@@ -1407,6 +1420,9 @@
 /* Function: get_saved_register
    Just call the generic_get_saved_register function.  */
 
+/* This function is declared identically in findvar.c, I'm not sure 
+ * which one should go away but for now I'm keeping my changes in 
+ * the PowerPC-specific files.
 #ifdef USE_GENERIC_DUMMY_FRAMES
 void
 get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
@@ -1421,6 +1437,7 @@
 			      frame, regnum, lval);
 }
 #endif
+*/
 
 #ifdef ELF_OBJECT_FORMAT

Reply to: