mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 09:43:08 +00:00
[vm/bytecode] Fix clobbering of exception handler types in bytecode reader.
This fixes service/pause_on_unhandled_async_exceptions_test in compiled bytecode mode, but not yet in interpreted bytecode mode. Improve debugger verbosity. Change-Id: I89e32179b0a3f043716d5117f958bf6a0de3ccac Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/116483 Commit-Queue: Régis Crelier <regis@google.com> Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
parent
b4724c1d78
commit
9fccb5120b
3 changed files with 15 additions and 4 deletions
|
@ -945,7 +945,7 @@ void BytecodeReaderHelper::ReadExceptionsTable(const Bytecode& bytecode,
|
||||||
if (try_block_count > 0) {
|
if (try_block_count > 0) {
|
||||||
const ObjectPool& pool = ObjectPool::Handle(Z, bytecode.object_pool());
|
const ObjectPool& pool = ObjectPool::Handle(Z, bytecode.object_pool());
|
||||||
AbstractType& handler_type = AbstractType::Handle(Z);
|
AbstractType& handler_type = AbstractType::Handle(Z);
|
||||||
Array& handler_types = Array::ZoneHandle(Z);
|
Array& handler_types = Array::Handle(Z);
|
||||||
DescriptorList* pc_descriptors_list = new (Z) DescriptorList(64);
|
DescriptorList* pc_descriptors_list = new (Z) DescriptorList(64);
|
||||||
ExceptionHandlerList* exception_handlers_list =
|
ExceptionHandlerList* exception_handlers_list =
|
||||||
new (Z) ExceptionHandlerList();
|
new (Z) ExceptionHandlerList();
|
||||||
|
@ -986,9 +986,13 @@ void BytecodeReaderHelper::ReadExceptionsTable(const Bytecode& bytecode,
|
||||||
DeoptId::kNone,
|
DeoptId::kNone,
|
||||||
TokenPosition::kNoSource, -1);
|
TokenPosition::kNoSource, -1);
|
||||||
|
|
||||||
|
// The exception handler keeps a zone handle of the types array, rather
|
||||||
|
// than a raw pointer. Do not share the handle across iterations to avoid
|
||||||
|
// clobbering the array.
|
||||||
exception_handlers_list->AddHandler(
|
exception_handlers_list->AddHandler(
|
||||||
try_index, outer_try_index, handler_pc, TokenPosition::kNoSource,
|
try_index, outer_try_index, handler_pc, TokenPosition::kNoSource,
|
||||||
is_generated, handler_types, needs_stacktrace);
|
is_generated, Array::ZoneHandle(Z, handler_types.raw()),
|
||||||
|
needs_stacktrace);
|
||||||
}
|
}
|
||||||
const PcDescriptors& descriptors = PcDescriptors::Handle(
|
const PcDescriptors& descriptors = PcDescriptors::Handle(
|
||||||
Z, pc_descriptors_list->FinalizePcDescriptors(bytecode.PayloadStart()));
|
Z, pc_descriptors_list->FinalizePcDescriptors(bytecode.PayloadStart()));
|
||||||
|
|
|
@ -1184,6 +1184,10 @@ ActivationFrame* DebuggerStackTrace::GetHandlerFrame(
|
||||||
const Instance& exc_obj) const {
|
const Instance& exc_obj) const {
|
||||||
for (intptr_t frame_index = 0; frame_index < Length(); frame_index++) {
|
for (intptr_t frame_index = 0; frame_index < Length(); frame_index++) {
|
||||||
ActivationFrame* frame = FrameAt(frame_index);
|
ActivationFrame* frame = FrameAt(frame_index);
|
||||||
|
if (FLAG_trace_debugger_stacktrace) {
|
||||||
|
OS::PrintErr("GetHandlerFrame: #%04" Pd " %s", frame_index,
|
||||||
|
frame->ToCString());
|
||||||
|
}
|
||||||
if (frame->HandlesException(exc_obj)) {
|
if (frame->HandlesException(exc_obj)) {
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
@ -1606,6 +1610,10 @@ RawTypeArguments* ActivationFrame::BuildParameters(
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ActivationFrame::ToCString() {
|
const char* ActivationFrame::ToCString() {
|
||||||
|
if (function().IsNull()) {
|
||||||
|
return Thread::Current()->zone()->PrintToString("[ Frame kind: %s]\n",
|
||||||
|
KindToCString(kind_));
|
||||||
|
}
|
||||||
const String& url = String::Handle(SourceUrl());
|
const String& url = String::Handle(SourceUrl());
|
||||||
intptr_t line = LineNumber();
|
intptr_t line = LineNumber();
|
||||||
const char* func_name = Debugger::QualifiedFunctionName(function());
|
const char* func_name = Debugger::QualifiedFunctionName(function());
|
||||||
|
@ -1630,7 +1638,7 @@ const char* ActivationFrame::ToCString() {
|
||||||
"\turl = %s\n"
|
"\turl = %s\n"
|
||||||
"\tline = %" Pd
|
"\tline = %" Pd
|
||||||
"\n"
|
"\n"
|
||||||
"\tcontext = %s\n",
|
"\tcontext = %s]\n",
|
||||||
IsInterpreted() ? "bytecode" : "code", func_name, url.ToCString(), line,
|
IsInterpreted() ? "bytecode" : "code", func_name, url.ToCString(), line,
|
||||||
ctx_.ToCString());
|
ctx_.ToCString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,6 @@ intptr_t StackTraceUtils::CollectFrames(Thread* thread,
|
||||||
code_array.SetAt(array_offset, bytecode);
|
code_array.SetAt(array_offset, bytecode);
|
||||||
} else {
|
} else {
|
||||||
code = frame->LookupDartCode();
|
code = frame->LookupDartCode();
|
||||||
function = code.function();
|
|
||||||
offset = Smi::New(frame->pc() - code.PayloadStart());
|
offset = Smi::New(frame->pc() - code.PayloadStart());
|
||||||
code_array.SetAt(array_offset, code);
|
code_array.SetAt(array_offset, code);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue