Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Trying to track a sleeping CGI request with gdb

by sgifford (Prior)
on Oct 10, 2006 at 18:21 UTC ( [id://577466]=note: print w/replies, xml ) Need Help??


in reply to Trying to track a sleeping CGI request with gdb

As far as the OS is concerned, the running program is perl, and your script is just an argument to it. So you would do:
gdb /usr/bin/perl 1234

But this is doing to drop you into the middle of a running perl process, and you may not find that very helpful. It's easy enough to write a test script that will sleep for long enough that you can attach to it and poke around in the debugger. That should give you an idea of how to get around in the debugger, and whether or not you'll find this useful.

Ideally, you would want to drop into perl -d, but that currently isn't possible; see How to attach a perl debugger to a running perl.

I usually debug these sorts of things by printing out a lot of debugging information. Then when it's stuck, you can see the last thing it printed out to figure out what it's doing. As others have mentioned, strace/truss can also be very useful.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://577466]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 11:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found