On Mon, Mar 18, 2002 at 03:21:53PM +0800, Stas Bekman wrote: > Daniel Jacobowitz wrote: > >On Sun, Mar 17, 2002 at 03:22:04AM +0800, Stas Bekman wrote: > > > >>Thanks Daniel, > >> > >>I guess first of all we are after being able to use the debugger with > >>threads at all, next working on the speed. If I knew how to make gdb > >>automatically switch to the thread which I want that would be a first > >>big step (i don't know which thread number do I want). What I see > >>currently is this: (I'm running on dual-proc smp kernel) I've a bp set > >>and I press 'continue' and at random I get my thread which runs the code > >>but most of the time not. I suppose this has to do with threads > >>scheduling and its interaction with the debugger. > >> > > > >Well, the same code is being called in the thread you want and another? > >How do you know which thread you want? > > > >GDB supports both thread-specific breakpoints and conditional > >breakpoints. From the manual, you can do things like: > > (gdb) break main thread 1 if a == 2 > > > >So if you can express the condition that says "this is my thread", you > >can do > > (gdb) break apr_poll if thread->magic == MY_MAGIC > >or whatever. > > Interesting. Has anybody an idea what would be the condition in httpd > threads? looking through worker.c I cannot see any variables I can have > in the scope of the running thread. How do I refer to the thread, while > I'm inside of it so I can get get to its local storage?
The same way the thread figures out what its local storage is (remember, you can make function calls from GDB...). -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
