- if (gdbarch_push_dummy_call_p (current_gdbarch))
- /* When there is no push_dummy_call method, should this code
- simply error out. That would the implementation of this method
- for all ABIs (which is probably a good thing). */
- sp = gdbarch_push_dummy_call (current_gdbarch, function, current_regcache,
- bp_addr, nargs, args, sp, struct_return,
- struct_addr);
- else if (DEPRECATED_PUSH_ARGUMENTS_P ())
- /* Keep old targets working. */
- sp = DEPRECATED_PUSH_ARGUMENTS (nargs, args, sp, struct_return,
- struct_addr);
- else
- error ("This target does not support function calls");
-
- if (DEPRECATED_PUSH_RETURN_ADDRESS_P ())
- /* for targets that use no CALL_DUMMY */
- /* There are a number of targets now which actually don't write
- any CALL_DUMMY instructions into the target, but instead just
- save the machine state, push the arguments, and jump directly
- to the callee function. Since this doesn't actually involve
- executing a JSR/BSR instruction, the return address must be set
- up by hand, either by pushing onto the stack or copying into a
- return-address register as appropriate. Formerly this has been
- done in PUSH_ARGUMENTS, but that's overloading its
- functionality a bit, so I'm making it explicit to do it here. */
- /* NOTE: cagney/2003-04-22: The first parameter ("real_pc") has
- been replaced with zero, it turns out that no implementation
- used that parameter. This occured because the value being
- supplied - the address of the called function's entry point
- instead of the address of the breakpoint that the called
- function should return to - wasn't useful. */
- sp = DEPRECATED_PUSH_RETURN_ADDRESS (0, sp);
-
- /* NOTE: cagney/2003-03-23: Diable this code when there is a
- push_dummy_call() method. Since that method will have already
- handled any alignment issues, the code below is entirely
- redundant. */
- if (!gdbarch_push_dummy_call_p (current_gdbarch)
- && DEPRECATED_STACK_ALIGN_P () && !INNER_THAN (1, 2))
- {
- /* If stack grows up, we must leave a hole at the bottom, note
- that sp already has been advanced for the arguments! */
- sp = DEPRECATED_STACK_ALIGN (sp);
- }
+ sp = gdbarch_push_dummy_call (current_gdbarch, function,
+ get_current_regcache (), bp_addr, nargs, args,
+ sp, struct_return, struct_addr);
+
+ /* Set up a frame ID for the dummy frame so we can pass it to
+ set_momentary_breakpoint. We need to give the breakpoint a frame
+ ID so that the breakpoint code can correctly re-identify the
+ dummy breakpoint. */
+ /* Sanity. The exact same SP value is returned by PUSH_DUMMY_CALL,
+ saved as the dummy-frame TOS, and used by unwind_dummy_id to form
+ the frame ID's stack address. */
+ dummy_id = frame_id_build (sp, bp_addr);