From: Mark Kettenis <kettenis@wins.uva.nl>
To: gdb-patches@sources.redhat.com
Subject: [PATCH]: Turn FRAME_SAVED_PC into a functions for Linux/x86
Date: Mon, 26 Mar 2001 11:54:00 -0000 [thread overview]
Message-ID: <200103261954.f2QJs8b08024@delius.kettenis.local> (raw)
Another small step towards multi-arching the stuff. Checked in.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* i386-linux-tdep.c (i386_linux_sigtramp_saved_pc,
i386_linux_sigtramp_saved_sp): Make static.
(i386_linux_frame_saved_pc): New function based on the old
FRAME_SAVED_PC macro, but use read_memory_unsigned_integer instead
of read_memory_integer.
* config/i386/tm-linux.h (sigtramp_saved_pc): Remove definition.
(i386_linux_sigtramp_saved_pc): Remove prototype.
(FRAME_SAVED_PC): Redefine in terms of i386_linux_frame_saved_pc.
(i386_linux_frame_saved_pc): New prototype.
Index: i386-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-tdep.c,v
retrieving revision 1.5
diff -u -p -r1.5 i386-linux-tdep.c
--- i386-linux-tdep.c 2001/03/13 12:42:08 1.5
+++ i386-linux-tdep.c 2001/03/26 19:46:20
@@ -255,7 +255,7 @@ i386_linux_sigcontext_addr (struct frame
/* Assuming FRAME is for a Linux sigtramp routine, return the saved
program counter. */
-CORE_ADDR
+static CORE_ADDR
i386_linux_sigtramp_saved_pc (struct frame_info *frame)
{
CORE_ADDR addr;
@@ -269,12 +269,34 @@ i386_linux_sigtramp_saved_pc (struct fra
/* Assuming FRAME is for a Linux sigtramp routine, return the saved
stack pointer. */
-CORE_ADDR
+static CORE_ADDR
i386_linux_sigtramp_saved_sp (struct frame_info *frame)
{
CORE_ADDR addr;
addr = i386_linux_sigcontext_addr (frame);
return read_memory_integer (addr + LINUX_SIGCONTEXT_SP_OFFSET, 4);
+}
+
+/* Return the saved program counter for FRAME. */
+
+CORE_ADDR
+i386_linux_frame_saved_pc (struct frame_info *frame)
+{
+ if (frame->signal_handler_caller)
+ return i386_linux_sigtramp_saved_pc (frame);
+
+ /* See comment in "i386/tm-linux.h" for an explanation what this
+ "FRAMELESS_SIGNAL" stuff is supposed to do.
+
+ FIXME: kettenis/2001-03-26: That comment should eventually be
+ moved to this file. */
+ if (FRAMELESS_SIGNAL (frame))
+ {
+ CORE_ADDR sp = i386_linux_sigtramp_saved_sp (frame->next);
+ return read_memory_unsigned_integer (sp, 4);
+ }
+
+ return read_memory_unsigned_integer (frame->frame + 4, 4);
}
/* Immediately after a function call, return the saved pc. */
Index: config/i386/tm-linux.h
===================================================================
RCS file: /cvs/src/src/gdb/config/i386/tm-linux.h,v
retrieving revision 1.11
diff -u -p -r1.11 tm-linux.h
--- config/i386/tm-linux.h 2001/03/17 22:24:00 1.11
+++ config/i386/tm-linux.h 2001/03/26 19:46:20
@@ -46,12 +46,6 @@ extern struct link_map_offsets *i386_lin
#define IN_SIGTRAMP(pc, name) i386_linux_in_sigtramp (pc, name)
extern int i386_linux_in_sigtramp (CORE_ADDR, char *);
-/* We need our own version of sigtramp_saved_pc to get the saved PC in
- a sigtramp routine. */
-
-#define sigtramp_saved_pc i386_linux_sigtramp_saved_pc
-extern CORE_ADDR i386_linux_sigtramp_saved_pc (struct frame_info *);
-
/* Signal trampolines don't have a meaningful frame. As in tm-i386.h,
the frame pointer value we use is actually the frame pointer of the
calling frame--that is, the frame which was in progress when the
@@ -89,14 +83,8 @@ extern CORE_ADDR i386_linux_sigtramp_sav
: 0)))
#undef FRAME_SAVED_PC
-#define FRAME_SAVED_PC(FRAME) \
- ((FRAME)->signal_handler_caller \
- ? sigtramp_saved_pc (FRAME) \
- : (FRAMELESS_SIGNAL (FRAME) \
- ? read_memory_integer (i386_linux_sigtramp_saved_sp ((FRAME)->next), 4) \
- : read_memory_integer ((FRAME)->frame + 4, 4)))
-
-extern CORE_ADDR i386_linux_sigtramp_saved_sp (struct frame_info *);
+#define FRAME_SAVED_PC(frame) i386_linux_frame_saved_pc (frame)
+extern CORE_ADDR i386_linux_frame_saved_pc (struct frame_info *frame);
#undef SAVED_PC_AFTER_CALL
#define SAVED_PC_AFTER_CALL(frame) i386_linux_saved_pc_after_call (frame)
reply other threads:[~2001-03-26 11:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200103261954.f2QJs8b08024@delius.kettenis.local \
--to=kettenis@wins.uva.nl \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox