Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [MI tracepoints 5/9] -break-passcount
@ 2010-03-14  8:56 Vladimir Prus
  2010-03-15 21:04 ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Vladimir Prus @ 2010-03-14  8:56 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: Text/Plain, Size: 257 bytes --]


This patch introduces -break-passcount. This is of general utility, not
just for tracepoint and was missing for not good reason. This is MI-only
change, so just as RFC.

Thanks,

-- 
Vladimir Prus
CodeSourcery
vladimir@codesourcery.com
(650) 331-3385 x722

[-- Attachment #2: 5-break-passcount.diff --]
[-- Type: text/x-patch, Size: 2432 bytes --]

commit 14d3141d9af168e76ae58c54b6f9f03ad3f37ead
Author: vladimir <vladimir@e7755896-6108-0410-9592-8049d3e74e28>
Date:   Thu Aug 6 07:47:57 2009 +0000

    Implement -break-passcount.
    
    	* mi/mi-cmd-break.c (mi_cmd_break_passcount): New.
    	* mi/mi-cmds.c (mi_cmds): Register -break-passcount.
    	* mi/mi-cmds.h (mi_cmd_break_passcount): Declare.
    
    git-svn-id: svn+ssh://cugel//net/svn-internal/subversion/Repository/csl/gdb/branches/ericsson-tracing@257799 e7755896-6108-0410-9592-8049d3e74e28

diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index 3e82b8f..bdbbe09 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -170,6 +170,31 @@ enum wp_type
   ACCESS_WP
 };
 
+void
+mi_cmd_break_passcount (char *command, char **argv, int argc)
+{
+  int n;
+  int p;
+  struct breakpoint *t;
+
+  if (argc != 2)
+    error (_("Usage: tracepoint-number passcount"));
+
+  n = atoi (argv[0]);
+  p = atoi (argv[1]);
+  t = get_tracepoint (n);
+
+  if (t)
+    {
+      t->pass_count = p;
+      observer_notify_tracepoint_modified (n);
+    }
+  else
+    {
+      error (_("Cound not find tracepoint %d"), n);
+    }
+}
+
 /* Insert a watchpoint. The type of watchpoint is specified by the
    first argument: 
    -break-watch <expr> --> insert a regular wp.  
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index c2183fb..6b260fc 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -43,6 +43,7 @@ struct mi_cmd mi_cmds[] =
   { "break-info", { "info break", 1 }, NULL },
   { "break-insert", { NULL, 0 }, mi_cmd_break_insert},
   { "break-list", { "info break", }, NULL },
+  { "break-passcount", { NULL, 0 }, mi_cmd_break_passcount},
   { "break-watch", { NULL, 0 }, mi_cmd_break_watch},
   { "data-disassemble", { NULL, 0 }, mi_cmd_disassemble},
   { "data-evaluate-expression", { NULL, 0 }, mi_cmd_data_evaluate_expression},
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 702dd9e..b5ff61f 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -39,6 +39,7 @@ typedef void (mi_cmd_argv_ftype) (char *command, char **argv, int argc);
 extern mi_cmd_argv_ftype mi_cmd_add_inferior;
 extern mi_cmd_argv_ftype mi_cmd_break_insert;
 extern mi_cmd_argv_ftype mi_cmd_break_commands;
+extern mi_cmd_argv_ftype mi_cmd_break_passcount;
 extern mi_cmd_argv_ftype mi_cmd_break_watch;
 extern mi_cmd_argv_ftype mi_cmd_disassemble;
 extern mi_cmd_argv_ftype mi_cmd_data_evaluate_expression;

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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-14  8:56 [MI tracepoints 5/9] -break-passcount Vladimir Prus
@ 2010-03-15 21:04 ` Tom Tromey
  2010-03-16 12:13   ` Vladimir Prus
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2010-03-15 21:04 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

Volodya> This patch introduces -break-passcount. This is of general
Volodya> utility, not just for tracepoint and was missing for not good
Volodya> reason.

Doesn't the use of get_tracepoint make it tracepoint-specific?
Or is this changed somewhere in the patch series?

Tom


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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-15 21:04 ` Tom Tromey
@ 2010-03-16 12:13   ` Vladimir Prus
  2010-03-16 15:37     ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Vladimir Prus @ 2010-03-16 12:13 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches

On Tuesday 16 March 2010 00:04:26 Tom Tromey wrote:

> Volodya> This patch introduces -break-passcount. This is of general
> Volodya> utility, not just for tracepoint and was missing for not good
> Volodya> reason.
> 
> Doesn't the use of get_tracepoint make it tracepoint-specific?
> Or is this changed somewhere in the patch series?

I was confused. This command remains specific to tracepoint, there's
no patch (yet?) that merges -break-passcount and -break-after and
in fact, it's probably not a good idea.

Thanks,

-- 
Vladimir Prus
CodeSourcery
vladimir@codesourcery.com
(650) 331-3385 x722


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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-16 12:13   ` Vladimir Prus
@ 2010-03-16 15:37     ` Tom Tromey
  2010-03-16 15:47       ` Vladimir Prus
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2010-03-16 15:37 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

>>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:

Tom> Doesn't the use of get_tracepoint make it tracepoint-specific?
Tom> Or is this changed somewhere in the patch series?

Volodya> I was confused. This command remains specific to tracepoint, there's
Volodya> no patch (yet?) that merges -break-passcount and -break-after and
Volodya> in fact, it's probably not a good idea.

In that case, shouldn't the new command be called -trace-passcount, not
-break-passcount?

Tom


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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-16 15:37     ` Tom Tromey
@ 2010-03-16 15:47       ` Vladimir Prus
  2010-03-16 15:56         ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Vladimir Prus @ 2010-03-16 15:47 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches

On Tuesday 16 March 2010 18:37:13 Tom Tromey wrote:

> >>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:
> 
> Tom> Doesn't the use of get_tracepoint make it tracepoint-specific?
> Tom> Or is this changed somewhere in the patch series?
> 
> Volodya> I was confused. This command remains specific to tracepoint, there's
> Volodya> no patch (yet?) that merges -break-passcount and -break-after and
> Volodya> in fact, it's probably not a good idea.
> 
> In that case, shouldn't the new command be called -trace-passcount, not
> -break-passcount?

I am not sure. Given that tracepoints are special kind of breakpoint now,
I'd rather have -break-passcount, with -trace command reserversed for
overall control of tracing. After all, mixing -break-insert -a with
later -trace-passcount may be confusing.

Thanks,

-- 
Vladimir Prus
CodeSourcery
vladimir@codesourcery.com
(650) 331-3385 x722


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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-16 15:47       ` Vladimir Prus
@ 2010-03-16 15:56         ` Tom Tromey
  2010-03-16 16:05           ` Vladimir Prus
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2010-03-16 15:56 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

>>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:

Volodya> I am not sure. Given that tracepoints are special kind of
Volodya> breakpoint now, I'd rather have -break-passcount, with -trace
Volodya> command reserversed for overall control of tracing. After all,
Volodya> mixing -break-insert -a with later -trace-passcount may be
Volodya> confusing.

It is odd to have a command named -break-passcount that can't actually
be used on breakpoints -- and that will never be usable on breakpoints.
I think this is more confusing than the alternative.

Tom


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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-16 15:56         ` Tom Tromey
@ 2010-03-16 16:05           ` Vladimir Prus
  2010-03-16 16:23             ` Tom Tromey
  0 siblings, 1 reply; 11+ messages in thread
From: Vladimir Prus @ 2010-03-16 16:05 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Tuesday 16 March 2010 18:56:09 Tom Tromey wrote:

> >>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:
> 
> Volodya> I am not sure. Given that tracepoints are special kind of
> Volodya> breakpoint now, I'd rather have -break-passcount, with -trace
> Volodya> command reserversed for overall control of tracing. After all,
> Volodya> mixing -break-insert -a with later -trace-passcount may be
> Volodya> confusing.
> 
> It is odd to have a command named -break-passcount that can't actually
> be used on breakpoints

It can -- just not on all kinds of breakpoints.

> -- and that will never be usable on breakpoints.

You mean, on "ordinary" breakpoints? It's totally unclear -- while presently
tracing breakpoints are always target assisted, we may in future implement
a software tracing breakpoints, where GDB would execute the commands implicitly
for user.

Thanks,

-- 
Vladimir Prus
CodeSourcery
vladimir@codesourcery.com
(650) 331-3385 x722


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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-16 16:05           ` Vladimir Prus
@ 2010-03-16 16:23             ` Tom Tromey
  2010-03-16 17:07               ` Vladimir Prus
  0 siblings, 1 reply; 11+ messages in thread
From: Tom Tromey @ 2010-03-16 16:23 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

>>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:

Tom> It is odd to have a command named -break-passcount that can't actually
Tom> be used on breakpoints

Volodya> It can -- just not on all kinds of breakpoints.

Ok.  Maybe you could explain how -break-passcount and -break-after are
different, without referring to "tracepoints" as something separate from
"breakpoints".

Tom> -- and that will never be usable on breakpoints.

Volodya> You mean, on "ordinary" breakpoints? It's totally unclear --
Volodya> while presently tracing breakpoints are always target assisted,
Volodya> we may in future implement a software tracing breakpoints,
Volodya> where GDB would execute the commands implicitly for user.

I was just basing this observation on your own statement that merging
-break-passcount and -break-after doesn't make sense.

Tom


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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-16 16:23             ` Tom Tromey
@ 2010-03-16 17:07               ` Vladimir Prus
  2010-03-16 17:11                 ` Tom Tromey
  2010-03-16 18:06                 ` Marc Khouzam
  0 siblings, 2 replies; 11+ messages in thread
From: Vladimir Prus @ 2010-03-16 17:07 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On Tuesday 16 March 2010 19:23:22 Tom Tromey wrote:

> >>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:
> 
> Tom> It is odd to have a command named -break-passcount that can't actually
> Tom> be used on breakpoints
> 
> Volodya> It can -- just not on all kinds of breakpoints.
> 
> Ok.  Maybe you could explain how -break-passcount and -break-after are
> different, without referring to "tracepoints" as something separate from
> "breakpoints".

-break-after specifies how many initial hits of the breakpoint are to be
ignored.

-break-passcount, ideally, after how many execution of breakpoint commands
they stop being executed (and breakpoint becomes silently ignored)

Thanks,

-- 
Vladimir Prus
CodeSourcery
vladimir@codesourcery.com
(650) 331-3385 x722


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

* Re: [MI tracepoints 5/9] -break-passcount
  2010-03-16 17:07               ` Vladimir Prus
@ 2010-03-16 17:11                 ` Tom Tromey
  2010-03-16 18:06                 ` Marc Khouzam
  1 sibling, 0 replies; 11+ messages in thread
From: Tom Tromey @ 2010-03-16 17:11 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

>>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:

Volodya> -break-after specifies how many initial hits of the breakpoint
Volodya> are to be ignored.

Volodya> -break-passcount, ideally, after how many execution of
Volodya> breakpoint commands they stop being executed (and breakpoint
Volodya> becomes silently ignored)

Duh on me.
Thanks.

Tom


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

* RE: [MI tracepoints 5/9] -break-passcount
  2010-03-16 17:07               ` Vladimir Prus
  2010-03-16 17:11                 ` Tom Tromey
@ 2010-03-16 18:06                 ` Marc Khouzam
  1 sibling, 0 replies; 11+ messages in thread
From: Marc Khouzam @ 2010-03-16 18:06 UTC (permalink / raw)
  To: Vladimir Prus, Tom Tromey, gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org 
> [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Vladimir Prus
> Sent: March-16-10 1:07 PM
> To: Tom Tromey; gdb-patches@sourceware.org
> Subject: Re: [MI tracepoints 5/9] -break-passcount
> 
> On Tuesday 16 March 2010 19:23:22 Tom Tromey wrote:
> 
> > >>>>> "Volodya" == Vladimir Prus <vladimir@codesourcery.com> writes:
> > 
> > Tom> It is odd to have a command named -break-passcount that can't 
> > Tom> actually be used on breakpoints
> > 
> > Volodya> It can -- just not on all kinds of breakpoints.
> > 
> > Ok.  Maybe you could explain how -break-passcount and 
> -break-after are 
> > different, without referring to "tracepoints" as something separate 
> > from "breakpoints".
> 
> -break-after specifies how many initial hits of the 
> breakpoint are to be ignored.
> 
> -break-passcount, ideally, after how many execution of 
> breakpoint commands they stop being executed (and breakpoint 
> becomes silently ignored)

It would be nice to have this new -break-passcount also work for 'normal'
breakpoints.  The use case is the following:

when setting a breakpoint in code that many threads go through, and
while debugging in non-stop mode, a user may not want every thread to stop
on the breakpoint, but only one thread (or N threads).  This is special 
to non-stop because many threads could hit in a very short amount of time,
before the user can disable the bp manually.  
With -break-passcount, we can tell GDB that "after N threads have been 
stopped on this breakpoint, disable the bp".

Thanks

Marc


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

end of thread, other threads:[~2010-03-16 18:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-14  8:56 [MI tracepoints 5/9] -break-passcount Vladimir Prus
2010-03-15 21:04 ` Tom Tromey
2010-03-16 12:13   ` Vladimir Prus
2010-03-16 15:37     ` Tom Tromey
2010-03-16 15:47       ` Vladimir Prus
2010-03-16 15:56         ` Tom Tromey
2010-03-16 16:05           ` Vladimir Prus
2010-03-16 16:23             ` Tom Tromey
2010-03-16 17:07               ` Vladimir Prus
2010-03-16 17:11                 ` Tom Tromey
2010-03-16 18:06                 ` Marc Khouzam

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