aboutsummaryrefslogtreecommitdiffstats
path: root/load.c
diff options
context:
space:
mode:
Diffstat (limited to 'load.c')
-rw-r--r--load.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/load.c b/load.c
index 827679ebac..98a5900b5b 100644
--- a/load.c
+++ b/load.c
@@ -7,6 +7,7 @@
#include "internal.h"
#include "dln.h"
#include "eval_intern.h"
+#include "probes.h"
VALUE ruby_dln_librefs;
@@ -621,6 +622,14 @@ rb_f_load(int argc, VALUE *argv)
VALUE fname, wrap, path;
rb_scan_args(argc, argv, "11", &fname, &wrap);
+
+ if(RUBY_DTRACE_LOAD_ENTRY_ENABLED()) {
+ RUBY_DTRACE_LOAD_ENTRY(
+ StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+
path = rb_find_file(FilePathValue(fname));
if (!path) {
if (!rb_file_load_ok(RSTRING_PTR(fname)))
@@ -628,6 +637,11 @@ rb_f_load(int argc, VALUE *argv)
path = fname;
}
rb_load_internal(path, RTEST(wrap));
+
+ if(RUBY_DTRACE_LOAD_RETURN_ENABLED()) {
+ RUBY_DTRACE_LOAD_RETURN(StringValuePtr(fname));
+ }
+
return Qtrue;
}
@@ -861,6 +875,13 @@ rb_require_safe(VALUE fname, int safe)
} volatile saved;
char *volatile ftptr = 0;
+ if(RUBY_DTRACE_REQUIRE_ENTRY_ENABLED()) {
+ RUBY_DTRACE_REQUIRE_ENTRY(
+ StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+
PUSH_TAG();
saved.safe = rb_safe_level();
if ((state = EXEC_TAG()) == 0) {
@@ -871,7 +892,22 @@ rb_require_safe(VALUE fname, int safe)
rb_set_safe_level_force(safe);
FilePathValue(fname);
rb_set_safe_level_force(0);
+
+ if(RUBY_DTRACE_FIND_REQUIRE_ENTRY_ENABLED()) {
+ RUBY_DTRACE_FIND_REQUIRE_ENTRY(
+ StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
+
found = search_required(fname, &path, safe);
+
+ if(RUBY_DTRACE_FIND_REQUIRE_RETURN_ENABLED()) {
+ RUBY_DTRACE_FIND_REQUIRE_RETURN(
+ StringValuePtr(fname),
+ rb_sourcefile(),
+ rb_sourceline());
+ }
if (found) {
if (!path || !(ftptr = load_lock(RSTRING_PTR(path)))) {
result = Qfalse;
@@ -907,6 +943,10 @@ rb_require_safe(VALUE fname, int safe)
th->errinfo = errinfo;
+ if(RUBY_DTRACE_REQUIRE_RETURN_ENABLED()) {
+ RUBY_DTRACE_REQUIRE_RETURN(StringValuePtr(fname));
+ }
+
return result;
}