5af949e350
(paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
440 lines
13 KiB
C
440 lines
13 KiB
C
/* TUI display locator.
|
||
|
||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008,
|
||
2009 Free Software Foundation, Inc.
|
||
|
||
Contributed by Hewlett-Packard Company.
|
||
|
||
This file is part of GDB.
|
||
|
||
This program is free software; you can redistribute it and/or modify
|
||
it under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation; either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||
|
||
#include "defs.h"
|
||
#include "symtab.h"
|
||
#include "breakpoint.h"
|
||
#include "frame.h"
|
||
#include "command.h"
|
||
#include "inferior.h"
|
||
#include "target.h"
|
||
#include "top.h"
|
||
#include "gdb_string.h"
|
||
#include "tui/tui.h"
|
||
#include "tui/tui-data.h"
|
||
#include "tui/tui-stack.h"
|
||
#include "tui/tui-wingeneral.h"
|
||
#include "tui/tui-source.h"
|
||
#include "tui/tui-winsource.h"
|
||
#include "tui/tui-file.h"
|
||
|
||
#include "gdb_curses.h"
|
||
|
||
/* Get a printable name for the function at the address.
|
||
The symbol name is demangled if demangling is turned on.
|
||
Returns a pointer to a static area holding the result. */
|
||
static char *tui_get_function_from_frame (struct frame_info *fi);
|
||
|
||
/* Set the filename portion of the locator. */
|
||
static void tui_set_locator_filename (const char *filename);
|
||
|
||
/* Update the locator, with the provided arguments. */
|
||
static void tui_set_locator_info (struct gdbarch *gdbarch,
|
||
const char *filename,
|
||
const char *procname,
|
||
int lineno, CORE_ADDR addr);
|
||
|
||
static void tui_update_command (char *, int);
|
||
|
||
|
||
/* Create the status line to display as much information as we can on
|
||
this single line: target name, process number, current function,
|
||
current line, current PC, SingleKey mode. */
|
||
static char*
|
||
tui_make_status_line (struct tui_locator_element *loc)
|
||
{
|
||
char *string;
|
||
char line_buf[50], *pname;
|
||
char *buf;
|
||
int status_size;
|
||
int i, proc_width;
|
||
const char *pid_name;
|
||
const char *pc_buf;
|
||
int target_width;
|
||
int pid_width;
|
||
int line_width;
|
||
int pc_width;
|
||
struct ui_file *pc_out;
|
||
|
||
if (ptid_equal (inferior_ptid, null_ptid))
|
||
pid_name = "No process";
|
||
else
|
||
pid_name = target_pid_to_str (inferior_ptid);
|
||
|
||
target_width = strlen (target_shortname);
|
||
if (target_width > MAX_TARGET_WIDTH)
|
||
target_width = MAX_TARGET_WIDTH;
|
||
|
||
pid_width = strlen (pid_name);
|
||
if (pid_width > MAX_PID_WIDTH)
|
||
pid_width = MAX_PID_WIDTH;
|
||
|
||
status_size = tui_term_width ();
|
||
string = (char *) xmalloc (status_size + 1);
|
||
buf = (char*) alloca (status_size + 1);
|
||
|
||
/* Translate line number and obtain its size. */
|
||
if (loc->line_no > 0)
|
||
sprintf (line_buf, "%d", loc->line_no);
|
||
else
|
||
strcpy (line_buf, "??");
|
||
line_width = strlen (line_buf);
|
||
if (line_width < MIN_LINE_WIDTH)
|
||
line_width = MIN_LINE_WIDTH;
|
||
|
||
/* Translate PC address. */
|
||
pc_out = tui_sfileopen (128);
|
||
fputs_filtered (paddress (loc->gdbarch, loc->addr), pc_out);
|
||
pc_buf = tui_file_get_strbuf (pc_out);
|
||
pc_width = strlen (pc_buf);
|
||
|
||
/* First determine the amount of proc name width we have available.
|
||
The +1 are for a space separator between fields.
|
||
The -1 are to take into account the \0 counted by sizeof. */
|
||
proc_width = (status_size
|
||
- (target_width + 1)
|
||
- (pid_width + 1)
|
||
- (sizeof (PROC_PREFIX) - 1 + 1)
|
||
- (sizeof (LINE_PREFIX) - 1 + line_width + 1)
|
||
- (sizeof (PC_PREFIX) - 1 + pc_width + 1)
|
||
- (tui_current_key_mode == TUI_SINGLE_KEY_MODE
|
||
? (sizeof (SINGLE_KEY) - 1 + 1)
|
||
: 0));
|
||
|
||
/* If there is no room to print the function name, try by removing
|
||
some fields. */
|
||
if (proc_width < MIN_PROC_WIDTH)
|
||
{
|
||
proc_width += target_width + 1;
|
||
target_width = 0;
|
||
if (proc_width < MIN_PROC_WIDTH)
|
||
{
|
||
proc_width += pid_width + 1;
|
||
pid_width = 0;
|
||
if (proc_width <= MIN_PROC_WIDTH)
|
||
{
|
||
proc_width += pc_width + sizeof (PC_PREFIX) - 1 + 1;
|
||
pc_width = 0;
|
||
if (proc_width < 0)
|
||
{
|
||
proc_width += line_width + sizeof (LINE_PREFIX) - 1 + 1;
|
||
line_width = 0;
|
||
if (proc_width < 0)
|
||
proc_width = 0;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/* Now convert elements to string form. */
|
||
pname = loc->proc_name;
|
||
|
||
/* Now create the locator line from the string version of the
|
||
elements. We could use sprintf() here but that wouldn't ensure
|
||
that we don't overrun the size of the allocated buffer.
|
||
strcat_to_buf() will. */
|
||
*string = (char) 0;
|
||
|
||
if (target_width > 0)
|
||
{
|
||
sprintf (buf, "%*.*s ",
|
||
-target_width, target_width, target_shortname);
|
||
strcat_to_buf (string, status_size, buf);
|
||
}
|
||
if (pid_width > 0)
|
||
{
|
||
sprintf (buf, "%*.*s ",
|
||
-pid_width, pid_width, pid_name);
|
||
strcat_to_buf (string, status_size, buf);
|
||
}
|
||
|
||
/* Show whether we are in SingleKey mode. */
|
||
if (tui_current_key_mode == TUI_SINGLE_KEY_MODE)
|
||
{
|
||
strcat_to_buf (string, status_size, SINGLE_KEY);
|
||
strcat_to_buf (string, status_size, " ");
|
||
}
|
||
|
||
/* Procedure/class name. */
|
||
if (proc_width > 0)
|
||
{
|
||
if (strlen (pname) > proc_width)
|
||
sprintf (buf, "%s%*.*s* ", PROC_PREFIX,
|
||
1 - proc_width, proc_width - 1, pname);
|
||
else
|
||
sprintf (buf, "%s%*.*s ", PROC_PREFIX,
|
||
-proc_width, proc_width, pname);
|
||
strcat_to_buf (string, status_size, buf);
|
||
}
|
||
|
||
if (line_width > 0)
|
||
{
|
||
sprintf (buf, "%s%*.*s ", LINE_PREFIX,
|
||
-line_width, line_width, line_buf);
|
||
strcat_to_buf (string, status_size, buf);
|
||
}
|
||
if (pc_width > 0)
|
||
{
|
||
strcat_to_buf (string, status_size, PC_PREFIX);
|
||
strcat_to_buf (string, status_size, pc_buf);
|
||
}
|
||
|
||
|
||
for (i = strlen (string); i < status_size; i++)
|
||
string[i] = ' ';
|
||
string[status_size] = (char) 0;
|
||
|
||
ui_file_delete (pc_out);
|
||
return string;
|
||
}
|
||
|
||
/* Get a printable name for the function at the address. The symbol
|
||
name is demangled if demangling is turned on. Returns a pointer to
|
||
a static area holding the result. */
|
||
static char*
|
||
tui_get_function_from_frame (struct frame_info *fi)
|
||
{
|
||
static char name[256];
|
||
struct ui_file *stream = tui_sfileopen (256);
|
||
char *p;
|
||
|
||
print_address_symbolic (get_frame_pc (fi), stream, demangle, "");
|
||
p = tui_file_get_strbuf (stream);
|
||
|
||
/* Use simple heuristics to isolate the function name. The symbol
|
||
can be demangled and we can have function parameters. Remove
|
||
them because the status line is too short to display them. */
|
||
if (*p == '<')
|
||
p++;
|
||
strncpy (name, p, sizeof (name));
|
||
p = strchr (name, '(');
|
||
if (!p)
|
||
p = strchr (name, '>');
|
||
if (p)
|
||
*p = 0;
|
||
p = strchr (name, '+');
|
||
if (p)
|
||
*p = 0;
|
||
ui_file_delete (stream);
|
||
return name;
|
||
}
|
||
|
||
void
|
||
tui_show_locator_content (void)
|
||
{
|
||
char *string;
|
||
struct tui_gen_win_info *locator;
|
||
|
||
locator = tui_locator_win_info_ptr ();
|
||
|
||
if (locator != NULL && locator->handle != (WINDOW *) NULL)
|
||
{
|
||
struct tui_win_element *element;
|
||
|
||
element = (struct tui_win_element *) locator->content[0];
|
||
|
||
string = tui_make_status_line (&element->which_element.locator);
|
||
wmove (locator->handle, 0, 0);
|
||
wstandout (locator->handle);
|
||
waddstr (locator->handle, string);
|
||
wclrtoeol (locator->handle);
|
||
wstandend (locator->handle);
|
||
tui_refresh_win (locator);
|
||
wmove (locator->handle, 0, 0);
|
||
xfree (string);
|
||
locator->content_in_use = TRUE;
|
||
}
|
||
}
|
||
|
||
|
||
/* Set the filename portion of the locator. */
|
||
static void
|
||
tui_set_locator_filename (const char *filename)
|
||
{
|
||
struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
|
||
struct tui_locator_element *element;
|
||
|
||
if (locator->content[0] == NULL)
|
||
{
|
||
tui_set_locator_info (NULL, filename, NULL, 0, 0);
|
||
return;
|
||
}
|
||
|
||
element = &((struct tui_win_element *) locator->content[0])->which_element.locator;
|
||
element->file_name[0] = 0;
|
||
strcat_to_buf (element->file_name, MAX_LOCATOR_ELEMENT_LEN, filename);
|
||
}
|
||
|
||
/* Update the locator, with the provided arguments. */
|
||
static void
|
||
tui_set_locator_info (struct gdbarch *gdbarch,
|
||
const char *filename,
|
||
const char *procname,
|
||
int lineno,
|
||
CORE_ADDR addr)
|
||
{
|
||
struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
|
||
struct tui_locator_element *element;
|
||
|
||
/* Allocate the locator content if necessary. */
|
||
if (locator->content_size <= 0)
|
||
{
|
||
locator->content = (void **) tui_alloc_content (1, locator->type);
|
||
locator->content_size = 1;
|
||
}
|
||
|
||
element = &((struct tui_win_element *) locator->content[0])->which_element.locator;
|
||
element->proc_name[0] = (char) 0;
|
||
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);
|
||
}
|
||
|
||
/* Update only the filename portion of the locator. */
|
||
void
|
||
tui_update_locator_filename (const char *filename)
|
||
{
|
||
tui_set_locator_filename (filename);
|
||
tui_show_locator_content ();
|
||
}
|
||
|
||
/* Function to print the frame information for the TUI. */
|
||
void
|
||
tui_show_frame_info (struct frame_info *fi)
|
||
{
|
||
struct tui_win_info *win_info;
|
||
int i;
|
||
|
||
if (fi)
|
||
{
|
||
int start_line, i;
|
||
CORE_ADDR low;
|
||
struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
|
||
int source_already_displayed;
|
||
struct symtab_and_line sal;
|
||
|
||
find_frame_sal (fi, &sal);
|
||
|
||
source_already_displayed = sal.symtab != 0
|
||
&& tui_source_is_displayed (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));
|
||
tui_show_locator_content ();
|
||
start_line = 0;
|
||
for (i = 0; i < (tui_source_windows ())->count; i++)
|
||
{
|
||
union tui_which_element *item;
|
||
win_info = (tui_source_windows ())->list[i];
|
||
|
||
item = &((struct tui_win_element *) locator->content[0])->which_element;
|
||
if (win_info == TUI_SRC_WIN)
|
||
{
|
||
start_line = (item->locator.line_no -
|
||
(win_info->generic.viewport_height / 2)) + 1;
|
||
if (start_line <= 0)
|
||
start_line = 1;
|
||
}
|
||
else
|
||
{
|
||
if (find_pc_partial_function (get_frame_pc (fi), (char **) NULL,
|
||
&low, (CORE_ADDR) 0) == 0)
|
||
error (_("No function contains program counter for selected frame."));
|
||
else
|
||
low = tui_get_low_disassembly_address (get_frame_arch (fi),
|
||
low, get_frame_pc (fi));
|
||
}
|
||
|
||
if (win_info == TUI_SRC_WIN)
|
||
{
|
||
struct tui_line_or_address l;
|
||
l.loa = LOA_LINE;
|
||
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, get_frame_arch (fi),
|
||
sal.symtab, l, TRUE);
|
||
else
|
||
{
|
||
l.u.line_no = item->locator.line_no;
|
||
tui_set_is_exec_point_at (l, win_info);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (win_info == TUI_DISASM_WIN)
|
||
{
|
||
struct tui_line_or_address a;
|
||
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, get_frame_arch (fi),
|
||
sal.symtab, a, TRUE);
|
||
else
|
||
{
|
||
a.u.addr = item->locator.addr;
|
||
tui_set_is_exec_point_at (a, win_info);
|
||
}
|
||
}
|
||
}
|
||
tui_update_exec_info (win_info);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
tui_set_locator_info (NULL, NULL, NULL, 0, (CORE_ADDR) 0);
|
||
tui_show_locator_content ();
|
||
for (i = 0; i < (tui_source_windows ())->count; i++)
|
||
{
|
||
win_info = (tui_source_windows ())->list[i];
|
||
tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT);
|
||
tui_update_exec_info (win_info);
|
||
}
|
||
}
|
||
}
|
||
|
||
/* Function to initialize gdb commands, for tui window stack
|
||
manipulation. */
|
||
|
||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||
extern initialize_file_ftype _initialize_tui_stack;
|
||
|
||
void
|
||
_initialize_tui_stack (void)
|
||
{
|
||
add_com ("update", class_tui, tui_update_command, _("\
|
||
Update the source window and locator to display the current execution point.\n"));
|
||
}
|
||
|
||
/* Command to update the display with the current execution point. */
|
||
static void
|
||
tui_update_command (char *arg, int from_tty)
|
||
{
|
||
char cmd[sizeof("frame 0")];
|
||
|
||
strcpy (cmd, "frame 0");
|
||
execute_command (cmd, from_tty);
|
||
}
|