42 #define RAW_FUNCTION_ADDRESS_FORMAT "at 0x%s"
43 #define RAW_FUNCTION_ADDRESS_SIZE (sizeof (RAW_FUNCTION_ADDRESS_FORMAT) \
44 + 2 * sizeof (CORE_ADDR))
79 _(
"Coercion of floats to doubles "
80 "when calling functions is %s.\n"),
97 _(
"Unwinding of stack if a signal is "
98 "received while in a call dummy is %s.\n"),
123 _(
"Unwind stack if a C++ exception is "
124 "unhandled while in a call dummy is %s.\n"),
136 static struct value *
159 struct value *new_value;
295 int found_descriptor = 0;
306 if (funaddr != nfunaddr)
307 found_descriptor = 1;
309 if (!found_descriptor)
315 error (
_(
"Invalid data type for function to be called."));
317 if (retval_type != NULL)
328 struct value **args,
int nargs,
336 args, nargs, value_type, real_pc, bp_addr,
387 int saved_in_infcall = call_thread->control.in_infcall;
388 ptid_t call_thread_ptid = call_thread->ptid;
396 call_thread->control.in_infcall = 1;
403 call_thread->control.proceed_to_finish = 1;
409 proceed (real_pc, GDB_SIGNAL_0);
464 if (caught_error.
reason < 0)
466 if (call_thread != NULL)
470 if (call_thread != NULL)
471 call_thread->control.in_infcall = saved_in_infcall;
529 else if (registers_valid)
575 saver =
xmalloc (
sizeof (*saver));
603 int nargs,
struct value **args,
605 void *dummy_dtor_data)
608 struct type *values_type, *target_values_type;
612 struct cleanup *inf_status_cleanup;
622 struct cleanup *terminate_bp_cleanup;
628 struct cleanup *context_saver_cleanup;
637 error (
_(
"May not call functions while looking at trace frames."));
640 error (
_(
"Cannot call functions in reverse mode."));
646 error (
_(
"This target does not support function calls."));
730 if (stack_temporaries)
732 struct value *lastval;
775 hidden_first_param_p = 1;
784 target_values_type = values_type;
807 target_values_type, &real_pc, &bp_addr,
821 bp_addr_as_address = bp_addr;
824 if (bp_bytes != NULL)
840 bp_addr = dummy_addr;
848 error (
_(
"Too few arguments in function call."));
853 for (i = nargs - 1; i >= 0; i--)
856 struct type *param_type;
873 param_type, prototyped, &sp);
895 if (struct_return || hidden_first_param_p
920 if (hidden_first_param_p)
922 struct value **new_args;
925 new_args =
xmalloc (
sizeof (
struct value *) * (nargs + 1));
928 memcpy (&new_args[1], &args[0],
sizeof (
struct value *) * nargs);
940 bp_addr, nargs, args,
941 sp, struct_return, struct_addr);
1011 if (dummy_dtor != NULL)
1013 dummy_dtor, dummy_dtor_data);
1037 call_thread_ptid = tp->
ptid;
1051 name_buf,
sizeof (name_buf));
1063 An error occurred while in a function called from GDB.\n\
1064 Evaluation of the expression containing the function\n\
1065 (%s) will be abandoned.\n\
1066 When the function is done executing, GDB will silently stop."),
1080 name_buf,
sizeof (name_buf));
1090 error (
_(
"The program being debugged exited while in a function "
1091 "called from GDB.\n"
1092 "Evaluation of the expression containing the function\n"
1093 "(%s) will be abandoned."),
1100 name_buf,
sizeof (name_buf));
1111 The program received a signal in another thread while\n\
1112 making a function call from GDB.\n\
1113 Evaluation of the expression containing the function\n\
1114 (%s) will be abandoned.\n\
1115 When the function is done executing, GDB will silently stop."),
1119 The program stopped in another thread while making a function call from GDB.\n\
1120 Evaluation of the expression containing the function\n\
1121 (%s) will be abandoned.\n\
1122 When the function is done executing, GDB will silently stop."),
1130 name_buf,
sizeof (name_buf)));
1155 The program being debugged was signaled while in a function called from GDB.\n\
1156 GDB has restored the context to what it was before the call.\n\
1157 To change this behavior use \"set unwindonsignal off\".\n\
1158 Evaluation of the expression containing the function\n\
1159 (%s) will be abandoned."),
1173 The program being debugged was signaled while in a function called from GDB.\n\
1174 GDB remains in the frame where the signal was received.\n\
1175 To change this behavior use \"set unwindonsignal on\".\n\
1176 Evaluation of the expression containing the function\n\
1177 (%s) will be abandoned.\n\
1178 When the function is done executing, GDB will silently stop."),
1194 The program being debugged entered a std::terminate call, most likely\n\
1195 caused by an unhandled C++ exception. GDB blocked this call in order\n\
1196 to prevent the program from being terminated, and has restored the\n\
1197 context to its original state before the call.\n\
1198 To change this behaviour use \"set unwind-on-terminating-exception off\".\n\
1199 Evaluation of the expression containing the function (%s)\n\
1200 will be abandoned."),
1221 The program being debugged stopped while in a function called from GDB.\n\
1222 Evaluation of the expression containing the function\n\
1223 (%s) will be abandoned.\n\
1224 When the function is done executing, GDB will silently stop."),
1238 struct value *retval = NULL;
1246 else if (struct_return || hidden_first_param_p)
1248 if (stack_temporaries)
1298 Set coercion of floats to doubles when calling functions."),
_(
"\
1299 Show coercion of floats to doubles when calling functions"),
_(
"\
1300 Variables of type float should generally be converted to doubles before\n\
1301 calling an unprototyped function, and left alone when calling a prototyped\n\
1302 function. However, some older debug info formats do not provide enough\n\
1303 information to determine that a function is prototyped. If this flag is\n\
1304 set, GDB will perform the conversion for a function it considers\n\
1306 The default is to perform the conversion.\n"),
1313 Set unwinding of stack if a signal is received while in a call dummy."),
_(
"\
1314 Show unwinding of stack if a signal is received while in a call dummy."),
_(
"\
1315 The unwindonsignal lets the user determine what gdb should do if a signal\n\
1316 is received while in a function called from gdb (call dummy). If set, gdb\n\
1317 unwinds the stack and restore the context to what as it was before the call.\n\
1318 The default is to stop in the frame where the signal was received."),
1325 Set unwinding of stack if std::terminate is called while in call dummy."),
_(
"\
1326 Show unwinding of stack if std::terminate() is called while in a call dummy."),
1328 The unwind on terminating exception flag lets the user determine\n\
1329 what gdb should do if a std::terminate() call is made from the\n\
1330 default exception handler. If set, gdb unwinds the stack and restores\n\
1331 the context to what it was before the call. If unset, gdb allows the\n\
1332 std::terminate call to proceed.\n\
1333 The default is to unwind the frame."),
#define target_can_async_p()
char * hex_string(LONGEST num)
void restore_infcall_control_state(struct infcall_control_state *)
ptid_t user_visible_resume_ptid(int step)
struct value * call_function_by_hand(struct value *function, int nargs, struct value **args)
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
struct thread_info * find_thread_ptid(ptid_t ptid)
int class_or_union_p(const struct type *t)
struct value * value_addr(struct value *arg1)
struct type * builtin_long_double
#define SYMBOL_PRINT_NAME(symbol)
static int coerce_float_to_double_p
struct frame_info * get_current_frame(void)
int ptid_equal(ptid_t ptid1, ptid_t ptid2)
struct value * value_from_contents_and_address(struct type *type, const gdb_byte *valaddr, CORE_ADDR address)
static const char * get_function_name(CORE_ADDR funaddr, char *buf, int buf_size)
CORE_ADDR gdbarch_frame_align(struct gdbarch *gdbarch, CORE_ADDR address)
int gdbarch_push_dummy_code_p(struct gdbarch *gdbarch)
struct value * value_ref(struct value *arg1)
int gdbarch_inner_than(struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
struct infcall_suspend_state * save_infcall_suspend_state(void)
LONGEST value_as_long(struct value *val)
void dummy_frame_pop(struct frame_id dummy_id, ptid_t ptid)
void breakpoint_auto_delete(bpstat bs)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
void register_dummy_frame_dtor(struct frame_id dummy_id, ptid_t ptid, dummy_frame_dtor_ftype *dtor, void *dtor_data)
CORE_ADDR get_frame_sp(struct frame_info *this_frame)
void internal_error(const char *file, int line, const char *fmt,...)
struct thread_info * inferior_thread(void)
void init_sal(struct symtab_and_line *sal)
CORE_ADDR gdbarch_deprecated_function_start_offset(struct gdbarch *gdbarch)
int thread_stack_temporaries_enabled_p(ptid_t ptid)
static int unwind_on_terminating_exception_p
const struct gdb_exception exception_none
enum language la_language
struct obj_section * section
struct cleanup * make_cleanup_restore_infcall_suspend_state(struct infcall_suspend_state *)
struct value * call_function_by_hand_dummy(struct value *function, int nargs, struct value **args, dummy_frame_dtor_ftype *dummy_dtor, void *dummy_dtor_data)
#define TYPE_PROTOTYPED(t)
#define TYPE_FIELD_TYPE(thistype, n)
struct value * allocate_value(struct type *type)
struct regcache * dummy_frame_context_saver_get_regs(struct dummy_frame_context_saver *saver)
struct regcache * get_current_regcache(void)
struct obj_section * find_pc_overlay(CORE_ADDR pc)
struct regcache * regcache_dup(struct regcache *src)
void null_cleanup(void *arg)
#define MSYMBOL_PRINT_NAME(symbol)
struct cmd_list_element * setlist
int gdbarch_call_dummy_location(struct gdbarch *gdbarch)
int gdbarch_frame_align_p(struct gdbarch *gdbarch)
struct type * check_typedef(struct type *type)
#define TYPE_GNU_IFUNC(t)
#define CATCH(EXCEPTION, MASK)
void dummy_frame_push(struct infcall_suspend_state *caller_state, const struct frame_id *dummy_id, ptid_t ptid)
struct target_ops current_target
void fprintf_filtered(struct ui_file *stream, const char *format,...)
static void dummy_frame_context_saver_dtor(void *data_voidp, int registers_valid)
struct symbol * find_pc_function(CORE_ADDR pc)
struct value * value_cast_pointers(struct type *type, struct value *arg2, int subclass_check)
CORE_ADDR gdbarch_push_dummy_code(struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache)
CORE_ADDR gdbarch_convert_from_func_ptr_addr(struct gdbarch *gdbarch, CORE_ADDR addr, struct target_ops *targ)
int using_struct_return(struct gdbarch *gdbarch, struct value *function, struct type *value_type)
struct cmd_list_element * showlist
int get_traceframe_number(void)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
struct value * value_coerce_to_target(struct value *val)
void( dummy_frame_dtor_ftype)(void *data, int registers_valid)
void finish_thread_state(ptid_t ptid)
struct gdbarch * get_type_arch(const struct type *type)
void _initialize_infcall(void)
enum return_value_convention gdbarch_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
void push_thread_stack_temporary(ptid_t ptid, struct value *v)
struct value * value_cast(struct type *type, struct value *arg2)
#define target_has_execution
char * xstrprintf(const char *format,...)
CORE_ADDR gdbarch_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
void async_disable_stdin(void)
struct value * get_last_thread_stack_temporary(ptid_t)
static CORE_ADDR push_dummy_code(struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache)
static struct gdb_exception run_inferior_call(struct thread_info *call_thread, CORE_ADDR real_pc)
struct breakpoint * set_momentary_breakpoint(struct gdbarch *gdbarch, struct symtab_and_line sal, struct frame_id frame_id, enum bptype type)
void disable_watchpoints_before_interactive_call_start(void)
int stopped_by_random_signal
void discard_infcall_control_state(struct infcall_control_state *)
void throw_exception(struct gdb_exception exception)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)
void discard_cleanups(struct cleanup *old_chain)
const struct language_defn * current_language
CORE_ADDR entry_point_address(void)
#define TYPE_TARGET_TYPE(thistype)
int gdbarch_frame_red_zone_size(struct gdbarch *gdbarch)
struct type * builtin_double
struct bound_minimal_symbol lookup_minimal_symbol_by_pc(CORE_ADDR pc)
struct dummy_frame_context_saver * dummy_frame_context_saver_setup(struct frame_id dummy_id, ptid_t ptid)
void proceed(CORE_ADDR addr, enum gdb_signal siggnal)
#define SYMBOL_BLOCK_VALUE(symbol)
struct breakpoint * set_longjmp_breakpoint_for_call_dummy(void)
#define RAW_FUNCTION_ADDRESS_FORMAT
#define TYPE_CODE(thistype)
static void show_unwind_on_terminating_exception_p(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
void clear_proceed_status(int step)
void read_value_memory(struct value *val, int embedded_offset, int stack, CORE_ADDR memaddr, gdb_byte *buffer, size_t length)
const gdb_byte * gdbarch_breakpoint_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
CORE_ADDR find_function_addr(struct value *function, struct type **retval_type)
struct minimal_symbol * minsym
struct program_space * pspace
#define TYPE_NFIELDS(thistype)
void set_std_terminate_breakpoint(void)
static struct value * value_arg_coerce(struct gdbarch *gdbarch, struct value *arg, struct type *param_type, int is_prototyped, CORE_ADDR *sp)
#define CHECK_TYPEDEF(TYPE)
void observer_notify_inferior_call_post(ptid_t thread, CORE_ADDR address)
void regcache_xfree(struct regcache *regcache)
struct breakpoint * related_breakpoint
void observer_notify_inferior_call_pre(ptid_t thread, CORE_ADDR address)
struct program_space * current_program_space
static void show_unwind_on_signal_p(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
void value_force_lval(struct value *v, CORE_ADDR addr)
static void cleanup_delete_std_terminate_breakpoint(void *ignore)
struct type * value_type(const struct value *value)
#define SYMBOL_TYPE(symbol)
struct value * ada_convert_actual(struct value *actual, struct type *formal_type0)
void dummy_frame_context_saver_drop(struct dummy_frame_context_saver *saver)
CORE_ADDR value_as_address(struct value *val)
void dummy_frame_context_saver_cleanup(void *data)
void wait_for_inferior(void)
int gdbarch_push_dummy_call_p(struct gdbarch *gdbarch)
gdb_byte * value_contents_raw(struct value *value)
static void show_coerce_float_to_double_p(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
void delete_std_terminate_breakpoint(void)
#define TYPE_LENGTH(thistype)
enum stop_stack_kind stop_stack_dummy
static struct type * find_function_return_type(CORE_ADDR pc)
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
#define RAW_FUNCTION_ADDRESS_SIZE
CORE_ADDR value_address(const struct value *value)
void enable_watchpoints_after_interactive_call_stop(void)
static int unwind_on_signal_p
int find_dummy_frame_dtor(dummy_frame_dtor_ftype *dtor, void *dtor_data)
static void dummy_frame_context_saver_free(struct dummy_frame_context_saver *saver)
struct type * builtin_void
void error(const char *fmt,...)
struct type * lookup_pointer_type(struct type *type)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
struct cleanup * make_cleanup_restore_infcall_control_state(struct infcall_control_state *)
void throw_error(enum errors error, const char *fmt,...)
#define gnu_ifunc_resolve_addr
void do_cleanups(struct cleanup *old_chain)
void add_setshow_boolean_cmd(const char *name, enum command_class theclass, int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
int language_pass_by_reference(struct type *type)
enum return_reason reason
struct type * builtin_int
struct infcall_control_state * save_infcall_control_state(void)
int gdbarch_return_in_first_hidden_param_p(struct gdbarch *gdbarch, struct type *type)