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]

[PATCH] Fix `next'-ing out of a signal handler on Linux/i386


FYI,

I committed the attached patch.  It is now possible to use the `next'
command to step out of a signal handler.  Using `step' however is
still broken.  Making that work will probably require some changes to
`infrun.c'.  But I'm not sure exactly on how to fix it, and even if I
find out, I'm not sure whether I should touch that file before the 5.0
release.

Mark


2000-03-08  Mark Kettenis  <kettenis@gnu.org>

	* i386-tdep.c (i386_linux_saved_pc_after_call): New function.
	* config/i386/tm-linux.h (SAVED_PC_AFTER_CALL): Define to call
	i386_linux_saved_pc_after_call.


Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.5
diff -u -p -r1.5 i386-tdep.c
--- i386-tdep.c	2000/03/04 23:37:33	1.5
+++ i386-tdep.c	2000/03/08 22:32:34
@@ -1024,6 +1024,17 @@ i386_linux_sigtramp_saved_sp (struct fra
   return read_memory_integer (addr + LINUX_SIGCONTEXT_SP_OFFSET, 4);
 }
 
+/* Immediately after a function call, return the saved pc.  */
+
+CORE_ADDR
+i386_linux_saved_pc_after_call (struct frame_info *frame)
+{
+  if (frame->signal_handler_caller)
+    return i386_linux_sigtramp_saved_pc (frame);
+
+  return read_memory_integer (read_register (SP_REGNUM), 4);
+}
+
 #endif /* I386_LINUX_SIGTRAMP */
 
 #ifdef STATIC_TRANSFORM_NAME
Index: config/i386/tm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-linux.h,v
retrieving revision 1.2
diff -u -p -r1.2 tm-linux.h
--- config/i386/tm-linux.h	2000/03/04 23:37:33	1.2
+++ config/i386/tm-linux.h	2000/03/08 22:32:34
@@ -154,6 +154,10 @@ extern CORE_ADDR i386_linux_sigtramp_sav
 
 extern CORE_ADDR i386_linux_sigtramp_saved_sp (struct frame_info *);
 
+#undef SAVED_PC_AFTER_CALL
+#define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame)
+extern CORE_ADDR i386_linux_saved_pc_after_call (struct frame_info *);
+
 /* When we call a function in a shared library, and the PLT sends us
    into the dynamic linker to find the function's real address, we
    need to skip over the dynamic linker call.  This function decides

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