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

Unified Diff: runtime/vm/object.cc

Issue 2692803006: Track the 'awaiter return' call stack use it to detect uncaught exceptions in async functions (Closed)
Patch Set: rebase Created 3 years, 10 months 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
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index b9521e685f9797e196d6920253283e7dd1bff946..64f14ea6716841d477a890286b23b887d23c13ce 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12496,7 +12496,9 @@ void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
intptr_t outer_try_index,
uword handler_pc_offset,
bool needs_stacktrace,
- bool has_catch_all) const {
+ bool has_catch_all,
+ TokenPosition token_pos,
hausner 2017/02/28 19:04:51 token_pos appears to be unused.
Cutch 2017/02/28 21:46:52 Yes, this was part of development and I may use it
+ bool is_generated) const {
ASSERT((try_index >= 0) && (try_index < num_entries()));
NoSafepointScope no_safepoint;
ExceptionHandlerInfo* info =
@@ -12509,6 +12511,7 @@ void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
info->handler_pc_offset = handler_pc_offset;
info->needs_stacktrace = needs_stacktrace;
info->has_catch_all = has_catch_all;
+ info->is_generated = is_generated;
}
void ExceptionHandlers::GetHandlerInfo(intptr_t try_index,
@@ -12537,6 +12540,12 @@ bool ExceptionHandlers::NeedsStackTrace(intptr_t try_index) const {
}
+bool ExceptionHandlers::IsGenerated(intptr_t try_index) const {
+ ASSERT((try_index >= 0) && (try_index < num_entries()));
+ return raw_ptr()->data()[try_index].is_generated;
+}
+
+
bool ExceptionHandlers::HasCatchAll(intptr_t try_index) const {
ASSERT((try_index >= 0) && (try_index < num_entries()));
return raw_ptr()->data()[try_index].has_catch_all;
@@ -12615,7 +12624,7 @@ RawExceptionHandlers* ExceptionHandlers::New(const Array& handled_types_data) {
const char* ExceptionHandlers::ToCString() const {
-#define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d)\n"
+#define FORMAT1 "%" Pd " => %#x (%" Pd " types) (outer %d) %s\n"
#define FORMAT2 " %d. %s\n"
if (num_entries() == 0) {
return "empty ExceptionHandlers\n";
@@ -12631,7 +12640,8 @@ const char* ExceptionHandlers::ToCString() const {
const intptr_t num_types =
handled_types.IsNull() ? 0 : handled_types.Length();
len += OS::SNPrint(NULL, 0, FORMAT1, i, info.handler_pc_offset, num_types,
- info.outer_try_index);
+ info.outer_try_index,
+ info.is_generated ? "(generated)" : "");
for (int k = 0; k < num_types; k++) {
type ^= handled_types.At(k);
ASSERT(!type.IsNull());
@@ -12649,7 +12659,8 @@ const char* ExceptionHandlers::ToCString() const {
handled_types.IsNull() ? 0 : handled_types.Length();
num_chars +=
OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT1, i,
- info.handler_pc_offset, num_types, info.outer_try_index);
+ info.handler_pc_offset, num_types, info.outer_try_index,
+ info.is_generated ? "(generated)" : "");
for (int k = 0; k < num_types; k++) {
type ^= handled_types.At(k);
num_chars += OS::SNPrint((buffer + num_chars), (len - num_chars), FORMAT2,
« runtime/vm/debugger.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/object_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698