Index: runtime/vm/exceptions.cc |
=================================================================== |
--- runtime/vm/exceptions.cc (revision 17487) |
+++ runtime/vm/exceptions.cc (working copy) |
@@ -20,11 +20,20 @@ |
"Prints a stack trace everytime a throw occurs."); |
DEFINE_FLAG(bool, heap_profile_out_of_memory, false, |
"Writes a heap profile on unhandled out-of-memory exceptions."); |
+DEFINE_FLAG(bool, verbose_stacktrace, false, |
+ "Stack traces will include methods marked invisible."); |
- |
const char* Exceptions::kCastErrorDstName = "type cast"; |
+static bool ShouldShowFunction(const Function& function) { |
+ if (FLAG_verbose_stacktrace) { |
+ return true; |
+ } |
+ return function.is_visible(); |
+} |
+ |
+ |
// Iterate through the stack frames and try to find a frame with an |
// exception handler. Once found, set the pc, sp and fp so that execution |
// can continue in that frame. |
@@ -56,16 +65,20 @@ |
ASSERT(pc != 0); |
code = func.unoptimized_code(); |
offset = Smi::New(pc - code.EntryPoint()); |
+ if (ShouldShowFunction(func)) { |
+ func_list.Add(func); |
+ code_list.Add(code); |
+ pc_offset_list.Add(offset); |
+ } |
+ } |
+ } else { |
+ offset = Smi::New(frame->pc() - code.EntryPoint()); |
+ func = code.function(); |
+ if (ShouldShowFunction(func)) { |
func_list.Add(func); |
code_list.Add(code); |
pc_offset_list.Add(offset); |
} |
- } else { |
- offset = Smi::New(frame->pc() - code.EntryPoint()); |
- func = code.function(); |
- func_list.Add(func); |
- code_list.Add(code); |
- pc_offset_list.Add(offset); |
} |
if (frame->FindExceptionHandler(handler_pc)) { |
*handler_sp = frame->sp(); |