diff options
Diffstat (limited to 'gdb/tui')
-rw-r--r-- | gdb/tui/tui-data.c | 2 | ||||
-rw-r--r-- | gdb/tui/tui-data.h | 4 | ||||
-rw-r--r-- | gdb/tui/tui-disasm.c | 53 | ||||
-rw-r--r-- | gdb/tui/tui-disasm.h | 8 | ||||
-rw-r--r-- | gdb/tui/tui-layout.c | 24 | ||||
-rw-r--r-- | gdb/tui/tui-source.c | 6 | ||||
-rw-r--r-- | gdb/tui/tui-source.h | 2 | ||||
-rw-r--r-- | gdb/tui/tui-stack.c | 23 | ||||
-rw-r--r-- | gdb/tui/tui-win.c | 7 | ||||
-rw-r--r-- | gdb/tui/tui-winsource.c | 37 | ||||
-rw-r--r-- | gdb/tui/tui-winsource.h | 6 | ||||
-rw-r--r-- | gdb/tui/tui.c | 4 | ||||
-rw-r--r-- | gdb/tui/tui.h | 6 |
13 files changed, 113 insertions, 69 deletions
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 655a5d0..46a218a 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 1e475c3..ae5e09a 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 14f0496..7571a9b 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 0f06511..64aafed 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 09fd0c3..75edde4 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 5b8000e..057383f 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 27199d0..7d6bb2e 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 ccc9b9f..00e091d 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 b101cdd..11944fe 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 158aa89..4b7d744 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 fdfd3ec..6fae8d8 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 a8952e6..7c0d0ce 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 41438ca..22ff02a 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); |