From owner-freebsd-threads@FreeBSD.ORG Wed Dec 1 02:52:13 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3A92516A4CE for ; Wed, 1 Dec 2004 02:52:13 +0000 (GMT) Received: from alicia.nttmcl.com (alicia.nttmcl.com [216.69.69.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 16C7443D54 for ; Wed, 1 Dec 2004 02:52:13 +0000 (GMT) (envelope-from kelly@nttmcl.com) Received: from alicia.nttmcl.com (localhost [127.0.0.1]) by alicia.nttmcl.com (8.12.11/8.12.11) with ESMTP id iB12qCab043448 for ; Tue, 30 Nov 2004 18:52:12 -0800 (PST) (envelope-from kelly@nttmcl.com) Received: from localhost (kelly@localhost)iB12qCQ2043445 for ; Tue, 30 Nov 2004 18:52:12 -0800 (PST) (envelope-from kelly@nttmcl.com) X-Authentication-Warning: alicia.nttmcl.com: kelly owned process doing -bs Date: Tue, 30 Nov 2004 18:52:12 -0800 (PST) From: Kelly Yancey To: threads@freebsd.org Message-ID: <20041130181558.H42615@alicia.nttmcl.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: Single stepping through threads X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Dec 2004 02:52:13 -0000 Is there a way to single-step (trap on the next instruction, not gdb's step) a single thread in a process without any remaining threads running concurrently *without* reimplementing gdb? My application is not a full debugger; all it needs to do is single-step through an application. However, I need to be certain that every instruction that is executed (no matter which thread it is in) traps so my tracing process can inspect the state of the application. My utility works fine for single-thread processes, but by my reading of kse_create(), new threads are created with the P_TRACED bit cleared meaning my utility has no control over them. It looks like the functionality I am after is provided by libthread_db, but it appears to require ps_global_lookup() to determine which threading library the application is using. However, to implement ps_global_lookup() I would have to add logic to parse the symbol table in the target program, assuming it even has one. Which gets me to the crux of my quandary: I'm not implementing a debugger, I don't particularly want to implement a debugger, and even if I did I cannot assume that the programs I am trying to trace have any debugging symbols. So how do I control a multithreaded application? As I see no special support for threads in truss(1), can I assume that procfs somehow avoids this issue? Thanks, Kelly