From d80b854b33baf5ebc3940cd5928dc06c8708750d Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 17 Jun 2009 18:43:24 +0000 Subject: [PATCH] * dummy-frame.c (deprecated_pc_in_call_dummy): Add GDBARCH parameter, use it instead of current_gdbarch. * frame.h (deprecated_pc_in_call_dummy): Add GDBARCH parameter. * arm-tdep.c (arm_skip_prologue): Pass architecture to deprecated_pc_in_call_dummy. * symtab.c (skip_prologue_using_sal): Add GDBARCH parameter. Use it instead of current_gdbarch. * symtab.h (skip_prologue_using_sal): Add GDBARCH parameter. * breakpoint.c (expand_line_sal_maybe): Pass architecture to skip_prologue_using_sal. * arm-tdep.c (skip_prologue_using_sal): Likewise. * lm32-tdep.c (lm32_skip_prologue): Likewise. * m32-tdep.c (m32c_skip_prologue): Likewise. * mips-tdep.c (mips_skip_prologue): Likewise. * moxie-tdep.c (moxie_skip_prologue): Likewise. * mt-tdep.c (mt_frame_unwind_cache): Likewise. * rs6000-tdep.c (rs6000_skip_prologue): Likewise. * frv-tdep.c (frv_analyze_prologue): Add GDBARCH parameter, pass it to skip_prologue_using_sal. Update call sites ... (frv_skip_prologue, frv_frame_unwind_cache): ... here. * mn10300-tdep.c (struct mn10300_prologue): Add GDBARCH member. (check_for_saved): Use it instead of current_gdbarch. (mn10300_analyze_prologue): Set it. * value.c (using_struct_return): Add GDBARCH parameter. Use it instead of current_gdbarch. * value.h (using_struct_return): Add GDBARCH parameter. * eval.c (evaluate_subexp_standard): Pass architecture to using_struct_return. * infcall.c (call_function_by_hand): Likewise. * stack.c (return_command): Likewise. * sparc-tdep.c (sparc32_push_dummy_code): Likewise. * symtab.c (in_prologue): Add GDBARCH parameter. Use it instead of current_gdbarch. * symtab.h (in_prologue): Add GDBARCH parameter. * infrun.c (handle_inferior_event): Pass architecture to in_prologue. * eval.c (evaluate_subexp_standard): Use expression architecture instead of current_gdbarch. * c-lang.c (evaluate_subexp_c): Use expression architecture and language instead of current_gdbarch and current_language. * printcmd.c (do_one_display): Use expression architecture instead of current_gdbarch. * infcmd.c (print_return_value): Use architecture of stop_regcache instead of current_gdbarch. (print_vector_info, print_float_info): Remove GDBARCH argument, use frame architecture instead. (vector_info, float_info): Update calls. * objc-lang.c (objc_skip_trampoline): Use frame architecture instead of current_gdbarch. * parse.c (write_dollar_variable): Use parse architecture instead of current_gdbarch. * source.c (line_info): Use objfile architecture instead of current_gdbarch. * symtab.c (find_function_start_sal): Use gdbarch instead of current_gdbarch. (print_msymbol_info): Use objfile architecture instead of current_gdbarch. * valops.c (value_assign): Use frame architecture instead of current_gdbarch. --- gdb/ChangeLog | 74 ++++++++++++++++++++++++++++++++++++++++++++++ gdb/arm-tdep.c | 7 +++-- gdb/breakpoint.c | 14 +++++++-- gdb/c-lang.c | 4 +-- gdb/dummy-frame.c | 4 +-- gdb/eval.c | 13 ++++---- gdb/frame.h | 2 +- gdb/frv-tdep.c | 10 ++++--- gdb/infcall.c | 3 +- gdb/infcmd.c | 16 +++++----- gdb/infrun.c | 2 +- gdb/lm32-tdep.c | 5 ++-- gdb/m32c-tdep.c | 2 +- gdb/mips-tdep.c | 5 ++-- gdb/mn10300-tdep.c | 6 +++- gdb/moxie-tdep.c | 3 +- gdb/mt-tdep.c | 2 +- gdb/objc-lang.c | 6 ++-- gdb/parse.c | 2 +- gdb/printcmd.c | 2 +- gdb/rs6000-tdep.c | 5 ++-- gdb/source.c | 2 +- gdb/sparc-tdep.c | 2 +- gdb/stack.c | 5 +++- gdb/symtab.c | 18 +++++------ gdb/symtab.h | 6 ++-- gdb/valops.c | 9 +++--- gdb/value.c | 5 ++-- gdb/value.h | 3 +- 29 files changed, 172 insertions(+), 65 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fdb4541d85..38c8afe54b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,77 @@ +2009-06-17 Ulrich Weigand + + * dummy-frame.c (deprecated_pc_in_call_dummy): Add GDBARCH parameter, + use it instead of current_gdbarch. + * frame.h (deprecated_pc_in_call_dummy): Add GDBARCH parameter. + * arm-tdep.c (arm_skip_prologue): Pass architecture to + deprecated_pc_in_call_dummy. + + * symtab.c (skip_prologue_using_sal): Add GDBARCH parameter. + Use it instead of current_gdbarch. + * symtab.h (skip_prologue_using_sal): Add GDBARCH parameter. + * breakpoint.c (expand_line_sal_maybe): Pass architecture to + skip_prologue_using_sal. + * arm-tdep.c (skip_prologue_using_sal): Likewise. + * lm32-tdep.c (lm32_skip_prologue): Likewise. + * m32-tdep.c (m32c_skip_prologue): Likewise. + * mips-tdep.c (mips_skip_prologue): Likewise. + * moxie-tdep.c (moxie_skip_prologue): Likewise. + * mt-tdep.c (mt_frame_unwind_cache): Likewise. + * rs6000-tdep.c (rs6000_skip_prologue): Likewise. + * frv-tdep.c (frv_analyze_prologue): Add GDBARCH parameter, pass + it to skip_prologue_using_sal. Update call sites ... + (frv_skip_prologue, frv_frame_unwind_cache): ... here. + + * mn10300-tdep.c (struct mn10300_prologue): Add GDBARCH member. + (check_for_saved): Use it instead of current_gdbarch. + (mn10300_analyze_prologue): Set it. + + * value.c (using_struct_return): Add GDBARCH parameter. Use it + instead of current_gdbarch. + * value.h (using_struct_return): Add GDBARCH parameter. + * eval.c (evaluate_subexp_standard): Pass architecture to + using_struct_return. + * infcall.c (call_function_by_hand): Likewise. + * stack.c (return_command): Likewise. + * sparc-tdep.c (sparc32_push_dummy_code): Likewise. + + * symtab.c (in_prologue): Add GDBARCH parameter. Use it instead of + current_gdbarch. + * symtab.h (in_prologue): Add GDBARCH parameter. + * infrun.c (handle_inferior_event): Pass architecture to in_prologue. + + * eval.c (evaluate_subexp_standard): Use expression architecture + instead of current_gdbarch. + + * c-lang.c (evaluate_subexp_c): Use expression architecture and + language instead of current_gdbarch and current_language. + + * printcmd.c (do_one_display): Use expression architecture instead + of current_gdbarch. + + * infcmd.c (print_return_value): Use architecture of stop_regcache + instead of current_gdbarch. + (print_vector_info, print_float_info): Remove GDBARCH argument, + use frame architecture instead. + (vector_info, float_info): Update calls. + + * objc-lang.c (objc_skip_trampoline): Use frame architecture + instead of current_gdbarch. + + * parse.c (write_dollar_variable): Use parse architecture instead + of current_gdbarch. + + * source.c (line_info): Use objfile architecture instead of + current_gdbarch. + + * symtab.c (find_function_start_sal): Use gdbarch instead of + current_gdbarch. + (print_msymbol_info): Use objfile architecture instead of + current_gdbarch. + + * valops.c (value_assign): Use frame architecture instead of + current_gdbarch. + 2009-06-17 Ulrich Weigand * buildsym.c (record_line): Remove call to gdbarch_addr_bits_remove. diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 933a2242fe..9ea5a0605b 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -539,7 +539,7 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) struct symtab_and_line sal; /* If we're in a dummy frame, don't even try to skip the prologue. */ - if (deprecated_pc_in_call_dummy (pc)) + if (deprecated_pc_in_call_dummy (gdbarch, pc)) return pc; /* See if we can determine the end of the prologue via the symbol table. @@ -547,7 +547,8 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) is greater. */ if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) { - CORE_ADDR post_prologue_pc = skip_prologue_using_sal (func_addr); + CORE_ADDR post_prologue_pc + = skip_prologue_using_sal (gdbarch, func_addr); if (post_prologue_pc != 0) return max (pc, post_prologue_pc); } @@ -559,7 +560,7 @@ arm_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) information. If the debug information could not be used to provide that bound, then use an arbitrary large number as the upper bound. */ /* Like arm_scan_prologue, stop no later than pc + 64. */ - limit_pc = skip_prologue_using_sal (pc); + limit_pc = skip_prologue_using_sal (gdbarch, pc); if (limit_pc == 0) limit_pc = pc + 64; /* Magic. */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 8732f2efbd..99909e7509 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -5420,8 +5420,18 @@ expand_line_sal_maybe (struct symtab_and_line sal) if (sym) expanded.sals[i] = find_function_start_sal (sym, 1); else - expanded.sals[i].pc - = gdbarch_skip_prologue (current_gdbarch, pc); + { + /* Since find_pc_partial_function returned true, + we should really always find the section here. */ + struct obj_section *section = find_pc_section (pc); + if (section) + { + struct gdbarch *gdbarch + = get_objfile_arch (section->objfile); + expanded.sals[i].pc + = gdbarch_skip_prologue (gdbarch, pc); + } + } } } } diff --git a/gdb/c-lang.c b/gdb/c-lang.c index b605d3e8ea..0d3b50a119 100644 --- a/gdb/c-lang.c +++ b/gdb/c-lang.c @@ -904,8 +904,8 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp, switch (dest_type & ~C_CHAR) { case C_STRING: - type = language_string_char_type (current_language, - current_gdbarch); + type = language_string_char_type (exp->language_defn, + exp->gdbarch); break; case C_WIDE_STRING: type = lookup_typename ("wchar_t", NULL, 0); diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c index 6e63686c11..90eb43100a 100644 --- a/gdb/dummy-frame.c +++ b/gdb/dummy-frame.c @@ -66,7 +66,7 @@ static struct dummy_frame *dummy_frame_stack = NULL; NOTE: cagney/2004-08-02: Code should not need to call this. */ int -deprecated_pc_in_call_dummy (CORE_ADDR pc) +deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc) { struct dummy_frame *dummyframe; for (dummyframe = dummy_frame_stack; @@ -75,7 +75,7 @@ deprecated_pc_in_call_dummy (CORE_ADDR pc) { if ((pc >= dummyframe->id.code_addr) && (pc <= dummyframe->id.code_addr - + gdbarch_decr_pc_after_break (current_gdbarch))) + + gdbarch_decr_pc_after_break (gdbarch))) return 1; } return 0; diff --git a/gdb/eval.c b/gdb/eval.c index ec5b0911e4..e64d4bf52f 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -754,7 +754,7 @@ evaluate_subexp_standard (struct type *expect_type, struct value *val; (*pos) += 3 + BYTES_TO_EXP_ELEM (exp->elts[pc + 1].longconst + 1); - regno = user_reg_map_name_to_regnum (current_gdbarch, + regno = user_reg_map_name_to_regnum (exp->gdbarch, name, strlen (name)); if (regno == -1) error (_("Register $%s not available."), name); @@ -765,9 +765,9 @@ evaluate_subexp_standard (struct type *expect_type, So for these registers, we fetch the register value regardless of the evaluation mode. */ if (noside == EVAL_AVOID_SIDE_EFFECTS - && regno < gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch)) - val = value_zero (register_type (current_gdbarch, regno), not_lval); + && regno < gdbarch_num_regs (exp->gdbarch) + + gdbarch_num_pseudo_regs (exp->gdbarch)) + val = value_zero (register_type (exp->gdbarch, regno), not_lval); else val = value_of_register (regno, get_selected_frame (NULL)); if (val == NULL) @@ -1185,11 +1185,12 @@ evaluate_subexp_standard (struct type *expect_type, val_type = expect_type; } - struct_return = using_struct_return (value_type (method), val_type); + struct_return = using_struct_return (exp->gdbarch, + value_type (method), val_type); } else if (expect_type != NULL) { - struct_return = using_struct_return (NULL, + struct_return = using_struct_return (exp->gdbarch, NULL, check_typedef (expect_type)); } diff --git a/gdb/frame.h b/gdb/frame.h index 224aec9a03..18a62a1ade 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -598,7 +598,7 @@ extern void print_frame_info (struct frame_info *, int print_level, extern struct frame_info *block_innermost_frame (struct block *); -extern int deprecated_pc_in_call_dummy (CORE_ADDR pc); +extern int deprecated_pc_in_call_dummy (struct gdbarch *gdbarch, CORE_ADDR pc); /* FIXME: cagney/2003-02-02: Should be deprecated or replaced with a function called get_frame_register_p(). This slightly weird (and diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 452f70cd3a..cf48dc66f7 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -510,7 +510,8 @@ is_argument_reg (int reg) arguments in any frame but the top, you'll need to do this serious prologue analysis. */ static CORE_ADDR -frv_analyze_prologue (CORE_ADDR pc, struct frame_info *this_frame, +frv_analyze_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, + struct frame_info *this_frame, struct frv_unwind_cache *info) { /* When writing out instruction bitpatterns, we use the following @@ -568,7 +569,7 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *this_frame, /* Try to compute an upper limit (on how far to scan) based on the line number info. */ - lim_pc = skip_prologue_using_sal (pc); + lim_pc = skip_prologue_using_sal (gdbarch, pc); /* If there's no line number info, lim_pc will be 0. In that case, set the limit to be 100 instructions away from pc. Hopefully, this will be far enough away to account for the entire prologue. Don't @@ -993,7 +994,7 @@ frv_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) If we didn't find a real source location past that, then do a full analysis of the prologue. */ if (new_pc < pc + 20) - new_pc = frv_analyze_prologue (pc, 0, 0); + new_pc = frv_analyze_prologue (gdbarch, pc, 0, 0); return new_pc; } @@ -1095,7 +1096,8 @@ frv_frame_unwind_cache (struct frame_info *this_frame, info->saved_regs = trad_frame_alloc_saved_regs (this_frame); /* Prologue analysis does the rest... */ - frv_analyze_prologue (get_frame_func (this_frame), this_frame, info); + frv_analyze_prologue (gdbarch, + get_frame_func (this_frame), this_frame, info); return info; } diff --git a/gdb/infcall.c b/gdb/infcall.c index 416219e038..584fdeb0a0 100644 --- a/gdb/infcall.c +++ b/gdb/infcall.c @@ -566,7 +566,8 @@ call_function_by_hand (struct value *function, int nargs, struct value **args) } else { - struct_return = using_struct_return (value_type (function), values_type); + struct_return = using_struct_return (gdbarch, + value_type (function), values_type); target_values_type = values_type; } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 61407778e1..a8ab1f0faf 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1291,7 +1291,7 @@ advance_command (char *arg, int from_tty) static void print_return_value (struct type *func_type, struct type *value_type) { - struct gdbarch *gdbarch = current_gdbarch; + struct gdbarch *gdbarch = get_regcache_arch (stop_registers); struct cleanup *old_chain; struct ui_stream *stb; struct value *value; @@ -2012,9 +2012,11 @@ nofp_registers_info (char *addr_exp, int from_tty) } static void -print_vector_info (struct gdbarch *gdbarch, struct ui_file *file, +print_vector_info (struct ui_file *file, struct frame_info *frame, const char *args) { + struct gdbarch *gdbarch = get_frame_arch (frame); + if (gdbarch_print_vector_info_p (gdbarch)) gdbarch_print_vector_info (gdbarch, file, frame, args); else @@ -2044,8 +2046,7 @@ vector_info (char *args, int from_tty) if (!target_has_registers) error (_("The program has no registers now.")); - print_vector_info (current_gdbarch, gdb_stdout, - get_selected_frame (NULL), args); + print_vector_info (gdb_stdout, get_selected_frame (NULL), args); } /* Kill the inferior process. Make us have no inferior. */ @@ -2528,9 +2529,11 @@ interrupt_target_command (char *args, int from_tty) } static void -print_float_info (struct gdbarch *gdbarch, struct ui_file *file, +print_float_info (struct ui_file *file, struct frame_info *frame, const char *args) { + struct gdbarch *gdbarch = get_frame_arch (frame); + if (gdbarch_print_float_info_p (gdbarch)) gdbarch_print_float_info (gdbarch, file, frame, args); else @@ -2561,8 +2564,7 @@ float_info (char *args, int from_tty) if (!target_has_registers) error (_("The program has no registers now.")); - print_float_info (current_gdbarch, gdb_stdout, - get_selected_frame (NULL), args); + print_float_info (gdb_stdout, get_selected_frame (NULL), args); } static void diff --git a/gdb/infrun.c b/gdb/infrun.c index da2dc72a38..3eaf89e1b6 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -3723,7 +3723,7 @@ infrun: not switching back to stepped thread, it has vanished\n"); if ((ecs->event_thread->step_over_calls == STEP_OVER_NONE) || ((ecs->event_thread->step_range_end == 1) - && in_prologue (ecs->event_thread->prev_pc, + && in_prologue (gdbarch, ecs->event_thread->prev_pc, ecs->stop_func_start))) { /* I presume that step_over_calls is only 0 when we're diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index d36c41733a..def139d601 100644 --- a/gdb/lm32-tdep.c +++ b/gdb/lm32-tdep.c @@ -194,7 +194,8 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) is greater. */ if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) { - CORE_ADDR post_prologue_pc = skip_prologue_using_sal (func_addr); + CORE_ADDR post_prologue_pc + = skip_prologue_using_sal (gdbarch, func_addr); if (post_prologue_pc != 0) return max (pc, post_prologue_pc); } @@ -205,7 +206,7 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* Find an upper limit on the function prologue using the debug information. If the debug information could not be used to provide that bound, then use an arbitrary large number as the upper bound. */ - limit_pc = skip_prologue_using_sal (pc); + limit_pc = skip_prologue_using_sal (gdbarch, pc); if (limit_pc == 0) limit_pc = pc + 100; /* Magic. */ diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index 10367b38b0..a932d14d6b 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -1815,7 +1815,7 @@ m32c_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip) /* Find end by prologue analysis. */ m32c_analyze_prologue (gdbarch, ip, func_end, &p); /* Find end by line info. */ - sal_end = skip_prologue_using_sal (ip); + sal_end = skip_prologue_using_sal (gdbarch, ip); /* Return whichever is lower. */ if (sal_end != 0 && sal_end != ip && sal_end < p.prologue_end) return sal_end; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index e6aa8ffc34..ccd20699d4 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -4695,7 +4695,8 @@ mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) is greater. */ if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) { - CORE_ADDR post_prologue_pc = skip_prologue_using_sal (func_addr); + CORE_ADDR post_prologue_pc + = skip_prologue_using_sal (gdbarch, func_addr); if (post_prologue_pc != 0) return max (pc, post_prologue_pc); } @@ -4706,7 +4707,7 @@ mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* Find an upper limit on the function prologue using the debug information. If the debug information could not be used to provide that bound, then use an arbitrary large number as the upper bound. */ - limit_pc = skip_prologue_using_sal (pc); + limit_pc = skip_prologue_using_sal (gdbarch, pc); if (limit_pc == 0) limit_pc = pc + 100; /* Magic. */ diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c index d6322b146c..a110798752 100644 --- a/gdb/mn10300-tdep.c +++ b/gdb/mn10300-tdep.c @@ -47,6 +47,9 @@ /* This structure holds the results of a prologue analysis. */ struct mn10300_prologue { + /* The architecture for which we generated this prologue info. */ + struct gdbarch *gdbarch; + /* The offset from the frame base to the stack pointer --- always zero or negative. @@ -371,7 +374,7 @@ check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value) if (value.kind == pvk_register && value.k == 0 && pv_is_register (addr, E_SP_REGNUM) - && size == register_size (current_gdbarch, value.reg)) + && size == register_size (result->gdbarch, value.reg)) result->reg_offset[value.reg] = addr.k; } @@ -393,6 +396,7 @@ mn10300_analyze_prologue (struct gdbarch *gdbarch, int am33_mode = AM33_MODE (gdbarch); memset (result, 0, sizeof (*result)); + result->gdbarch = gdbarch; for (rn = 0; rn < MN10300_MAX_NUM_REGS; rn++) { diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c index 884416ce49..23b573eb55 100644 --- a/gdb/moxie-tdep.c +++ b/gdb/moxie-tdep.c @@ -204,7 +204,8 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) is greater. */ if (find_pc_partial_function (pc, &func_name, &func_addr, &func_end)) { - CORE_ADDR post_prologue_pc = skip_prologue_using_sal (func_addr); + CORE_ADDR post_prologue_pc + = skip_prologue_using_sal (gdbarch, func_addr); if (post_prologue_pc != 0) return max (pc, post_prologue_pc); else diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c index 28f8b46fa1..04029a425a 100644 --- a/gdb/mt-tdep.c +++ b/gdb/mt-tdep.c @@ -906,7 +906,7 @@ mt_frame_unwind_cache (struct frame_info *this_frame, return info; end_addr = get_frame_pc (this_frame); - prologue_end_addr = skip_prologue_using_sal (start_addr); + prologue_end_addr = skip_prologue_using_sal (gdbarch, start_addr); if (end_addr == 0) for (next_addr = start_addr; next_addr < end_addr; next_addr += 4) { diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index f1f33efe1a..cd4c1977c4 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -442,11 +442,11 @@ objc_printstr (struct ui_file *stream, struct type *type, static CORE_ADDR objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) { + struct gdbarch *gdbarch = get_frame_arch (frame); CORE_ADDR real_stop_pc; CORE_ADDR method_stop_pc; - real_stop_pc = gdbarch_skip_trampoline_code - (current_gdbarch, frame, stop_pc); + real_stop_pc = gdbarch_skip_trampoline_code (gdbarch, frame, stop_pc); if (real_stop_pc != 0) find_objc_msgcall (real_stop_pc, &method_stop_pc); @@ -456,7 +456,7 @@ objc_skip_trampoline (struct frame_info *frame, CORE_ADDR stop_pc) if (method_stop_pc) { real_stop_pc = gdbarch_skip_trampoline_code - (current_gdbarch, frame, method_stop_pc); + (gdbarch, frame, method_stop_pc); if (real_stop_pc == 0) real_stop_pc = method_stop_pc; } diff --git a/gdb/parse.c b/gdb/parse.c index 96dc1c5249..5de3bc7202 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -597,7 +597,7 @@ write_dollar_variable (struct stoken str) /* Handle tokens that refer to machine registers: $ followed by a register name. */ - i = user_reg_map_name_to_regnum (current_gdbarch, + i = user_reg_map_name_to_regnum (parse_gdbarch, str.ptr + 1, str.length - 1); if (i >= 0) goto handle_register; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 49ae9d1c81..9678a7348b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1616,7 +1616,7 @@ do_one_display (struct display *d) val = evaluate_expression (d->exp); addr = value_as_address (val); if (d->format.format == 'i') - addr = gdbarch_addr_bits_remove (current_gdbarch, addr); + addr = gdbarch_addr_bits_remove (d->exp->gdbarch, addr); annotate_display_value (); diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 926d0b6784..863cedbf9a 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2080,7 +2080,8 @@ rs6000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) is greater. */ if (find_pc_partial_function (pc, NULL, &func_addr, NULL)) { - CORE_ADDR post_prologue_pc = skip_prologue_using_sal (func_addr); + CORE_ADDR post_prologue_pc + = skip_prologue_using_sal (gdbarch, func_addr); if (post_prologue_pc != 0) return max (pc, post_prologue_pc); } @@ -2091,7 +2092,7 @@ rs6000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) /* Find an upper limit on the function prologue using the debug information. If the debug information could not be used to provide that bound, then use an arbitrary large number as the upper bound. */ - limit_pc = skip_prologue_using_sal (pc); + limit_pc = skip_prologue_using_sal (gdbarch, pc); if (limit_pc == 0) limit_pc = pc + 100; /* Magic. */ diff --git a/gdb/source.c b/gdb/source.c index e4766167b6..29194aa234 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -1515,7 +1515,7 @@ line_info (char *arg, int from_tty) } /* x/i should display this line's code. */ - set_next_address (current_gdbarch, start_pc); + set_next_address (get_objfile_arch (sal.symtab->objfile), start_pc); /* Repeating "info line" should do the following line. */ last_line_listed = sal.line + 1; diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index 8fab945056..543a39764f 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -388,7 +388,7 @@ sparc32_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, *bp_addr = sp - 4; *real_pc = funcaddr; - if (using_struct_return (NULL, value_type)) + if (using_struct_return (gdbarch, NULL, value_type)) { gdb_byte buf[4]; diff --git a/gdb/stack.c b/gdb/stack.c index a968cbfe66..3a4cc7f40d 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1823,12 +1823,14 @@ void return_command (char *retval_exp, int from_tty) { struct frame_info *thisframe; + struct gdbarch *gdbarch; struct symbol *thisfun; struct value *return_value = NULL; const char *query_prefix = ""; thisframe = get_selected_frame ("No selected frame."); thisfun = get_frame_function (thisframe); + gdbarch = get_frame_arch (thisframe); /* Compute the return value. If the computation triggers an error, let it bail. If the return type can't be handled, set @@ -1873,7 +1875,8 @@ return_command (char *retval_exp, int from_tty) occur. */ return_value = NULL; else if (thisfun != NULL - && using_struct_return (SYMBOL_TYPE (thisfun), return_type)) + && using_struct_return (gdbarch, + SYMBOL_TYPE (thisfun), return_type)) { query_prefix = "\ The location at which to store the function's return value is unknown.\n\ diff --git a/gdb/symtab.c b/gdb/symtab.c index 3a82d33c35..ee138ff0ae 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2681,11 +2681,11 @@ find_function_start_sal (struct symbol *sym, int funfirstline) to `__main' in `main' between the prologue and before user code. */ if (funfirstline - && gdbarch_skip_main_prologue_p (current_gdbarch) + && gdbarch_skip_main_prologue_p (gdbarch) && SYMBOL_LINKAGE_NAME (sym) && strcmp (SYMBOL_LINKAGE_NAME (sym), "main") == 0) { - pc = gdbarch_skip_main_prologue (current_gdbarch, pc); + pc = gdbarch_skip_main_prologue (gdbarch, pc); /* Recalculate the line number (might not be N+1). */ sal = find_pc_sect_line (pc, SYMBOL_OBJ_SECTION (sym), 0); } @@ -3399,9 +3399,10 @@ print_symbol_info (domain_enum kind, struct symtab *s, struct symbol *sym, static void print_msymbol_info (struct minimal_symbol *msymbol) { + struct gdbarch *gdbarch = get_objfile_arch (msymbol_objfile (msymbol)); char *tmp; - if (gdbarch_addr_bit (current_gdbarch) <= 32) + if (gdbarch_addr_bit (gdbarch) <= 32) tmp = hex_string_custom (SYMBOL_VALUE_ADDRESS (msymbol) & (CORE_ADDR) 0xffffffff, 8); @@ -4237,7 +4238,7 @@ make_source_files_completion_list (char *text, char *word) */ int -in_prologue (CORE_ADDR pc, CORE_ADDR func_start) +in_prologue (struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR func_start) { struct symtab_and_line sal; CORE_ADDR func_addr, func_end; @@ -4269,7 +4270,7 @@ in_prologue (CORE_ADDR pc, CORE_ADDR func_start) if (! func_start) return 1; /* We *might* be in a prologue. */ - prologue_end = gdbarch_skip_prologue (current_gdbarch, func_start); + prologue_end = gdbarch_skip_prologue (gdbarch, func_start); return func_start <= pc && pc < prologue_end; } @@ -4293,8 +4294,7 @@ in_prologue (CORE_ADDR pc, CORE_ADDR func_start) /* We don't have any good line number info, so use the minsym information, together with the architecture-specific prologue scanning code. */ - CORE_ADDR prologue_end = gdbarch_skip_prologue - (current_gdbarch, func_addr); + CORE_ADDR prologue_end = gdbarch_skip_prologue (gdbarch, func_addr); return func_addr <= pc && pc < prologue_end; } @@ -4321,7 +4321,7 @@ in_prologue (CORE_ADDR pc, CORE_ADDR func_start) found in both ia64 and ppc). */ CORE_ADDR -skip_prologue_using_sal (CORE_ADDR func_addr) +skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr) { struct symtab_and_line prologue_sal; CORE_ADDR start_pc; @@ -4330,7 +4330,7 @@ skip_prologue_using_sal (CORE_ADDR func_addr) /* Get an initial range for the function. */ find_pc_partial_function (func_addr, NULL, &start_pc, &end_pc); - start_pc += gdbarch_deprecated_function_start_offset (current_gdbarch); + start_pc += gdbarch_deprecated_function_start_offset (gdbarch); prologue_sal = find_pc_line (start_pc, 0); if (prologue_sal.line != 0) diff --git a/gdb/symtab.h b/gdb/symtab.h index b126c16361..ab06b1e86e 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1292,9 +1292,11 @@ extern enum language deduce_language_from_filename (char *); /* symtab.c */ -extern int in_prologue (CORE_ADDR pc, CORE_ADDR func_start); +extern int in_prologue (struct gdbarch *gdbarch, + CORE_ADDR pc, CORE_ADDR func_start); -extern CORE_ADDR skip_prologue_using_sal (CORE_ADDR func_addr); +extern CORE_ADDR skip_prologue_using_sal (struct gdbarch *gdbarch, + CORE_ADDR func_addr); extern struct symbol *fixup_symbol_section (struct symbol *, struct objfile *); diff --git a/gdb/valops.c b/gdb/valops.c index 5530f553b9..422821ab1e 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -832,6 +832,7 @@ value_assign (struct value *toval, struct value *fromval) case lval_register: { struct frame_info *frame; + struct gdbarch *gdbarch; int value_reg; /* Figure out which frame this is in currently. */ @@ -840,14 +841,14 @@ value_assign (struct value *toval, struct value *fromval) if (!frame) error (_("Value being assigned to is no longer active.")); - - if (gdbarch_convert_register_p - (current_gdbarch, VALUE_REGNUM (toval), type)) + + gdbarch = get_frame_arch (frame); + if (gdbarch_convert_register_p (gdbarch, VALUE_REGNUM (toval), type)) { /* If TOVAL is a special machine register requiring conversion of program values to a special raw format. */ - gdbarch_value_to_register (current_gdbarch, frame, + gdbarch_value_to_register (gdbarch, frame, VALUE_REGNUM (toval), type, value_contents (fromval)); } diff --git a/gdb/value.c b/gdb/value.c index e9dfe6ab86..aec3b4b500 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -2138,7 +2138,8 @@ coerce_array (struct value *arg) address as a hidden first parameter). */ int -using_struct_return (struct type *func_type, struct type *value_type) +using_struct_return (struct gdbarch *gdbarch, + struct type *func_type, struct type *value_type) { enum type_code code = TYPE_CODE (value_type); @@ -2151,7 +2152,7 @@ using_struct_return (struct type *func_type, struct type *value_type) return 0; /* Probe the architecture for the return-value convention. */ - return (gdbarch_return_value (current_gdbarch, func_type, value_type, + return (gdbarch_return_value (gdbarch, func_type, value_type, NULL, NULL, NULL) != RETURN_VALUE_REGISTER_CONVENTION); } diff --git a/gdb/value.h b/gdb/value.h index fcff0ad4aa..317d4ef8ce 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -482,7 +482,8 @@ extern int value_in (struct value *element, struct value *set); extern int value_bit_index (struct type *type, const gdb_byte *addr, int index); -extern int using_struct_return (struct type *func_type, +extern int using_struct_return (struct gdbarch *gdbarch, + struct type *func_type, struct type *value_type); extern struct value *evaluate_expression (struct expression *exp); -- 2.34.1