show a separator even if ec is NULL.

`RUBY_DEBUG_LOG()` doesn't show anything if `GET_EC()` returns NULL,
but print a separator "\t" to make consistent TSV.
This commit is contained in:
Koichi Sasada 2023-04-26 17:05:32 +09:00
parent 457824e2d3
commit 06b68db7cf
Notes: git 2023-04-26 08:58:00 +00:00

View File

@ -540,10 +540,10 @@ ruby_debug_log(const char *file, int line, const char *func_name, const char *fm
rb_execution_context_t *ec = rb_current_execution_context(false);
if (ec) {
// Ruby location
int ruby_line;
const char *ruby_file = rb_source_location_cstr(&ruby_line);
const char *ruby_file = ec ? rb_source_location_cstr(&ruby_line) : NULL;
if (len < MAX_DEBUG_LOG_MESSAGE_LEN) {
if (ruby_file) {
r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\t%s:%d", pretty_filename(ruby_file), ruby_line);
@ -554,7 +554,6 @@ ruby_debug_log(const char *file, int line, const char *func_name, const char *fm
if (r < 0) rb_bug("ruby_debug_log returns %d\n", r);
len += r;
}
}
#ifdef RUBY_NT_SERIAL
// native thread information