Date: Tue, 30 Nov 2004 18:52:12 -0800 (PST) From: Kelly Yancey <kelly@nttmcl.com> To: threads@freebsd.org Subject: Single stepping through threads Message-ID: <20041130181558.H42615@alicia.nttmcl.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041130181558.H42615>