Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1041)

Unified Diff: src/frames.cc

Issue 2509323002: [wasm] Implement frame printing for debug (Closed)
Patch Set: What's wrong about constexpr?? Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/wasm/wasm-objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index 5920bfda8c4bb6484c1c06162db6e3f1ba4ccdc1..9f46d8e8b5cb0687daf4361fafdaf34c46516e23 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -1487,7 +1487,28 @@ void StackFrame::PrintIndex(StringStream* accumulator,
void WasmFrame::Print(StringStream* accumulator, PrintMode mode,
int index) const {
- accumulator->Add("wasm frame");
+ PrintIndex(accumulator, mode, index);
+ accumulator->Add("WASM [");
+ Script* script = this->script();
+ accumulator->PrintName(script->name());
+ int pc = static_cast<int>(this->pc() - LookupCode()->instruction_start());
+ Vector<const uint8_t> raw_func_name;
+ Object* instance_or_undef = this->wasm_instance();
+ if (instance_or_undef->IsUndefined(this->isolate())) {
+ raw_func_name = STATIC_CHAR_VECTOR("<undefined>");
+ } else {
+ raw_func_name = WasmInstanceObject::cast(instance_or_undef)
+ ->get_compiled_module()
+ ->GetRawFunctionName(this->function_index());
+ }
+ const int kMaxPrintedFunctionName = 64;
+ char func_name[kMaxPrintedFunctionName + 1];
+ int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length());
+ memcpy(func_name, raw_func_name.start(), func_name_len);
+ func_name[func_name_len] = '\0';
+ accumulator->Add("], function #%u ('%s'), pc=%p, pos=%d\n",
titzer 2016/11/18 10:38:21 Does the accumulator pass the format string to pri
Clemens Hammacher 2016/11/18 12:01:27 No, unfortunately not. It does the formatting inte
+ this->function_index(), func_name, pc, this->position());
+ if (mode != OVERVIEW) accumulator->Add("\n");
}
Code* WasmFrame::unchecked_code() const {
« no previous file with comments | « no previous file | src/wasm/wasm-objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698