Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: tracing system calls a perl script is making

by shmem (Canon)
on Jun 03, 2013 at 10:24 UTC ( #1036708=note: print w/ replies, xml ) Need Help??


in reply to Re^2: tracing system calls a perl script is making
in thread tracing system calls a perl script is making

What BrowserUk says - use INIT, not BEGIN, since BEGIN blocks are executed in the compile phase of the perl script.

I want to write something of a generic tracer for any perl script.

Why? GNU/Linux has tools for that ready - strace(1), ltrace(1). I suspect an XY problem here. What are you trying to to with that which you are ostensibly trying to do?

Then, perl is linked against many libraries, and it can well be that most of those syscalls happen inside calls to functions in these libraries. To verify that, you can use ltrace(1), which displays library calls, together with the -S switch to display system calls as well.


Comment on Re^3: tracing system calls a perl script is making
Re^4: tracing system calls a perl script is making
by gideondsouza (Pilgrim) on Jun 03, 2013 at 14:39 UTC
    use INIT, not BEGIN

    Yes, it is INIT not begin. I put in a typo. Sorry!

    I suspect an XY problem here. What are you trying to to with that which you are ostensibly trying to do?

    Oh, no no! It's not. I'm just trying to learn how a debugger is built :) I downloaded the source for strace and gdb but it's just too large to understand..

    Mostly, it's a exercise in perl, C and Linux I've given myself to write a program that can list out all system calls a perl script is making while executing that program .

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2014-07-30 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (231 votes), past polls