aboutsummaryrefslogtreecommitdiffstats
path: root/debug.c
Commit message (Collapse)AuthorAgeFilesLines
* USE_RUBY_DEBUG_LOG is not defined !devel buildKoichi Sasada2020-12-251-0/+2
|
* show ractor info on non-single ractor modeKoichi Sasada2020-12-071-1/+1
| | | | | | | 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.
* fix public interfaceKoichi Sasada2020-11-181-1/+1
| | | | | | | | | | | | | | | | | | 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)
* Introduce Ractor mechanism for parallel executionKoichi Sasada2020-09-031-2/+1
| | | | | | | | | | | | | | | | 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.
* ruby_debug_log: suppress warning卜部昌平2020-08-131-1/+1
| | | | | | | | | | | 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.
* remove accidentally introduced debug codeKoichi Sasada2020-08-021-2/+2
|
* support multiple filters by RUBY_DEBUG_LOG_FILTERKoichi Sasada2020-08-021-16/+45
| | | | | | 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).
* RUBY_DEBUG_LOG: Logging debug information mechanism (#3279)Koichi Sasada2020-07-031-0/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* More enums are mandatory for rp in lldb_cruby.pyNobuyoshi Nakada2020-04-251-0/+4
|
* RUBY_SPECIAL_SHIFT and RUBY_FL_USHIFT are mandatory for rp in lldb_cruby.pyNobuyoshi Nakada2020-04-181-0/+1
|
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+1
| | | Split ruby.h
* VALUE size packed callinfo (ci).Koichi Sasada2020-02-221-0/+1
| | | | | | | | | | | | | | | | | | | | 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.
* move internal/debug.h definitions to internal.hKoichi Sasada2020-01-031-1/+0
| | | | Debug utilities should be accessible from any internal code.
* decouple internal.h headers卜部昌平2019-12-261-5/+12
| | | | | | | | | | | | | | | | | | 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).
* internal/imemo.h rework卜部昌平2019-12-261-0/+9
| | | | | | Arrange contents and eliminate macros, to make them readable. Macro IFUNC_NEW was deleted because there was only one usage.
* add additional CF info for CI envKoichi Sasada2019-12-051-0/+2
| | | | | | | | | 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.
* internal.h: remove dependecy on ruby/io.hnobu2018-01-091-0/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* debug.c: include RIMemo in ruby_dummy_gdb_enumsnobu2017-11-231-2/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* debug.c: vm call flagsnobu2017-11-021-0/+1
| | | | | | * 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
* debug.c: RSymbol infonobu2017-10-251-0/+2
| | | | | | | * 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
* debug.c: imemo_masknobu2017-10-241-0/+2
| | | | | | | | * .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
* debug.c: add FMODE constantsnobu2017-07-051-0/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c: debug options in command linenobu2017-06-211-6/+14
| | | | | | | * 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
* debug.c: rgengc debug optionnobu2017-06-191-23/+39
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59117 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* debug.c: fix breaking condtionsnobu2017-06-061-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* debug.c: parse locale and filesystem codepagesnobu2017-06-061-7/+18
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* debug.c: more enumsnobu2017-06-011-0/+4
| | | | | | | * 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
* enable ruby_w32_codepage on cygwinnobu2017-05-161-0/+5
| | | | | | | * 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
* debug.c: check codepage value [ci skip]nobu2017-03-311-3/+7
| | | | | | * 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
* RUBY_DEBUG codepage option [ci skip]nobu2017-03-311-4/+23
| | | | | | | | | | * 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
* * debug.c (ruby_debug_printf): use rb_raw_obj_info()ko12016-07-251-4/+6
| | | | | | | | 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
* ruby.h: add prefixnobu2015-09-131-37/+4
| | | | | | | | * 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
* * debug.c (ruby_debug_print_id): use rb_id2name() for fprintf().ko12015-05-231-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_id2str over rb_id2namenobu2014-11-251-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * debug.c (set_debug_option): need the declaration.usa2014-11-181-1/+4
| | | | | | | | * 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
* * debug.c (SET_WHEN): Don't declare debug variables here.akr2014-11-181-6/+5
| | | | | | | | | | | 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
* follow RIncGCnobu2014-09-121-0/+1
| | | | | | * .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
* * gc.c: add incremental GC algorithm. [Feature #10137]ko12014-09-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Please refer this ticket for details. This change also introduces the following changes. * Remove RGENGC_AGE2_PROMOTION and introduce object age (0 to 3). Age can be count with FL_PROMOTE0 and FL_PROMOTE1 flags in RBasic::flags (2 bit). Age == 3 objects become old objects. * WB_PROTECTED flag in RBasic to WB_UNPROTECTED bitmap. * LONG_LIVED bitmap to represent living objects while minor GCs It specifies (1) Old objects and (2) remembered shady objects. * Introduce rb_objspace_t::marked_objects which counts marked objects in current marking phase. marking count is needed to introduce incremental marking. * rename mark related function and sweep related function to gc_(marks|sweep)_(start|finish|step|rest|continue). * rename rgengc_report() to gc_report(). * Add obj_info() function to get cstr of object details. * Add MEASURE_LINE() macro to measure execution time of specific line. * and many small fixes. * include/ruby/ruby.h: add flag USE_RINCGC. Now USE_RINCGC can be set only with USE_RGENGC. * include/ruby/ruby.h: introduce FL_PROMOTED0 and add FL_PROMOTED1 to count object age. * include/ruby/ruby.h: rewrite write barriers for incremental marking. * debug.c: catch up flag name changes. * internal.h: add rb_gc_writebarrier_remember() instead of rb_gc_writebarrier_remember_promoted(). * array.c (ary_memcpy0): use rb_gc_writebarrier_remember(). * array.c (rb_ary_modify): ditto. * hash.c (rb_hash_keys): ditto. * hash.c (rb_hash_values): ditto. * object.c (init_copy): use rb_copy_wb_protected_attribute() because FL_WB_PROTECTED is moved from RBasic::flags. * test/objspace/test_objspace.rb: catch up ObjectSpace.dump() changes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/ruby.h: rename FL_OLDGEN to FL_PROMOTED.ko12013-11-041-1/+1
| | | | | | | | | This flag represents that "this object is promoted at least once." * gc.c, debug.c, object.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit: show ID typenobu2013-09-201-0/+1
| | | | | | | | * .gdbinit (rp_id): show ID type. * template/id.h.tmpl (ruby_id_types): make enum for debugger. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * safe.c (rb_set_safe_level, safe_setter): raise an ArgumentErrorshugo2013-06-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when $SAFE is set to 4. $SAFE=4 is now obsolete. [ruby-core:55222] [Feature #8468] * object.c (rb_obj_untrusted, rb_obj_untrust, rb_obj_trust): Kernel#untrusted?, untrust, and trust are now deprecated. Their behavior is same as tainted?, taint, and untaint, respectively. * include/ruby/ruby.h (OBJ_UNTRUSTED, OBJ_UNTRUST): OBJ_UNTRUSTED() and OBJ_UNTRUST() are aliases of OBJ_TAINTED() and OBJ_TAINT(), respectively. * array.c, class.c, debug.c, dir.c, encoding.c, error.c, eval.c, ext/curses/curses.c, ext/dbm/dbm.c, ext/dl/cfunc.c, ext/dl/cptr.c, ext/dl/dl.c, ext/etc/etc.c, ext/fiddle/fiddle.c, ext/fiddle/pointer.c, ext/gdbm/gdbm.c, ext/readline/readline.c, ext/sdbm/init.c, ext/socket/ancdata.c, ext/socket/basicsocket.c, ext/socket/socket.c, ext/socket/udpsocket.c, ext/stringio/stringio.c, ext/syslog/syslog.c, ext/tk/tcltklib.c, ext/win32ole/win32ole.c, file.c, gc.c, hash.c, io.c, iseq.c, load.c, marshal.c, object.c, proc.c, process.c, random.c, re.c, safe.c, string.c, thread.c, transcode.c, variable.c, vm_insnhelper.c, vm_method.c, vm_trace.c: remove code for $SAFE=4. * test/dl/test_dl2.rb, test/erb/test_erb.rb, test/readline/test_readline.rb, test/readline/test_readline_history.rb, test/ruby/test_alias.rb, test/ruby/test_array.rb, test/ruby/test_dir.rb, test/ruby/test_encoding.rb, test/ruby/test_env.rb, test/ruby/test_eval.rb, test/ruby/test_exception.rb, test/ruby/test_file_exhaustive.rb, test/ruby/test_hash.rb, test/ruby/test_io.rb, test/ruby/test_method.rb, test/ruby/test_module.rb, test/ruby/test_object.rb, test/ruby/test_pack.rb, test/ruby/test_rand.rb, test/ruby/test_regexp.rb, test/ruby/test_settracefunc.rb, test/ruby/test_struct.rb, test/ruby/test_thread.rb, test/ruby/test_time.rb: remove tests for $SAFE=4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c: support RGENGC. [ruby-trunk - Feature #8339]ko12013-05-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See this ticet about RGENGC. * gc.c: Add several flags: * RGENGC_DEBUG: if >0, then prints debug information. * RGENGC_CHECK_MODE: if >0, add assertions. * RGENGC_PROFILE: if >0, add profiling features. check GC.stat and GC::Profiler. * include/ruby/ruby.h: disable RGENGC by default (USE_RGENGC == 0). * array.c: add write barriers for T_ARRAY and generate sunny objects. * include/ruby/ruby.h (RARRAY_PTR_USE): added. Use this macro if you want to access raw pointers. If you modify the contents which pointer pointed, then you need to care write barrier. * bignum.c, marshal.c, random.c: generate T_BIGNUM sunny objects. * complex.c, include/ruby/ruby.h: add write barriers for T_COMPLEX and generate sunny objects. * rational.c (nurat_s_new_internal), include/ruby/ruby.h: add write barriers for T_RATIONAL and generate sunny objects. * internal.h: add write barriers for RBasic::klass. * numeric.c (rb_float_new_in_heap): generate sunny T_FLOAT objects. * object.c (rb_class_allocate_instance), range.c: generate sunny T_OBJECT objects. * string.c: add write barriers for T_STRING and generate sunny objects. * variable.c: add write barriers for ivars. * vm_insnhelper.c (vm_setivar): ditto. * include/ruby/ruby.h, debug.c: use two flags FL_WB_PROTECTED and FL_OLDGEN. * node.h (NODE_FL_CREF_PUSHED_BY_EVAL, NODE_FL_CREF_OMOD_SHARED): move flag bits. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * include/ruby/debug.h: introdudced.ko12012-11-201-1/+1
| | | | | | | | | | | | | | | | | Debugging/profiling features will be located. * vm_trace.c: expose C-level TracePoint APIs. Note that they are experimental. * vm_trace.c, include/ruby/debug.h: rename `rb_hook_flag_t' to `rb_event_hook_flag_t'. Macro names `RUBY_HOOK_FLAG_*' are also renamed to `RUBY_EVENT_HOOK_FLAG_*'. * debug.h, vm_debug.h: rename debug.h to vm_debug.h. * common.mk: ditto. * debug.c, main.c, vm_core.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * gc.c: use Bitmap Marking algorithm to avoid copy-on-write ofnari2012-01-071-2/+2
| | | | | | | | | | | | | | | | | memory pages. See [ruby-dev:45085] [Feature #5839] [ruby-core:41916]. * include/ruby/ruby.h : FL_MARK rename to FL_RESERVED1. * node.h : ditto. * debug.c : ditto. * object.c (rb_obj_clone): FL_MARK move to a bitmap. * class.c (rb_singleton_class_clone): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * debug.c: parenthesize macro arguments.akr2010-12-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * debug.c (ruby_set_debug_option): define always for binarynobu2010-10-131-2/+0
| | | | | | | | compatibility with debug env enabled binary. * signal.c (ruby_enable_coredump): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29477 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * suppress warnings.nobu2010-05-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * debug.c (RUBY_NODE_LMASK): may exceed int limit.nobu2010-05-051-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27624 b2dd03c8-39d4-4d8f-98ff-823fe69b080e