diff options
author | Koichi Sasada <ko1@atdot.net> | 2019-08-21 01:04:08 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-21 01:04:08 +0900 |
commit | 88b1f2dac430d7b10fc98c5a072c4edfeb51b27a (patch) | |
tree | 028cf6e5a461578e0a47646a54d76c888af740ed /internal.h | |
parent | d10e28b875a58e2c4422b8df8f4bbcc2fb0362d0 (diff) |
`rp(obj)` shows func, file and line. (#2394)
rp() macro for debug also shows file location and function name
such as:
[OBJ_INFO:rb_call_inits@inits.c:73] 0x000056147741b248 ...
Notes
Notes:
Merged-By: ko1
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/internal.h b/internal.h index 4df3826db9..eb18581d47 100644 --- a/internal.h +++ b/internal.h @@ -1390,10 +1390,12 @@ rb_ary_entry_internal(VALUE ary, long offset) /* MRI debug support */ void rb_obj_info_dump(VALUE obj); -void ruby_debug_breakpoint(void); +void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func); +void ruby_debug_breakpoint(void); // show obj data structure without any side-effect -#define rp(obj) rb_obj_info_dump((VALUE)obj); +#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, __func__) + // same as rp, but add message header #define rp_m(msg, obj) do { \ fprintf(stderr, "%s", (msg)); \ |