0

I'm writing a medium-sized systemtap script with clearly separable parts. I would like to split it into multiple files. I see two possibilities for doing this, but not ideal. Is there an official way or maybe a convention?

1. concatenate manually and read script from stdin

cat *.stp | stap -

2. use an import function

Systemtap always imports whole files, so this should work:

main.stp

probe begin {
    import_child();
}

child.stp

function import_child() {
    // using this function imports the whole file
}
Georg Schölly
  • 124,188
  • 49
  • 220
  • 267

1 Answers1

1

The latter method is the one used by the tapset library. Since you're creating your own analogous library, feel free to use the same one. stap -I /path/to/your/tapset/directory will add it to the search path. You don't have to use a function to create the cross-file reference; a global variable or probe alias is good enough too.

fche
  • 2,641
  • 20
  • 28