1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-06-19 17:29:32 +00:00

views that use startProbing() can use cumulative data mode

This commit is contained in:
Steven Hugg 2020-07-11 15:26:59 -05:00
parent e66802addb
commit dbda38d31a
2 changed files with 13 additions and 4 deletions

View File

@ -1102,11 +1102,12 @@ export abstract class BaseMachinePlatform<T extends Machine> extends BaseDebugPl
pause() { pause() {
this.timer.stop(); this.timer.stop();
this.audio && this.audio.stop(); this.audio && this.audio.stop();
// i guess for runToVsync()?
if (this.probeRecorder) { if (this.probeRecorder) {
this.probeRecorder.singleFrame = true; this.probeRecorder.singleFrame = true;
} }
} }
// so probe views stick around // so probe views stick around TODO: must be a better way?
runToVsync() { runToVsync() {
if (this.probeRecorder) { if (this.probeRecorder) {
this.probeRecorder.clear(); this.probeRecorder.clear();

View File

@ -6,7 +6,7 @@ import { hex, lpad, rpad, safeident, rgb2bgr } from "../common/util";
import { CodeAnalyzer } from "../common/analysis"; import { CodeAnalyzer } from "../common/analysis";
import { platform, platform_id, compparams, current_project, lastDebugState, projectWindows, runToPC } from "./ui"; import { platform, platform_id, compparams, current_project, lastDebugState, projectWindows, runToPC } from "./ui";
import { ProbeRecorder, ProbeFlags } from "../common/recorder"; import { ProbeRecorder, ProbeFlags } from "../common/recorder";
import { getMousePos, dumpRAM } from "../common/emu"; import { getMousePos, dumpRAM, Toolbar } from "../common/emu";
import * as pixed from "./pixeleditor"; import * as pixed from "./pixeleditor";
declare var Mousetrap; declare var Mousetrap;
@ -923,6 +923,7 @@ export class MemoryMapView implements ProjectView {
abstract class ProbeViewBaseBase { abstract class ProbeViewBaseBase {
probe : ProbeRecorder; probe : ProbeRecorder;
tooldiv : HTMLElement; tooldiv : HTMLElement;
cumulativeData : boolean = false;
abstract tick() : void; abstract tick() : void;
@ -955,8 +956,10 @@ abstract class ProbeViewBaseBase {
setVisible(showing : boolean) : void { setVisible(showing : boolean) : void {
if (showing) { if (showing) {
this.probe = platform.startProbing(); this.probe = platform.startProbing();
this.probe.singleFrame = !this.cumulativeData;
this.tick(); this.tick();
} else { } else {
if (this.probe) this.probe.singleFrame = true;
platform.stopProbing(); platform.stopProbing();
this.probe = null; this.probe = null;
} }
@ -1234,6 +1237,7 @@ export class ProbeSymbolView extends ProbeViewBaseBase {
keys : string[]; keys : string[];
recreateOnResize = true; recreateOnResize = true;
dumplines; dumplines;
cumulativeData = true;
// TODO: auto resize // TODO: auto resize
createDiv(parent : HTMLElement) { createDiv(parent : HTMLElement) {
@ -1293,6 +1297,7 @@ export class ProbeSymbolView extends ProbeViewBaseBase {
} }
}); });
this.vlist.refresh(); this.vlist.refresh();
if (this.probe) this.probe.clear(); // clear cumulative data (TODO: doesnt work with seeking or debugging)
} }
} }
@ -1490,7 +1495,6 @@ export class DebugBrowserView extends TreeViewBase implements ProjectView {
getRootObject() { return platform.getDebugTree(); } getRootObject() { return platform.getDebugTree(); }
} }
// TODO?
interface CallGraphNode { interface CallGraphNode {
count : number; count : number;
$$SP : number; $$SP : number;
@ -1500,12 +1504,14 @@ interface CallGraphNode {
calls : {[id:string] : CallGraphNode}; calls : {[id:string] : CallGraphNode};
} }
// TODO: clear stack data when reset?
export class CallStackView extends ProbeViewBaseBase implements ProjectView { export class CallStackView extends ProbeViewBaseBase implements ProjectView {
treeroot : TreeNode; treeroot : TreeNode;
graph : CallGraphNode; graph : CallGraphNode;
stack : CallGraphNode[]; stack : CallGraphNode[];
lastsp : number; lastsp : number;
jsr : boolean; jsr : boolean;
cumulativeData = true;
createDiv(parent : HTMLElement) : HTMLElement { createDiv(parent : HTMLElement) : HTMLElement {
this.clear(); this.clear();
@ -1519,6 +1525,7 @@ export class CallStackView extends ProbeViewBaseBase implements ProjectView {
tick() { tick() {
this.treeroot.update(this.getRootObject()); this.treeroot.update(this.getRootObject());
if (this.probe) this.probe.clear(); // clear cumulative data (TODO: doesnt work with seeking or debugging)
} }
clear() { clear() {
@ -1533,6 +1540,7 @@ export class CallStackView extends ProbeViewBaseBase implements ProjectView {
} }
getRootObject() : Object { getRootObject() : Object {
// TODO: we don't capture every frame, so if we don't start @ the top frame we may have problems
this.redraw((op,addr,col,row,clk,value) => { this.redraw((op,addr,col,row,clk,value) => {
switch (op) { switch (op) {
case ProbeFlags.SP_PUSH: case ProbeFlags.SP_PUSH:
@ -1574,7 +1582,7 @@ export class CallStackView extends ProbeViewBaseBase implements ProjectView {
break; break;
} }
}); });
//if (this.graph) this.graph['_stack'] = this.stack; if (this.graph) this.graph['$$Stack'] = this.stack;
return this.graph; return this.graph;
} }
} }