Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* GDB breakpoint implementation for multithreaded programms
@ 2014-05-10 22:00 Sofia
  2014-05-11  3:27 ` Luis Machado
  0 siblings, 1 reply; 2+ messages in thread
From: Sofia @ 2014-05-10 22:00 UTC (permalink / raw)
  To: gdb

I'm writing my GDB stub and trying to set breakpoints on different threads. 
When I don't ask GDB about the number of threads, It works fine as a single-
threaded application and breakpoints are set correctly. But when I enter - 
'info threads', something strange happens.

Firstly, GDB reads the contents of all threads' registers(it's OK). Then I 
enter 'continue' and see that breakpoints are not set at all threads my 
program has. I don't understand why, but the packet Z0(breakpoint packet) is 
only sent to inactive thread. The documentation says that if the thread id is 
not specified, breakpoints will be set at all threads. What's wrong with this 
or where can I read about such GDB behavior?


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

* Re: GDB breakpoint implementation for multithreaded programms
  2014-05-10 22:00 GDB breakpoint implementation for multithreaded programms Sofia
@ 2014-05-11  3:27 ` Luis Machado
  0 siblings, 0 replies; 2+ messages in thread
From: Luis Machado @ 2014-05-11  3:27 UTC (permalink / raw)
  To: Sofia, gdb

On 05/10/2014 06:56 PM, Sofia wrote:
> I'm writing my GDB stub and trying to set breakpoints on different threads.
> When I don't ask GDB about the number of threads, It works fine as a single-
> threaded application and breakpoints are set correctly. But when I enter -
> 'info threads', something strange happens.
>
> Firstly, GDB reads the contents of all threads' registers(it's OK). Then I
> enter 'continue' and see that breakpoints are not set at all threads my
> program has. I don't understand why, but the packet Z0(breakpoint packet) is
> only sent to inactive thread. The documentation says that if the thread id is
> not specified, breakpoints will be set at all threads. What's wrong with this
> or where can I read about such GDB behavior?
>
>
>

Is this a software breakpoint (Z0/z0) or a hardware breakpoint we are 
talking about?

A software breakpoint should be valid for all threads if the threads are 
executing a shared piece of code. If these breakpoints are not 
triggering, we may have a bug somewhere.

For hardware breakpoints, the target code (in this case, the remote 
stub) is responsible for replicating the hardware breakpoint settings 
(register contents) to all threads upon their creation.

What version of GDB are you using?


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

end of thread, other threads:[~2014-05-11  3:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-10 22:00 GDB breakpoint implementation for multithreaded programms Sofia
2014-05-11  3:27 ` Luis Machado

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