aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/tui/tui-disasm.c64
-rw-r--r--gdb/tui/tui-regs.c32
3 files changed, 61 insertions, 42 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f0c47cd..0b8330d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2004-02-24 J. Brobecker <brobecker@gnat.com>
+
+ * tui/tui-disasm.c: %s/lines/asm_lines/g to avoid a collision
+ with the lines macro defined in term.h on AiX.
+ * tui/tui-regs.c: %s/label_width/tui_label_width/g, to avoid
+ a collision with the label_width macro defined in term.h on AiX.
+
2004-02-23 David Mosberger <davidm@hpl.hp.com>
Committed by Kevin Buettner <kevinb@redhat.com>.
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 19226b3..9c3072b 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -51,7 +51,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* lines, CORE_ADDR pc, int count)
+tui_disassemble (struct tui_asm_line* asm_lines, CORE_ADDR pc, int count)
{
struct ui_file *gdb_dis_out;
@@ -59,22 +59,22 @@ tui_disassemble (struct tui_asm_line* lines, CORE_ADDR pc, int count)
gdb_dis_out = tui_sfileopen (256);
/* Now construct each line */
- for (; count > 0; count--, lines++)
+ for (; count > 0; count--, asm_lines++)
{
- if (lines->addr_string)
- xfree (lines->addr_string);
- if (lines->insn)
- xfree (lines->insn);
+ if (asm_lines->addr_string)
+ xfree (asm_lines->addr_string);
+ if (asm_lines->insn)
+ xfree (asm_lines->insn);
print_address (pc, gdb_dis_out);
- lines->addr = pc;
- lines->addr_string = xstrdup (tui_file_get_strbuf (gdb_dis_out));
+ asm_lines->addr = pc;
+ asm_lines->addr_string = xstrdup (tui_file_get_strbuf (gdb_dis_out));
ui_file_rewind (gdb_dis_out);
pc = pc + gdb_print_insn (pc, gdb_dis_out);
- lines->insn = xstrdup (tui_file_get_strbuf (gdb_dis_out));
+ asm_lines->insn = xstrdup (tui_file_get_strbuf (gdb_dis_out));
/* reset the buffer to empty */
ui_file_rewind (gdb_dis_out);
@@ -92,21 +92,21 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
CORE_ADDR new_low;
int max_lines;
int i;
- struct tui_asm_line* lines;
+ struct tui_asm_line* asm_lines;
max_lines = (from > 0) ? from : - from;
if (max_lines <= 1)
return pc;
- lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line)
+ asm_lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line)
* max_lines);
- memset (lines, 0, sizeof (struct tui_asm_line) * max_lines);
+ memset (asm_lines, 0, sizeof (struct tui_asm_line) * max_lines);
new_low = pc;
if (from > 0)
{
- tui_disassemble (lines, pc, max_lines);
- new_low = lines[max_lines - 1].addr;
+ tui_disassemble (asm_lines, pc, max_lines);
+ new_low = asm_lines[max_lines - 1].addr;
}
else
{
@@ -127,8 +127,8 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
else
new_low += 1 * max_lines;
- tui_disassemble (lines, new_low, max_lines);
- last_addr = lines[pos].addr;
+ tui_disassemble (asm_lines, new_low, max_lines);
+ last_addr = asm_lines[pos].addr;
} while (last_addr > pc && msymbol);
/* Scan forward disassembling one instruction at a time
@@ -145,7 +145,7 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
if (pos >= max_lines)
pos = 0;
- next_addr = tui_disassemble (&lines[pos], last_addr, 1);
+ next_addr = tui_disassemble (&asm_lines[pos], last_addr, 1);
/* If there are some problems while disassembling exit. */
if (next_addr <= last_addr)
@@ -155,12 +155,12 @@ tui_find_disassembly_address (CORE_ADDR pc, int from)
pos++;
if (pos >= max_lines)
pos = 0;
- new_low = lines[pos].addr;
+ new_low = asm_lines[pos].addr;
}
for (i = 0; i < max_lines; i++)
{
- xfree (lines[i].addr_string);
- xfree (lines[i].insn);
+ xfree (asm_lines[i].addr_string);
+ xfree (asm_lines[i].insn);
}
return new_low;
}
@@ -176,7 +176,7 @@ tui_set_disassem_content (CORE_ADDR pc)
CORE_ADDR cur_pc;
struct tui_gen_win_info * locator = tui_locator_win_info_ptr ();
int tab_len = tui_default_tab_len ();
- struct tui_asm_line* lines;
+ struct tui_asm_line* asm_lines;
int insn_pos;
int addr_size, max_size;
char* line;
@@ -195,24 +195,24 @@ tui_set_disassem_content (CORE_ADDR pc)
max_lines = TUI_DISASM_WIN->generic.height - 2; /* account for hilite */
/* Get temporary table that will hold all strings (addr & insn). */
- lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line)
+ asm_lines = (struct tui_asm_line*) alloca (sizeof (struct tui_asm_line)
* max_lines);
- memset (lines, 0, sizeof (struct tui_asm_line) * max_lines);
+ memset (asm_lines, 0, sizeof (struct tui_asm_line) * max_lines);
line_width = TUI_DISASM_WIN->generic.width - 1;
- tui_disassemble (lines, pc, max_lines);
+ tui_disassemble (asm_lines, pc, max_lines);
/* See what is the maximum length of an address and of a line. */
addr_size = 0;
max_size = 0;
for (i = 0; i < max_lines; i++)
{
- size_t len = strlen (lines[i].addr_string);
+ size_t len = strlen (asm_lines[i].addr_string);
if (len > addr_size)
addr_size = len;
- len = strlen (lines[i].insn) + tab_len;
+ len = strlen (asm_lines[i].insn) + tab_len;
if (len > max_size)
max_size = len;
}
@@ -231,7 +231,7 @@ tui_set_disassem_content (CORE_ADDR pc)
element = (struct tui_win_element *) TUI_DISASM_WIN->generic.content[i];
src = &element->which_element.source;
- strcpy (line, lines[i].addr_string);
+ strcpy (line, asm_lines[i].addr_string);
cur_len = strlen (line);
/* Add spaces to make the instructions start on the same column */
@@ -241,7 +241,7 @@ tui_set_disassem_content (CORE_ADDR pc)
cur_len++;
}
- strcat (line, lines[i].insn);
+ strcat (line, asm_lines[i].insn);
/* Now copy the line taking the offset into account */
if (strlen (line) > offset)
@@ -249,15 +249,15 @@ tui_set_disassem_content (CORE_ADDR pc)
else
src->line[0] = '\0';
- src->line_or_addr.addr = lines[i].addr;
- src->is_exec_point = lines[i].addr == cur_pc;
+ src->line_or_addr.addr = asm_lines[i].addr;
+ src->is_exec_point = asm_lines[i].addr == cur_pc;
/* See whether there is a breakpoint installed. */
src->has_break = (!src->is_exec_point
&& breakpoint_here_p (pc) != no_breakpoint_here);
- xfree (lines[i].addr_string);
- xfree (lines[i].insn);
+ xfree (asm_lines[i].addr_string);
+ xfree (asm_lines[i].insn);
}
TUI_DISASM_WIN->generic.content_size = i;
return TUI_SUCCESS;
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 7ce92c2..3813db0 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -277,9 +277,15 @@ tui_display_registers_from (int start_element_no)
TUI_DATA_WIN->detail.data_display_info.regs_content_count > 0)
{
int i = start_element_no;
- int j, value_chars_wide, item_win_width, cur_y, label_width;
+ int j, value_chars_wide, item_win_width, cur_y;
enum precision_type precision;
+ /* Do not rename the following variable into "label_width".
+ Unfortunately, term.h on AiX systems defines a macro with
+ the same name, which causes a build failure if we use the
+ same name for this variable. */
+ int tui_label_width;
+
precision = (TUI_DATA_WIN->detail.data_display_info.regs_display_type
== TUI_DFLOAT_REGS) ?
double_precision : unspecified_precision;
@@ -287,7 +293,7 @@ tui_display_registers_from (int start_element_no)
TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS)
{
value_chars_wide = DOUBLE_FLOAT_VALUE_WIDTH;
- label_width = DOUBLE_FLOAT_LABEL_WIDTH;
+ tui_label_width = DOUBLE_FLOAT_LABEL_WIDTH;
}
else
{
@@ -295,15 +301,15 @@ tui_display_registers_from (int start_element_no)
TUI_SFLOAT_REGS)
{
value_chars_wide = SINGLE_FLOAT_VALUE_WIDTH;
- label_width = SINGLE_FLOAT_LABEL_WIDTH;
+ tui_label_width = SINGLE_FLOAT_LABEL_WIDTH;
}
else
{
value_chars_wide = SINGLE_VALUE_WIDTH;
- label_width = SINGLE_LABEL_WIDTH;
+ tui_label_width = SINGLE_LABEL_WIDTH;
}
}
- item_win_width = value_chars_wide + label_width;
+ item_win_width = value_chars_wide + tui_label_width;
/*
** Now create each data "sub" window, and write the display into it.
*/
@@ -859,15 +865,21 @@ tui_display_register (int reg_num,
{
int i;
char buf[40];
- int value_chars_wide, label_width;
+ int value_chars_wide;
struct tui_data_element * data_element_ptr = &((tui_win_content)
win_info->content)[0]->which_element.data;
+ /* Do not rename the following variable into "label_width".
+ Unfortunately, term.h on AiX systems defines a macro with
+ the same name, which causes a build failure if we use the
+ same name for this variable. */
+ int tui_label_width;
+
if (IS_64BIT ||
TUI_DATA_WIN->detail.data_display_info.regs_display_type == TUI_DFLOAT_REGS)
{
value_chars_wide = DOUBLE_FLOAT_VALUE_WIDTH;
- label_width = DOUBLE_FLOAT_LABEL_WIDTH;
+ tui_label_width = DOUBLE_FLOAT_LABEL_WIDTH;
}
else
{
@@ -875,18 +887,18 @@ tui_display_register (int reg_num,
TUI_SFLOAT_REGS)
{
value_chars_wide = SINGLE_FLOAT_VALUE_WIDTH;
- label_width = SINGLE_FLOAT_LABEL_WIDTH;
+ tui_label_width = SINGLE_FLOAT_LABEL_WIDTH;
}
else
{
value_chars_wide = SINGLE_VALUE_WIDTH;
- label_width = SINGLE_LABEL_WIDTH;
+ tui_label_width = SINGLE_LABEL_WIDTH;
}
}
buf[0] = (char) 0;
tui_register_format (buf,
- value_chars_wide + label_width,
+ value_chars_wide + tui_label_width,
reg_num,
data_element_ptr,
precision);