Index: runtime/vm/exceptions.cc |
=================================================================== |
--- runtime/vm/exceptions.cc (revision 17332) |
+++ runtime/vm/exceptions.cc (working copy) |
@@ -20,11 +20,26 @@ |
"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, |
+ "Includes also core-lib's private methods"); |
siva
2013/01/19 01:12:13
Should this be limited to just the core lib or all
|
- |
const char* Exceptions::kCastErrorDstName = "type cast"; |
+static bool ShouldShowFunction(const Function& func) { |
+ if (FLAG_verbose_stacktrace) return true; |
+ const Class& owner = Class::Handle(func.Owner()); |
+ if (owner.library() != Library::CoreLibrary()) return true; |
+ // Check if function is private, hide it if so. |
+ const String& name = String::Handle(func.name()); |
+ for (intptr_t i = 0; i < name.Length(); i++) { |
+ if (name.CharAt(i) == Scanner::kPrivateKeySeparator) { |
+ return false; |
+ } |
+ } |
siva
2013/01/19 01:12:13
We should probably pull this code into a helper me
|
+ return true; |
+} |
+ |
// 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 +71,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(); |