- /* 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. */
- gdb_assert (gdbarch_unwind_dummy_id_p (current_gdbarch));
- (*this_id) = gdbarch_unwind_dummy_id (current_gdbarch, next_frame);
- (*this_prologue_cache) = find_dummy_frame ((*this_id).code_addr,
- (*this_id).stack_addr);
+
+ /* Don't bother unless there is at least one dummy frame. */
+ if (dummy_frame_stack != NULL)
+ {
+ struct dummy_frame *dummyframe;
+ /* Use an architecture specific method to extract this frame's
+ dummy ID, assuming it is a dummy frame. */
+ struct frame_id this_id
+ = gdbarch_dummy_id (get_frame_arch (this_frame), this_frame);
+ struct dummy_frame_id dummy_id = { this_id, inferior_ptid };
+
+ /* Use that ID to find the corresponding cache entry. */
+ for (dummyframe = dummy_frame_stack;
+ dummyframe != NULL;
+ dummyframe = dummyframe->next)
+ {
+ if (dummy_frame_id_eq (&dummyframe->id, &dummy_id))
+ {
+ struct dummy_frame_cache *cache;
+
+ cache = FRAME_OBSTACK_ZALLOC (struct dummy_frame_cache);
+ cache->prev_regcache = get_infcall_suspend_state_regcache
+ (dummyframe->caller_state);
+ cache->this_id = this_id;
+ (*this_prologue_cache) = cache;
+ return 1;
+ }
+ }
+ }
+ return 0;