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?

>>define bring_me_there
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>    continue
>>end
>>
> 
> I recommend looking up the "ignore" command, if you want to skip a
> breakpoint N times.

Thanks Daniel, that works:

# threads specific
define bring_me_there
     # ignoring apr_poll (bp 3) 12 times
     ignore 3 12
     continue
end

I wish there was a syntax allowing to do it by name rather by number.

-- 


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to