This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Display exact entered expression for watchpoints


 When I watch a memory location,
I almost always use hexadecimal notation.

For instance lets say that I want to watch 
the memory containing the value of gdb_stderr
On my linux box 
(top-gdb)p &gdb_stderr
returns
$1 = (struct ui_file **) 0x823b5cc
(ok, here I could simply use 'watch gdb_stderr,
but in some other cases like dynamically allocated memory I can't).
if I enter
(top-gdb) watch *0x823b5cc
Hardware watchpoint 3: *136558028
(top-gdb) inf b
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0x080f0d79 in internal_error
                                       at ../../src/origdb/utils.c:810
2   breakpoint     keep y   0x080783eb in info_command
                                       at ../../src/origdb/cli/cli-cmds.c:202
        silent
        return
3   hw watchpoint  keep y              *136558028
(top-gdb)


After my patch, I get
(top-gdb) watch *0x823b5cc
Hardware watchpoint 3: *0x823b5cc
(top-gdb) inf b
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0x080f0d79 in internal_error
                                       at ../../src/origdb/utils.c:810
2   breakpoint     keep y   0x080783eb in info_command
                                       at ../../src/origdb/cli/cli-cmds.c:202
        silent
        return
3   hw watchpoint  keep y              *0x823b5cc


I really prefer the later,
but maybe I did miss a good reason
why its not  that way.
I ran the testsuite before and after,
and to my surprise, found no new failure....


ChangeLog entry

2002-11-14  Pierre Muller  <muller@ics.u-strasbg.fr>

        * breakpoint.c (print_one_breakpoint): Use exp_string field
        to display expression of watchpoints.
        (mention): Likewise.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.93
diff -u -p -r1.93 breakpoint.c
--- breakpoint.c        10 Nov 2002 15:36:26 -0000      1.93
+++ breakpoint.c        14 Nov 2002 11:00:06 -0000
@@ -3284,8 +3284,7 @@ print_one_breakpoint (struct breakpoint
       if (addressprint)
        ui_out_field_skip (uiout, "addr");
       annotate_field (5);
-      print_expression (b->exp, stb->stream);
-      ui_out_field_stream (uiout, "what", stb);
+      ui_out_field_string (uiout, "what", b->exp_string);
       break;

     case bp_catch_load:
@@ -4421,8 +4420,7 @@ mention (struct breakpoint *b)
       ui_out_tuple_begin (uiout, "wpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
-      print_expression (b->exp, stb->stream);
-      ui_out_field_stream (uiout, "exp", stb);
+      ui_out_field_string (uiout, "exp", b->exp_string);
       ui_out_tuple_end (uiout);
       break;
     case bp_hardware_watchpoint:
@@ -4430,8 +4428,7 @@ mention (struct breakpoint *b)
       ui_out_tuple_begin (uiout, "wpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
-      print_expression (b->exp, stb->stream);
-      ui_out_field_stream (uiout, "exp", stb);
+      ui_out_field_string (uiout, "exp", b->exp_string);
       ui_out_tuple_end (uiout);
       break;
     case bp_read_watchpoint:
@@ -4439,8 +4436,6 @@ mention (struct breakpoint *b)
       ui_out_tuple_begin (uiout, "hw-rwpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
-      print_expression (b->exp, stb->stream);
-      ui_out_field_stream (uiout, "exp", stb);
       ui_out_tuple_end (uiout);
       break;
     case bp_access_watchpoint:
@@ -4448,8 +4443,7 @@ mention (struct breakpoint *b)
       ui_out_tuple_begin (uiout, "hw-awpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
-      print_expression (b->exp, stb->stream);
-      ui_out_field_stream (uiout, "exp", stb);
+      ui_out_field_string (uiout, "exp", b->exp_string);
       ui_out_tuple_end (uiout);
       break;
     case bp_breakpoint:



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]