Bug 30512

Summary: error when thread ends in GDB
Product: [Retired] Red Hat Linux Reporter: Ji ZhenYong <jizy>
Component: gdbAssignee: Trond Eivind Glomsrxd <teg>
Status: CLOSED RAWHIDE QA Contact: Aaron Brown <abrown>
Severity: high Docs Contact:
Priority: high    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-03-07 11:04:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description Ji ZhenYong 2001-03-04 06:45:37 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

when a thread ends, GDB consider the program exited, i.e. I can't debug 
the codes after pthread_create. 

Reproducible: Always
Steps to Reproduce:
1.create a new thread and wait it
2.the new thread ends
3.now GDB considers the program exited normally

Actual Results: 
[...]$ cat main.c
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>

void MyProc()
	printf( "MyProc : .......Thread : %d......\r\n", (int)
pthread_self() );

void *ThreadProc( void *pParam )
	printf( "ThreadProc : \r\n" );
	return NULL;

int main(int argc, char *argv[])
	pthread_t aThread = 0;
	void		*pRet = NULL;

	pthread_create( &aThread, NULL, ThreadProc, NULL );


	pthread_join( aThread, &pRet );
	printf( "Main : ...\r\n" );

	return 0;

[...]$ gcc -lpthread -g -Wall -othread main.c
[...]$ gdb ./thread
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you 
welcome to change it and/or distribute copies of it under certain 
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux"...
(gdb) r
Starting program: /home/jizy/./thread
[New Thread 1024 (LWP 12127)]
[New Thread 2049 (LWP 12128)]
[New Thread 1026 (LWP 12129)]
MyProc : .......Thread : 1026......

Program exited normally.
(gdb) q

Expected Results:  "Main : ..." and "MyProc : .......Thread : 
1024......"should be outputed.

Comment 1 Jakub Jelinek 2001-03-07 11:04:29 UTC
First of all, this is gdb issue and I cannot see why it should have severity
security when it has nothing to do with security.
I haven't been able to reproduce this with gdb-5.0rh-3, with gdb in 7.0
I haven't seen the behaviour you describe, but got some weird message every
couple invocations, but that seems to be gone in current rawhide gdb.

Comment 2 Trond Eivind Glomsrxd 2001-03-08 19:58:53 UTC
It works with gdb-5.0rh-3 from Rawhide.