* Watchpoints stopping GDB on specific threads
@ 2007-08-14 16:21 Luis Machado
2007-08-14 16:42 ` Daniel Jacobowitz
2007-08-14 19:41 ` Eli Zaretskii
0 siblings, 2 replies; 6+ messages in thread
From: Luis Machado @ 2007-08-14 16:21 UTC (permalink / raw)
To: gdb
Folks,
GDB currently has support for conditional breakpoint stops on specific
threads, by issuing the command "break <location> thread <id>".
I'm looking forward to have the same functionality for watchpoints. So
whenever GDB detects a watchpoint trigger, it would verify the current
thread and would stop only if the thread matches the ID we provided in a
command like "watch <address> thread <id>". if no ID is provided, GDB
would stop at every thread as usual (assuming a threaded watchpoint
support).
This is useful to conduct debugging sessions on applications with a
great number of threads, being able to inspect just the thread we're
interested in. It would also take advantage of the upcomming threaded
watchpoint support, hopefully.
At a first glance, i'd need to work in a different way than the
breakpoint case, because the entire watchpoint expression is handled by
a expression parser. It automatically processes the "thread <id>"
parameter and of course gives an error because that's not recognized. Do
you have any idea on how this could be solved in a clever way? We could
start parsing the expression from the end, and try to locate the "thread
<id>" parameter, and then hand over the remaining parameters to the
expression parser. What do you think?
Best regards,
--
Luis Machado
Software Engineer
IBM Linux Technology Center
LoP Toolchain/Debuggers' team
Phone: +55 19-2132-2218
T/L: 839-2218
e-mail: luisgpm@vnet.linux.ibm.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Watchpoints stopping GDB on specific threads
2007-08-14 16:21 Watchpoints stopping GDB on specific threads Luis Machado
@ 2007-08-14 16:42 ` Daniel Jacobowitz
2007-08-14 19:41 ` Eli Zaretskii
1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-08-14 16:42 UTC (permalink / raw)
To: Luis Machado; +Cc: gdb
On Tue, Aug 14, 2007 at 01:20:58PM -0300, Luis Machado wrote:
> At a first glance, i'd need to work in a different way than the
> breakpoint case, because the entire watchpoint expression is handled by
> a expression parser. It automatically processes the "thread <id>"
> parameter and of course gives an error because that's not recognized. Do
> you have any idea on how this could be solved in a clever way? We could
> start parsing the expression from the end, and try to locate the "thread
> <id>" parameter, and then hand over the remaining parameters to the
> expression parser. What do you think?
You might want to take a look at this:
http://sourceware.org/ml/gdb-patches/2005-04/msg00092.html
break *EXPRESSION thread N is the same as watch EXPRESSION thread N.
Eli suggested basically the same thing you did; it might work :-)
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Watchpoints stopping GDB on specific threads
2007-08-14 16:21 Watchpoints stopping GDB on specific threads Luis Machado
2007-08-14 16:42 ` Daniel Jacobowitz
@ 2007-08-14 19:41 ` Eli Zaretskii
2007-08-14 19:47 ` Daniel Jacobowitz
2007-08-14 20:19 ` Luis Machado
1 sibling, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2007-08-14 19:41 UTC (permalink / raw)
To: luisgpm; +Cc: gdb
> From: Luis Machado <luisgpm@linux.vnet.ibm.com>
> Date: Tue, 14 Aug 2007 13:20:58 -0300
>
> I'm looking forward to have the same functionality for watchpoints. So
> whenever GDB detects a watchpoint trigger, it would verify the current
> thread and would stop only if the thread matches the ID we provided in a
> command like "watch <address> thread <id>". if no ID is provided, GDB
> would stop at every thread as usual (assuming a threaded watchpoint
> support).
Unless I misunderstand something fundamental, if the current thread ID
is in some variable, you could define a condition for a watchpoint,
no?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Watchpoints stopping GDB on specific threads
2007-08-14 19:41 ` Eli Zaretskii
@ 2007-08-14 19:47 ` Daniel Jacobowitz
2007-08-14 20:19 ` Luis Machado
1 sibling, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2007-08-14 19:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: luisgpm, gdb
On Tue, Aug 14, 2007 at 10:41:06PM +0300, Eli Zaretskii wrote:
> Unless I misunderstand something fundamental, if the current thread ID
> is in some variable,
I don't believe it is.
I see that Frederic Riss posted a "threadnum" command patch, in July
2006 - that's also related to this problem.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Watchpoints stopping GDB on specific threads
2007-08-14 19:41 ` Eli Zaretskii
2007-08-14 19:47 ` Daniel Jacobowitz
@ 2007-08-14 20:19 ` Luis Machado
2007-08-15 3:06 ` Eli Zaretskii
1 sibling, 1 reply; 6+ messages in thread
From: Luis Machado @ 2007-08-14 20:19 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: gdb
On Tue, 2007-08-14 at 22:41 +0300, Eli Zaretskii wrote:
> > From: Luis Machado <luisgpm@linux.vnet.ibm.com>
> > Date: Tue, 14 Aug 2007 13:20:58 -0300
> >
> > I'm looking forward to have the same functionality for watchpoints. So
> > whenever GDB detects a watchpoint trigger, it would verify the current
> > thread and would stop only if the thread matches the ID we provided in a
> > command like "watch <address> thread <id>". if no ID is provided, GDB
> > would stop at every thread as usual (assuming a threaded watchpoint
> > support).
>
> Unless I misunderstand something fundamental, if the current thread ID
> is in some variable, you could define a condition for a watchpoint,
> no?
Using the "if" statement? But in which kind of variable? A user defined
variable on GDB or a variable inside the inferior?
--
Luis Machado
Software Engineer
IBM Linux Technology Center
LoP Toolchain/Debuggers' team
Phone: +55 19-2132-2218
T/L: 839-2218
e-mail: luisgpm@linux.vnet.ibm.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Watchpoints stopping GDB on specific threads
2007-08-14 20:19 ` Luis Machado
@ 2007-08-15 3:06 ` Eli Zaretskii
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2007-08-15 3:06 UTC (permalink / raw)
To: luisgpm; +Cc: gdb
> From: Luis Machado <luisgpm@linux.vnet.ibm.com>
> Cc: gdb@sourceware.org
> Date: Tue, 14 Aug 2007 17:18:49 -0300
>
> Using the "if" statement?
"if" or "conditions".
> But in which kind of variable? A user defined
> variable on GDB or a variable inside the inferior?
I meant the latter, but Daniel says there's no such variable.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-08-15 3:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-14 16:21 Watchpoints stopping GDB on specific threads Luis Machado
2007-08-14 16:42 ` Daniel Jacobowitz
2007-08-14 19:41 ` Eli Zaretskii
2007-08-14 19:47 ` Daniel Jacobowitz
2007-08-14 20:19 ` Luis Machado
2007-08-15 3:06 ` Eli Zaretskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox