This is the mail archive of the gdb-prs@sources.redhat.com 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]

Re: gdb/669: GDB/MI -thread-list-ids diffferent then "info threads"


The following reply was made to PR gdb/669; it has been noted by GNATS.

From: "Alain Magloire" <alain@qnx.com>
To: gdb-gnats@sources.redhat.com
Cc:  
Subject: Re: gdb/669: GDB/MI -thread-list-ids diffferent then "info threads"
Date: Fri, 30 Aug 2002 14:34:52 -0400 (EDT)

 > 
 > >Category:       gdb
 > >Responsible:    unassigned
 > >Synopsis:       GDB/MI -thread-list-ids diffferent then "info threads"
 > >Arrival-Date:   Mon Aug 26 11:38:01 PDT 2002
 
 Some examples below, on GNU/Linux.  But it is more "visible" on
 Solaris where they have (LWP), -thread-list-ids is not updated.
 Below the last -thread-list-ids will report 4 threads but 
 info threads will report 2 threads.
 
 #cat thread.c
 #include <pthread.h>
 #include <stdio.h>
 
 void *routine(void *arg) {
 	int i = (int)arg;
 	printf("routine %d\n", i);
 }
 
 int main() {
 	pthread_t t1, t2;
 	int x = 0;
 	printf("Starting 1\n");
 	pthread_create(&t1, NULL, routine, (void *)x++);
 	printf("Starting 2\n");
 	pthread_create(&t2, NULL, routine, (void *)x);
 	pthread_join(t1, NULL);
 	pthread_join(t2, NULL);
 	printf("Finish 2\n");
 	return 0;
 }
 # gdb -i mi ./thread
 GNU gdb 5.2.1
 Copyright 2002 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you are
 welcome to change it and/or distribute copies of it under certain conditions.
 Type "show copying" to see the conditions.
 There is absolutely no warranty for GDB.  Type "show warranty" for details.
 This GDB was configured as "i686-pc-linux-gnu"...
 (gdb) 
 b main
 &"b main\n"
 ^done
 (gdb) 
 r
 &"r\n"
 ~"[New Thread 1024 (LWP 16125)]\n"
 ~"[Switching to Thread 1024 (LWP 16125)]\n"
 ^done,reason="breakpoint-hit",bkptno="1",thread-id="1",frame={addr="0x0804854a",func="main",args=[],file="thread.c",line="11"}
 (gdb) 
 -thread-list-ids
 ^done,thread-ids={thread-id="1"},number-of-threads="1"
 (gdb) 
 info threads
 &"info threads\n"
 ~"* 1 Thread 1024 (LWP 16125)  "
 ^done,frame={func="main",args=[],file="thread.c",line="11"}
 (gdb) 
 b exit
 &"b exit\n"
 ^done
 (gdb) 
 c
 &"c\n"
 Starting 1
 ~"[New Thread 2049 (LWP 16110)]\n"
 ~"[New Thread 1026 (LWP 16111)]\n"
 Starting 2
 routine 0
 ~"[New Thread 2051 (LWP 16112)]\n"
 routine 1
 ^done,reason="breakpoint-hit",bkptno="2",thread-id="1",frame={addr="0x080485c2",func="main",args=[],file="thread.c",line="18"}
 (gdb) 
 -thread-list-ids
 ^done,thread-ids={thread-id="4",thread-id="3",thread-id="2",thread-id="1"},number-of-threads="4"
 (gdb) 
 info threads
 &"info threads\n"
 ~"  2 Thread 2049 (LWP 16110)  "
 ~"* 1 Thread 1024 (LWP 16107)  "
 ^done,frame={addr="0x40119227",func="__poll",args=[{name="fds",value="0x804b604"},{name="nfds",value="1"},{name="timeout",value="2000"}],file="../sysdeps/unix/sysv/linux/poll.c",line="63"},frame={func="main",args=[],file="thread.c",line="18"}
 (gdb) 
 
 


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