- struct dummy_frame *dummy = (*this_prologue_cache);
- if (dummy != NULL)
- {
- (*this_id) = dummy->id;
- return;
- }
- /* When unwinding a normal frame, the stack structure is determined
- by analyzing the frame's function's code (be it using brute force
- prologue analysis, or the dwarf2 CFI). In the case of a dummy
- frame, that simply isn't possible. The The PC is either the
- program entry point, or some random address on the stack. Trying
- to use that PC to apply standard frame ID unwind techniques is
- just asking for trouble. */
- if (gdbarch_unwind_dummy_id_p (current_gdbarch))
- {
- /* Assume call_function_by_hand(), via SAVE_DUMMY_FRAME_TOS,
- previously saved the dummy frame's ID. Things only work if
- the two return the same value. */
- gdb_assert (SAVE_DUMMY_FRAME_TOS_P ());
- /* Use an architecture specific method to extract the prev's
- dummy ID from the next frame. Note that this method uses
- frame_register_unwind to obtain the register values needed to
- determine the dummy frame's ID. */
- (*this_id) = gdbarch_unwind_dummy_id (current_gdbarch, next_frame);
- }
- else if (frame_relative_level (next_frame) < 0)
- {
- /* We're unwinding a sentinel frame, the PC of which is pointing
- at a stack dummy. Fake up the dummy frame's ID using the
- same sequence as is found a traditional unwinder. Once all
- architectures supply the unwind_dummy_id method, this code
- can go away. */
- (*this_id).base = read_fp ();
- (*this_id).pc = read_pc ();
- }
- else if (legacy_frame_p (current_gdbarch)
- && get_prev_frame (next_frame))
+ /* The dummy-frame sniffer always fills in the cache. */
+ struct dummy_frame_cache *cache
+ = (struct dummy_frame_cache *) *this_prologue_cache;
+
+ gdb_assert (cache != NULL);
+ (*this_id) = cache->this_id;
+}
+
+const struct frame_unwind dummy_frame_unwind =
+{
+ DUMMY_FRAME,
+ default_frame_unwind_stop_reason,
+ dummy_frame_this_id,
+ dummy_frame_prev_register,
+ NULL,
+ dummy_frame_sniffer,
+};
+
+/* See dummy-frame.h. */
+
+struct frame_id
+default_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
+{
+ CORE_ADDR sp, pc;
+
+ sp = get_frame_sp (this_frame);
+ pc = get_frame_pc (this_frame);
+ return frame_id_build (sp, pc);
+}
+
+static void
+fprint_dummy_frames (struct ui_file *file)
+{
+ struct dummy_frame *s;
+
+ for (s = dummy_frame_stack; s != NULL; s = s->next)