Daniel Jacobowitz wrote:
> On Tue, Mar 12, 2002 at 06:46:17PM +0800, Stas Bekman wrote:
> 
>>Hi Daniel,
>>
>>Remember you've helped me at the mod_perl dev list with my gdb starting 
>>very slowly?
>>http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=100679267518055&w=2
>>Your auto-solib-add tip works great with preforked httpd.
>>
>>Now, I'm trying to debug mod_perl over threaded httpd (worker mpm) and 
>>the two simply won't play together. If I set auto-solib-add to 0, gdb 
>>won't work with threaded httpd. Have you seen this problem before?
>>
>>Any ideas how to tell gdb not to resolve so's automatically and still
>>have threads working? without auto-solib-add=0, I'm back to the painful 
>>1+ minute startups :(
>>
> 
> Threads: in shared libraries.  Basically, auto-solib-add 0 had two
> effects: Don't stop all the time to load libraries, and don't notice
> the thread library getting loaded.
> 
> There's not much we can do without improving the speed of thread
> debugging.  I'm thinking about it, but it's really quite complicated...

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.

... time passes, me trying more combinations ...

On the other hand at this moment for some reason gdb always switches to 
the right thread after I hit the apr_poll bp 14 times. And then it 
happens, i get what I want:

Breakpoint 3, apr_poll (aprset=0x8187eb0, nsds=0xbf5ffaec, timeout=-1) 
at poll.c:143
(gdb) cont

... 12 more times...

Breakpoint 3, apr_poll (aprset=0x8187eb0, nsds=0xbf5ffaec, timeout=-1) 
at poll.c:143
(gdb) cont
[Switching to Thread 3076 (LWP 18425)]

Breakpoint 4, mpxs_Apache__Scoreboard_image (my_perl=0x81e7960, 
Class=0x88fb814, pool=0x844c7e0) at 
/home/stas/apache.org/mp-sb/xs/Apache/Scoreboard/Apache__Scoreboard.h:233

(gdb) info threads
* 5 Thread 3076 (LWP 18425)  mpxs_Apache__Scoreboard_image 
(my_perl=0x81e7960, Class=0x88fb814, pool=0x844c7e0) at 
/home/stas/apache.org/mp-sb/xs/Apache/Scoreboard/Apache__Scoreboard.h:233
   4 Thread 2051 (LWP 18424)  0x402dfd94 in poll () from /lib/libc.so.6
   2 Thread 2049 (LWP 18422)  0x402dfd94 in poll () from /lib/libc.so.6
   1 Thread 1024 (LWP 18374)  0x402267a2 in sigsuspend () from 
/lib/libc.so.6
(gdb)

I don't know why this happens, because under forked httpd there is no 14 
times apr_poll bp hits. I suppose that there is some other thread 
running and hits the apr_poll bp. Why 14 times, I dunno.

So I've automated the process and now I have:

.debug
-----------
file /home/stas/httpd/worker/bin/httpd
handle SIGPIPE nostop
handle SIGPIPE pass

define myrun
     tbreak main
     break ap_run_pre_config
     run -d `pwd`/t -f `pwd`/t/conf/httpd.conf -DONE_PROCESS 
-DNO_DETATCH -DAPACHE2
     set auto-solib-add 0
     continue
end

define gopoll
     b apr_poll
     continue
     continue
end

define bring_me_there
     continue
     continue
     continue
     continue
     continue
     continue
     continue
     continue
     continue
     continue
     continue
     continue
     continue
end

define mybp
     sharedlibrary Scoreboard
     b mpxs_Apache__Scoreboard_image
end

myrun
gopoll
mybp
bring_me_there

which I run as:
ddd -command=.debug & ; sleep 2 ; t/TEST -v -run apache/scoreboard &

and voila, I can debug my code :) takes about 10-15 secs to get me 
there, which is not bad.

But I'm almost sure that this won't work when I really need it :) I 
don't like this 14 times number, which makes no sense to me.

Hey, gozer you have an smp machine, can you reproduce the same? Use some 
other bp for the mod_perl code, since scoreboard stuff wasn't committed yet.

_____________________________________________________________________
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