objdiff-wasm 2.0.0 → 3.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,264 @@
1
+ {
2
+ "properties": [
3
+ {
4
+ "id": "functionRelocDiffs",
5
+ "type": "choice",
6
+ "default": "name_address",
7
+ "name": "Function relocation diffs",
8
+ "description": "How relocation targets will be diffed in the function view.",
9
+ "items": [
10
+ {
11
+ "value": "none",
12
+ "name": "None"
13
+ },
14
+ {
15
+ "value": "name_address",
16
+ "name": "Name or address"
17
+ },
18
+ {
19
+ "value": "data_value",
20
+ "name": "Data value"
21
+ },
22
+ {
23
+ "value": "all",
24
+ "name": "Name or address, data value"
25
+ }
26
+ ]
27
+ },
28
+ {
29
+ "id": "spaceBetweenArgs",
30
+ "type": "boolean",
31
+ "default": true,
32
+ "name": "Space between args",
33
+ "description": "Adds a space between arguments in the diff output."
34
+ },
35
+ {
36
+ "id": "combineDataSections",
37
+ "type": "boolean",
38
+ "default": false,
39
+ "name": "Combine data sections",
40
+ "description": "Combines data sections with equal names."
41
+ },
42
+ {
43
+ "id": "combineTextSections",
44
+ "type": "boolean",
45
+ "default": false,
46
+ "name": "Combine text sections",
47
+ "description": "Combines all text sections into one."
48
+ },
49
+ {
50
+ "id": "arm.archVersion",
51
+ "type": "choice",
52
+ "default": "auto",
53
+ "name": "Architecture version",
54
+ "description": "ARM architecture version to use for disassembly.",
55
+ "items": [
56
+ {
57
+ "value": "auto",
58
+ "name": "Auto"
59
+ },
60
+ {
61
+ "value": "v4t",
62
+ "name": "ARMv4T (GBA)"
63
+ },
64
+ {
65
+ "value": "v5te",
66
+ "name": "ARMv5TE (DS)"
67
+ },
68
+ {
69
+ "value": "v6k",
70
+ "name": "ARMv6K (3DS)"
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "id": "arm.unifiedSyntax",
76
+ "type": "boolean",
77
+ "default": false,
78
+ "name": "Unified syntax",
79
+ "description": "Disassemble as unified assembly language (UAL)."
80
+ },
81
+ {
82
+ "id": "arm.avRegisters",
83
+ "type": "boolean",
84
+ "default": false,
85
+ "name": "Use A/V registers",
86
+ "description": "Display R0-R3 as A1-A4 and R4-R11 as V1-V8."
87
+ },
88
+ {
89
+ "id": "arm.r9Usage",
90
+ "type": "choice",
91
+ "default": "generalPurpose",
92
+ "name": "Display R9 as",
93
+ "items": [
94
+ {
95
+ "value": "generalPurpose",
96
+ "name": "R9 or V6",
97
+ "description": "Use R9 as a general-purpose register."
98
+ },
99
+ {
100
+ "value": "sb",
101
+ "name": "SB (static base)",
102
+ "description": "Used for position-independent data (PID)."
103
+ },
104
+ {
105
+ "value": "tr",
106
+ "name": "TR (TLS register)",
107
+ "description": "Used for thread-local storage."
108
+ }
109
+ ]
110
+ },
111
+ {
112
+ "id": "arm.slUsage",
113
+ "type": "boolean",
114
+ "default": false,
115
+ "name": "Display R10 as SL",
116
+ "description": "Used for explicit stack limits."
117
+ },
118
+ {
119
+ "id": "arm.fpUsage",
120
+ "type": "boolean",
121
+ "default": false,
122
+ "name": "Display R11 as FP",
123
+ "description": "Used for frame pointers."
124
+ },
125
+ {
126
+ "id": "arm.ipUsage",
127
+ "type": "boolean",
128
+ "default": false,
129
+ "name": "Display R12 as IP",
130
+ "description": "Used for interworking and long branches."
131
+ },
132
+ {
133
+ "id": "mips.abi",
134
+ "type": "choice",
135
+ "default": "auto",
136
+ "name": "ABI",
137
+ "description": "MIPS ABI to use for disassembly.",
138
+ "items": [
139
+ {
140
+ "value": "auto",
141
+ "name": "Auto"
142
+ },
143
+ {
144
+ "value": "o32",
145
+ "name": "O32"
146
+ },
147
+ {
148
+ "value": "n32",
149
+ "name": "N32"
150
+ },
151
+ {
152
+ "value": "n64",
153
+ "name": "N64"
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ "id": "mips.instrCategory",
159
+ "type": "choice",
160
+ "default": "auto",
161
+ "name": "Instruction category",
162
+ "description": "MIPS instruction category to use for disassembly.",
163
+ "items": [
164
+ {
165
+ "value": "auto",
166
+ "name": "Auto"
167
+ },
168
+ {
169
+ "value": "cpu",
170
+ "name": "CPU"
171
+ },
172
+ {
173
+ "value": "rsp",
174
+ "name": "RSP (N64)"
175
+ },
176
+ {
177
+ "value": "r3000gte",
178
+ "name": "R3000 GTE (PS1)"
179
+ },
180
+ {
181
+ "value": "r4000allegrex",
182
+ "name": "R4000 ALLEGREX (PSP)"
183
+ },
184
+ {
185
+ "value": "r5900",
186
+ "name": "R5900 EE (PS2)"
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ "id": "mips.registerPrefix",
192
+ "type": "boolean",
193
+ "default": false,
194
+ "name": "Register '$' prefix",
195
+ "description": "Display MIPS register names with a '$' prefix."
196
+ },
197
+ {
198
+ "id": "x86.formatter",
199
+ "type": "choice",
200
+ "default": "intel",
201
+ "name": "Format",
202
+ "description": "x86 disassembly syntax.",
203
+ "items": [
204
+ {
205
+ "value": "intel",
206
+ "name": "Intel"
207
+ },
208
+ {
209
+ "value": "gas",
210
+ "name": "AT&T"
211
+ },
212
+ {
213
+ "value": "nasm",
214
+ "name": "NASM"
215
+ },
216
+ {
217
+ "value": "masm",
218
+ "name": "MASM"
219
+ }
220
+ ]
221
+ }
222
+ ],
223
+ "groups": [
224
+ {
225
+ "id": "general",
226
+ "name": "General",
227
+ "properties": [
228
+ "functionRelocDiffs",
229
+ "spaceBetweenArgs",
230
+ "combineDataSections",
231
+ "combineTextSections"
232
+ ]
233
+ },
234
+ {
235
+ "id": "arm",
236
+ "name": "ARM",
237
+ "properties": [
238
+ "arm.archVersion",
239
+ "arm.unifiedSyntax",
240
+ "arm.avRegisters",
241
+ "arm.r9Usage",
242
+ "arm.slUsage",
243
+ "arm.fpUsage",
244
+ "arm.ipUsage"
245
+ ]
246
+ },
247
+ {
248
+ "id": "mips",
249
+ "name": "MIPS",
250
+ "properties": [
251
+ "mips.abi",
252
+ "mips.instrCategory",
253
+ "mips.registerPrefix"
254
+ ]
255
+ },
256
+ {
257
+ "id": "x86",
258
+ "name": "x86",
259
+ "properties": [
260
+ "x86.formatter"
261
+ ]
262
+ }
263
+ ]
264
+ }
@@ -0,0 +1,33 @@
1
+ /** @module Interface objdiff:core/diff **/
2
+ export function runDiff(left: Object | undefined, right: Object | undefined, config: DiffConfig): DiffResult;
3
+ export interface MappingConfig {
4
+ mappings: Array<[string, string]>,
5
+ selectingLeft?: string,
6
+ selectingRight?: string,
7
+ }
8
+ export interface DiffResult {
9
+ left?: ObjectDiff,
10
+ right?: ObjectDiff,
11
+ }
12
+
13
+ export class DiffConfig {
14
+ constructor()
15
+ setProperty(id: string, value: string): void;
16
+ getProperty(id: string): string;
17
+ }
18
+
19
+ export class Object {
20
+ /**
21
+ * This type does not have a public constructor.
22
+ */
23
+ private constructor();
24
+ static parse(data: Uint8Array, config: DiffConfig): Object;
25
+ }
26
+
27
+ export class ObjectDiff {
28
+ /**
29
+ * This type does not have a public constructor.
30
+ */
31
+ private constructor();
32
+ findSymbol(name: string, sectionName: string | undefined): number | undefined;
33
+ }
@@ -0,0 +1,224 @@
1
+ /** @module Interface objdiff:core/display **/
2
+ export function displaySections(diff: ObjectDiff, filter: SymbolFilter, config: DisplayConfig): Array<SectionDisplay>;
3
+ export function displaySymbol(diff: ObjectDiff, symbol: SectionDisplaySymbol): SymbolDisplay;
4
+ export function displayInstructionRow(diff: ObjectDiff, symbol: SectionDisplaySymbol, rowIndex: number, config: DiffConfig): InstructionDiffRow;
5
+ export function symbolContext(diff: ObjectDiff, symbol: SectionDisplaySymbol): Array<ContextItem>;
6
+ export function symbolHover(diff: ObjectDiff, symbol: SectionDisplaySymbol): Array<HoverItem>;
7
+ export function instructionContext(diff: ObjectDiff, symbol: SectionDisplaySymbol, rowIndex: number, config: DiffConfig): Array<ContextItem>;
8
+ export function instructionHover(diff: ObjectDiff, symbol: SectionDisplaySymbol, rowIndex: number, config: DiffConfig): Array<HoverItem>;
9
+ export type Object = import('./objdiff-core-diff.js').Object;
10
+ export type ObjectDiff = import('./objdiff-core-diff.js').ObjectDiff;
11
+ export type DiffConfig = import('./objdiff-core-diff.js').DiffConfig;
12
+ export type SymbolRef = number;
13
+ export interface DisplayConfig {
14
+ showHiddenSymbols: boolean,
15
+ showMappedSymbols: boolean,
16
+ reverseFnOrder: boolean,
17
+ }
18
+ export interface SymbolFilter {
19
+ regex?: string,
20
+ mapping?: SymbolRef,
21
+ }
22
+ export interface SectionDisplaySymbol {
23
+ symbol: SymbolRef,
24
+ isMappingSymbol: boolean,
25
+ }
26
+ export interface SectionDisplay {
27
+ id: string,
28
+ name: string,
29
+ size: bigint,
30
+ matchPercent?: number,
31
+ symbols: Array<SectionDisplaySymbol>,
32
+ }
33
+ /**
34
+ * # Variants
35
+ *
36
+ * ## `"unknown"`
37
+ *
38
+ * ## `"function"`
39
+ *
40
+ * ## `"object"`
41
+ *
42
+ * ## `"section"`
43
+ */
44
+ export type SymbolKind = 'unknown' | 'function' | 'object' | 'section';
45
+ export interface SymbolFlags {
46
+ global?: boolean,
47
+ local?: boolean,
48
+ weak?: boolean,
49
+ common?: boolean,
50
+ hidden?: boolean,
51
+ hasExtra?: boolean,
52
+ sizeInferred?: boolean,
53
+ }
54
+ export interface SymbolDisplay {
55
+ name: string,
56
+ demangledName?: string,
57
+ address: bigint,
58
+ size: bigint,
59
+ kind: SymbolKind,
60
+ section?: number,
61
+ flags: SymbolFlags,
62
+ align?: number,
63
+ virtualAddress?: bigint,
64
+ targetSymbol?: SymbolRef,
65
+ matchPercent?: number,
66
+ diffScore?: [bigint, bigint],
67
+ rowCount: number,
68
+ }
69
+ /**
70
+ * # Variants
71
+ *
72
+ * ## `"normal"`
73
+ *
74
+ * ## `"extab"`
75
+ */
76
+ export type SymbolNavigationKind = 'normal' | 'extab';
77
+ export interface ContextItemCopy {
78
+ value: string,
79
+ label?: string,
80
+ }
81
+ export interface ContextItemNavigate {
82
+ label: string,
83
+ symbol: SymbolRef,
84
+ kind: SymbolNavigationKind,
85
+ }
86
+ export type ContextItem = ContextItemCopy | ContextItemNavigate | ContextItemSeparator;
87
+ export interface ContextItemCopy {
88
+ tag: 'copy',
89
+ val: ContextItemCopy,
90
+ }
91
+ export interface ContextItemNavigate {
92
+ tag: 'navigate',
93
+ val: ContextItemNavigate,
94
+ }
95
+ export interface ContextItemSeparator {
96
+ tag: 'separator',
97
+ }
98
+ /**
99
+ * # Variants
100
+ *
101
+ * ## `"normal"`
102
+ *
103
+ * ## `"emphasized"`
104
+ *
105
+ * ## `"special"`
106
+ */
107
+ export type HoverItemColor = 'normal' | 'emphasized' | 'special';
108
+ export interface HoverItemText {
109
+ label: string,
110
+ value: string,
111
+ color: HoverItemColor,
112
+ }
113
+ export type HoverItem = HoverItemText | HoverItemSeparator;
114
+ export interface HoverItemText {
115
+ tag: 'text',
116
+ val: HoverItemText,
117
+ }
118
+ export interface HoverItemSeparator {
119
+ tag: 'separator',
120
+ }
121
+ export interface DiffTextOpcode {
122
+ mnemonic: string,
123
+ opcode: number,
124
+ }
125
+ export interface DiffTextSymbol {
126
+ name: string,
127
+ demangledName?: string,
128
+ }
129
+ export type DiffText = DiffTextBasic | DiffTextLine | DiffTextAddress | DiffTextOpcode | DiffTextSigned | DiffTextUnsigned | DiffTextOpaque | DiffTextBranchDest | DiffTextSymbol | DiffTextAddend | DiffTextSpacing | DiffTextEol;
130
+ export interface DiffTextBasic {
131
+ tag: 'basic',
132
+ val: string,
133
+ }
134
+ export interface DiffTextLine {
135
+ tag: 'line',
136
+ val: number,
137
+ }
138
+ export interface DiffTextAddress {
139
+ tag: 'address',
140
+ val: bigint,
141
+ }
142
+ export interface DiffTextOpcode {
143
+ tag: 'opcode',
144
+ val: DiffTextOpcode,
145
+ }
146
+ export interface DiffTextSigned {
147
+ tag: 'signed',
148
+ val: bigint,
149
+ }
150
+ export interface DiffTextUnsigned {
151
+ tag: 'unsigned',
152
+ val: bigint,
153
+ }
154
+ export interface DiffTextOpaque {
155
+ tag: 'opaque',
156
+ val: string,
157
+ }
158
+ export interface DiffTextBranchDest {
159
+ tag: 'branch-dest',
160
+ val: bigint,
161
+ }
162
+ export interface DiffTextSymbol {
163
+ tag: 'symbol',
164
+ val: DiffTextSymbol,
165
+ }
166
+ export interface DiffTextAddend {
167
+ tag: 'addend',
168
+ val: bigint,
169
+ }
170
+ export interface DiffTextSpacing {
171
+ tag: 'spacing',
172
+ val: number,
173
+ }
174
+ export interface DiffTextEol {
175
+ tag: 'eol',
176
+ }
177
+ export type DiffTextColor = DiffTextColorNormal | DiffTextColorDim | DiffTextColorBright | DiffTextColorReplace | DiffTextColorDelete | DiffTextColorInsert | DiffTextColorRotating;
178
+ export interface DiffTextColorNormal {
179
+ tag: 'normal',
180
+ }
181
+ export interface DiffTextColorDim {
182
+ tag: 'dim',
183
+ }
184
+ export interface DiffTextColorBright {
185
+ tag: 'bright',
186
+ }
187
+ export interface DiffTextColorReplace {
188
+ tag: 'replace',
189
+ }
190
+ export interface DiffTextColorDelete {
191
+ tag: 'delete',
192
+ }
193
+ export interface DiffTextColorInsert {
194
+ tag: 'insert',
195
+ }
196
+ export interface DiffTextColorRotating {
197
+ tag: 'rotating',
198
+ val: number,
199
+ }
200
+ export interface DiffTextSegment {
201
+ text: DiffText,
202
+ color: DiffTextColor,
203
+ padTo: number,
204
+ }
205
+ /**
206
+ * # Variants
207
+ *
208
+ * ## `"none"`
209
+ *
210
+ * ## `"op-mismatch"`
211
+ *
212
+ * ## `"arg-mismatch"`
213
+ *
214
+ * ## `"replace"`
215
+ *
216
+ * ## `"insert"`
217
+ *
218
+ * ## `"delete"`
219
+ */
220
+ export type InstructionDiffKind = 'none' | 'op-mismatch' | 'arg-mismatch' | 'replace' | 'insert' | 'delete';
221
+ export interface InstructionDiffRow {
222
+ segments: Array<DiffTextSegment>,
223
+ diffKind: InstructionDiffKind,
224
+ }
@@ -0,0 +1,18 @@
1
+ /** @module Interface wasi:logging/logging@0.1.0-draft **/
2
+ export function log(level: Level, context: string, message: string): void;
3
+ /**
4
+ * # Variants
5
+ *
6
+ * ## `"trace"`
7
+ *
8
+ * ## `"debug"`
9
+ *
10
+ * ## `"info"`
11
+ *
12
+ * ## `"warn"`
13
+ *
14
+ * ## `"error"`
15
+ *
16
+ * ## `"critical"`
17
+ */
18
+ export type Level = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'critical';
Binary file
@@ -0,0 +1,7 @@
1
+ // world root:component/root
2
+ export type Level = import('./interfaces/wasi-logging-logging.js').Level;
3
+ export type * as WasiLoggingLogging010Draft from './interfaces/wasi-logging-logging.js'; // import wasi:logging/logging@0.1.0-draft
4
+ export * as diff from './interfaces/objdiff-core-diff.js'; // export objdiff:core/diff
5
+ export * as display from './interfaces/objdiff-core-display.js'; // export objdiff:core/display
6
+ export function init(level: Level): void;
7
+ export function version(): string;