Skip to content

Commit

Permalink
[VM] Add more information when seeing disagreeing sources in a dill
Browse files Browse the repository at this point in the history
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 <jensj@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
  • Loading branch information
jensjoha authored and commit-bot@chromium.org committed Jul 9, 2020
1 parent e8d3389 commit c8b5a9b
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions runtime/vm/kernel_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,19 @@ Object& KernelLoader::LoadEntireProgram(Program* program,
if (pair != NULL) {
// At least two entries with content. Unless the content is the same
// that's not valid.
if (pair->sources->CompareTo(script_source) != 0 ||
!pair->line_starts->CanonicalizeEquals(line_starts)) {
FATAL(
const bool src_differ = pair->sources->CompareTo(script_source) != 0;
const bool line_starts_differ =
!pair->line_starts->CanonicalizeEquals(line_starts);
if (src_differ || line_starts_differ) {
FATAL3(
"Invalid kernel binary: Contains at least two source entries "
"that do not agree.");
"that do not agree. URI '%s', difference: %s. Subprogram count: "
"%" Pd ".",
uri_string.ToCString(),
src_differ && line_starts_differ
? "src and line starts"
: (src_differ ? "src" : "line starts"),
subprogram_count);
}
} else {
UriToSourceTableEntry* tmp = new UriToSourceTableEntry();
Expand Down Expand Up @@ -544,7 +552,7 @@ void KernelLoader::AnnotateNativeProcedures() {
for (intptr_t j = 0; j < annotation_count; ++j) {
const intptr_t tag = helper_.PeekTag();
if (tag == kConstantExpression) {
helper_.ReadByte(); // Skip the tag.
helper_.ReadByte(); // Skip the tag.
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.

Expand Down Expand Up @@ -675,7 +683,7 @@ void KernelLoader::LoadNativeExtensionLibraries() {

const intptr_t tag = helper_.PeekTag();
if (tag == kConstantExpression) {
helper_.ReadByte(); // Skip the tag.
helper_.ReadByte(); // Skip the tag.
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.

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

helper_.ReadByte(); // Skip the tag.
helper_.ReadByte(); // Skip the tag.
helper_.ReadPosition(); // Skip fileOffset.
helper_.SkipDartType(); // Skip type.
const intptr_t offset_in_constant_table = helper_.ReadUInt();
Expand Down

0 comments on commit c8b5a9b

Please sign in to comment.