From owner-freebsd-current Fri May 7 13:26:33 1999 Delivered-To: freebsd-current@freebsd.org Received: from herring.nlsystems.com (nlsys.demon.co.uk [158.152.125.33]) by hub.freebsd.org (Postfix) with ESMTP id 7D511155BA for ; Fri, 7 May 1999 13:26:26 -0700 (PDT) (envelope-from dfr@nlsystems.com) Received: from localhost (dfr@localhost) by herring.nlsystems.com (8.9.3/8.8.8) with ESMTP id VAA15807; Fri, 7 May 1999 21:26:46 +0100 (BST) (envelope-from dfr@nlsystems.com) Date: Fri, 7 May 1999 21:26:46 +0100 (BST) From: Doug Rabson To: Matthew Dillon Cc: current@FreeBSD.ORG Subject: Re: Debugging FreeBSD user threads with gdb In-Reply-To: <199905072010.NAA46817@apollo.backplane.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 7 May 1999, Matthew Dillon wrote: > :--- uthread_create.c 1999/03/23 05:07:55 1.12 > :+++ uthread_create.c 1999/05/06 15:27:33 > :@@ -42,6 +42,8 @@ > : #include "pthread_private.h" > : #include "libc_private.h" > : > :+static int next_tid = 1; > :+ > : int > : pthread_create(pthread_t * thread, const pthread_attr_t * attr, > : void *(*start_routine) (void *), void *arg) > :@@ -87,6 +89,7 @@ > : } else { > : /* Initialise the thread structure: */ > : memset(new_thread, 0, sizeof(struct pthread)); > :+ new_thread->tid = next_tid++; > : > :Doug Rabson Mail: dfr@nlsystems.com > :Nonlinear Systems Ltd. Phone: +44 181 442 9037 > > Hmmm. tid is only an int and some programs which create and destroy > threads a lot are almost certainly going to overflow it. 4 billion > is not hard to reach. This can result in duplicate tid's. Didn't think of that. It gets a bit ugly inside gdb since gdb needs a single int to encode the pid and thread id. I'm currently allowing 20 bits for the pid and 11 for the tid. Any ideas? -- Doug Rabson Mail: dfr@nlsystems.com Nonlinear Systems Ltd. Phone: +44 181 442 9037 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message