Граф коммитов

120 Коммитов

Автор SHA1 Сообщение Дата
naruse 2bf56deded * addr2line.c (fill_lines): loop reverse order not to overwrite
the basis of base addresses comparison.

* addr2line.c: use uintptr_t instead of intptr_t for poinrters.

* addr2line.c (rb_dump_backtrace_with_lines): don't use syms.

* vm_dump.c (rb_print_backtrace): ditto.

* addr2line.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-26 04:30:43 +00:00
naruse 3bd0fd118d temporaly change/add to debug on powerpc64-linux
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 23:55:58 +00:00
naruse fefbd47bdd * vm_dump.c (rb_vm_bugreport): show vm maps on FreeBSD.
* vm_dump.c (procstat_vm): copied from FreeBSD.
  http://svnweb.freebsd.org/base/head/usr.bin/procstat/procstat_vm.c?revision=261780

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-10 17:10:57 +00:00
tmm1 4ece8eea11 vm_dump.c: improve wording of apple crashlog messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-19 23:18:14 +00:00
nobu 3005a9fb62 vm_dump.c: suppress warning
* vm_dump.c (rb_vmdebug_debug_print_pre): suppress warning on a
  platform ptrdiff_t is shorter than long int.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-30 09:05:45 +00:00
tarui 44cb6eaef9 * vm_dump.c (rb_vmdebug_debug_print_pre): Bugfix. Get PC directly.
PC is cached into local stack and cfp->pc is incorrent at next of
	  branch or jump.
	* vm_exec.h (DEBUG_ENTER_INSN): catch up this change.
	* vm_core.h: update signature of rb_vmdebug_debug_print_pre.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-29 12:01:18 +00:00
nobu f02c2b9cfa * vm_dump.c (rb_vm_bugreport): show name of class and module.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-22 08:03:53 +00:00
nobu 22c0397a20 * vm_dump.c (rb_vm_bugreport): limit class name length.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40890 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-22 08:03:51 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
naruse a1a6fd90bb * vm_dump.c (rb_print_backtrace): separate to ease showing C backtrace.
* internal.h (rb_print_backtrace): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-02 07:02:54 +00:00
naruse ab31e97c44 Add comments to r39808
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18 17:39:39 +00:00
naruse aa24857f12 * vm_dump.c (backtrace): on darwin use custom backtrace() to trace
beyond _sigtramp. darwin's backtrace can't trace beyond signal
  trampoline with sigaltstack.

* configure.in: check execinfo.h on darwin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-18 04:31:59 +00:00
naruse 10103e8cc7 Correct condition of r39302
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 21:46:00 +00:00
naruse 0b261c379b * vm_dump: FreeBSD ports' libexecinfo's backtrace(3) can't trace
beyond signal trampoline, and as described in r38342 it can't
  trace on -O because it see stack frame pointers.
  libunwind unw_backtrace see dwarf information in the binary
  and it works with -O (without frame pointers).

* configure.in: remove r38342's hack and check libunwind.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 21:21:02 +00:00
naruse e233ca15e0 * configure.in: check whether backtrace(3) works well or not.
* vm_dump.c: set HAVE_BACKTRACE 0 if BROKEN_BACKTRACE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 21:20:59 +00:00
ko1 4cb4c929df * vm_dump.c (control_frame_dump): capitalize prefix of `ep'
if `ep' points an env object.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-04 03:46:12 +00:00
nobu 5efb130d39 vm_dump.c: important message first
* vm_dump.c (rb_vm_bugreport): show the most important message, Crash
  Report log information, first.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-30 06:21:33 +00:00
kosaki 585afbbc6a * vm_dump.c (rb_vm_bugreport): revert r38533.
* addr2line.c (fill_lines): add ELF sanity check.
  [Bug #7597] [ruby-dev:46786]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21 17:21:12 +00:00
tarui 315bf4b6d7 * vm_dump.c (rb_vm_bugreport): commentout addr2line call temporarily
in order to avoid segv. anyone can fix addr2line?
	  [Bug #7597] [ruby-dev:46786]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21 12:17:03 +00:00
naruse 486795d951 * configure.in: add -fno-omit-frame-pointer if libexecinfo is used.
At least on FreeBSD ruby will crash on getting C backtrace
  when it is compiled with other than -O0.

* vm_dump.c: enable backtrace on FreeBSD even if with optimizations.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-12 07:36:32 +00:00
naruse 34fb7d7830 Specify rlimits_core to prevent making core file
Stable fix for r38041.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-12 03:12:37 +00:00
naruse a52c63e420 Experimental fix for r38041
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-12 00:42:26 +00:00
naruse 64bbd55c85 Experimental: don't use $.*s of fprintf
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 21:17:37 +00:00
naruse a6455f2994 Experimentally recommit of r38041: specify smaller max length
* vm_dump.c (rb_vm_bugreport): get rid of calling methods in sigsegv
  handler.  based on a patch by charliesome (Charlie Somerville)
  [ruby-core:49573] [Bug #7402]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 17:13:18 +00:00
naruse 0ab057280c Experimentally revert r38041
"vm_dump.c: no methods in segv handler"
It may cause segv:
http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20121130T090301Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11 02:58:54 +00:00
nobu 981f9c52c6 vm_dump.c: no methods in segv handler
* vm_dump.c (rb_vm_bugreport): get rid of calling methods in sigsegv
  handler.  based on a patch by charliesome (Charlie Somerville)
  [ruby-core:49573] [Bug #7402]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-30 07:19:16 +00:00
ngoto f17aa9b361 * vm_dump.c: not to include probes.h because the code does not depend
on it.
* common.mk (vm_dump.$(OBJEXT)): remove dependency on probes.h


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19 12:37:43 +00:00
tenderlove 4c740bae97 * probes.d: add DTrace probe declarations. [ruby-core:27448]
* array.c (empty_ary_alloc, ary_new): added array create DTrace probe.

* compile.c (rb_insns_name): allowing DTrace probes to access
  instruction sequence name.

* Makefile.in: translate probes.d file to appropriate header file.

* common.mk: declare dependencies on the DTrace header.

* configure.in: add a test for existence of DTrace.

* eval.c (setup_exception): add a probe for when an exception is
  raised.

* gc.c: Add DTrace probes for mark begin and end, and sweep begin and
  end.

* hash.c (empty_hash_alloc): Add a probe for hash allocation.

* insns.def: Add probes for function entry and return.

* internal.h: function declaration for compile.c change.

* load.c (rb_f_load): add probes for `load` entry and exit, require
  entry and exit, and wrapping search_required for load path search.

* object.c (rb_obj_alloc): added a probe for general object creation.

* parse.y (yycompile0): added a probe around parse and compile phase.

* string.c (empty_str_alloc, str_new): DTrace probes for string
  allocation.

* test/dtrace/*: tests for DTrace probes.

* vm.c (vm_invoke_proc): add probes for function return on exception
  raise, hash create, and instruction sequence execution.

* vm_core.h: add probe declarations for function entry and exit.

* vm_dump.c: add probes header file.

* vm_eval.c (vm_call0_cfunc, vm_call0_cfunc_with_frame): add probe on
  function entry and return.

* vm_exec.c: expose instruction number to instruction name function.

* vm_insnshelper.c: add function entry and exit probes for cfunc
  methods.

* vm_insnhelper.h: vm usage information is always collected, so
  uncomment the functions.

12 19:14:50 2012  Akinori MUSHA  <knu@iDaemons.org>

* configure.in (isinf, isnan): isinf() and isnan() are macros on
  DragonFly which cannot be found by AC_REPLACE_FUNCS().  This
  workaround enforces the fact that they exist on DragonFly.

12 15:59:38 2012  Shugo Maeda  <shugo@ruby-lang.org>

* vm_core.h (rb_call_info_t::refinements), compile.c (new_callinfo),
  vm_insnhelper.c (vm_search_method): revert r37616 because it's too
  slow.  [ruby-dev:46477]

* test/ruby/test_refinement.rb (test_inline_method_cache): skip
  the test until the bug is fixed efficiently.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-12 21:52:12 +00:00
sorah a8b3d67e7c * vm_dump.c (rb_vm_bugreport): Because of many log directories,
making directory lists readable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-02 08:00:02 +00:00
mrkn 8db54e07f9 * vm_dump.c (rb_vm_bugreport): add ~/Library/Logs/DiagnosticReports
in the locations list of crash reports.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-02 07:52:56 +00:00
ko1 a52af29271 * vm_dump.c: fix debug prints to catch up recent changes
such as VM data structures.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-10 17:55:57 +00:00
ko1 23dc0dbc4a * vm.c (VM_COLLECT_USAGE_DETAILS): make new VM usage analysis
hooks (old macro name is COLLECT_USAGE_ANALYSIS).
  This feature is only for VM developers.  (I'm not sure I can use
  `VM developers' (the plural form) in this sentence).
  If VM_COLLECT_USAGE_DETAILS is not 0, VM enables the following
  usage collection features:
  (1) insntruction: collect intruction usages.
  (2) operand: collect operand usages.
  (3) register: collect register usages.
  The results are stored in
  RubyVM::USAGE_ANALYSIS_INSN for (1, 2),
  RubyVM::USAGE_ANALYSIS_INSN_BIGRAM for (1) and
  RubyVM::USAGE_ANALYSIS_REGS for (3).
  You can stop collecting usages with
  RubyVM::USAGE_ANALYSIS_INSN_STOP(),
  RubyVM::USAGE_ANALYSIS_OPERAND_STOP(),
  RubyVM::USAGE_ANALYSIS_REGISTER_STOP()
  for (1), (2), (3) respectively.
  You can also change the hook functions by setting
  C level global variables
  `ruby_vm_collect_usage_func_(insn|operand|register)'
  for (1), (2), (3) respectively.
  See codes for more details.
* tool/instruction.rb: fix macro names.
* iseq.c (insn_operand_intern): make it export (used in vm.c).
  fix to skip several processes if not needed (pointer is 0).
* vm_dump.c: move codes for collection features to vm.c.
* vm_exec.h: rename macro and function names.
* vm_insnhelper.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-04 12:31:05 +00:00
mrkn 0d3cd4119e * vm_dump.c (rb_vm_bugreport): add /Library/Logs/DiagnosticReports
in the list of locations of crash reports.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-30 14:34:55 +00:00
ko1 d50483df23 * vm_core.h: remove rb_control_frame_t::bp (bp: base pointer).
`bp' can be calculate by `sp' (stack pointer) of previous frame.
  Now, `bp_check' field is remained for debug.  You can eliminate
  this field by setting  VM_DEBUG_BP_CHECK as 0.
* vm_insnhelper.c (vm_base_ptr): add `vm_base_ptr(cfp).
  This function calculates base pointer from cfp.
* vm_insnhelper.c (vm_setup_method): push `recv' value on top of
  value stack (before method parameters).
  This change is for keeping consistency with normal method dispatch.
* insns.def: fix to use vm_base_ptr().
* vm.c (vm_exec): ditto.
* vm_dump.c: remove `bp' related dumps.
* cont.c (fiber_init): fix to check VM_DEBUG_BP_CHECK.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-09-28 04:05:36 +00:00
ko1 0d1a905edb * vm_exec.c, insns.def (leave): solve problems on
OPT_CALL_THREADED_CODE.
  Catch up finish frame structure on OPT_CALL_THREADED_CODE.
* vm_core.h: add rb_thread_t#retval for temporary space on
  OPT_CALL_THREADED_CODE.
* vm.c (th_init): clear rb_thread_t#retval as Qundef.
* vm_dump.c (rb_vmdebug_debug_print_pre): fix debug print format.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-07 11:13:57 +00:00
kosaki 3e1d8aab17 * dln.c: Simplify and make consistent an ifdef for Mac OS X.
* ext/socket/rubysocket.h: ditto.
* ext/tk/stubs.c: ditto.
* io.c: ditto.
* process.c: ditto.
* signal.c: ditto.
* vm_dump.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-09 15:52:49 +00:00
ko1 745c23b2d9 * vm_core.h: remove VM_FRAME_MAGIC_FINISH (finish frame type).
Before this commit:
  `finish frame' was place holder which indicates that VM loop
  needs to return function.
  If a C method calls a Ruby methods (a method written by Ruby),
  then VM loop will be (re-)invoked.  When the Ruby method returns,
  then also VM loop should be escaped.  `finish frame' has only
  one instruction `finish', which returns VM loop function.
  VM loop function executes `finish' instruction, then VM loop
  function returns itself.
  With such mechanism, `leave' instruction (which returns one
  frame from current scope) doesn't need to check that this `leave'
  should also return from VM loop function.
  Strictly, one branch can be removed from `leave' instructon.
  Consideration:
  However, pushing the `finish frame' needs costs because
  it needs several memory accesses.  The number of pushing
  `finish frame' is greater than I had assumed.  Of course,
  pushing `finish frame' consumes additional control frame.
  Moreover, recent processors has good branch prediction,
  with which we can ignore such trivial checking.
  After this commit:
  Finally, I decide to remove `finish frame' and `finish'
  instruction.  Some parts of VM depend on `finish frame',
  so the new frame flag VM_FRAME_FLAG_FINISH is introduced.
  If this frame should escape from VM function loop, then
  the result of VM_FRAME_TYPE_FINISH_P(cfp) is true.
  `leave' instruction checks this flag every time.
  I measured performance on it.  However on my environments,
  it improves some benchmarks and slows some benchmarks down.
  Maybe it is because of C compiler optimization parameters.
  I'll re-visit here if this cause problems.
* insns.def (leave, finish): remove finish instruction.
* vm.c, vm_eval.c, vm_exec.c, vm_backtrace.c, vm_dump.c:
  apply above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-15 10:22:34 +00:00
ko1 0a71db8a74 * vm_core.h: remove lfp (local frame pointer) and rename
dfp (dynamic frame pointer) to ep (environment pointer).
  This change make VM `normal' (similar to other interpreters).
  Before this commit:
  Each frame has two env pointers lfp and dfp.  lfp points
  local environment which is method/class/toplevel frame.
  lfp[0] is block pointer.
  dfp is block local frame. dfp[0] points previous (parent)
  environment pointer.
  lfp == dfp when frame is method/class/toplevel.
  You can get lfp from dfp by traversing previous environment
  pointers.
  After this commit:
  Each frame has only `ep' to point respective enviornoment.
  If there is parent environment, then ep[0] points parent
  envioenment (as dfp).  If there are no more environment,
  then ep[0] points block pointer (as lfp).  We call such ep
  as `LEP' (local EP).  We add some macros to get LEP and to
  detect LEP or not.
  In short, we replace dfp and lfp with ep and LEP.
  rb_block_t and rb_binding_t member `lfp' and `dfp' are removed
  and member `ep' is added.
  rename rb_thread_t's member `local_lfp' and `local_svar' to
  `root_lep' and `root_svar'.
  (VM_EP_PREV_EP(ep)): get previous environment pointer.  This macro
  assume that ep is not LEP.
  (VM_EP_BLOCK_PTR(ep)): get block pointer.  This macro assume
  that ep is LEP.
  (VM_EP_LEP_P(ep)): detect ep is LEP or not.
  (VM_ENVVAL_BLOCK_PTR(ptr)): make block pointer.
  (VM_ENVVAL_BLOCK_PTR_P(v)): detect v is block pointer.
  (VM_ENVVAL_PREV_EP_PTR(ptr)): make prev environment pointer.
  (VM_ENVVAL_PREV_EP_PTR_P(v)): detect v is prev env pointer.
* vm.c: apply above changes.
  (VM_EP_LEP(ep)): get LEP.
  (VM_CF_LEP(cfp)): get LEP of cfp->ep.
  (VM_CF_PREV_EP(cfp)): utility function VM_EP_PREV_EP(cfp->ep).
  (VM_CF_BLOCK_PTR(cfp)): utility function VM_EP_BLOCK_PTR(cfp->ep).
* vm.c, vm_eval.c, vm_insnhelper.c, vm_insnhelper.h, insns.def:
  apply above changes.
* cont.c: ditto.
* eval.c, eval_intern.h: ditto.
* proc.c: ditto.
* thread.c: ditto.
* vm_dump.c: ditto.
* vm_exec.h: fix function name (on vm debug mode).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-11 03:14:59 +00:00
ko1 bac9f65f70 * vm_core.h (rb_location_t): fix type and field name.
(1) rename rb_location_t to rb_iseq_location_t.
  (2) rename field names of rb_iseq_location_t to adjust
  RubyVM::Backtrace::Location methods.
  (2-1) filename -> path
  (2-2) filepath -> absolute_path
  (2-3) basename -> base_label
  (2-4) name -> label
  (3) rename filed name rb_iseq_location_t#line_no to
  rb_iseq_location_t#first_lineno to clear purpose of this field.
  (4) The field names rb_binding_t#(filename|line_no) are also renamed
  to rb_binding_t#(path|first_lineno).
* compile.c: apply above changes.
* iseq.c: ditto.
* proc.c: ditto.
* vm*.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-04 02:49:37 +00:00
ko1 b57c81ae3e * common.mk: fix to build vm_backtrace.c only itself (vm_backtrace.c
is no longer included from vm.c).  I hope this separation reduce
  compile time of vm.c.
* internal.h: ditto.
* vm.c, vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm_eval.c: some functions (callee, etc) moved to vm_backtrace.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 15:59:37 +00:00
ko1 1f3142a447 * vm.c: refactoring backtrace related funcitons.
(1) unify similar functions (rb_backtrace_each() and
  backtrace_object()).  backtrace_each() is a unified function.
  variation:
  a) backtrace_object(): create backtrace object.
  b) vm_backtrace_str_ary(): create bt as an array of string.
  c) vm_backtrace_print(): print backtrace to specified file.
  d) rb_backtrace_print_as_bugreport(): print backtrace on
  bugreport style.
  (2) remove rb_backtrace_each().  Use backtrace_each() instead.
  (3) chang the type of lev parameter to size_t.
  a) lev == 0 means current frame (exception, etc use it).
  b) lev == 1 means upper frame (caller(0) use it).
* vm_core.h, vm_dump.c, vm_eval.c: ditto.
* vm.c (backtrace_object(), vm_backtrace_str_ary()): fix to return a
  correct size of caller(lev) array.
  Let n be a "caller(0).size" then ln as caller(lev).size should be
  (n - lev).  However, the previous implementation returns a wrong
  size array (ln > n - lev).  [ruby-dev:45673]
* test/ruby/test_backtrace.rb: add tests for backtrace.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25 04:50:10 +00:00
ko1 8bcf7fc402 * vm_core.h: add a data type rb_location_t to store iseq location
information.
  rb_location_t#filename, filepath, name and line_no was moved from
  rb_iseq_t.  rb_location_t#basename is a new field which is
  similar to `name' field without any decoration.
  `name' field contains some decoration such as `block in foo'.
  `basename' only contains `foo'.
  rb_iseq_t contains memory object of rb_location_t.
* iseq.c: setup rb_location_t for each rb_iseq_t memory objects.
* compile.c, proc.c, vm.c, vm_dump.c, vm_eval.c, vm_insnhelper.c,
  vm_method.c: support about it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-22 08:31:38 +00:00
kosaki 8cee31214d * io.c (rb_write_error2): get rid of warning on linux. fwrite
of glibc is tagged __attribute__ ((__warn_unused_result__))
  if _FORTIFY_SOURCE != 0.
* vm_dump.c (rb_vm_bugreport): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-27 12:06:10 +00:00
nobu 05e7354864 * vm_dump.c (HAVE_BACKTRACE): fallback to 0.
* vm_dump.c (rb_vm_bugreport): show "Other runtime information"
  header only when available.
* vm_dump.c (rb_vm_bugreport): get rid of modifying the content of
  VM directly.
* vm_dump.c (rb_vm_bugreport): check if vm is non-null.
  Pointed out by Ikegami Daisuke <ikegami.da@gmail.com>.
  Thank you.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-11 08:09:48 +00:00
nobu 3550766601 * vm_dump.c (VMDEBUG): suppress undefined macro warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-27 02:04:51 +00:00
naruse e33183acca * addr2line.c: use USE_ELF instead of __ELF__ because Solaris
doesn't define it. USE_ELF is already provided by configure.
  patched by Naohisa Goto. [ruby-dev:44066] [Bug #4998]

* addr2line.h: ditto.

* vm_dump.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08 12:23:10 +00:00
kosaki 230be2a771 * vm_dump.c (rb_vm_bugreport): change CrashReporter suggestion messages
on Mac. It should be placed after "-- C level backtrace" line.
  Suggested by Endoh-san.

  <before>
  -- See Crash Report log file under ~/Library/Logs/CrashReporter or ---------
  -- /Library/Logs/CrashReporter, for the more detail of ---------------------
  -- C level backtrace information -------------------------------------------

<after>
  -- C level backtrace information -------------------------------------------

     See Crash Report log file under ~/Library/Logs/CrashReporter or
     /Library/Logs/CrashReporter, for the more detail of.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-26 04:49:33 +00:00
mrkn 96874ec46e * vm_dump.c: delete dashes to make lines 80 chars, Patched by
Shota Fukumori (sora_h).  [Bug #4275] [ruby-dev:43021]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-13 04:37:25 +00:00
mrkn 5b9b8d9cfe * vm_dump.c: fix misspelling of CrashReporter.
[Bug #4275] [ruby-dev:43021]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-13 04:23:30 +00:00
akr 38f129397b * vm_dump.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 10:37:32 +00:00