* source.c (print_source_lines_base): Print for TUI also "fullname".
	* tui/tui-data.c (init_content_element): Change tui_locator_element
	field to full_name.
	* tui/tui-data.h (struct tui_locator_element): Likewise.
	* tui/tui-disasm.c (tui_show_disassem_and_update_source): Rename
	tui_update_locator_filename calls to tui_update_locator_fullname.
	Replace symtab->filename refererence by symtab_to_fullname call.
	* tui/tui-out.c (tui_field_string): Check for "fullname" now.
	* tui/tui-source.c (tui_set_source_content): Change tui_locator_element
	field to full_name.  Replace symtab->filename refererence by
	symtab_to_fullname call.
	(tui_show_symtab_source): Rename parameter to fullname.  Change
	tui_locator_element field to full_name.
	* tui/tui-stack.c: Include source.h.
	(tui_set_locator_filename): Rename the declaration to ...
	(tui_set_locator_fullname): ... here.  Rename its parameter to
	fullname, updates its comment.
	(tui_set_locator_info): Rename its parameter to fullname.
	(tui_set_locator_filename): Rename the definition to ...
	(tui_set_locator_fullname): ... here.  Rename its parameter to
	fullname, updates its comment.  Change tui_locator_element field to
	full_name.
	(tui_set_locator_info): Rename its parameter to fullname.
	(tui_set_locator_info): Rename callee to tui_set_locator_fullname.
	(tui_update_locator_filename): Rename to ...
	(tui_update_locator_fullname): ... here. Rename callee to
	tui_set_locator_fullname.
	(tui_show_frame_info): Replace symtab->filename refererence by
	symtab_to_fullname call.
	* tui/tui-stack.h (tui_update_locator_filename): Rename to ...
	(tui_update_locator_fullname): ... here.
	* tui/tui-winsource.c (tui_display_main): Rename the callee to
	tui_update_locator_fullname.  Replace symtab->filename refererence by
	symtab_to_fullname call.
	* tui/tui.c (tui_show_source): Rename its parameter to fullname.
	Rename the callee to tui_update_locator_fullname.
	* tui/tui.h (tui_show_source): Rename its parameter to fullname.
This commit is contained in:
Jan Kratochvil
2013-02-03 16:16:42 +00:00
parent 05cba821ad
commit 56d397a382
12 changed files with 78 additions and 31 deletions

View File

@@ -1,3 +1,43 @@
2013-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* source.c (print_source_lines_base): Print for TUI also "fullname".
* tui/tui-data.c (init_content_element): Change tui_locator_element
field to full_name.
* tui/tui-data.h (struct tui_locator_element): Likewise.
* tui/tui-disasm.c (tui_show_disassem_and_update_source): Rename
tui_update_locator_filename calls to tui_update_locator_fullname.
Replace symtab->filename refererence by symtab_to_fullname call.
* tui/tui-out.c (tui_field_string): Check for "fullname" now.
* tui/tui-source.c (tui_set_source_content): Change tui_locator_element
field to full_name. Replace symtab->filename refererence by
symtab_to_fullname call.
(tui_show_symtab_source): Rename parameter to fullname. Change
tui_locator_element field to full_name.
* tui/tui-stack.c: Include source.h.
(tui_set_locator_filename): Rename the declaration to ...
(tui_set_locator_fullname): ... here. Rename its parameter to
fullname, updates its comment.
(tui_set_locator_info): Rename its parameter to fullname.
(tui_set_locator_filename): Rename the definition to ...
(tui_set_locator_fullname): ... here. Rename its parameter to
fullname, updates its comment. Change tui_locator_element field to
full_name.
(tui_set_locator_info): Rename its parameter to fullname.
(tui_set_locator_info): Rename callee to tui_set_locator_fullname.
(tui_update_locator_filename): Rename to ...
(tui_update_locator_fullname): ... here. Rename callee to
tui_set_locator_fullname.
(tui_show_frame_info): Replace symtab->filename refererence by
symtab_to_fullname call.
* tui/tui-stack.h (tui_update_locator_filename): Rename to ...
(tui_update_locator_fullname): ... here.
* tui/tui-winsource.c (tui_display_main): Rename the callee to
tui_update_locator_fullname. Replace symtab->filename refererence by
symtab_to_fullname call.
* tui/tui.c (tui_show_source): Rename its parameter to fullname.
Rename the callee to tui_update_locator_fullname.
* tui/tui.h (tui_show_source): Rename its parameter to fullname.
2013-02-03 Jan Kratochvil <jan.kratochvil@redhat.com> 2013-02-03 Jan Kratochvil <jan.kratochvil@redhat.com>
* ada-lang.c (user_select_syms): Replace symtab->filename refererences * ada-lang.c (user_select_syms): Replace symtab->filename refererences

View File

@@ -1346,7 +1346,11 @@ print_source_lines_base (struct symtab *s, int line, int stopline,
ui_out_text (uiout, "\tin "); ui_out_text (uiout, "\tin ");
ui_out_field_string (uiout, "file", ui_out_field_string (uiout, "file",
symtab_to_filename_for_display (s)); symtab_to_filename_for_display (s));
if (ui_out_is_mi_like_p (uiout))
/* TUI expects the "fullname" field. While it is
!ui_out_is_mi_like_p compared to CLI it is !ui_source_list. */
if (ui_out_is_mi_like_p (uiout)
|| !ui_out_test_flags (uiout, ui_source_list))
{ {
const char *fullname = symtab_to_fullname (s); const char *fullname = symtab_to_fullname (s);

View File

@@ -510,7 +510,7 @@ init_content_element (struct tui_win_element *element,
element->which_element.data.content = (char*) NULL; element->which_element.data.content = (char*) NULL;
break; break;
case LOCATOR_WIN: case LOCATOR_WIN:
element->which_element.locator.file_name[0] = element->which_element.locator.full_name[0] =
element->which_element.locator.proc_name[0] = (char) 0; element->which_element.locator.proc_name[0] = (char) 0;
element->which_element.locator.line_no = 0; element->which_element.locator.line_no = 0;
element->which_element.locator.addr = 0; element->which_element.locator.addr = 0;

View File

@@ -203,7 +203,8 @@ struct tui_command_element
/* Elements in the locator window content. */ /* Elements in the locator window content. */
struct tui_locator_element struct tui_locator_element
{ {
char file_name[MAX_LOCATOR_ELEMENT_LEN]; /* Resolved absolute filename as returned by symtab_to_fullname. */
char full_name[MAX_LOCATOR_ELEMENT_LEN];
char proc_name[MAX_LOCATOR_ELEMENT_LEN]; char proc_name[MAX_LOCATOR_ELEMENT_LEN];
int line_no; int line_no;
CORE_ADDR addr; CORE_ADDR addr;

View File

@@ -316,10 +316,10 @@ tui_show_disassem_and_update_source (struct gdbarch *gdbarch,
if (sal.symtab) if (sal.symtab)
{ {
set_current_source_symtab_and_line (&sal); set_current_source_symtab_and_line (&sal);
tui_update_locator_filename (sal.symtab->filename); tui_update_locator_fullname (symtab_to_fullname (sal.symtab));
} }
else else
tui_update_locator_filename ("?"); tui_update_locator_fullname ("?");
} }
return; return;

View File

@@ -84,7 +84,7 @@ tui_field_string (struct ui_out *uiout,
if (data->base.suppress_output) if (data->base.suppress_output)
return; return;
if (fldname && data->line > 0 && strcmp (fldname, "file") == 0) if (fldname && data->line > 0 && strcmp (fldname, "fullname") == 0)
{ {
data->start_of_line ++; data->start_of_line ++;
if (data->line > 0) if (data->line > 0)

View File

@@ -153,8 +153,8 @@ tui_set_source_content (struct symtab *s,
cur_line_no; cur_line_no;
element->which_element.source.is_exec_point = element->which_element.source.is_exec_point =
(filename_cmp (((struct tui_win_element *) (filename_cmp (((struct tui_win_element *)
locator->content[0])->which_element.locator.file_name, locator->content[0])->which_element.locator.full_name,
s->filename) == 0 symtab_to_fullname (s)) == 0
&& cur_line_no == ((struct tui_win_element *) && cur_line_no == ((struct tui_win_element *)
locator->content[0])->which_element.locator.line_no); locator->content[0])->which_element.locator.line_no);
if (c != EOF) if (c != EOF)
@@ -335,14 +335,14 @@ tui_show_symtab_source (struct gdbarch *gdbarch, struct symtab *s,
/* Answer whether the source is currently displayed in the source /* Answer whether the source is currently displayed in the source
window. */ window. */
int int
tui_source_is_displayed (const char *fname) tui_source_is_displayed (const char *fullname)
{ {
return (TUI_SRC_WIN != NULL return (TUI_SRC_WIN != NULL
&& TUI_SRC_WIN->generic.content_in_use && TUI_SRC_WIN->generic.content_in_use
&& (filename_cmp (((struct tui_win_element *) && (filename_cmp (((struct tui_win_element *)
(tui_locator_win_info_ptr ())-> (tui_locator_win_info_ptr ())->
content[0])->which_element.locator.file_name, content[0])->which_element.locator.full_name,
fname) == 0)); fullname) == 0));
} }

View File

@@ -29,6 +29,7 @@
#include "top.h" #include "top.h"
#include "gdb-demangle.h" #include "gdb-demangle.h"
#include "gdb_string.h" #include "gdb_string.h"
#include "source.h"
#include "tui/tui.h" #include "tui/tui.h"
#include "tui/tui-data.h" #include "tui/tui-data.h"
#include "tui/tui-stack.h" #include "tui/tui-stack.h"
@@ -44,12 +45,12 @@
Returns a pointer to a static area holding the result. */ 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. */ /* Set the full_name portion of the locator. */
static void tui_set_locator_filename (const char *filename); static void tui_set_locator_fullname (const char *fullname);
/* Update the locator, with the provided arguments. */ /* Update the locator, with the provided arguments. */
static void tui_set_locator_info (struct gdbarch *gdbarch, static void tui_set_locator_info (struct gdbarch *gdbarch,
const char *filename, const char *fullname,
const char *procname, const char *procname,
int lineno, CORE_ADDR addr); int lineno, CORE_ADDR addr);
@@ -276,27 +277,27 @@ tui_show_locator_content (void)
/* Set the filename portion of the locator. */ /* Set the filename portion of the locator. */
static void static void
tui_set_locator_filename (const char *filename) tui_set_locator_fullname (const char *fullname)
{ {
struct tui_gen_win_info *locator = tui_locator_win_info_ptr (); struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
struct tui_locator_element *element; struct tui_locator_element *element;
if (locator->content[0] == NULL) if (locator->content[0] == NULL)
{ {
tui_set_locator_info (NULL, filename, NULL, 0, 0); tui_set_locator_info (NULL, fullname, NULL, 0, 0);
return; return;
} }
element = &((struct tui_win_element *) element = &((struct tui_win_element *)
locator->content[0])->which_element.locator; locator->content[0])->which_element.locator;
element->file_name[0] = 0; element->full_name[0] = 0;
strcat_to_buf (element->file_name, MAX_LOCATOR_ELEMENT_LEN, filename); strcat_to_buf (element->full_name, MAX_LOCATOR_ELEMENT_LEN, fullname);
} }
/* Update the locator, with the provided arguments. */ /* Update the locator, with the provided arguments. */
static void static void
tui_set_locator_info (struct gdbarch *gdbarch, tui_set_locator_info (struct gdbarch *gdbarch,
const char *filename, const char *fullname,
const char *procname, const char *procname,
int lineno, int lineno,
CORE_ADDR addr) CORE_ADDR addr)
@@ -318,14 +319,14 @@ tui_set_locator_info (struct gdbarch *gdbarch,
element->line_no = lineno; element->line_no = lineno;
element->addr = addr; element->addr = addr;
element->gdbarch = gdbarch; element->gdbarch = gdbarch;
tui_set_locator_filename (filename); tui_set_locator_fullname (fullname);
} }
/* Update only the filename portion of the locator. */ /* Update only the full_name portion of the locator. */
void void
tui_update_locator_filename (const char *filename) tui_update_locator_fullname (const char *fullname)
{ {
tui_set_locator_filename (filename); tui_set_locator_fullname (fullname);
tui_show_locator_content (); tui_show_locator_content ();
} }
@@ -348,11 +349,12 @@ tui_show_frame_info (struct frame_info *fi)
find_frame_sal (fi, &sal); find_frame_sal (fi, &sal);
source_already_displayed = sal.symtab != 0 source_already_displayed = sal.symtab != 0
&& tui_source_is_displayed (sal.symtab->filename); && tui_source_is_displayed (symtab_to_fullname (sal.symtab));
if (get_frame_pc_if_available (fi, &pc)) if (get_frame_pc_if_available (fi, &pc))
tui_set_locator_info (get_frame_arch (fi), tui_set_locator_info (get_frame_arch (fi),
sal.symtab == 0 ? "??" : sal.symtab->filename, (sal.symtab == 0
? "??" : symtab_to_fullname (sal.symtab)),
tui_get_function_from_frame (fi), tui_get_function_from_frame (fi),
sal.line, sal.line,
pc); pc);

View File

@@ -24,7 +24,7 @@
struct frame_info; struct frame_info;
extern void tui_update_locator_filename (const char *); extern void tui_update_locator_fullname (const char *);
extern void tui_show_locator_content (void); extern void tui_show_locator_content (void);
extern void tui_show_frame_info (struct frame_info *); extern void tui_show_frame_info (struct frame_info *);

View File

@@ -59,9 +59,9 @@ tui_display_main (void)
tui_update_source_windows_with_addr (gdbarch, addr); tui_update_source_windows_with_addr (gdbarch, addr);
sal = find_pc_line (addr, 0); sal = find_pc_line (addr, 0);
if (sal.symtab) if (sal.symtab)
tui_update_locator_filename (sal.symtab->filename); tui_update_locator_fullname (symtab_to_fullname (sal.symtab));
else else
tui_update_locator_filename ("??"); tui_update_locator_fullname ("??");
} }
} }
} }

View File

@@ -532,7 +532,7 @@ tui_reset (void)
#endif #endif
void void
tui_show_source (const char *file, int line) tui_show_source (const char *fullname, int line)
{ {
struct symtab_and_line cursal = get_current_source_symtab_and_line (); struct symtab_and_line cursal = get_current_source_symtab_and_line ();
@@ -540,7 +540,7 @@ tui_show_source (const char *file, int line)
tui_add_win_to_layout (SRC_WIN); tui_add_win_to_layout (SRC_WIN);
tui_update_source_windows_with_line (cursal.symtab, line); tui_update_source_windows_with_line (cursal.symtab, line);
tui_update_locator_filename (file); tui_update_locator_fullname (fullname);
} }
void void

View File

@@ -95,7 +95,7 @@ extern void tui_set_key_mode (enum tui_key_mode mode);
extern int tui_active; extern int tui_active;
extern void tui_show_source (const char *file, int line); extern void tui_show_source (const char *fullname, int line);
extern struct ui_out *tui_out_new (struct ui_file *stream); extern struct ui_out *tui_out_new (struct ui_file *stream);