# HG changeset patch # User John W. Eaton # Date 1429929081 14400 # Node ID a42de4173533b1476fdfb85f192278d9f11384d0 # Parent d34e31b07966e20a3103f99313e4563c7036728b also provide stack traces for errors in script files (bug #44862) * error.cc (error_2, warning_1): Check whether we are in user code rather than at the top-level symbol table to determine whether to display a stack trace. diff -r d34e31b07966 -r a42de4173533 libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc Fri Apr 24 09:01:38 2015 -0700 +++ b/libinterp/corefcn/error.cc Fri Apr 24 22:31:21 2015 -0400 @@ -447,13 +447,12 @@ error_1 (std::cerr, "error", id, fmt, args, with_cfn); - if (error_state != -2 && ! symbol_table::at_top_level () - && ! discard_error_messages) + bool in_user_code = octave_call_stack::caller_user_code () != 0; + + if (error_state != -2 && in_user_code && ! discard_error_messages) pr_where ("error"); - if (interactive - && Vdebug_on_error && init_state == 0 - && octave_call_stack::caller_user_code ()) + if (interactive && Vdebug_on_error && init_state == 0 && in_user_code) { unwind_protect frame; frame.protect_var (Vdebug_on_error); @@ -637,17 +636,16 @@ { vwarning ("warning", id, fmt, args); - if (! symbol_table::at_top_level () - && Vbacktrace_on_warning - && ! warning_state + bool in_user_code = octave_call_stack::caller_user_code () != 0; + + if (in_user_code && Vbacktrace_on_warning && ! warning_state && ! discard_warning_messages) pr_where ("warning"); warning_state = 1; if ((interactive || forced_interactive) - && Vdebug_on_warning - && octave_call_stack::caller_user_code ()) + && Vdebug_on_warning && in_user_code) { unwind_protect frame; frame.protect_var (Vdebug_on_warning);