uae-dap
Version:
Debug Adapter Protocol for Amiga development with FS-UAE or WinUAE
132 lines (131 loc) • 4.18 kB
TypeScript
import { DebugProtocol } from "@vscode/debugprotocol";
import { GdbClient } from "./gdbClient";
import { NumberFormat } from "./utils/strings";
import SourceMap from "./sourceMap";
export declare enum ScopeType {
Registers = 0,
Segments = 1,
Symbols = 2,
StatusRegister = 3,
Expression = 4,
Custom = 5,
Vectors = 6,
SourceConstants = 7
}
export interface ScopeReference {
type: ScopeType;
frameId: number;
}
export interface MemoryFormat {
length: number;
wordLength?: number;
rowLength?: number;
mode?: string;
}
/**
* Provider to get constants for program sources
*/
export interface SourceConstantResolver {
/**
* Get constants defined in the sources
*
* @param sourceFiles Array of file paths for source files
* @returns object containing key/value pairs for
*/
getSourceConstants(sourceFiles: string[]): Promise<Record<string, number>>;
}
/**
* Wrapper to interact with running Program
*/
declare class VariableManager {
private gdb;
private sourceMap;
private constantResolver?;
private memoryFormats;
private scopes;
/** Variables lookup by handle */
private referencedVariables;
/** Lazy loaded constants extracted from current file source */
private sourceConstants?;
/** Store format options for specific variables */
private variableFormatterMap;
constructor(gdb: GdbClient, sourceMap: SourceMap, constantResolver?: SourceConstantResolver | undefined, memoryFormats?: Record<string, MemoryFormat>);
/**
* Read memory from address
*
* @param length Length of data to read in bytes
*/
private getMemory;
/**
* Get scopes for frame ID
*/
getScopes(frameId: number): DebugProtocol.Scope[];
/**
* Get object containing all variables and constants
*/
getVariables(frameId?: number): Promise<Record<string, number | Record<string, number>>>;
getCompletions(text: string, frameId?: number): Promise<DebugProtocol.CompletionItem[]>;
private registerFields;
/**
* Lazy load constants from parsed source files
*/
private getSourceConstants;
/**
* Retrieve variables for a given variable reference i.e. scope
*/
getVariablesByReference(variablesReference: number): Promise<DebugProtocol.Variable[]>;
/**
* Get information about the scope associated with a variables reference
*/
getScopeReference(variablesReference: number): ScopeReference;
private getRegisterVariables;
private getSegmentVariables;
private getSymbolVariables;
private getVectorVariables;
private getSourceConstantVariables;
private getCustomVariables;
/**
* Set the value of a variable
*
* Only registers are supported.
*/
setVariable(variablesReference: number, name: string, value: string): Promise<string>;
/**
* Format a variable as a string in the preferred NumberFormat
*/
formatVariable(variableName: string, value: any, defaultFormat?: NumberFormat, minBytes?: number): string;
/**
* Set the preferred format for a specific variable
*/
setVariableFormat(variableName: string, format: NumberFormat): void;
/**
* Evaluate an expression or custom command
*
* @returns Single value or array
*/
evaluateExpression({ expression, frameId, context, }: DebugProtocol.EvaluateArguments): Promise<{
result: string;
type?: string;
variablesReference: number;
} | undefined>;
protected getMemoryFormat(context?: string): MemoryFormat;
/**
* Evaluate simple expression to numeric value
*/
evaluate(expression: string, frameIndex?: number): Promise<any>;
private writeMemoryCommand;
private dumpMemoryCommand;
private disassembleCommand;
private disassembleCopperCommand;
private readMemoryAsVariables;
private disassembleAsVariables;
private disassembleCopperAsVariables;
private boolReg;
private byteReg;
private wordReg;
/**
* Get symbol name and offset for address
*/
private symbolOffset;
}
export default VariableManager;