Date: Fri, 7 May 1999 21:07:20 +0100 (BST) From: Doug Rabson <dfr@nlsystems.com> To: current@freebsd.org Subject: Debugging FreeBSD user threads with gdb Message-ID: <Pine.BSF.4.05.9905072102080.10400-100000@herring.nlsystems.com>
next in thread | raw e-mail | index | archive | help
I have just implemented a new target for gdb-4.18 which allows programs
which use FreeBSD's user threads library to be effectively debugged. The
new target automatically detects the presence of user threads when a
program is started or attached to and examined using the gdb commands
'info thread' and 'thread'.
To allow individual threads to be distinguished from gdb, I had to make
the following minor change to uthread. Unless anyone has any objections, I
will be committing this change and the new gdb target into -current.
Index: pthread_private.h
===================================================================
RCS file: /home/ncvs/src/lib/libc_r/uthread/pthread_private.h,v
retrieving revision 1.17
diff -u -r1.17 pthread_private.h
--- pthread_private.h 1999/03/23 05:07:54 1.17
+++ pthread_private.h 1999/05/06 15:26:53
@@ -420,6 +420,7 @@
#define PTHREAD_MAGIC ((u_int32_t) 0xd09ba115)
u_int32_t magic;
char *name;
+ int tid; /* for gdb */
/*
* Lock for accesses to this thread structure.
Index: uthread_create.c
===================================================================
RCS file: /home/ncvs/src/lib/libc_r/uthread/uthread_create.c,v
retrieving revision 1.12
diff -u -r1.12 uthread_create.c
--- 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++;
new_thread->slice_usec = -1;
new_thread->sig_saved = 0;
new_thread->stack = stack;
--
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9905072102080.10400-100000>
