This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug breakpoints/11568] New: delete thread-specific breakpoint on the thread exit


Breakpoint created using `thread THREADNUM' stays valid even after THREADNUM
exits.  New threads will always have bigger number than THREADNUM.  Breakpoint
using `thread THREADNUM' can be never hit again after thread THREADNUM exits.

Such breakpoint should be deleted.  Similar to when a scope-bound breakpoint
gets deleted after the scope exits.

-----------------------------------------------------------------------------
#include <pthread.h>
static void *
start (void *arg)
{
  return NULL;
}
int
main (void)
{
  pthread_t thread;
  pthread_create (&thread, NULL, start, NULL);
  pthread_join (thread, NULL);
  return 0;	/* line 13 */
}
-----------------------------------------------------------------------------
(gdb) b start
Breakpoint 1 at 0x40057c: file lost.c, line 5.
(gdb) r
Starting program: /home/jkratoch/t/lost 
[Thread debugging using libthread_db enabled]
[New Thread 0x7ffff7fde710 (LWP 28373)]
[Switching to Thread 0x7ffff7fde710 (LWP 28373)]

Breakpoint 1, start (arg=0x0) at lost.c:5
5	  return NULL;
(gdb) info threads 
* 2 Thread 0x7ffff7fde710 (LWP 28373)  start (arg=0x0) at lost.c:5
  1 Thread 0x7ffff7fe0700 (LWP 28370)  0x00000035e9807bfd in pthread_join (
    threadid=<value optimized out>, thread_return=<value optimized out>) at
pthread_join.c:89
(gdb) b main thread 2
Breakpoint 2 at 0x40058b: file lost.c, line 11.
(gdb) b lost.c:13
Breakpoint 3 at 0x4005b7: file lost.c, line 13.
(gdb) c
Continuing.
[Thread 0x7ffff7fde710 (LWP 28373) exited]
[Switching to Thread 0x7ffff7fe0700 (LWP 28370)]

Breakpoint 3, main () at lost.c:13
13	  return 0;	/* line 13 */
(gdb) info breakpoints 
Num     Type           Disp Enb Address            What
1       breakpoint     keep y   0x000000000040057c in start at lost.c:5
	breakpoint already hit 1 time
2       breakpoint     keep y   0x000000000040058b in main at lost.c:11 thread 2
	stop only in thread 2
3       breakpoint     keep y   0x00000000004005b7 in main at lost.c:13
	breakpoint already hit 1 time
(gdb) info threads 
* 1 Thread 0x7ffff7fe0700 (LWP 28370)  main () at lost.c:13
(gdb) _

-- 
           Summary: delete thread-specific breakpoint on the thread exit
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: breakpoints
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: jan dot kratochvil at redhat dot com
                CC: gdb-prs at sourceware dot org
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://sourceware.org/bugzilla/show_bug.cgi?id=11568

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]