Commit Graph

49 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 8efa7b00df Preallocate SystemStackError; ref #3421 2017-02-15 11:59:47 +09:00
Yukihiro "Matz" Matsumoto 4b32e651a5 Check if irep is NULL before print_backtrace()
According to the valgrind log attached to #3438, proc->body.irep
may be NULL in some cases.
2017-02-08 23:10:25 +09:00
Yukihiro "Matz" Matsumoto 28b7b9ec64 Skip non string values in backtraces; ref #3408 2017-01-23 16:22:55 +09:00
Tomasz Dąbrowski 1af9e363f2 Fixes for compiling mruby as C++ 2016-11-24 09:28:00 +09:00
Yukihiro "Matz" Matsumoto 0c28c7d754 change backtrace sep from const char* to char 2016-03-07 10:59:34 +09:00
Kouhei Sutou d77c72dac5 Revert "Merge pull request #3126 from jbreeden/backtrace_irep_null_check"
This reverts commit bf7719fe8d, reversing
changes made to 4f4fa0ade0.

We should get backtrace while irep is alive.
2016-03-06 11:51:04 +09:00
jbreeden d2a8f7e0cc Fix Travis CI 2016-03-05 14:22:31 -08:00
jbreeden e02ff850fe Null check for irep & initialize loc.lineno 2016-03-05 13:45:56 -08:00
Carlo Prelz d6cbe1bfc6 The original code crashed when mrb->backtrace.n grew to 16.
It looks like the logic to reallocate the backtrace was flawed,
based on the wrong variable (loc_raw->i, which, as I have verified,
decreases from 16 to 0 instead of increasing)

I am not sure if this is the correct fix
2016-02-26 09:21:33 +01:00
Simon Génier 146a9eeb38 Fix segfault on mrb_exc_backtrace.
The code to iterate over backtrace locations was changed in #3065, but
unfortunately output_backtrace was not correctly updated to forward the
callback.
2016-01-07 11:24:16 -05:00
Syohei YOSHIDA 931cc0359a printf precision parameter must be 'int' type
There is a problem when MRB_INT64 is enabled.
2016-01-07 11:06:20 +09:00
Kouhei Sutou a561bdb25f Support backtrace after method calls
GitHub: fix #2902, #2917

The current implementation traverses stack to retrieve backtrace. But
stack will be changed when some operations are occurred. It means that
backtrace may be broken after some operations.

This change (1) saves the minimum information to retrieve backtrace when
exception is raised and (2) restores backtrace from the minimum
information when backtrace is needed. It reduces overhead for creating
backtrace Ruby objects.

The space for the minimum information is reused by multiple
exceptions. So memory allocation isn't occurred for each exception.
2015-12-29 20:36:12 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Yukihiro "Matz" Matsumoto 4440566b95 DISABLE_STDIO/ENABLE_DEBUG macros to rename; close #3014
changes:
 * rename DISABLE_STDIO -> MRB_DISABLE_STDIO
 * rename ENABLE_DEBUG -> MRB_ENABLE_DEBUG_HOOK
 * no more opposite macro definitions (e.g. ENABLE_STDIO, DISABLE_DEBUG).
 * rewrite above macro references throughout the code.
 * update documents
2015-11-17 07:30:34 +09:00
Simon Génier 40e4eb599c DISABLE_STDIO does not disable backtraces. 2015-02-12 13:18:59 -05:00
Simon Génier df382dea73 Fix possible segfault when accessing backtrace with MRB_WORD_BOXING. 2015-02-05 15:12:21 -05:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
Yukihiro "Matz" Matsumoto 472a1c244e backtrace supression condition was wrong; fix #2472 2014-07-15 08:34:34 +09:00
Yukihiro "Matz" Matsumoto 6137bf9e71 avoid print backtrace for SystemStackError 2014-07-12 22:10:48 +09:00
Jose Narvaez 24c105a251 Fixed dead assignment in 'backtrace.c' reported by 'clang-analyzer' 2014-06-13 09:36:44 +01:00
cremno 01b76630b8 fix disabled stdio (and remove trailing spaces) 2014-04-29 07:05:30 +02:00
kyab 4c8092fe00 Fix MSVC warning for backtrace.c 2014-04-24 22:10:19 +09:00
Yukihiro "Matz" Matsumoto 675fd3dc80 allow send method not to call mrb_funcall if calling method is implemented in Ruby; fix #1680 ref #1765 2014-03-01 18:13:10 +09:00
Yukihiro "Matz" Matsumoto 5b8229715d revert 38e9ce21 and API changed; mrb_get_backtrace() -> renamed to mrb_exc_backtrace since this is a backtrace method implementation of Exception; mrb_get_backtrace_at() -> removed; mrb_get_backtrace() -> added to get backtrace in array (like caller) 2014-02-27 04:34:30 +09:00
Yukihiro "Matz" Matsumoto 38e9ce21f8 add new function mrb_get_backtrace_at() to get backtrace at ci and pc 2014-02-27 03:45:52 +09:00
Yukihiro "Matz" Matsumoto b3f8f8a5b0 describe call stack overwritten problem of mrb_get_backtrace; close #1661 2014-01-21 17:12:14 +09:00
cremno aa655b9ee1 remove superfluous includes
- reduce compile time by a little bit (full-core: ~0.7s for me)
- thanks to 'include-what-you-use' for some help
- include Standard C header files before any other (coding style)
2014-01-07 17:56:30 +01:00
Yukihiro "Matz" Matsumoto cff4ac6bb7 skip "trace:" header if no backtrace line exists 2014-01-08 00:49:23 +09:00
Yukihiro "Matz" Matsumoto fe19ac2bcd small cosmetic variable renaming 2014-01-06 14:24:33 +09:00
take_cheeze df780ae5e9 add mrb_intern_lit for creating symbol from string literal 2013-12-01 10:38:59 +09:00
Yukihiro "Matz" Matsumoto 9c6398a444 rename mrb_intern2() to mrb_intern(); huge API incompatibility; close #1513 2013-11-29 08:47:28 +09:00
Yukihiro "Matz" Matsumoto 8954241687 clear ci->err after const set; revert 5b51b1; ref #1583 2013-11-19 09:21:55 +09:00
Yukihiro "Matz" Matsumoto 5b51b119ca ci->err may be out of boud; close #1583 2013-11-18 22:51:51 +09:00
Yukihiro "Matz" Matsumoto a7c9a71684 better error position display 2013-10-15 12:49:41 +09:00
Yukihiro "Matz" Matsumoto 3995e7ff8f rename voidp to cptr 2013-09-21 17:28:47 +09:00
Yukihiro "Matz" Matsumoto 2fe64f24f8 remove Exception#verbose_backtrace; #1495 2013-09-03 15:52:35 +09:00
take_cheeze bd5afe9eef rename debug function name 2013-09-02 00:48:07 +09:00
take_cheeze 3d1fffbd6b support multiple filename in irep 2013-09-02 00:48:06 +09:00
take_cheeze bc131350d4 print singleton class name in verbose backtrace 2013-09-02 00:48:06 +09:00
take_cheeze d12b6ab218 add verbose_backtrace 2013-09-02 00:48:06 +09:00
take_cheeze d19d9bb047 fix crash in 2nd call to vsnprintf 2013-09-02 00:48:05 +09:00
Yukihiro "Matz" Matsumoto f3c8cf6735 do not use mrb_alloca() that keeps memory until mrb_state freed 2013-08-26 16:33:27 +09:00
Yukihiro "Matz" Matsumoto f18837886c add cast to void* 2013-08-26 16:10:42 +09:00
Yukihiro "Matz" Matsumoto dd4b7ead7e undef print_backtrace_i() unless ENABLE_STDIO 2013-08-26 16:00:37 +09:00
wanabe 7007ce7ce0 add Exception#backtrace 2013-08-25 01:18:01 +09:00
Jun Hiroe 883c45b931 Replace mrb_intern() func with mrb_intern2() func or mrb_intern_cstr() func. 2013-07-12 01:00:50 +09:00
Yukihiro "Matz" Matsumoto 6557ee938a mruby error messages should be directed to stderr 2013-05-26 02:13:02 +09:00
Yukihiro "Matz" Matsumoto 5c0b9b703c primary mruby fiber implementation 2013-05-20 17:54:07 +09:00
Yukihiro "Matz" Matsumoto 077213c5eb forgot to add src/backtrace.c 2013-05-13 11:15:08 +09:00