From: Ulrich Weigand Date: Thu, 2 Jul 2009 17:17:42 +0000 (+0000) Subject: * disasm.h (gdb_disassembly): Add GDBARCH parameter. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=13274fc342aae3c94dbb38f01ba7d8f2e3821ddf;p=binutils-gdb.git * disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4e80a6659cc..709fc16a745 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,111 @@ +2009-07-02 Ulrich Weigand + + * disasm.h (gdb_disassembly): Add GDBARCH parameter. + (gdb_print_insn): Likewise. + * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead + of current_gdbarch. + (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to + dump_insns. + (do_assembly_only): Likewise. + (gdb_disassembly): Add GDBARCH parameter. Use it instead of + current_gdbarch. Pass to subroutines. + (gdb_print_insn): Add GDBARCH parameter. Use it instead of + current_gdbarch. + + * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. + (gdb_disassembly_stub): Pass architecture to gdb_disassembly. + (do_gdb_disassembly): Add GDBARCH argument. Store into args. + (print_frame_info): Pass architecture to do_gdb_disassembly. + + * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. + + * mi/mi-cmd-disas.c: Include "arch-utils.h" + (mi_cmd_disassemble): Pass architecture to gdb_disassembly. + + * cli/cli-cmds.c: Include "arch-utils.h". + (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly + and tui_show_assembly. + (disassemble_current_function): Pass architecture to + tui_get_low_disassembly_address and print_disassembly. + (disassemble_command): Pass architecture to + tui_get_low_disassembly_address and print_disassembly. + + * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to + tui_update_source_windows_with_addr. + + * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. + (struct tui_source_info): Likewise. + * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. + + * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. + Pass to gdb_print_insn. + (tui_find_disassembly_address): Add GDBARCH parameter. Pass to + tui_disassemble. + (tui_set_disassem_content): Add GDBARCH parameter. Install into + source_info.gdbarch. Pass to tui_disassemble. + (tui_show_disassem): Add GDBARCH parameter. Pass to + tui_update_source_window. + (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to + tui_show_disassem and tui_update_source_window. + + (tui_get_begin_asm_address): Return locator architecture in addition + to locator PC value. + + (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to + tui_get_low_disassembly_address. + + (tui_vertical_disassem_scroll): Pass architecture to subroutines. + + * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. + (tui_show_disassem): Likewise. + (tui_show_disassem_and_update_source): Likewise. + (tui_get_begin_asm_address): Return architecture and PC value. + + * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. + (tui_show_assembly): Add GDBARCH parameter. + + * tui/tui-layout.c (extract_display_start_addr): Return current window + architecture in addition to current PC value. + + (tui_set_layout): Update calls to tui_get_low_disassembly_address and + extract_display_start_addr. Pass architecture to + tui_update_source_windows_with_addr. + + * tui/tui-source.c: Include "objfiles.h". + (tui_set_source_content): Initialize window architecture. + (tui_show_symtab_source): Add GDBARCH parameter. Pass to + tui_update_source_window_as_is + + * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. + + * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. + Install locator architecture. + (tui_set_locator_filename): Update call. + (tui_show_frame_info): Pass architecture to tui_set_locator_info + and subroutines. + + * tui/tui-win.c (make_visible_with_new_height): Pass architecture + to tui_update_source_window. + + * tui/tui-winsource.c: Include "objfiles.h". + (tui_display_main): Update call to tui_get_begin_asm_address. + Pass architecture to tui_update_source_windows_with_addr. + (tui_update_source_window): Add GDBARCH parameter. Pass to + tui_update_source_window_as_is. + (tui_update_source_window_as_is): Add GDBARCH parameter. + Pass to tui_set_disassem_content. + (tui_update_source_windows_with_addr): Add GDBARCH parameter. + Pass to subroutines. + (tui_update_source_windows_with_line): Pass objfile architecture + to subroutines. + (tui_horizontal_source_scroll): Pass architecture to + tui_update_source_window_as_is. + + * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH + parameter. + (tui_update_source_window_as_is): Likewise. + (tui_update_source_windows_with_addr): Likewise. + 2009-07-02 Ulrich Weigand * breakpoint.h (struct breakpoint): New member GDBARCH. diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 0211489e937..c9cdfbe7ed4 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -19,6 +19,7 @@ along with this program. If not, see . */ #include "defs.h" +#include "arch-utils.h" #include "readline/readline.h" #include "readline/tilde.h" #include "completer.h" @@ -892,7 +893,8 @@ list_command (char *arg, int from_tty) MIXED is non-zero to print source with the assembler. */ static void -print_disassembly (const char *name, CORE_ADDR low, CORE_ADDR high, int mixed) +print_disassembly (struct gdbarch *gdbarch, const char *name, + CORE_ADDR low, CORE_ADDR high, int mixed) { #if defined(TUI) if (!tui_is_window_visible (DISASSEM_WIN)) @@ -905,7 +907,7 @@ print_disassembly (const char *name, CORE_ADDR low, CORE_ADDR high, int mixed) printf_filtered ("from %s to %s:\n", paddress (low), paddress (high)); /* Dump the specified range. */ - gdb_disassembly (uiout, 0, mixed, -1, low, high); + gdb_disassembly (gdbarch, uiout, 0, mixed, -1, low, high); printf_filtered ("End of assembler dump.\n"); gdb_flush (gdb_stdout); @@ -913,7 +915,7 @@ print_disassembly (const char *name, CORE_ADDR low, CORE_ADDR high, int mixed) #if defined(TUI) else { - tui_show_assembly (low); + tui_show_assembly (gdbarch, low); } #endif } @@ -925,10 +927,14 @@ print_disassembly (const char *name, CORE_ADDR low, CORE_ADDR high, int mixed) static void disassemble_current_function (int mixed) { + struct frame_info *frame; + struct gdbarch *gdbarch; CORE_ADDR low, high, pc; char *name; - pc = get_frame_pc (get_selected_frame (_("No frame selected."))); + frame = get_selected_frame (_("No frame selected.")); + gdbarch = get_frame_arch (frame); + pc = get_frame_pc (frame); if (find_pc_partial_function (pc, &name, &low, &high) == 0) error (_("No function contains program counter for selected frame.")); #if defined(TUI) @@ -936,11 +942,11 @@ disassemble_current_function (int mixed) `tui_version'. */ if (tui_active) /* FIXME: cagney/2004-02-07: This should be an observer. */ - low = tui_get_low_disassembly_address (low, pc); + low = tui_get_low_disassembly_address (gdbarch, low, pc); #endif - low += gdbarch_deprecated_function_start_offset (current_gdbarch); + low += gdbarch_deprecated_function_start_offset (gdbarch); - print_disassembly (name, low, high, mixed); + print_disassembly (gdbarch, name, low, high, mixed); } /* Dump a specified section of assembly code. @@ -958,6 +964,7 @@ disassemble_current_function (int mixed) static void disassemble_command (char *arg, int from_tty) { + struct gdbarch *gdbarch = get_current_arch (); CORE_ADDR low, high; char *name; CORE_ADDR pc, pc_masked; @@ -1010,9 +1017,9 @@ disassemble_command (char *arg, int from_tty) `tui_version'. */ if (tui_active) /* FIXME: cagney/2004-02-07: This should be an observer. */ - low = tui_get_low_disassembly_address (low, pc); + low = tui_get_low_disassembly_address (gdbarch, low, pc); #endif - low += gdbarch_deprecated_function_start_offset (current_gdbarch); + low += gdbarch_deprecated_function_start_offset (gdbarch); } else { @@ -1022,7 +1029,7 @@ disassemble_command (char *arg, int from_tty) high = parse_and_eval_address (space_index + 1); } - print_disassembly (name, low, high, mixed_source_and_assembly); + print_disassembly (gdbarch, name, low, high, mixed_source_and_assembly); } static void diff --git a/gdb/disasm.c b/gdb/disasm.c index 4ea5137dd38..8812b1c3df1 100644 --- a/gdb/disasm.c +++ b/gdb/disasm.c @@ -84,7 +84,8 @@ compare_lines (const void *mle1p, const void *mle2p) } static int -dump_insns (struct ui_out *uiout, struct disassemble_info * di, +dump_insns (struct gdbarch *gdbarch, struct ui_out *uiout, + struct disassemble_info * di, CORE_ADDR low, CORE_ADDR high, int how_many, struct ui_stream *stb) { @@ -133,7 +134,7 @@ dump_insns (struct ui_out *uiout, struct disassemble_info * di, xfree (name); ui_file_rewind (stb->stream); - pc += gdbarch_print_insn (current_gdbarch, pc, di); + pc += gdbarch_print_insn (gdbarch, pc, di); ui_out_field_stream (uiout, "inst", stb); ui_file_rewind (stb->stream); do_cleanups (ui_out_chain); @@ -147,7 +148,7 @@ dump_insns (struct ui_out *uiout, struct disassemble_info * di, in source order, with (possibly) out of order assembly immediately following. */ static void -do_mixed_source_and_assembly (struct ui_out *uiout, +do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout, struct disassemble_info *di, int nlines, struct linetable_entry *le, CORE_ADDR low, CORE_ADDR high, @@ -274,7 +275,8 @@ do_mixed_source_and_assembly (struct ui_out *uiout, = make_cleanup_ui_out_list_begin_end (uiout, "line_asm_insn"); } - num_displayed += dump_insns (uiout, di, mle[i].start_pc, mle[i].end_pc, + num_displayed += dump_insns (gdbarch, uiout, di, + mle[i].start_pc, mle[i].end_pc, how_many, stb); /* When we've reached the end of the mle array, or we've seen the last @@ -295,7 +297,8 @@ do_mixed_source_and_assembly (struct ui_out *uiout, static void -do_assembly_only (struct ui_out *uiout, struct disassemble_info * di, +do_assembly_only (struct gdbarch *gdbarch, struct ui_out *uiout, + struct disassemble_info * di, CORE_ADDR low, CORE_ADDR high, int how_many, struct ui_stream *stb) { @@ -304,7 +307,7 @@ do_assembly_only (struct ui_out *uiout, struct disassemble_info * di, ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns"); - num_displayed = dump_insns (uiout, di, low, high, how_many, stb); + num_displayed = dump_insns (gdbarch, uiout, di, low, high, how_many, stb); do_cleanups (ui_out_chain); } @@ -349,14 +352,14 @@ gdb_disassemble_info (struct gdbarch *gdbarch, struct ui_file *file) } void -gdb_disassembly (struct ui_out *uiout, +gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout, char *file_string, int mixed_source_and_assembly, int how_many, CORE_ADDR low, CORE_ADDR high) { struct ui_stream *stb = ui_out_stream_new (uiout); struct cleanup *cleanups = make_cleanup_ui_out_stream_delete (stb); - struct disassemble_info di = gdb_disassemble_info (current_gdbarch, stb->stream); + struct disassemble_info di = gdb_disassemble_info (gdbarch, stb->stream); /* To collect the instruction outputted from opcodes. */ struct symtab *symtab = NULL; struct linetable_entry *le = NULL; @@ -374,10 +377,10 @@ gdb_disassembly (struct ui_out *uiout, if (!mixed_source_and_assembly || nlines <= 0 || symtab == NULL || symtab->linetable == NULL) - do_assembly_only (uiout, &di, low, high, how_many, stb); + do_assembly_only (gdbarch, uiout, &di, low, high, how_many, stb); else if (mixed_source_and_assembly) - do_mixed_source_and_assembly (uiout, &di, nlines, le, low, + do_mixed_source_and_assembly (gdbarch, uiout, &di, nlines, le, low, high, symtab, how_many, stb); do_cleanups (cleanups); @@ -389,14 +392,14 @@ gdb_disassembly (struct ui_out *uiout, and, if requested, the number of branch delay slot instructions. */ int -gdb_print_insn (CORE_ADDR memaddr, struct ui_file *stream, - int *branch_delay_insns) +gdb_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr, + struct ui_file *stream, int *branch_delay_insns) { struct disassemble_info di; int length; - di = gdb_disassemble_info (current_gdbarch, stream); - length = gdbarch_print_insn (current_gdbarch, memaddr, &di); + di = gdb_disassemble_info (gdbarch, stream); + length = gdbarch_print_insn (gdbarch, memaddr, &di); if (branch_delay_insns) { if (di.insn_info_valid) diff --git a/gdb/disasm.h b/gdb/disasm.h index 2f9c3708f1c..a11280d5b15 100644 --- a/gdb/disasm.h +++ b/gdb/disasm.h @@ -22,7 +22,7 @@ struct ui_out; struct ui_file; -extern void gdb_disassembly (struct ui_out *uiout, +extern void gdb_disassembly (struct gdbarch *gdbarch, struct ui_out *uiout, char *file_string, int mixed_source_and_assembly, int how_many, CORE_ADDR low, CORE_ADDR high); @@ -31,8 +31,7 @@ extern void gdb_disassembly (struct ui_out *uiout, on STREAM. Returns the length of the instruction, in bytes, and, if requested, the number of branch delay slot instructions. */ -extern int gdb_print_insn (CORE_ADDR memaddr, - struct ui_file *stream, - int *branch_delay_insns); +extern int gdb_print_insn (struct gdbarch *gdbarch, CORE_ADDR memaddr, + struct ui_file *stream, int *branch_delay_insns); #endif diff --git a/gdb/mi/mi-cmd-disas.c b/gdb/mi/mi-cmd-disas.c index 0017cf8e642..d63f1ad0ebb 100644 --- a/gdb/mi/mi-cmd-disas.c +++ b/gdb/mi/mi-cmd-disas.c @@ -19,6 +19,7 @@ along with this program. If not, see . */ #include "defs.h" +#include "arch-utils.h" #include "target.h" #include "value.h" #include "mi-cmds.h" @@ -50,6 +51,7 @@ void mi_cmd_disassemble (char *command, char **argv, int argc) { + struct gdbarch *gdbarch = get_current_arch (); CORE_ADDR start; int mixed_source_and_assembly; @@ -152,7 +154,7 @@ mi_cmd_disassemble (char *command, char **argv, int argc) error (_("mi_cmd_disassemble: No function contains specified address")); } - gdb_disassembly (uiout, + gdb_disassembly (gdbarch, uiout, file_string, mixed_source_and_assembly, how_many, low, high); diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 5533faafe5f..7601d7c416f 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -293,7 +293,8 @@ print_formatted (struct value *val, int size, /* We often wrap here if there are long symbolic names. */ wrap_here (" "); next_address = (value_address (val) - + gdb_print_insn (value_address (val), stream, + + gdb_print_insn (get_type_arch (type), + value_address (val), stream, &branch_delay_insns)); return; } diff --git a/gdb/stack.c b/gdb/stack.c index 7117f278cd8..a77fe5e9694 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -468,6 +468,7 @@ Debugger's willingness to use disassemble-next-line is %s.\n"), struct gdb_disassembly_stub_args { + struct gdbarch *gdbarch; int how_many; CORE_ADDR low; CORE_ADDR high; @@ -477,18 +478,20 @@ static void gdb_disassembly_stub (void *args) { struct gdb_disassembly_stub_args *p = args; - gdb_disassembly (uiout, 0, 0, p->how_many, p->low, p->high); + gdb_disassembly (p->gdbarch, uiout, 0, 0, p->how_many, p->low, p->high); } /* Use TRY_CATCH to catch the exception from the gdb_disassembly because it will be broken by filter sometime. */ static void -do_gdb_disassembly (int how_many, CORE_ADDR low, CORE_ADDR high) +do_gdb_disassembly (struct gdbarch *gdbarch, + int how_many, CORE_ADDR low, CORE_ADDR high) { volatile struct gdb_exception exception; struct gdb_disassembly_stub_args args; + args.gdbarch = gdbarch; args.how_many = how_many; args.low = low; args.high = high; @@ -589,7 +592,8 @@ print_frame_info (struct frame_info *frame, int print_level, if ((disassemble_next_line == AUTO_BOOLEAN_AUTO || disassemble_next_line == AUTO_BOOLEAN_TRUE) && source_print && !sal.symtab) - do_gdb_disassembly (1, get_frame_pc (frame), get_frame_pc (frame) + 1); + do_gdb_disassembly (get_frame_arch (frame), 1, + get_frame_pc (frame), get_frame_pc (frame) + 1); if (source_print && sal.symtab) { @@ -631,7 +635,8 @@ print_frame_info (struct frame_info *frame, int print_level, /* If disassemble-next-line is set to on and there is line debug messages, output assembly codes for next line. */ if (disassemble_next_line == AUTO_BOOLEAN_TRUE) - do_gdb_disassembly (-1, get_frame_pc (frame), sal.end); + do_gdb_disassembly (get_frame_arch (frame), -1, + get_frame_pc (frame), sal.end); } if (print_what != LOCATION) diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 655a5d09b1f..46a218a7dd9 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -211,6 +211,7 @@ tui_clear_win_detail (struct tui_win_info *win_info) { case SRC_WIN: case DISASSEM_WIN: + win_info->detail.source_info.gdbarch = NULL; win_info->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS; win_info->detail.source_info.start_line_or_addr.u.addr = 0; win_info->detail.source_info.horizontal_offset = 0; @@ -545,6 +546,7 @@ init_win_info (struct tui_win_info *win_info) win_info->detail.source_info.execution_info = (struct tui_gen_win_info *) NULL; win_info->detail.source_info.has_locator = FALSE; win_info->detail.source_info.horizontal_offset = 0; + win_info->detail.source_info.gdbarch = NULL; win_info->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS; win_info->detail.source_info.start_line_or_addr.u.addr = 0; win_info->detail.source_info.filename = 0; diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 1e475c31591..ae5e09adf83 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -208,6 +208,8 @@ struct tui_locator_element char proc_name[MAX_LOCATOR_ELEMENT_LEN]; int line_no; CORE_ADDR addr; + /* Architecture associated with code at this location. */ + struct gdbarch *gdbarch; }; /* Flags to tell what kind of breakpoint is at current line. */ @@ -270,6 +272,8 @@ struct tui_source_info int horizontal_offset; /* Used for horizontal scroll. */ struct tui_line_or_address start_line_or_addr; char *filename; + /* Architecture associated with code at this location. */ + struct gdbarch *gdbarch; }; diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 14f0496c311..7571a9b3f6c 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -50,7 +50,7 @@ struct tui_asm_line Disassemble count lines starting at pc. Return address of the count'th instruction after pc. */ static CORE_ADDR -tui_disassemble (struct tui_asm_line *asm_lines, +tui_disassemble (struct gdbarch *gdbarch, struct tui_asm_line *asm_lines, CORE_ADDR pc, int count) { struct ui_file *gdb_dis_out; @@ -72,7 +72,7 @@ tui_disassemble (struct tui_asm_line *asm_lines, ui_file_rewind (gdb_dis_out); - pc = pc + gdb_print_insn (pc, gdb_dis_out, NULL); + pc = pc + gdb_print_insn (gdbarch, pc, gdb_dis_out, NULL); asm_lines->insn = xstrdup (tui_file_get_strbuf (gdb_dis_out)); @@ -87,7 +87,7 @@ tui_disassemble (struct tui_asm_line *asm_lines, or below the PC. Variable sized instructions are taken into account by the algorithm. */ static CORE_ADDR -tui_find_disassembly_address (CORE_ADDR pc, int from) +tui_find_disassembly_address (struct gdbarch *gdbarch, CORE_ADDR pc, int from) { CORE_ADDR new_low; int max_lines; @@ -105,7 +105,7 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) new_low = pc; if (from > 0) { - tui_disassemble (asm_lines, pc, max_lines); + tui_disassemble (gdbarch, asm_lines, pc, max_lines); new_low = asm_lines[max_lines - 1].addr; } else @@ -127,7 +127,7 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) else new_low += 1 * max_lines; - tui_disassemble (asm_lines, new_low, max_lines); + tui_disassemble (gdbarch, asm_lines, new_low, max_lines); last_addr = asm_lines[pos].addr; } while (last_addr > pc && msymbol); @@ -144,7 +144,8 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) if (pos >= max_lines) pos = 0; - next_addr = tui_disassemble (&asm_lines[pos], last_addr, 1); + next_addr = tui_disassemble (gdbarch, &asm_lines[pos], + last_addr, 1); /* If there are some problems while disassembling exit. */ if (next_addr <= last_addr) @@ -166,7 +167,7 @@ tui_find_disassembly_address (CORE_ADDR pc, int from) /* Function to set the disassembly window's content. */ enum tui_status -tui_set_disassem_content (CORE_ADDR pc) +tui_set_disassem_content (struct gdbarch *gdbarch, CORE_ADDR pc) { enum tui_status ret = TUI_FAILURE; int i; @@ -187,6 +188,7 @@ tui_set_disassem_content (CORE_ADDR pc) if (ret != TUI_SUCCESS) return ret; + TUI_DISASM_WIN->detail.source_info.gdbarch = gdbarch; TUI_DISASM_WIN->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS; TUI_DISASM_WIN->detail.source_info.start_line_or_addr.u.addr = pc; cur_pc = (CORE_ADDR) @@ -202,7 +204,7 @@ tui_set_disassem_content (CORE_ADDR pc) line_width = TUI_DISASM_WIN->generic.width - 1; - tui_disassemble (asm_lines, pc, max_lines); + tui_disassemble (gdbarch, asm_lines, pc, max_lines); /* See what is the maximum length of an address and of a line. */ addr_size = 0; @@ -269,7 +271,7 @@ tui_set_disassem_content (CORE_ADDR pc) /* Function to display the disassembly window with disassembled code. */ void -tui_show_disassem (CORE_ADDR start_addr) +tui_show_disassem (struct gdbarch *gdbarch, CORE_ADDR start_addr) { struct symtab *s = find_pc_symtab (start_addr); struct tui_win_info *win_with_focus = tui_win_with_focus (); @@ -278,7 +280,7 @@ tui_show_disassem (CORE_ADDR start_addr) val.loa = LOA_ADDRESS; val.u.addr = start_addr; tui_add_win_to_layout (DISASSEM_WIN); - tui_update_source_window (TUI_DISASM_WIN, s, val, FALSE); + tui_update_source_window (TUI_DISASM_WIN, gdbarch, s, val, FALSE); /* If the focus was in the src win, put it in the asm win, if the source view isn't split. */ @@ -292,11 +294,12 @@ tui_show_disassem (CORE_ADDR start_addr) /* Function to display the disassembly window. */ void -tui_show_disassem_and_update_source (CORE_ADDR start_addr) +tui_show_disassem_and_update_source (struct gdbarch *gdbarch, + CORE_ADDR start_addr) { struct symtab_and_line sal; - tui_show_disassem (start_addr); + tui_show_disassem (gdbarch, start_addr); if (tui_current_layout () == SRC_DISASSEM_COMMAND) { struct tui_line_or_address val; @@ -307,7 +310,7 @@ tui_show_disassem_and_update_source (CORE_ADDR start_addr) sal = find_pc_line (start_addr, 0); val.loa = LOA_LINE; val.u.line_no = sal.line; - tui_update_source_window (TUI_SRC_WIN, sal.symtab, val, TRUE); + tui_update_source_window (TUI_SRC_WIN, gdbarch, sal.symtab, val, TRUE); if (sal.symtab) { set_current_source_symtab_and_line (&sal); @@ -320,11 +323,12 @@ tui_show_disassem_and_update_source (CORE_ADDR start_addr) return; } -CORE_ADDR -tui_get_begin_asm_address (void) +void +tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) { struct tui_gen_win_info *locator; struct tui_locator_element *element; + struct gdbarch *gdbarch = NULL; CORE_ADDR addr; locator = tui_locator_win_info_ptr (); @@ -347,24 +351,28 @@ tui_get_begin_asm_address (void) addr = 0; } else /* The target is executing. */ - addr = element->addr; + { + gdbarch = element->gdbarch; + addr = element->addr; + } - return addr; + *gdbarch_p = gdbarch; + *addr_p = addr; } /* Determine what the low address will be to display in the TUI's disassembly window. This may or may not be the same as the low address input. */ CORE_ADDR -tui_get_low_disassembly_address (CORE_ADDR low, - CORE_ADDR pc) +tui_get_low_disassembly_address (struct gdbarch *gdbarch, + CORE_ADDR low, CORE_ADDR pc) { int pos; /* Determine where to start the disassembly so that the pc is about in the middle of the viewport. */ pos = tui_default_win_viewport_height (DISASSEM_WIN, DISASSEM_COMMAND) / 2; - pc = tui_find_disassembly_address (pc, -pos); + pc = tui_find_disassembly_address (gdbarch, pc, -pos); if (pc < low) pc = low; @@ -378,6 +386,7 @@ tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction, { if (TUI_DISASM_WIN->generic.content != NULL) { + struct gdbarch *gdbarch = TUI_DISASM_WIN->detail.source_info.gdbarch; CORE_ADDR pc; tui_win_content content; struct tui_line_or_address val; @@ -390,7 +399,7 @@ tui_vertical_disassem_scroll (enum tui_scroll_direction scroll_direction, dir = (scroll_direction == FORWARD_SCROLL) ? num_to_scroll : -num_to_scroll; val.loa = LOA_ADDRESS; - val.u.addr = tui_find_disassembly_address (pc, dir); - tui_update_source_window_as_is (TUI_DISASM_WIN, NULL, val, FALSE); + val.u.addr = tui_find_disassembly_address (gdbarch, pc, dir); + tui_update_source_window_as_is (TUI_DISASM_WIN, gdbarch, NULL, val, FALSE); } } diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h index 0f06511dd16..64aafedc4df 100644 --- a/gdb/tui/tui-disasm.h +++ b/gdb/tui/tui-disasm.h @@ -26,11 +26,11 @@ #include "tui/tui.h" /* For enum tui_status. */ #include "tui/tui-data.h" /* For enum tui_scroll_direction. */ -extern enum tui_status tui_set_disassem_content (CORE_ADDR); -extern void tui_show_disassem (CORE_ADDR); -extern void tui_show_disassem_and_update_source (CORE_ADDR); +extern enum tui_status tui_set_disassem_content (struct gdbarch *, CORE_ADDR); +extern void tui_show_disassem (struct gdbarch *, CORE_ADDR); +extern void tui_show_disassem_and_update_source (struct gdbarch *, CORE_ADDR); extern void tui_vertical_disassem_scroll (enum tui_scroll_direction, int); -extern CORE_ADDR tui_get_begin_asm_address (void); +extern void tui_get_begin_asm_address (struct gdbarch **, CORE_ADDR *); #endif diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index 09fd0c3e89b..75edde4dbcb 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -67,7 +67,7 @@ static enum tui_layout_type prev_layout (void); static void tui_layout_command (char *, int); static void tui_toggle_layout_command (char *, int); static void tui_toggle_split_layout_command (char *, int); -static CORE_ADDR extract_display_start_addr (void); +static void extract_display_start_addr (struct gdbarch **, CORE_ADDR *); static void tui_handle_xdb_layout (struct tui_layout_def *); @@ -143,10 +143,12 @@ tui_set_layout (enum tui_layout_type layout_type, enum tui_layout_type cur_layout = tui_current_layout (), new_layout = UNDEFINED_LAYOUT; int regs_populate = FALSE; - CORE_ADDR addr = extract_display_start_addr (); + struct gdbarch *gdbarch; + CORE_ADDR addr; struct tui_win_info *win_with_focus = tui_win_with_focus (); struct tui_layout_def *layout_def = tui_layout_def (); + extract_display_start_addr (&gdbarch, &addr); if (layout_type == UNDEFINED_LAYOUT && regs_display_type != TUI_UNDEFINED_REGS) @@ -192,7 +194,7 @@ tui_set_layout (enum tui_layout_type layout_type, 2. if target was compiled without -g We still want to show the assembly though! */ - addr = tui_get_begin_asm_address (); + tui_get_begin_asm_address (&gdbarch, &addr); tui_set_win_focus_to (TUI_DISASM_WIN); layout_def->display_mode = DISASSEM_WIN; layout_def->split = FALSE; @@ -206,7 +208,7 @@ tui_set_layout (enum tui_layout_type layout_type, 2. if target was compiled without -g We still want to show the assembly though! */ - addr = tui_get_begin_asm_address (); + tui_get_begin_asm_address (&gdbarch, &addr); if (win_with_focus == TUI_SRC_WIN) tui_set_win_focus_to (TUI_SRC_WIN); else @@ -230,7 +232,7 @@ tui_set_layout (enum tui_layout_type layout_type, 2. if target was compiled without -g We still want to show the assembly though! */ - addr = tui_get_begin_asm_address (); + tui_get_begin_asm_address (&gdbarch, &addr); if (win_with_focus != TUI_DATA_WIN) tui_set_win_focus_to (TUI_DISASM_WIN); else @@ -250,7 +252,7 @@ tui_set_layout (enum tui_layout_type layout_type, || new_layout == DISASSEM_DATA_COMMAND)) tui_display_all_data (); - tui_update_source_windows_with_addr (addr); + tui_update_source_windows_with_addr (gdbarch, addr); } if (regs_populate) { @@ -516,10 +518,11 @@ tui_set_layout_for_display_command (const char *layout_name) } -static CORE_ADDR -extract_display_start_addr (void) +static void +extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) { enum tui_layout_type cur_layout = tui_current_layout (); + struct gdbarch *gdbarch = NULL; CORE_ADDR addr; CORE_ADDR pc; struct symtab_and_line cursal = get_current_source_symtab_and_line (); @@ -528,6 +531,7 @@ extract_display_start_addr (void) { case SRC_COMMAND: case SRC_DATA_COMMAND: + gdbarch = TUI_SRC_WIN->detail.source_info.gdbarch; find_line_pc (cursal.symtab, TUI_SRC_WIN->detail.source_info.start_line_or_addr.u.line_no, &pc); @@ -536,6 +540,7 @@ extract_display_start_addr (void) case DISASSEM_COMMAND: case SRC_DISASSEM_COMMAND: case DISASSEM_DATA_COMMAND: + gdbarch = TUI_DISASM_WIN->detail.source_info.gdbarch; addr = TUI_DISASM_WIN->detail.source_info.start_line_or_addr.u.addr; break; default: @@ -543,7 +548,8 @@ extract_display_start_addr (void) break; } - return addr; + *gdbarch_p = gdbarch; + *addr_p = addr; } diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 5b8000e3d74..057383f8bf2 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -27,6 +27,7 @@ #include "breakpoint.h" #include "source.h" #include "symtab.h" +#include "objfiles.h" #include "tui/tui.h" #include "tui/tui-data.h" @@ -106,6 +107,7 @@ tui_set_source_content (struct symtab *s, stream = fdopen (desc, FOPEN_RT); clearerr (stream); cur_line = 0; + src->gdbarch = get_objfile_arch (s->objfile); src->start_line_or_addr.loa = LOA_LINE; cur_line_no = src->start_line_or_addr.u.line_no = line_no; if (offset > 0) @@ -311,12 +313,12 @@ tui_set_source_content_nil (struct tui_win_info *win_info, /* Function to display source in the source window. This function initializes the horizontal scroll to 0. */ void -tui_show_symtab_source (struct symtab *s, +tui_show_symtab_source (struct gdbarch *gdbarch, struct symtab *s, struct tui_line_or_address line, int noerror) { TUI_SRC_WIN->detail.source_info.horizontal_offset = 0; - tui_update_source_window_as_is (TUI_SRC_WIN, s, line, noerror); + tui_update_source_window_as_is (TUI_SRC_WIN, gdbarch, s, line, noerror); } diff --git a/gdb/tui/tui-source.h b/gdb/tui/tui-source.h index 27199d0e455..7d6bb2e6417 100644 --- a/gdb/tui/tui-source.h +++ b/gdb/tui/tui-source.h @@ -33,7 +33,7 @@ extern void tui_set_source_content_nil (struct tui_win_info *, extern enum tui_status tui_set_source_content (struct symtab *, int, int); -extern void tui_show_symtab_source (struct symtab *, +extern void tui_show_symtab_source (struct gdbarch *, struct symtab *, struct tui_line_or_address, int); extern int tui_source_is_displayed (char *); diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index ccc9b9ffdb2..00e091d64cd 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -48,7 +48,8 @@ static char *tui_get_function_from_frame (struct frame_info *fi); static void tui_set_locator_filename (const char *filename); /* Update the locator, with the provided arguments. */ -static void tui_set_locator_info (const char *filename, +static void tui_set_locator_info (struct gdbarch *gdbarch, + const char *filename, const char *procname, int lineno, CORE_ADDR addr); @@ -274,7 +275,7 @@ tui_set_locator_filename (const char *filename) if (locator->content[0] == NULL) { - tui_set_locator_info (filename, NULL, 0, 0); + tui_set_locator_info (NULL, filename, NULL, 0, 0); return; } @@ -285,7 +286,8 @@ tui_set_locator_filename (const char *filename) /* Update the locator, with the provided arguments. */ static void -tui_set_locator_info (const char *filename, +tui_set_locator_info (struct gdbarch *gdbarch, + const char *filename, const char *procname, int lineno, CORE_ADDR addr) @@ -305,6 +307,7 @@ tui_set_locator_info (const char *filename, strcat_to_buf (element->proc_name, MAX_LOCATOR_ELEMENT_LEN, procname); element->line_no = lineno; element->addr = addr; + element->gdbarch = gdbarch; tui_set_locator_filename (filename); } @@ -335,7 +338,8 @@ tui_show_frame_info (struct frame_info *fi) source_already_displayed = sal.symtab != 0 && tui_source_is_displayed (sal.symtab->filename); - tui_set_locator_info (sal.symtab == 0 ? "??" : sal.symtab->filename, + tui_set_locator_info (get_frame_arch (fi), + sal.symtab == 0 ? "??" : sal.symtab->filename, tui_get_function_from_frame (fi), sal.line, get_frame_pc (fi)); @@ -360,7 +364,8 @@ tui_show_frame_info (struct frame_info *fi) &low, (CORE_ADDR) 0) == 0) error (_("No function contains program counter for selected frame.")); else - low = tui_get_low_disassembly_address (low, get_frame_pc (fi)); + low = tui_get_low_disassembly_address (get_frame_arch (fi), + low, get_frame_pc (fi)); } if (win_info == TUI_SRC_WIN) @@ -370,7 +375,8 @@ tui_show_frame_info (struct frame_info *fi) l.u.line_no = start_line; if (!(source_already_displayed && tui_line_is_displayed (item->locator.line_no, win_info, TRUE))) - tui_update_source_window (win_info, sal.symtab, l, TRUE); + tui_update_source_window (win_info, get_frame_arch (fi), + sal.symtab, l, TRUE); else { l.u.line_no = item->locator.line_no; @@ -385,7 +391,8 @@ tui_show_frame_info (struct frame_info *fi) a.loa = LOA_ADDRESS; a.u.addr = low; if (!tui_addr_is_displayed (item->locator.addr, win_info, TRUE)) - tui_update_source_window (win_info, sal.symtab, a, TRUE); + tui_update_source_window (win_info, get_frame_arch (fi), + sal.symtab, a, TRUE); else { a.u.addr = item->locator.addr; @@ -398,7 +405,7 @@ tui_show_frame_info (struct frame_info *fi) } else { - tui_set_locator_info (NULL, NULL, 0, (CORE_ADDR) 0); + tui_set_locator_info (NULL, NULL, NULL, 0, (CORE_ADDR) 0); tui_show_locator_content (); for (i = 0; i < (tui_source_windows ())->count; i++) { diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index b101cdd5333..11944fe10eb 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -1360,19 +1360,22 @@ make_visible_with_new_height (struct tui_win_info *win_info) tui_make_visible (win_info->detail.source_info.execution_info); if (win_info->generic.content != NULL) { + struct gdbarch *gdbarch = win_info->detail.source_info.gdbarch; struct tui_line_or_address line_or_addr; struct symtab_and_line cursal = get_current_source_symtab_and_line (); line_or_addr = win_info->detail.source_info.start_line_or_addr; tui_free_win_content (&win_info->generic); - tui_update_source_window (win_info, cursal.symtab, line_or_addr, TRUE); + tui_update_source_window (win_info, gdbarch, + cursal.symtab, line_or_addr, TRUE); } else if (deprecated_safe_get_selected_frame () != NULL) { struct tui_line_or_address line; struct symtab_and_line cursal = get_current_source_symtab_and_line (); struct frame_info *frame = deprecated_safe_get_selected_frame (); + struct gdbarch *gdbarch = get_frame_arch (frame); s = find_pc_symtab (get_frame_pc (frame)); if (win_info->generic.type == SRC_WIN) @@ -1385,7 +1388,7 @@ make_visible_with_new_height (struct tui_win_info *win_info) line.loa = LOA_ADDRESS; find_line_pc (s, cursal.line, &line.u.addr); } - tui_update_source_window (win_info, s, line, TRUE); + tui_update_source_window (win_info, gdbarch, s, line, TRUE); } if (tui_win_has_locator (win_info)) { diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 158aa89cccd..4b7d744b131 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -27,6 +27,7 @@ #include "breakpoint.h" #include "value.h" #include "source.h" +#include "objfiles.h" #include "tui/tui.h" #include "tui/tui-data.h" @@ -47,14 +48,15 @@ tui_display_main (void) { if ((tui_source_windows ())->count > 0) { + struct gdbarch *gdbarch; CORE_ADDR addr; - addr = tui_get_begin_asm_address (); + tui_get_begin_asm_address (&gdbarch, &addr); if (addr != (CORE_ADDR) 0) { struct symtab_and_line sal; - tui_update_source_windows_with_addr (addr); + tui_update_source_windows_with_addr (gdbarch, addr); sal = find_pc_line (addr, 0); if (sal.symtab) tui_update_locator_filename (sal.symtab->filename); @@ -70,12 +72,13 @@ tui_display_main (void) initializes the horizontal scroll to 0. */ void tui_update_source_window (struct tui_win_info *win_info, + struct gdbarch *gdbarch, struct symtab *s, struct tui_line_or_address line_or_addr, int noerror) { win_info->detail.source_info.horizontal_offset = 0; - tui_update_source_window_as_is (win_info, s, line_or_addr, noerror); + tui_update_source_window_as_is (win_info, gdbarch, s, line_or_addr, noerror); return; } @@ -85,6 +88,7 @@ tui_update_source_window (struct tui_win_info *win_info, shows the source as specified by the horizontal offset. */ void tui_update_source_window_as_is (struct tui_win_info *win_info, + struct gdbarch *gdbarch, struct symtab *s, struct tui_line_or_address line_or_addr, int noerror) @@ -94,7 +98,7 @@ tui_update_source_window_as_is (struct tui_win_info *win_info, if (win_info->generic.type == SRC_WIN) ret = tui_set_source_content (s, line_or_addr.u.line_no, noerror); else - ret = tui_set_disassem_content (line_or_addr.u.addr); + ret = tui_set_disassem_content (gdbarch, line_or_addr.u.addr); if (ret == TUI_FAILURE) { @@ -130,7 +134,7 @@ tui_update_source_window_as_is (struct tui_win_info *win_info, /* Function to ensure that the source and/or disassemly windows reflect the input address. */ void -tui_update_source_windows_with_addr (CORE_ADDR addr) +tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr) { if (addr != 0) { @@ -141,16 +145,16 @@ tui_update_source_windows_with_addr (CORE_ADDR addr) { case DISASSEM_COMMAND: case DISASSEM_DATA_COMMAND: - tui_show_disassem (addr); + tui_show_disassem (gdbarch, addr); break; case SRC_DISASSEM_COMMAND: - tui_show_disassem_and_update_source (addr); + tui_show_disassem_and_update_source (gdbarch, addr); break; default: sal = find_pc_line (addr, 0); l.loa = LOA_LINE; l.u.line_no = sal.line; - tui_show_symtab_source (sal.symtab, l, FALSE); + tui_show_symtab_source (gdbarch, sal.symtab, l, FALSE); break; } } @@ -173,24 +177,30 @@ tui_update_source_windows_with_addr (CORE_ADDR addr) void tui_update_source_windows_with_line (struct symtab *s, int line) { + struct gdbarch *gdbarch; CORE_ADDR pc; struct tui_line_or_address l; - + + if (!s) + return; + + gdbarch = get_objfile_arch (s->objfile); + switch (tui_current_layout ()) { case DISASSEM_COMMAND: case DISASSEM_DATA_COMMAND: find_line_pc (s, line, &pc); - tui_update_source_windows_with_addr (pc); + tui_update_source_windows_with_addr (gdbarch, pc); break; default: l.loa = LOA_LINE; l.u.line_no = line; - tui_show_symtab_source (s, l, FALSE); + tui_show_symtab_source (gdbarch, s, l, FALSE); if (tui_current_layout () == SRC_DISASSEM_COMMAND) { find_line_pc (s, line, &pc); - tui_show_disassem (pc); + tui_show_disassem (gdbarch, pc); } break; } @@ -311,6 +321,7 @@ tui_horizontal_source_scroll (struct tui_win_info *win_info, { if (win_info->generic.content != NULL) { + struct gdbarch *gdbarch = win_info->detail.source_info.gdbarch; int offset; struct symtab *s = NULL; @@ -332,7 +343,7 @@ tui_horizontal_source_scroll (struct tui_win_info *win_info, offset = 0; } win_info->detail.source_info.horizontal_offset = offset; - tui_update_source_window_as_is (win_info, s, + tui_update_source_window_as_is (win_info, gdbarch, s, ((struct tui_win_element *) win_info->generic.content[0])->which_element.source.line_or_addr, FALSE); diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index fdfd3ec2bd5..6fae8d8c571 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -41,14 +41,14 @@ extern int tui_update_breakpoint_info (struct tui_win_info *win, /* Function to display the "main" routine. */ extern void tui_display_main (void); extern void tui_update_source_window (struct tui_win_info *, - struct symtab *, + struct gdbarch *, struct symtab *, struct tui_line_or_address, int); extern void tui_update_source_window_as_is (struct tui_win_info *, - struct symtab *, + struct gdbarch *, struct symtab *, struct tui_line_or_address, int); -extern void tui_update_source_windows_with_addr (CORE_ADDR); +extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR); extern void tui_update_source_windows_with_line (struct symtab *, int); extern void tui_clear_source_content (struct tui_win_info *, int); diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c index a8952e631b0..7c0d0ce45f2 100644 --- a/gdb/tui/tui.c +++ b/gdb/tui/tui.c @@ -535,10 +535,10 @@ tui_show_source (const char *file, int line) } void -tui_show_assembly (CORE_ADDR addr) +tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr) { tui_add_win_to_layout (DISASSEM_WIN); - tui_update_source_windows_with_addr (addr); + tui_update_source_windows_with_addr (gdbarch, addr); } int diff --git a/gdb/tui/tui.h b/gdb/tui/tui.h index 41438ca26f8..22ff02a6600 100644 --- a/gdb/tui/tui.h +++ b/gdb/tui/tui.h @@ -54,9 +54,9 @@ enum tui_win_type /* GENERAL TUI FUNCTIONS */ /* tui.c */ -extern CORE_ADDR tui_get_low_disassembly_address (CORE_ADDR, - CORE_ADDR); -extern void tui_show_assembly (CORE_ADDR addr); +extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *, + CORE_ADDR, CORE_ADDR); +extern void tui_show_assembly (struct gdbarch *gdbarch, CORE_ADDR addr); extern int tui_is_window_visible (enum tui_win_type type); extern int tui_get_command_dimension (unsigned int *width, unsigned int *height);