diff --git a/runtime/tests/vm/dart/causal_stacks/utils.dart b/runtime/tests/vm/dart/causal_stacks/utils.dart index 4356953531c..2269e315779 100644 --- a/runtime/tests/vm/dart/causal_stacks/utils.dart +++ b/runtime/tests/vm/dart/causal_stacks/utils.dart @@ -205,26 +205,21 @@ Future assertStack(List expects, StackTrace stackTrace, // Use the DWARF stack decoder if we're running in --dwarf-stack-traces mode // and in precompiled mode (otherwise --dwarf-stack-traces has no effect). - bool usingDwarf = false; - if (debugInfoFilename != null) { - try { - final dwarf = Dwarf.fromFile(debugInfoFilename)!; - usingDwarf = true; - frames = await Stream.fromIterable(original) - .transform(DwarfStackTraceDecoder(dwarf)) - .where(_lineRE.hasMatch) - .toList(); - } on FileSystemException { - // We're not running in precompiled mode, so the file doesn't exist and - // we can continue normally. - } + final decodeTrace = frames.first.startsWith('Warning:'); + if (decodeTrace) { + Expect.isNotNull(debugInfoFilename); + final dwarf = Dwarf.fromFile(debugInfoFilename!)!; + frames = await Stream.fromIterable(original) + .transform(DwarfStackTraceDecoder(dwarf)) + .where(_lineRE.hasMatch) + .toList(); } void printFrameInformation() { print('RegExps for expected stack:'); expects.forEach((s) => print('"${s}"')); print(''); - if (usingDwarf) { + if (decodeTrace) { print('Non-symbolic actual stack:'); original.forEach(print); print(''); diff --git a/runtime/tests/vm/dart_2/causal_stacks/utils.dart b/runtime/tests/vm/dart_2/causal_stacks/utils.dart index ec673b517ef..d7c80d1b245 100644 --- a/runtime/tests/vm/dart_2/causal_stacks/utils.dart +++ b/runtime/tests/vm/dart_2/causal_stacks/utils.dart @@ -207,26 +207,21 @@ Future assertStack(List expects, StackTrace stackTrace, // Use the DWARF stack decoder if we're running in --dwarf-stack-traces mode // and in precompiled mode (otherwise --dwarf-stack-traces has no effect). - bool usingDwarf = false; - if (debugInfoFilename != null) { - try { - final dwarf = Dwarf.fromFile(debugInfoFilename); - usingDwarf = true; - frames = await Stream.fromIterable(original) - .transform(DwarfStackTraceDecoder(dwarf)) - .where(_lineRE.hasMatch) - .toList(); - } on FileSystemException { - // We're not running in precompiled mode, so the file doesn't exist and - // we can continue normally. - } + final decodeTrace = frames.first.startsWith('Warning:'); + if (decodeTrace) { + Expect.isNotNull(debugInfoFilename); + final dwarf = Dwarf.fromFile(debugInfoFilename); + frames = await Stream.fromIterable(original) + .transform(DwarfStackTraceDecoder(dwarf)) + .where(_lineRE.hasMatch) + .toList(); } void printFrameInformation() { print('RegExps for expected stack:'); expects.forEach((s) => print('"${s}"')); print(''); - if (usingDwarf) { + if (decodeTrace) { print('Non-symbolic actual stack:'); original.forEach(print); print(''); diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc index 84694a600ba..d20cf5468a6 100644 --- a/runtime/vm/isolate.cc +++ b/runtime/vm/isolate.cc @@ -1739,6 +1739,13 @@ Isolate::Isolate(IsolateGroup* isolate_group, // how the vm_tag (kEmbedderTagId) can be set, these tags need to // move to the OSThread structure. set_user_tag(UserTags::kDefaultUserTag); + + if (group()->obfuscate()) { + OS::PrintErr( + "Warning: This VM has been configured to obfuscate symbol information " + "which violates the Dart standard.\n" + " See dartbug.com/30524 for more information.\n"); + } } #undef REUSABLE_HANDLE_SCOPE_INIT diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc index 88143201c6b..47633fef274 100644 --- a/runtime/vm/object.cc +++ b/runtime/vm/object.cc @@ -25878,6 +25878,12 @@ const char* StackTrace::ToCString() const { isolate_instructions_image.instructions_relocated_address(); auto const vm_relocated_address = vm_instructions_image.instructions_relocated_address(); + // The Dart standard requires the output of StackTrace.toString to include + // all pending activations with precise source locations (i.e., to expand + // inlined frames and provide line and column numbers). + buffer.Printf( + "Warning: This VM has been configured to produce stack traces " + "that violate the Dart standard.\n"); // This prologue imitates Android's debuggerd to make it possible to paste // the stack trace into ndk-stack. buffer.Printf(