Single stepping and threads

Daniel Jacobowitz drow@false.org
Sat Dec 2 16:33:00 GMT 2006


On Sat, Dec 02, 2006 at 04:27:12PM +0000, Rob Quill wrote:
> On 30/11/06, Michael Snyder <Michael.Snyder@palmsource.com> wrote:
> >Default on would be a disaster -- most threaded programs would
> >not behave even remotely the same under the debugger as they would
> >solo.
> >
> >In fact, many would deadlock almost immediately.
> 
> I have a question regarding this. In concurrent programming (as we
> were tuaght it), the principle was that the interleaving of
> instructions from threads was random. So, if "on" were the default,
> and a few steps were done in GDB, in fact, as many as it took to
> deadlock the program, surely it is possible (although, however
> unlikely) that when the program is run without GDB that the
> interleaving is the same as that forced by GDB, and the code would
> deadlock. Thus making the code bad, rather than the debugger.
> 
> What I'm trying to say is that it was my understanding that when doing
> concurent programming the interleaving was random and that for the
> program to be "corrent" it should not deadlock under any possible
> interleaving.
> 
> I fail to see how stopping all threads and just going forward with one
> should stop "correct" code from executiong properly.

That's not what "on" does - it would permanently starve all other
threads.

There's also the point that what is correct is not always useful; GDB
tries to interfere as little as practical.

-- 
Daniel Jacobowitz
CodeSourcery



More information about the Gdb mailing list