worker: debuginfo passed thru to link step

This commit is contained in:
Steven Hugg 2022-02-24 09:47:34 -06:00
parent c9e75ae77d
commit 75fb2a8e5c
4 changed files with 27 additions and 9 deletions

View File

@ -223,7 +223,10 @@ export abstract class BasePlatform {
return inspectSymbol((this as any) as Platform, sym);
}
getDebugTree() : {} {
return this.saveState();
var o : any = { };
o.state = this.saveState();
if (this.debugSymbols.debuginfo) o.debuginfo = this.debugSymbols.debuginfo;
return o;
}
readFile(path: string) : FileData {
return this.internalFiles[path];

View File

@ -1410,7 +1410,6 @@ export class EntityScope implements SourceLocated {
if (action.critical) this.inCritical--;
if (!this.inCritical && codeeval.isSubroutineSized(eventcode)) {
let normcode = this.normalizeCode(eventcode, action);
// TODO: label rewriting messes this up
let estats = this.eventCodeStats[normcode];
if (!estats) {
estats = this.eventCodeStats[normcode] = new EventCodeStats(
@ -1730,4 +1729,10 @@ export class EntityManager {
}
}
}
getDebugTree() : {} {
let scopes = this.topScopes;
let components = this.components;
let systems = this.systems;
return { scopes, components, systems };
}
}

View File

@ -23,6 +23,7 @@ export function assembleECS(step: BuildStep): BuildStepResult {
putWorkFile(destpath, outtext);
var listings: CodeListingMap = {};
listings[destpath] = {lines:[], text:outtext} // TODO
var debuginfo = compiler.em.getDebugTree();
} catch (e) {
if (e instanceof ECSError) {
compiler.addError(e.message, e.$loc);
@ -33,12 +34,13 @@ export function assembleECS(step: BuildStep): BuildStepResult {
throw e;
}
}
return {
nexttool: "ca65",
path: destpath,
args: [destpath],
files: [destpath].concat(step.files),
listings,
debuginfo
};
}
return {
nexttool: "ca65",
path: destpath,
args: [destpath],
files: [destpath].concat(step.files),
listings
};
}

View File

@ -424,6 +424,7 @@ export interface BuildStep extends WorkerBuildStep {
code?
prefix?
maxts?
debuginfo?
};
///
@ -511,6 +512,11 @@ class Builder {
}
if (step.result) {
(step.result as any).params = step.params; // TODO: type check
if (step.debuginfo) {
let r = step.result as any; // TODO
if (!r.debuginfo) r.debuginfo = {};
Object.assign(r.debuginfo, step.debuginfo);
}
// errors? return them
if ('errors' in step.result && step.result.errors.length) {
applyDefaultErrorPath(step.result.errors, step.path);
@ -522,6 +528,7 @@ class Builder {
}
// combine files with a link tool?
if ('linktool' in step.result) {
// add to existing link step
if (linkstep) {
linkstep.files = linkstep.files.concat(step.result.files);
linkstep.args = linkstep.args.concat(step.result.args);
@ -533,6 +540,7 @@ class Builder {
args:step.result.args
};
}
linkstep.debuginfo = step.debuginfo; // TODO: multiple debuginfos
}
// process with another tool?
if ('nexttool' in step.result) {