From fcc358a1ab62e38bbdbf327dfe74754f7ead125f Mon Sep 17 00:00:00 2001 From: Steven Hugg Date: Sat, 1 Jun 2019 21:14:52 -0400 Subject: [PATCH] fixed debugging in listing view --- doc/notes.txt | 3 --- src/views.ts | 5 +++-- src/worker/workermain.ts | 2 +- src/workertypes.ts | 9 +++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/notes.txt b/doc/notes.txt index d4e222ee..48ef3833 100644 --- a/doc/notes.txt +++ b/doc/notes.txt @@ -155,9 +155,6 @@ TODO: - support projects with subdirectories, file list? - emulator needs reset shortcut for nes - switching platform of a repo? -- z80 - - can't single step on PUSH insns in listings? - - order of acheader.s - ctrl+alt+l on ubuntu locks screen WEB WORKER FORMAT diff --git a/src/views.ts b/src/views.ts index 1e500590..3f8b71d5 100644 --- a/src/views.ts +++ b/src/views.ts @@ -492,10 +492,11 @@ export class ListingView extends DisassemblerView implements ProjectView { refreshListing() { // lookup corresponding assemblyfile for this file, using listing var lst = current_project.getListingForFile(this.path); - if (lst && lst.assemblyfile && lst.assemblyfile !== this.assemblyfile) { + // TODO? + if (lst && lst.assemblyfile) { this.assemblyfile = lst.assemblyfile; } - else if (lst && lst.sourcefile && lst.sourcefile !== this.assemblyfile) { + else if (lst && lst.sourcefile) { this.assemblyfile = lst.sourcefile; } } diff --git a/src/worker/workermain.ts b/src/worker/workermain.ts index 999fa580..673da13d 100644 --- a/src/worker/workermain.ts +++ b/src/worker/workermain.ts @@ -1273,7 +1273,7 @@ function linkSDLDZ80(step:BuildStep) if (fn.endsWith('.lst')) { var rstout = FS.readFile(fn.replace('.lst','.rst'), {encoding:'utf8'}); // 0000 21 02 00 [10] 52 ld hl, #2 - var asmlines = parseListing(rstout, /^\s*([0-9A-F]+)\s+([0-9A-F][0-9A-F r]*[0-9A-F])\s+\[([0-9 ]+)\]\s+(\d+) (.*)/i, 4, 1, 2); + var asmlines = parseListing(rstout, /^\s*([0-9A-F]{4})\s+([0-9A-F][0-9A-F r]*[0-9A-F])\s+(\[[0-9 ]+\])?\s+(\d+) (.*)/i, 4, 1, 2); var srclines = parseSourceLines(rstout, /^\s+\d+ ;:(\d+):/i, /^\s*([0-9A-F]{4})/i); putWorkFile(fn, rstout); // TODO: you have to get rid of all source lines to get asm listing diff --git a/src/workertypes.ts b/src/workertypes.ts index ea67eef4..7309a841 100644 --- a/src/workertypes.ts +++ b/src/workertypes.ts @@ -11,15 +11,15 @@ export interface SourceLine { export class SourceFile { lines: SourceLine[]; text: string; - offset2line: {[offset:number]:number}; - line2offset: {[line:number]:number}; + offset2line: Map; //{[offset:number]:number}; + line2offset: Map; //{[line:number]:number}; constructor(lines:SourceLine[], text?:string) { lines = lines || []; this.lines = lines; this.text = text; - this.offset2line = {}; - this.line2offset = {}; + this.offset2line = new Map(); + this.line2offset = new Map(); for (var info of lines) { if (info.offset >= 0) { this.offset2line[info.offset] = info.line; @@ -32,6 +32,7 @@ export class SourceFile { for (var i=0; i<=lookbehind; i++) { var line = this.offset2line[PC]; if (line >= 0) { + //console.log(this.lines.length, PC.toString(16), line); return line; } PC--;