Skip to content

Commit 6a3ddad

Browse files
committed
Print the function name when rb_tr_jmp_buf is NULL in rb_tr_exception_from_java_jump()
1 parent 8062a74 commit 6a3ddad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tool/generate-cext-trampoline.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ def struct_by_value?(type)
109109
}
110110
111111
RBIMPL_ATTR_NORETURN()
112-
static inline void rb_tr_exception_from_java_jump(void) {
112+
static inline void rb_tr_exception_from_java_jump(const char *function) {
113113
if (LIKELY(rb_tr_jmp_buf != NULL)) {
114114
// fprintf(stderr, "There was an exception, longjmp()'ing");
115115
RUBY_LONGJMP(*rb_tr_jmp_buf, 1);
116116
} else {
117-
fprintf(stderr, "ERROR: There was an exception in Java but rb_tr_jmp_buf is NULL.");
117+
fprintf(stderr, "ERROR: There was a Java exception when returning from %s() but rb_tr_jmp_buf is NULL.", function);
118118
abort();
119119
}
120120
}
@@ -217,7 +217,7 @@ def struct_by_value?(type)
217217
else
218218
f.puts " if (UNLIKELY(rb_tr_exception_from_java())) {"
219219
end
220-
f.puts " rb_tr_exception_from_java_jump();"
220+
f.puts " rb_tr_exception_from_java_jump(#{function_name.dump});"
221221
f.puts " }"
222222
f.puts " UNREACHABLE;" if no_return
223223
else
@@ -229,7 +229,7 @@ def struct_by_value?(type)
229229
end
230230
f.puts " #{return_type} _result = impl_#{function_name}(#{argument_names});"
231231
f.puts " if (UNLIKELY(rb_tr_exception_from_java())) {"
232-
f.puts " rb_tr_exception_from_java_jump();"
232+
f.puts " rb_tr_exception_from_java_jump(#{function_name.dump});"
233233
f.puts " }"
234234
f.puts " return _result;"
235235
end

0 commit comments

Comments
 (0)