summaryrefslogtreecommitdiff
path: root/debug.c
AgeCommit message (Collapse)Author
2022-06-10small fix on `setup_debug_log()`Koichi Sasada
* print `ruby_debug_log_mode` at first. * show filters when `ruby_debug_log_mode` is not "disabled". Notes: Merged: https://github.com/ruby/ruby/pull/5996
2022-06-09func: and file: prefix for `RUBY_DEBUG_LOG_FILTER`Koichi Sasada
`RUBY_DEBUG_LOG_FILTER` specified only function names but this patch also check file names for each log events. If you specify `file:` or `func:` prefix, it's only filter file names or func names (otherwize check both). foo # show log when file or func names are mached with foo func:foo # show log when func name matches foo file:foo # show log when file name matches foo -file:foo,func:bar # show log when file name does not contains foo # and func name matches bar Notes: Merged: https://github.com/ruby/ruby/pull/5988
2022-05-24add `rb_th_serial()`Koichi Sasada
`rb_th_serial(th)` returns th's serial for debug print purpose. Notes: Merged: https://github.com/ruby/ruby/pull/5933
2022-05-21extend `RUBY_DEBUG_LOG_FILTER` to reject wordsKoichi Sasada
support reject words with `-word` like RUBY_DEBUG_LOG_FILTER=-foo,-bar,baz,boo`. Notes: Merged: https://github.com/ruby/ruby/pull/5924
2022-05-20`rb_thread_t::serial` for debugKoichi Sasada
`rb_thread_t::serial` is auto-incremented serial number for threads and it can overflow, it means the serial is not a ID for each thread, it is only for debug print. `RUBY_DEBUG_LOG` shows this information. Also skip EC related information if EC is NULL. This patch enable to use `RUBY_DEBUG_LOG` without setup EC. Notes: Merged: https://github.com/ruby/ruby/pull/5921
2021-12-29`USE_RUBY_DEBUG_LOG` doesn't check `RUBY_DEVEL`Koichi Sasada
`USE_RUBY_DEBUG_LOG` was only defined when `RUBY_DEVEL` is defined. This patch removes this dependency (`USE_RUBY_DEBUG_LOG` is defined independently from `RUBY_DEVEL`). Do not commit a patch which enables `USE_RUBY_DEBUG_LOG`. Notes: Merged: https://github.com/ruby/ruby/pull/5366
2021-10-25[Feature #18239] Implement VWA for stringsPeter Zhu
This commit adds support for embedded strings with variable capacity and uses Variable Width Allocation to allocate strings. Notes: Merged: https://github.com/ruby/ruby/pull/4933
2021-09-28lldb: Show encoding of String [ci skip]Nobuyoshi Nakada
2021-08-24Moved exported symbols in internal/util.h to ruby/util.hNobuyoshi Nakada
[Feature #18051] Notes: Merged: https://github.com/ruby/ruby/pull/4763
2021-02-24Revert "Enclose crtitical sections in `thread_exclusive` block"Nobuyoshi Nakada
19cc24b34b0490b7c2779eec521fe0089e05f183 and fixups.
2021-02-23Use the system getenv in setup_debug_logNobuyoshi Nakada
As ruby_set_debug_option() is called before ruby_sysinit(), CRITICAL_SECTIONs are not initialized yet.
2020-12-25USE_RUBY_DEBUG_LOG is not defined !devel buildKoichi Sasada
2020-12-07show ractor info on non-single ractor modeKoichi Sasada
Without this patch, Ruby doesn't show ractor's information when there is only 1 ractor. However it is hard to read the log when some ractors are created and terminated. This patch makes to keep showing ractor's information on multi-ractor mode. Notes: Merged: https://github.com/ruby/ruby/pull/3842
2020-11-18fix public interfaceKoichi Sasada
To make some kind of Ractor related extensions, some functions should be exposed. * include/ruby/thread_native.h * rb_native_mutex_* * rb_native_cond_* * include/ruby/ractor.h * RB_OBJ_SHAREABLE_P(obj) * rb_ractor_shareable_p(obj) * rb_ractor_std*() * rb_cRactor and rm ractor_pub.h and rename srcdir/ractor.h to srcdir/ractor_core.h (to avoid conflict with include/ruby/ractor.h) Notes: Merged: https://github.com/ruby/ruby/pull/3775
2020-09-03Introduce Ractor mechanism for parallel executionKoichi Sasada
This commit introduces Ractor mechanism to run Ruby program in parallel. See doc/ractor.md for more details about Ractor. See ticket [Feature #17100] to see the implementation details and discussions. [Feature #17100] This commit does not complete the implementation. You can find many bugs on using Ractor. Also the specification will be changed so that this feature is experimental. You will see a warning when you make the first Ractor with `Ractor.new`. I hope this feature can help programmers from thread-safety issues. Notes: Merged: https://github.com/ruby/ruby/pull/3365
2020-08-13ruby_debug_log: suppress warning卜部昌平
Old gcc (< 5 maybe?) warns that this variable is not initialized: debug.c: In function 'ruby_debug_log': debug.c:441:13: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized] if (r && len < MAX_DEBUG_LOG_MESSAGE_LEN) { ^ I don't know if that is true, but adding "= 0" here must harm no one. Notes: Merged: https://github.com/ruby/ruby/pull/3411
2020-08-02remove accidentally introduced debug codeKoichi Sasada
2020-08-02support multiple filters by RUBY_DEBUG_LOG_FILTERKoichi Sasada
Now you can specify multiple filters for RUBY_DEBUG_LOG output by RUBY_DEBUG_LOG_FILTER=a,b,c (in this case, logs that the function name contains a, b or c).
2020-07-03RUBY_DEBUG_LOG: Logging debug information mechanism (#3279)Koichi Sasada
* RUBY_DEBUG_LOG: Logging debug information mechanism This feature provides a mechanism to store logging information to a file, stderr or memory space with simple macros. The following information will be stored. * (1) __FILE__, __LINE__ in C * (2) __FILE__, __LINE__ in Ruby * (3) __func__ in C (message title) * (4) given string with sprintf format * (5) Thread number (if multiple threads are running) This feature is enabled only USE_RUBY_DEBUG_LOG is enabled. Release version should not enable it. Running with the `RUBY_DEBUG_LOG` environment variable enables this feature. # logging into a file RUBY_DEBUG_LOG=/path/to/file STDERR # logging into STDERR RUBY_DEBUG_LOG=stderr # logging into memory space (check with a debugger) # It will help if the timing is important. RUBY_DEBUG_LOG=mem RUBY_DEBUG_LOG_FILTER environment variable can specify the fileter string. If "(3) __func__ in C (message title)" contains the specified string, the infomation will be stored (example: RUBY_DEBUG_LOG_FILTER=str will enable only on str related information). In a MRI source code, you can use the following macros: * RUBY_DEBUG_LOG(fmt, ...): Above (1) to (4) will be logged. * RUBY_DEBUG_LOG2(file, line, fmt, ...): Same as RUBY_DEBUG_LOG(), but (1) will be replaced with given file, line. Notes: Merged-By: ko1 <ko1@atdot.net>
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged: https://github.com/ruby/ruby/pull/3079
2020-04-25More enums are mandatory for rp in lldb_cruby.pyNobuyoshi Nakada
2020-04-18RUBY_SPECIAL_SHIFT and RUBY_FL_USHIFT are mandatory for rp in lldb_cruby.pyNobuyoshi Nakada
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <shyouhei@ruby-lang.org>
2020-02-22VALUE size packed callinfo (ci).Koichi Sasada
Now, rb_call_info contains how to call the method with tuple of (mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and mid+argc+flags only requires 64bits. So this patch packed rb_call_info to VALUE (1 word) on such cases. If we can not represent it in VALUE, then use imemo_callinfo which contains conventional callinfo (rb_callinfo, renamed from rb_call_info). iseq->body->ci_kw_size is removed because all of callinfo is VALUE size (packed ci or a pointer to imemo_callinfo). To access ci information, we need to use these functions: vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci). struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg. rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc() is temporary removed because cd->ci should be marked. Notes: Merged: https://github.com/ruby/ruby/pull/2888
2020-01-03move internal/debug.h definitions to internal.hKoichi Sasada
Debug utilities should be accessible from any internal code.
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-12-26internal/imemo.h rework卜部昌平
Arrange contents and eliminate macros, to make them readable. Macro IFUNC_NEW was deleted because there was only one usage. Notes: Merged: https://github.com/ruby/ruby/pull/2711
2019-12-05add additional CF info for CI envKoichi Sasada
Introduce new RUBY_DEBUG option 'ci' to inform Ruby interpreter that an interpreter is running on CI environment. With this option, `rb_bug()` shows more information includes method entry information, local variables information for each control frame.
2018-01-09internal.h: remove dependecy on ruby/io.hnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-23debug.c: include RIMemo in ruby_dummy_gdb_enumsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-02debug.c: vm call flagsnobu
* debug.c (ruby_dummy_gdb_enums): include vm_call_flag_bits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-25debug.c: RSymbol infonobu
* debug.c (ruby_dummy_gdb_enums): force to include struct RSymbol info. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-24debug.c: imemo_masknobu
* .gdbinit (rp, rp_imemo, rb_ps_thread): update imemo_mask. * debug.c (ruby_dummy_gdb_enums): include imemo_types. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-05debug.c: add FMODE constantsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-21ruby.c: debug options in command linenobu
* ruby.c (debug_option): parse options in --debug command line option same as RUBY_DEBUG env. available only in the trunk. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-19debug.c: rgengc debug optionnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06debug.c: fix breaking condtionsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-06debug.c: parse locale and filesystem codepagesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01debug.c: more enumsnobu
* debug.c (ruby_dummy_gdb_enums): add enums for RObject, RModule, RString, RArray. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-16enable ruby_w32_codepage on cygwinnobu
* debug.c, localeinit.c: enable ruby_w32_codepage on cygwin too. [ruby-core:81163] [Bug #13567] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-31debug.c: check codepage value [ci skip]nobu
* debug.c (set_debug_option): check garbage and overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-31RUBY_DEBUG codepage option [ci skip]nobu
* debug.c (set_debug_option): add "codepage" option to force locale charmap on Windows. * localeinit.c (locale_charmap): use the codepage by debug env if given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-25* debug.c (ruby_debug_printf): use rb_raw_obj_info()ko1
instead of rb_inspect() because it is more robust way to see object internal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-13ruby.h: add prefixnobu
* include/ruby/ruby.h: prefix RUBY or RB to global symbols to get rid of name conflicts with other headers. * include/ruby/encoding.h, include/ruby/intern.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-23* debug.c (ruby_debug_print_id): use rb_id2name() for fprintf().ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-25rb_id2str over rb_id2namenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18* debug.c (set_debug_option): need the declaration.usa
* debug.c (set_debug_option): use the same macro with the implementation at win32/win32.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-18* debug.c (SET_WHEN): Don't declare debug variables here.akr
ruby_initial_gc_stress_ptr is changed int* to VALUE* at r41406. * internal.h (ruby_initial_gc_stress_ptr): Declared. (ruby_enable_coredump): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-12follow RIncGCnobu
* .gdbinit (rp), debug.c (RUBY_FL_PROMOTED): follow RIncGC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e