mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +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
|
@ -945,7 +945,7 @@ void BytecodeReaderHelper::ReadExceptionsTable(const Bytecode& bytecode,
|
|||
if (try_block_count > 0) {
|
||||
const ObjectPool& pool = ObjectPool::Handle(Z, bytecode.object_pool());
|
||||
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);
|
||||
ExceptionHandlerList* exception_handlers_list =
|
||||
new (Z) ExceptionHandlerList();
|
||||
|
@ -986,9 +986,13 @@ void BytecodeReaderHelper::ReadExceptionsTable(const Bytecode& bytecode,
|
|||
DeoptId::kNone,
|
||||
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(
|
||||
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(
|
||||
Z, pc_descriptors_list->FinalizePcDescriptors(bytecode.PayloadStart()));
|
||||
|
|
|
@ -1184,6 +1184,10 @@ ActivationFrame* DebuggerStackTrace::GetHandlerFrame(
|
|||
const Instance& exc_obj) const {
|
||||
for (intptr_t frame_index = 0; frame_index < Length(); 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)) {
|
||||
return frame;
|
||||
}
|
||||
|
@ -1606,6 +1610,10 @@ RawTypeArguments* ActivationFrame::BuildParameters(
|
|||
}
|
||||
|
||||
const char* ActivationFrame::ToCString() {
|
||||
if (function().IsNull()) {
|
||||
return Thread::Current()->zone()->PrintToString("[ Frame kind: %s]\n",
|
||||
KindToCString(kind_));
|
||||
}
|
||||
const String& url = String::Handle(SourceUrl());
|
||||
intptr_t line = LineNumber();
|
||||
const char* func_name = Debugger::QualifiedFunctionName(function());
|
||||
|
@ -1630,7 +1638,7 @@ const char* ActivationFrame::ToCString() {
|
|||
"\turl = %s\n"
|
||||
"\tline = %" Pd
|
||||
"\n"
|
||||
"\tcontext = %s\n",
|
||||
"\tcontext = %s]\n",
|
||||
IsInterpreted() ? "bytecode" : "code", func_name, url.ToCString(), line,
|
||||
ctx_.ToCString());
|
||||
}
|
||||
|
|
|
@ -85,7 +85,6 @@ intptr_t StackTraceUtils::CollectFrames(Thread* thread,
|
|||
code_array.SetAt(array_offset, bytecode);
|
||||
} else {
|
||||
code = frame->LookupDartCode();
|
||||
function = code.function();
|
||||
offset = Smi::New(frame->pc() - code.PayloadStart());
|
||||
code_array.SetAt(array_offset, code);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue