Skip to content

loadSymbols cannot read large .sym files #36

@june-in-exile

Description

@june-in-exile

This is the error I encountered when I called assertOut:

Image

The debug message indicated that the process stopped at reading the .sym file in loadSymbols.

const symsStr = await fs.promises.readFile(

According to claud.ai the reason is that the file is too large for fs.readFile (in my case the file is 678MB). After switching to the implementation below the issue was solved.

  async loadSymbols() {
    if (this.symbols) return;

    this.symbols = {};
    const fileStream = fs.createReadStream(
      path.join(this.dir, this.baseName + ".sym"),
      { encoding: "utf8" }
    );
    const rl = readline.createInterface({
      input: fileStream,
      crlfDelay: Infinity,
    });

    for await (const line of rl) {
      const arr = line.split(",");
      if (arr.length !== 4) {
        continue;
      }

      this.symbols[arr[3]] = {
        labelIdx: Number(arr[0]),
        varIdx: Number(arr[1]),
        componentIdx: Number(arr[2]),
      };
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions