Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Display exact entered expression for watchpoints
@ 2002-11-14  3:01 Pierre Muller
  2002-11-14 11:52 ` Daniel Jacobowitz
  2002-11-14 17:58 ` Duncan Roe
  0 siblings, 2 replies; 4+ messages in thread
From: Pierre Muller @ 2002-11-14  3:01 UTC (permalink / raw)
  To: gdb-patches

 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:



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] Display exact entered expression for watchpoints
  2002-11-14  3:01 [RFC] Display exact entered expression for watchpoints Pierre Muller
@ 2002-11-14 11:52 ` Daniel Jacobowitz
  2002-11-19  3:06   ` Pierre Muller
  2002-11-14 17:58 ` Duncan Roe
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-11-14 11:52 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Thu, Nov 14, 2002 at 12:00:18PM +0100, Pierre Muller wrote:
>  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,


I like this behavior a lot better too; I see the number and get
hopelessly confused as to what I'm watching :)  Michael, Jim, do you
think this will cause any problems?  Watch doesn't take an implicit
argument the way that break does, so a string should always be
available.


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] Display exact entered expression for watchpoints
  2002-11-14  3:01 [RFC] Display exact entered expression for watchpoints Pierre Muller
  2002-11-14 11:52 ` Daniel Jacobowitz
@ 2002-11-14 17:58 ` Duncan Roe
  1 sibling, 0 replies; 4+ messages in thread
From: Duncan Roe @ 2002-11-14 17:58 UTC (permalink / raw)
  To: gdb-patches

Hi Pierre,

I like the "0x" variant better also.

Just a BTW, but in the circumstances you describe, I would do:

  watch *(struct ui_file **) 0x823b5cc

so that gdb knows how many bytes to watch. 

E.g.:

Hardware watchpoint 2: *(double *) 3221223348

Old value = 3.2999999999999994
New value = 3.2999999999999998

i.e. a 1-bit change in the 8th byte (0x400a666666666665 -> 0x400a666666666666)

Cheers ... Duncan.

On Thu, Nov 14, 2002 at 12:00:18PM +0100, Pierre Muller wrote:
>  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
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [RFC] Display exact entered expression for watchpoints
  2002-11-14 11:52 ` Daniel Jacobowitz
@ 2002-11-19  3:06   ` Pierre Muller
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Muller @ 2002-11-19  3:06 UTC (permalink / raw)
  To: Jim Blandy, Michael Snyder; +Cc: Daniel Jacobowitz, gdb-patches

At 20:53 14/11/2002, Daniel Jacobowitz wrote:
>On Thu, Nov 14, 2002 at 12:00:18PM +0100, Pierre Muller wrote:
>>  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,
>
>
>I like this behavior a lot better too; I see the number and get
>hopelessly confused as to what I'm watching :)  Michael, Jim, do you
>think this will cause any problems?  Watch doesn't take an implicit
>argument the way that break does, so a string should always be
>available.

So, I think that after looking into the MAINTAINERS file,
I need approval from either Jim Blandy or Michael Snyder
on this RFC.

Original RFC is
http://sources.redhat.com/ml/gdb-patches/2002-11/msg00409.html





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-11-19 11:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-14  3:01 [RFC] Display exact entered expression for watchpoints Pierre Muller
2002-11-14 11:52 ` Daniel Jacobowitz
2002-11-19  3:06   ` Pierre Muller
2002-11-14 17:58 ` Duncan Roe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox