Skip to content

Commit c8b5a9b

Browse files
jensjohacommit-bot@chromium.org
authored andcommitted
[VM] Add more information when seeing disagreeing sources in a dill
Hopefully this extra information will help debugging an issue such as flutter/flutter#60794 Change-Id: I426a9ab50a88f49ded47012a8f0aa280ea7e5ae2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153212 Commit-Queue: Jens Johansen <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent e8d3389 commit c8b5a9b

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

runtime/vm/kernel_loader.cc

+15-7
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,19 @@ Object& KernelLoader::LoadEntireProgram(Program* program,
279279
if (pair != NULL) {
280280
// At least two entries with content. Unless the content is the same
281281
// that's not valid.
282-
if (pair->sources->CompareTo(script_source) != 0 ||
283-
!pair->line_starts->CanonicalizeEquals(line_starts)) {
284-
FATAL(
282+
const bool src_differ = pair->sources->CompareTo(script_source) != 0;
283+
const bool line_starts_differ =
284+
!pair->line_starts->CanonicalizeEquals(line_starts);
285+
if (src_differ || line_starts_differ) {
286+
FATAL3(
285287
"Invalid kernel binary: Contains at least two source entries "
286-
"that do not agree.");
288+
"that do not agree. URI '%s', difference: %s. Subprogram count: "
289+
"%" Pd ".",
290+
uri_string.ToCString(),
291+
src_differ && line_starts_differ
292+
? "src and line starts"
293+
: (src_differ ? "src" : "line starts"),
294+
subprogram_count);
287295
}
288296
} else {
289297
UriToSourceTableEntry* tmp = new UriToSourceTableEntry();
@@ -544,7 +552,7 @@ void KernelLoader::AnnotateNativeProcedures() {
544552
for (intptr_t j = 0; j < annotation_count; ++j) {
545553
const intptr_t tag = helper_.PeekTag();
546554
if (tag == kConstantExpression) {
547-
helper_.ReadByte(); // Skip the tag.
555+
helper_.ReadByte(); // Skip the tag.
548556
helper_.ReadPosition(); // Skip fileOffset.
549557
helper_.SkipDartType(); // Skip type.
550558

@@ -675,7 +683,7 @@ void KernelLoader::LoadNativeExtensionLibraries() {
675683

676684
const intptr_t tag = helper_.PeekTag();
677685
if (tag == kConstantExpression) {
678-
helper_.ReadByte(); // Skip the tag.
686+
helper_.ReadByte(); // Skip the tag.
679687
helper_.ReadPosition(); // Skip fileOffset.
680688
helper_.SkipDartType(); // Skip type.
681689

@@ -1874,7 +1882,7 @@ void KernelLoader::ReadVMAnnotations(const Library& library,
18741882
// TODO(sjindel): Refactor `ExternalName` handling to do this as well
18751883
// and avoid the "potential natives" list.
18761884

1877-
helper_.ReadByte(); // Skip the tag.
1885+
helper_.ReadByte(); // Skip the tag.
18781886
helper_.ReadPosition(); // Skip fileOffset.
18791887
helper_.SkipDartType(); // Skip type.
18801888
const intptr_t offset_in_constant_table = helper_.ReadUInt();

0 commit comments

Comments
 (0)