Skip to content
Merged
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ It expects the file to be placed beside the `"program"` binary,
with `.dbg` extension.

The idea is that your debugger/adapter should not know about the format of the source
nor the assembler or compiler. It should just support breakpoints and interactive debugging.
Comment thread
mlauke marked this conversation as resolved.
nor the assembler or compiler. It should just support breakpoints and interactive debugging.
On the other side, the debugging extension for particular assembler/compiler should work
with many debuggers/emulators, supporting DAP protocol.

Expand Down Expand Up @@ -142,6 +142,7 @@ for the pack is being received.
List of emulators supporting this variation of DAP:

* Emu <img src="https://raw.githubusercontent.com/X65/emu/main/emu.gif" alt="Emu"> — The [X65 Computer](https://x65.zone/) Emulator.
* Steckschwein — The [Steckschwein](https://www.steckschwein.de/) Emulator.

If you know any other, please [create a PR][4] with an update to the list.

Expand Down
19 changes: 9 additions & 10 deletions src/cc65Debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -684,11 +684,12 @@ export class Cc65DebugSession extends LoggingDebugSession {
const sourceLines = lines || breakpoints?.map(({ line }) => line) || [];

const sourcePath = normalizePath(source.path);
const sourceBase = path.isAbsolute(source.path)
const sourcePathInWorkspace = path.isAbsolute(source.path)
? normalizePath(path.relative(workspacePath, sourcePath))
: sourcePath;
const sourceBase = path.basename(sourcePathInWorkspace);

if (sourceBase.startsWith("..")) {
if (sourcePathInWorkspace.startsWith("..")) {
return this.sendErrorResponse(response, {
id: ErrorCodes.DAP_ENV_INCORRECT,
format: "File '{sourcePath}' does not belong to workspace '{workspacePath}'",
Expand All @@ -706,14 +707,12 @@ export class Cc65DebugSession extends LoggingDebugSession {
if (!response.body.breakpoints) response.body.breakpoints = [];

if (!dbgFile) {
response.body.breakpoints = sourceLines.map((line) => ({
verified: false,
source,
line,
reason: "failed",
message: `Source file '${source.path}' is missing in debug info file.`,
}));
return this.sendResponse(response);
return this.sendErrorResponse(response, {
Comment thread
mlauke marked this conversation as resolved.
Outdated
id: ErrorCodes.DAP_ENV_INCORRECT,
format: "Source file '{sourceBase}' is missing in debug info file.",
variables: { sourceBase },
showUser: true,
});
}

// Store path base for later name reconstruction
Expand Down