- 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))
- {
- /* 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) = frame_id_build (deprecated_read_fp (), read_pc ());
- }
- else if (legacy_frame_p (current_gdbarch)
- && get_prev_frame (next_frame))
- {
- /* Things are looking seriously grim! Assume that the legacy
- get_prev_frame code has already created THIS frame and linked
- it in to the frame chain (a pretty bold assumption), extract
- the ID from THIS base / pc. */
- (*this_id) = frame_id_build (get_frame_base (get_prev_frame (next_frame)),
- get_frame_pc (get_prev_frame (next_frame)));
- }
- else
- {
- /* Outch! We're not trying to find the innermost frame's ID yet
- we're trying to unwind to a dummy. The architecture must
- provide the unwind_dummy_id() method. Abandon the unwind
- process but only after first warning the user. */
- internal_warning (__FILE__, __LINE__,
- "Missing unwind_dummy_id architecture method");
- (*this_id) = null_frame_id;
- return;
- }
- (*this_prologue_cache) = find_dummy_frame ((*this_id).code_addr,
- (*this_id).stack_addr);