summaryrefslogtreecommitdiff
path: root/eval_error.c
Commit message (Collapse)AuthorAgeFilesLines
* Trim extra whitespace in inaccesible error messageOKURA Masafumi2021-09-011-2/+2
| | | | | One whitespace is already included in `inaccessible_mesg_for` macro. This extra whitespace is included since 72ff61f4a8ae7a8bf05b0bd6f91b3b290645627c
* Limit bactrace length from Exception#full_messageNobuyoshi Nakada2020-12-271-12/+13
|
* eval_error.c: fix off-by-one error for --backtrace-limitYusuke Endoh2020-12-211-2/+2
| | | | https://bugs.ruby-lang.org/issues/17413
* Fixed infinite loop at error in printing cause [Bug #17033]Nobuyoshi Nakada2020-07-151-1/+5
|
* Merge pull request #3047 from mame/suppress-backtraceYusuke Endoh2020-05-151-9/+23
| | | Add `--suppress-backtrace=num` option to limit the backtrace length
* eval_error.c: default nil as "reverse" is now false [Feature #8661]Nobuyoshi Nakada2020-04-211-2/+2
|
* eval_error.c: revert the "reversed" backtrace [Feature #8661]Yusuke Endoh2020-04-211-1/+1
| | | | | | | | | | | | | | | | | | Now, the order is good, old-fashioned style: ``` $ ./local/bin/ruby -e 'def foo; raise; end def bar; foo; end def baz; bar; end def qux; baz; end qux ' -e:1:in `foo': unhandled exception from -e:2:in `bar' from -e:3:in `baz' from -e:4:in `qux' from -e:5:in `<main>' ```
* Raise EPIPE at broken pipe for the backward compatibilityNobuyoshi Nakada2020-04-151-0/+4
| | | | | | Instead of SignalException for SIGPIPE, raise `Errno::EPIPE` with instance variable `signo` and re-send that signal at exit. [Feature #14413]
* Renamed ruby_finalize_{0,1}Nobuyoshi Nakada2019-08-131-2/+1
| | | | And pass rb_execution_context_t as an argument.
* Removed duplicate highlightingNobuyoshi Nakada2019-07-151-2/+0
|
* * expand tabs.git2019-07-151-2/+2
|
* Removed dead codeNobuyoshi Nakada2019-07-151-1/+2
| | | | | | If `emesg` is `Qundef`, it is not a message string and then `elen` (the length of the message) is 0. So `emesg` cannot be `Qundef` in the `elen != 0` block. Pointed out by Coverity Scan.
* eval_error.c: should not escapce newline and tabnobu2019-01-241-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * expand tabs.svn2019-01-081-5/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Defer escaping control char in error messagesnobu2019-01-081-5/+43
| | | | | | | | * eval_error.c (print_errinfo): defer escaping control char in error messages until writing to stderr, instead of quoting at building the message. [ruby-core:90853] [Bug #15497] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix for circular causesnobu2018-12-221-6/+20
| | | | | | | * eval_error.c (show_cause): get rid of infinite recursion on circular causes. [Bug #15447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66493 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c (show_cause): check if cause is an Exception or notmame2018-12-211-1/+1
| | | | | | Fixes [Bug #15447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66475 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: log10(0) is ERANGEshyouhei2018-11-151-1/+1
| | | | | | | | | | By definition, the logarithm of 0 is negative infinity. This is a pole error (cf: cf: ISO/IEC 9899:1999 section 7.12.1 paragraph 3) and of course, cannot fit into an `int` value. We have to resort to INT_MIN. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix error message and backtrace ordernaruse2018-10-271-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Print exception's cause like Javanaruse2018-10-271-2/+25
| | | | | | | Print `cause` of the exception if the exception is not caught and printed its backtraces and error message [Feature #8257] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_execution_context_t: pack bits, 256 -> 252 bytes (on 32-bit)normal2018-10-191-1/+1
| | | | | | Maybe execution contexts will become more common. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Prefer `rb_fstring_lit` over `rb_fstring_cstr`nobu2018-10-131-2/+2
| | | | | | | The former states explicitly that the argument must be a literal, and can optimize away `strlen` on all compilers. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65059 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: fix loop on exception in messagenobu2018-04-111-10/+11
| | | | | | | | | * error.c (rb_get_message): accessor to the message. * eval_error.c (rb_ec_error_print): handle exceptions on fetching the message. [Bug #14566] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63133 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: reset attributesnobu2018-03-131-7/+25
| | | | | | | * eval_error.c (print_errinfo): reset all attributes for each lines before newlines. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62737 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: last newlinenobu2018-03-131-6/+8
| | | | | | | * eval_error.c (print_errinfo): do not print an empty line at the end when the message ends with a newline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: fix underflownobu2018-03-121-4/+2
| | | | | | | * eval_error.c (print_errinfo): get rid of negative string length. [ruby-core:86086] [Bug #14598] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: rb_error_write flagsnobu2018-02-231-9/+33
| | | | | | | * eval_error.c (rb_error_write): add highlight and reverse mode flags. defaulted to rb_stderr_tty_p() if Qnil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: reset in each linenobu2018-01-071-7/+24
| | | | | | | | * eval_error.c (print_errinfo): reset in each line, so that Exception#full_message ends with a newline and puts will not print an extra newline. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: concat directlynobu2018-01-071-10/+4
| | | | | | | * eval_error.c (write_warn, write_warn2): get rid of unnecessary intermediate string objects, concat directly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: renamed an argumentnobu2018-01-071-8/+8
| | | | | | | * eval_error.c (print_errinfo): renamed argument `colored` as `highlight`, as it does not use colors. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix uninitialized variableshyouhei2018-01-021-1/+1
| | | | | | Likewise this can easily be noticed if you read the warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: Fix compile error on Solaris 10ngoto2017-12-181-4/+4
| | | | | | | | | * eval_error.c (write_warn, write_warn2, write_warn_str): Fix compile error "operands have incompatible types" with Oracle Solaris Studio 12.4 on Solaris 10. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c(rb_error_write): Remove ec_ from its namesorah2017-12-121-2/+2
| | | | | | | It's unrelated to rb_execution_context_t during writing the patch r61154 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* hotfix implicit-function-declarationsorah2017-12-121-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c(exc_full_message): Exception#full_messagesorah2017-12-121-53/+74
| | | | | | | | | Add a method to retrieve a String expression of an exception, formatted in the same way that Ruby prints an uncaught exception out. [Feature #14141] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Log exception with bold and underline for TTYssorah2017-11-291-6/+17
| | | | | | | | | Print error message in bold/underlined text if STDERR is unchanged and a tty. [Feature #14160] [experimental] Screenshot: https://img.sorah.jp/s/2017-11-29_1711_xj2fu.png git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rb_source_location() may return nil.ko12017-11-161-1/+1
| | | | | | | * vm.c (rb_source_location): return nil if path is not found. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * eval_intern.h: rename macros rb_thread_raised_* toko12017-11-071-2/+2
| | | | | | | rb_ec_raised_*. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* rename to rb_ec_set_raised().ko12017-11-071-1/+1
| | | | | | | | * thread.c (rb_threadptr_set_raised): rename to rb_ec_set_raised and accepts `ec` git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* th->ec: rb_threadptr_reset_raised()ko12017-11-071-1/+1
| | | | | | | | | | | | | | * thread.c (rb_threadptr_reset_raised): rename to `rb_ec_reset_raised` and accepts `ec`. * vm_trace.c: the following functions accept `ec` instead of `th` * exec_hooks_body * exec_hooks_precheck * exec_hooks_unprotected * exec_hooks_protected git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `rb_ec_error_print()`.ko12017-10-291-14/+14
| | | | | | | | * eval_error.c (rb_threadptr_error_print): renamed to rb_ec_error_print() and it accepts `ec`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60545 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* introduce EC_*_TAG() instead of TH_*_TAG()ko12017-10-261-3/+3
| | | | | | | | | | | | | | | | * eval_intern.h: introduce EC_*_TAG() macros instead of TH_*_TAG() macros. * TH_PUSH_TAG() -> EC_PUSH_TAG() * TH_POP_TAG() -> EC_POP_TAG() * TH_TMPPOP_TAG() -> EC_TMPPOP_TAG() * TH_REPUSH_TAG() -> EC_REPUSH_TAG() * TH_EXEC_TAG() -> EC_EXEC_TAG() * TH_JUMP_TAG() -> EC_JUMP_TAG() rb_threadptr_tag_state() , rb_ec_tag_jump() also accept `ec` instead of `th`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use rb_execution_context_t instead of rb_thread_tko12017-10-261-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | to represent execution context [Feature #14038] * vm_core.h (rb_thread_t): rb_thread_t::ec is now a pointer. There are many code using `th` to represent execution context (such as cfp, VM stack and so on). To access `ec`, they need to use `th->ec->...` (adding one indirection) so that we need to replace them by passing `ec` instead of `th`. * vm_core.h (GET_EC()): introduced to access current ec. Also remove `ruby_current_thread` global variable. * cont.c (rb_context_t): introduce rb_context_t::thread_ptr instead of rb_context_t::thread_value. * cont.c (ec_set_vm_stack): added to update vm_stack explicitly. * cont.c (ec_switch): added to switch ec explicitly. * cont.c (rb_fiber_close): added to terminate fibers explicitly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move fields to ec.ko12017-06-281-3/+3
| | | | | | | | | | * vm_core.h (rb_thread.h): move errinfo and trace_arg to rb_execution_context_t. * cont.c (fiber_switch, rb_cont_call): do not restore "trace_arg" here. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* move several fields from rb_thread_t to rb_execution_context_t.ko12017-06-261-1/+1
| | | | | | | | * vm_core.h (rb_thread_t): move several fields which are copied at cont.c to rb_execution_context_t. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* use "enum ruby_tag_type" and TAG_NONE.ko12017-06-231-1/+1
| | | | | | | | | | | | | | | Return value of EXEC_TAG() is saved by "int state". Instead of "int", use "enum ruby_tag_type". First EXEC_TAG() value should be 0, so that define TAG_NONE (= 0) and use it. Some code used "status" instead of "state". To make them clear, rename them to state. We can change variable name from "state" to "tag_state", but this ticket doesn't contain it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* removed ruby_error_printnobu2017-06-161-6/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix syntax errornobu2017-05-191-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: enrich backtracenobu2017-05-191-2/+9
| | | | | | | * eval_error.c (print_backtrace): add frame number when printing in reverse order. [Feature #8661] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* eval_error.c: backstrace in reverse ordernobu2017-02-221-45/+63
| | | | | | | | * eval_error.c (rb_threadptr_error_print): print backtrace and error message in reverse order if STDERR is unchanged and a tty. [Feature #8661] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57685 b2dd03c8-39d4-4d8f-98ff-823fe69b080e