X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Ftui%2Ftui-stack.c;h=ccc9b9ffdb2f4e5c4831247d051d0e71e7d1fb77;hb=2c0b251b29eeafa90c84a3a938c744bc7ba81aea;hp=bba77fdcb23f1739e739a26c9464c04bb7c47b8f;hpb=362c05fe98907eeba515c04386aee99936914114;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c index bba77fdcb2..ccc9b9ffdb 100644 --- a/gdb/tui/tui-stack.c +++ b/gdb/tui/tui-stack.c @@ -1,7 +1,7 @@ /* TUI display locator. - Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software - Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, + 2009 Free Software Foundation, Inc. Contributed by Hewlett-Packard Company. @@ -9,7 +9,7 @@ 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 2 of the License, or + 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, @@ -18,9 +18,7 @@ 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + along with this program. If not, see . */ #include "defs.h" #include "symtab.h" @@ -44,31 +42,32 @@ /* 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 *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 (const char *filename, const char *procname, +static void tui_set_locator_info (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. */ +/* 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) +tui_make_status_line (struct tui_locator_element *loc) { - char* string; + char *string; char line_buf[50], *pname; - char* buf; + char *buf; int status_size; int i, proc_width; - const char* pid_name; - const char* pc_buf; + const char *pid_name; + const char *pc_buf; int target_width; int pid_width; int line_width; @@ -103,7 +102,7 @@ tui_make_status_line (struct tui_locator_element* loc) /* Translate PC address. */ pc_out = tui_sfileopen (128); - deprecated_print_address_numeric (loc->addr, 1, pc_out); + fputs_filtered (paddress (loc->addr), pc_out); pc_buf = tui_file_get_strbuf (pc_out); pc_width = strlen (pc_buf); @@ -145,13 +144,13 @@ tui_make_status_line (struct tui_locator_element* loc) } } - /* Now convert elements to string form */ + /* 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. */ + /* 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) @@ -174,7 +173,7 @@ tui_make_status_line (struct tui_locator_element* loc) strcat_to_buf (string, status_size, " "); } - /* procedure/class name */ + /* Procedure/class name. */ if (proc_width > 0) { if (strlen (pname) > proc_width) @@ -207,9 +206,9 @@ tui_make_status_line (struct tui_locator_element* loc) 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. */ +/* 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) { @@ -220,9 +219,9 @@ tui_get_function_from_frame (struct frame_info *fi) 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. */ + /* 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)); @@ -242,13 +241,13 @@ void tui_show_locator_content (void) { char *string; - struct tui_gen_win_info * locator; + struct tui_gen_win_info *locator; locator = tui_locator_win_info_ptr (); if (locator != NULL && locator->handle != (WINDOW *) NULL) { - struct tui_win_element * element; + struct tui_win_element *element; element = (struct tui_win_element *) locator->content[0]; @@ -270,8 +269,8 @@ tui_show_locator_content (void) 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; + struct tui_gen_win_info *locator = tui_locator_win_info_ptr (); + struct tui_locator_element *element; if (locator->content[0] == NULL) { @@ -286,11 +285,13 @@ tui_set_locator_filename (const char *filename) /* Update the locator, with the provided arguments. */ static void -tui_set_locator_info (const char *filename, const char *procname, int lineno, +tui_set_locator_info (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; + 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) @@ -319,14 +320,14 @@ tui_update_locator_filename (const char *filename) void tui_show_frame_info (struct frame_info *fi) { - struct tui_win_info * win_info; + 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 (); + struct tui_gen_win_info *locator = tui_locator_win_info_ptr (); int source_already_displayed; struct symtab_and_line sal; @@ -343,7 +344,7 @@ tui_show_frame_info (struct frame_info *fi) for (i = 0; i < (tui_source_windows ())->count; i++) { union tui_which_element *item; - win_info = (struct tui_win_info *) (tui_source_windows ())->list[i]; + win_info = (tui_source_windows ())->list[i]; item = &((struct tui_win_element *) locator->content[0])->which_element; if (win_info == TUI_SRC_WIN) @@ -356,7 +357,7 @@ tui_show_frame_info (struct frame_info *fi) else { if (find_pc_partial_function (get_frame_pc (fi), (char **) NULL, - &low, (CORE_ADDR) NULL) == 0) + &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)); @@ -401,7 +402,7 @@ tui_show_frame_info (struct frame_info *fi) tui_show_locator_content (); for (i = 0; i < (tui_source_windows ())->count; i++) { - win_info = (struct tui_win_info *) (tui_source_windows ())->list[i]; + win_info = (tui_source_windows ())->list[i]; tui_clear_source_content (win_info, EMPTY_SOURCE_PROMPT); tui_update_exec_info (win_info); } @@ -410,6 +411,10 @@ tui_show_frame_info (struct frame_info *fi) /* 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) {