Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index 53ae5079f0caff31d06750b518a5867c967c1bd0..8e256e3989faa5b27e14f8f29ac71b3482624deb 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -1047,6 +1047,18 @@ void StackFrame::PrintIndex(StringStream* accumulator, |
} |
+static void PrintFunctionSource(StringStream* accumulator, |
Benedikt Meurer
2015/06/17 03:21:39
Nit: Put into anonymous namespace instead of using
Jakob Kummerow
2015/06/17 11:23:45
Done.
|
+ SharedFunctionInfo* shared, Code* code) { |
+ if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
+ std::ostringstream os; |
+ os << "--------- s o u r c e c o d e ---------\n" |
+ << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
+ << "\n-----------------------------------------\n"; |
+ accumulator->Add(os.str().c_str()); |
+ } |
+} |
+ |
+ |
void JavaScriptFrame::Print(StringStream* accumulator, |
PrintMode mode, |
int index) const { |
@@ -1084,7 +1096,7 @@ void JavaScriptFrame::Print(StringStream* accumulator, |
accumulator->Add(":~%d", line); |
} |
- accumulator->Add("] "); |
+ accumulator->Add("] [pc=%p] ", pc); |
} |
accumulator->Add("(this=%o", receiver); |
@@ -1109,7 +1121,9 @@ void JavaScriptFrame::Print(StringStream* accumulator, |
return; |
} |
if (is_optimized()) { |
- accumulator->Add(" {\n// optimized frame\n}\n"); |
+ accumulator->Add(" {\n// optimized frame\n"); |
+ PrintFunctionSource(accumulator, shared, code); |
+ accumulator->Add("}\n"); |
return; |
} |
accumulator->Add(" {\n"); |
@@ -1176,15 +1190,7 @@ void JavaScriptFrame::Print(StringStream* accumulator, |
accumulator->Add(" [%02d] : %o\n", i, GetExpression(i)); |
} |
- // Print details about the function. |
- if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
- std::ostringstream os; |
- SharedFunctionInfo* shared = function->shared(); |
- os << "--------- s o u r c e c o d e ---------\n" |
- << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
- << "\n-----------------------------------------\n"; |
- accumulator->Add(os.str().c_str()); |
- } |
+ PrintFunctionSource(accumulator, shared, code); |
accumulator->Add("}\n\n"); |
} |