+/* Pop *DUMMY_PTR, restoring program state to that before the
+ frame was created. */
+
+static void
+pop_dummy_frame (struct dummy_frame **dummy_ptr)
+{
+ struct dummy_frame *dummy = *dummy_ptr;
+
+ restore_infcall_suspend_state (dummy->caller_state);
+
+ iterate_over_breakpoints (pop_dummy_frame_bpt, dummy);
+
+ /* restore_infcall_control_state frees inf_state,
+ all that remains is to pop *dummy_ptr. */
+ *dummy_ptr = dummy->next;
+ xfree (dummy);
+
+ /* We've made right mess of GDB's local state, just discard
+ everything. */
+ reinit_frame_cache ();
+}
+
+/* Look up DUMMY_ID.
+ Return NULL if not found. */
+
+static struct dummy_frame **
+lookup_dummy_frame (struct frame_id dummy_id)
+{
+ struct dummy_frame **dp;
+
+ for (dp = &dummy_frame_stack; *dp != NULL; dp = &(*dp)->next)
+ {
+ if (frame_id_eq ((*dp)->id, dummy_id))
+ return dp;
+ }
+
+ return NULL;
+}
+
+/* Pop the dummy frame DUMMY_ID, restoring program state to that before the
+ frame was created.
+ On return reinit_frame_cache has been called.
+ If the frame isn't found, flag an internal error.
+
+ NOTE: This can only pop the one frame, even if it is in the middle of the
+ stack, because the other frames may be for different threads, and there's
+ currently no way to tell which stack frame is for which thread. */