http://www.perlmonks.org?node_id=1036708


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.

Replies are listed 'Best First'.
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 .