summaryrefslogtreecommitdiff
path: root/gdb/frame.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-01-18 17:25:23 +0000
committerAndrew Cagney <cagney@redhat.com>2003-01-18 17:25:23 +0000
commit84ff55915cf2a322e5b6f1afcbc6f2400b3b4927 (patch)
tree95df15a88cc145e01610ae7f5f6f0d0ddac8bb36 /gdb/frame.c
parenta8f2ec5f48af6f669a6bf96dc0dc21583eb8942c (diff)
downloadgdb-84ff55915cf2a322e5b6f1afcbc6f2400b3b4927.tar.gz
2003-01-18 Andrew Cagney <ac131313@redhat.com>
* dummy-frame.h (dummy_frame_id_unwind): Delete declaration. (dummy_frame_pc_unwind, dummy_frame_register_unwind): Ditto. (struct frame_unwind): Declare opaque. (dummy_frame_p): Declare function. * dummy-frame.c (dummy_frame_id_unwind): Make static. (dummy_frame_pc_unwind, dummy_frame_register_unwind): Ditto. * dummy-frame.c: Include "frame-unwind.h". (dummy_frame_p): New function. (dummy_frame_unwind): New variable. * frame.c: Include "frame-unwind.h". (frame_pc_unwind, frame_id_unwind, frame_register_unwind): Update to use the new unwind field. (set_unwind_by_pc): Delete function. (create_new_frame, get_prev_frame): Set unwind field using frame_unwind_find_by_pc. (trad_frame_unwind, trad_frame_unwinder): New variables. * frame.h (trad_frame_unwind): Declare variable. (frame_id_unwind_ftype): Delete declaration. (frame_pc_unwind_ftype, frame_register_unwind_ftype): Ditto. (struct frame_unwind): Declare opaque. (struct frame_info): Replace the fields id_unwind, pc_unwind and register_unwind with a single unwind pointer. * frame-unwind.h, frame-unwind.c: New files. * Makefile.in (SFILES): Add frame-unwind.c. (frame_unwind_h): Define. (COMMON_OBS): Add frame-unwind.o. (frame-unwind.o): Specify dependencies. (frame.o, dummy-frame.o): Update dependencies.
Diffstat (limited to 'gdb/frame.c')
-rw-r--r--gdb/frame.c59
1 files changed, 15 insertions, 44 deletions
diff --git a/gdb/frame.c b/gdb/frame.c
index 78811e4b959..f85b54a2f3d 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -34,6 +34,7 @@
#include "gdbcore.h"
#include "annotate.h"
#include "language.h"
+#include "frame-unwind.h"
/* Return a frame uniq ID that can be used to, later, re-find the
frame. */
@@ -127,7 +128,7 @@ frame_pc_unwind (struct frame_info *frame)
{
if (!frame->pc_unwind_cache_p)
{
- frame->pc_unwind_cache = frame->pc_unwind (frame, &frame->unwind_cache);
+ frame->pc_unwind_cache = frame->unwind->pc (frame, &frame->unwind_cache);
frame->pc_unwind_cache_p = 1;
}
return frame->pc_unwind_cache;
@@ -138,7 +139,7 @@ frame_id_unwind (struct frame_info *frame)
{
if (!frame->id_unwind_cache_p)
{
- frame->id_unwind (frame, &frame->unwind_cache, &frame->id_unwind_cache);
+ frame->unwind->id (frame, &frame->unwind_cache, &frame->id_unwind_cache);
frame->id_unwind_cache_p = 1;
}
return frame->id_unwind_cache;
@@ -185,8 +186,8 @@ frame_register_unwind (struct frame_info *frame, int regnum,
}
/* Ask this frame to unwind its register. */
- frame->register_unwind (frame, &frame->unwind_cache, regnum,
- optimizedp, lvalp, addrp, realnump, bufferp);
+ frame->unwind->reg (frame, &frame->unwind_cache, regnum,
+ optimizedp, lvalp, addrp, realnump, bufferp);
}
void
@@ -714,6 +715,14 @@ frame_saved_regs_id_unwind (struct frame_info *next_frame, void **cache,
id->base = base;
}
+const struct frame_unwind trad_frame_unwinder = {
+ frame_saved_regs_pc_unwind,
+ frame_saved_regs_id_unwind,
+ frame_saved_regs_register_unwind
+};
+const struct frame_unwind *trad_frame_unwind = &trad_frame_unwinder;
+
+
/* Function: get_saved_register
Find register number REGNUM relative to FRAME and put its (raw,
target format) contents in *RAW_BUFFER.
@@ -813,42 +822,6 @@ deprecated_generic_get_saved_register (char *raw_buffer, int *optimized,
deprecated_read_register_gen (regnum, raw_buffer);
}
-/* Using the PC, select a mechanism for unwinding a frame returning
- the previous frame. The register unwind function should, on
- demand, initialize the ->context object. */
-
-static void
-set_unwind_by_pc (CORE_ADDR pc, CORE_ADDR fp,
- frame_register_unwind_ftype **unwind_register,
- frame_pc_unwind_ftype **unwind_pc,
- frame_id_unwind_ftype **unwind_id)
-{
- if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES)
- {
- /* Still need to set this to something. The ``info frame'' code
- calls this function to find out where the saved registers are.
- Hopefully this is robust enough to stop any core dumps and
- return vaguely correct values.. */
- *unwind_register = frame_saved_regs_register_unwind;
- *unwind_pc = frame_saved_regs_pc_unwind;
- *unwind_id = frame_saved_regs_id_unwind;
- }
- else if (DEPRECATED_PC_IN_CALL_DUMMY_P ()
- ? DEPRECATED_PC_IN_CALL_DUMMY (pc, 0, 0)
- : pc_in_dummy_frame (pc))
- {
- *unwind_register = dummy_frame_register_unwind;
- *unwind_pc = dummy_frame_pc_unwind;
- *unwind_id = dummy_frame_id_unwind;
- }
- else
- {
- *unwind_register = frame_saved_regs_register_unwind;
- *unwind_pc = frame_saved_regs_pc_unwind;
- *unwind_id = frame_saved_regs_id_unwind;
- }
-}
-
/* Create an arbitrary (i.e. address specified by user) or innermost frame.
Always returns a non-NULL value. */
@@ -891,8 +864,7 @@ create_new_frame (CORE_ADDR addr, CORE_ADDR pc)
INIT_EXTRA_FRAME_INFO (0, fi);
/* Select/initialize an unwind function. */
- set_unwind_by_pc (fi->pc, fi->frame, &fi->register_unwind,
- &fi->pc_unwind, &fi->id_unwind);
+ fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc);
return fi;
}
@@ -1135,8 +1107,7 @@ get_prev_frame (struct frame_info *next_frame)
(and probably other architectural information). The PC lets you
check things like the debug info at that point (dwarf2cfi?) and
use that to decide how the frame should be unwound. */
- set_unwind_by_pc (prev->pc, prev->frame, &prev->register_unwind,
- &prev->pc_unwind, &prev->id_unwind);
+ prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc);
/* NOTE: cagney/2002-11-18: The code segments, found in
create_new_frame and get_prev_frame(), that initializes the