[lldb-dev] Breakpoint hitting on wrong thread

Kopec, Matt matt.kopec at intel.com
Fri Oct 11 15:33:38 PDT 2013


In POSIXThread.cpp there is a call in BreakNotify() to SetSelectedThreadByID before the stop info gets set to a breakpoint stop. Not that sure if that call is actually needed there, it's not called anywhere in the POSIX/Linux process plugins.

Not sure if this is relevant but on Linux lldb needs to stop the other threads in the inferior with a kill() but I don't think any stop info gets set for those threads.

Matt

-----Original Message-----
From: lldb-dev-bounces at cs.uiuc.edu [mailto:lldb-dev-bounces at cs.uiuc.edu] On Behalf Of Greg Clayton
Sent: Friday, October 11, 2013 6:11 PM
To: Richard Mitton
Cc: lldb-dev at cs.uiuc.edu
Subject: Re: [lldb-dev] Breakpoint hitting on wrong thread

I haven't seen this.

Set a breakpoint in both of the following functions:

b ThreadList::SetSelectedThreadByID
b ThreadList::SetSelectedThreadByIndexID

You should be able to catch who is setting this incorrectly.

Greg


On Oct 11, 2013, at 3:04 PM, Richard Mitton <richard at codersnotes.com> wrote:

> Hi,
> 
> I'm running into an issue on Linux where hitting a breakpoint won't change the currently selected thread index to that thread:
> Notice in this example how the current thread is #1, even though the breakpoint hit on thread #2. I only have one breakpoint set, and thread #2 is the only thread anywhere near that breakpoint.
> (lldb) b main.c:21
> (lldb) run
> Process 12353 stopped
> thread #2: tid = 12357, 0x000000000040076a a.out`fn_static(param=0x0000000000000000) + 30 at main.c:21, name = 'a.out', stop reason = breakpoint 1.1
>     frame #0: 0x000000000040076a a.out`fn_static(param=0x0000000000000000) + 30 at main.c:21
>    18   {
>    19           var_static *= 2;
>    20           for(;;)
> -> 21                   usleep(1); // thread breakpoint
>    22   }
>    23   
>    24   int main (int argc, char const *argv[])
> (lldb) thread list
> Process 12353 stopped
> * thread #1: tid = 12353, 0x00007f0d8e31cd3d libc.so.6`nanosleep + 45, name = 'a.out'
>   thread #2: tid = 12357, 0x000000000040076a a.out`fn_static(param=0x0000000000000000) + 30 at main.c:21, name = 'a.out', stop reason = breakpoint 1.1
> 
> Somewhat annoyingly, this only fails when inside a unit test, and works fine from the command-line.
> Has anyone seen anything like this before?
> -- 
> Richard Mitton
> 
> richard at codersnotes.com
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev

_______________________________________________
lldb-dev mailing list
lldb-dev at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev




More information about the lldb-dev mailing list