Skip to content

Commit b192b1a

Browse files
committed
improve attach debugger
1 parent b6b4bae commit b192b1a

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/debugger/AttachDebugSession.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,16 @@ export class AttachDebugSession extends EmmyDebugSession implements ExprEvaluato
336336
return undefined;
337337
}
338338
}
339+
const extList = ["", ".lua", ".lua.txt"];
339340
for (let index = 0; index < this.sourcePaths.length; index++) {
340341
const p = this.sourcePaths[index];
341-
const absPath = path.join(p, filePath);
342-
if (fs.existsSync(absPath)) {
343-
return absPath;
342+
for (let j = 0; j < extList.length; j++) {
343+
const ext = extList[j];
344+
345+
const absPath = path.join(p, `${filePath}${ext}`);
346+
if (fs.existsSync(absPath)) {
347+
return absPath;
348+
}
344349
}
345350
}
346351
}

src/debugger/ByteArray.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ export class ByteArray {
2323
}
2424

2525
writeUint64(value: number) {
26-
this.buffer.writeUInt32BE(value >> 8);
27-
this.buffer.writeUInt32BE(value & 0xfffffff);
26+
this.buffer.writeUInt32BE(value >> 31);
27+
this.buffer.writeUInt32BE(value & 0xffffffff);
2828
}
2929

3030
readUint64(): number {
31-
let l = this.buffer.readUInt32BE() << 8;
31+
let l = this.buffer.readUInt32BE() << 31;
3232
let r = this.buffer.readUInt32BE();
3333
return l + r;
3434
}

0 commit comments

Comments
 (0)