aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-02-05 00:13:43 +0000
committerTom Tromey <tromey@redhat.com>2009-02-05 00:13:43 +0000
commitfa8a61dc873c4e7ede0738fc44d4d4a5bf0a77df (patch)
tree01574d2b45332dfaa07b4e91f87e46d5339b67ec /gdb/printcmd.c
parentd50297662acb52582480a91d5e61b2417fed2ada (diff)
downloadgdb-fa8a61dc873c4e7ede0738fc44d4d4a5bf0a77df.zip
gdb-fa8a61dc873c4e7ede0738fc44d4d4a5bf0a77df.tar.gz
gdb-fa8a61dc873c4e7ede0738fc44d4d4a5bf0a77df.tar.bz2
2009-01-07 Pierre Muller <muller@ics.u-strasbg.fr>
Tom Tromey <tromey@redhat.com> PR breakpoints/8079: * breakpoint.c (print_one_breakpoint): Use exp_string field to display expression of watchpoints. (mention): Likewise. (watch_command_1): Remove trailing whitespace from expression. * printcmd.c (struct display) <exp_string>: New field. (display_command): Set exp_string. (free_display): Free exp_string. (clear_displays): Use free_display. (do_one_display): Print exp_string. (display_info): Likewise.
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 0dfe80b..a51ba68 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -124,6 +124,8 @@ struct display
{
/* Chain link to next auto-display item. */
struct display *next;
+ /* The expression as the user typed it. */
+ char *exp_string;
/* Expression to be evaluated and displayed. */
struct expression *exp;
/* Item number of this auto-display item. */
@@ -1398,6 +1400,7 @@ display_command (char *exp, int from_tty)
new = (struct display *) xmalloc (sizeof (struct display));
+ new->exp_string = xstrdup (exp);
new->exp = expr;
new->block = innermost_block;
new->next = display_chain;
@@ -1416,6 +1419,7 @@ display_command (char *exp, int from_tty)
static void
free_display (struct display *d)
{
+ xfree (d->exp_string);
xfree (d->exp);
xfree (d);
}
@@ -1430,9 +1434,8 @@ clear_displays (void)
while ((d = display_chain) != NULL)
{
- xfree (d->exp);
display_chain = d->next;
- xfree (d);
+ free_display (d);
}
}
@@ -1546,7 +1549,7 @@ do_one_display (struct display *d)
annotate_display_expression ();
- print_expression (d->exp, gdb_stdout);
+ puts_filtered (d->exp_string);
annotate_display_expression_end ();
if (d->format.count != 1 || d->format.format == 'i')
@@ -1574,7 +1577,7 @@ do_one_display (struct display *d)
annotate_display_expression ();
- print_expression (d->exp, gdb_stdout);
+ puts_filtered (d->exp_string);
annotate_display_expression_end ();
printf_filtered (" = ");
@@ -1654,7 +1657,7 @@ Num Enb Expression\n"));
d->format.format);
else if (d->format.format)
printf_filtered ("/%c ", d->format.format);
- print_expression (d->exp, gdb_stdout);
+ puts_filtered (d->exp_string);
if (d->block && !contained_in (get_selected_block (0), d->block))
printf_filtered (_(" (cannot be evaluated in the current context)"));
printf_filtered ("\n");