diff options
author | Koichi Sasada <[email protected]> | 2023-03-31 03:52:58 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2023-03-31 11:28:18 +0900 |
commit | 2093e4c2db1e19991e601bf5191eddb4652de35d () | |
tree | 486cb12704655596fdec0227a37450da23d8b5f4 /debug.c | |
parent | 83667008b925c32b3ab70fb6ec70f7398e960d1e (diff) |
`nt->serial` for `RUBY_DEBUG_LOG`
Show native thread's serial on `RUBY_DEBUG_LOG`. `nt->serial` is also stored into `ruby_nt_serial` if the compiler supports `RB_THREAD_LOCAL_SPECIFIER`.
Notes: Merged: https://.com/ruby/ruby/pull/7630
-rw-r--r-- | debug.c | 40 |
1 files changed, 33 insertions, 7 deletions
@@ -533,7 +533,9 @@ ruby_debug_log(const char *file, int line, const char *func_name, const char *fm len += r; } - if (rb_current_execution_context(false)) { // Ruby location int ruby_line; const char *ruby_file = rb_source_location_cstr(&ruby_line); @@ -547,22 +549,46 @@ 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; } // ractor information if (ruby_single_main_ractor == NULL) { - rb_ractor_t *cr = GET_RACTOR(); if (r && len < MAX_DEBUG_LOG_MESSAGE_LEN) { - r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\tr:#%u/%u", - (unsigned int)rb_ractor_id(cr), GET_VM()->ractor.cnt); if (r < 0) rb_bug("ruby_debug_log returns %d\n", r); len += r; } } // thread information - const rb_thread_t *th = GET_THREAD(); - if (r && len < MAX_DEBUG_LOG_MESSAGE_LEN) { - r = snprintf(buff + len, MAX_DEBUG_LOG_MESSAGE_LEN - len, "\tth:%u", rb_th_serial(th)); if (r < 0) rb_bug("ruby_debug_log returns %d\n", r); len += r; } |