Skip to content

Breakpoint's path isn't normalized and it opens the file one more time with different path #170

@matepek

Description

@matepek

VSCode opens the same file with two path:

  • /Volumes/a/b/x.cpp
  • /Volumes/a/b/out/debug/../..x.cpp.

Repro:

  • launch config:
{
      "type": "lldb-mi",
      "request": "launch",
      "name": "webfreak.debug lldb-mi",
      "target": "./out/debug/Heap/Heap.test.exe",
      "cwd": "${workspaceRoot}",
      "lldbmipath": "/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi",
      "printCalls": true,
      "showDevDebugOutput": true
    }
  • version:
/Applications/Xcode.app/Contents/Developer/usr/bin/lldb-mi --version
Version: GNU gdb (GDB) 7.4 
(This is a MI stub on top of LLDB and not GDB)
  • Insert a breakpoint into the test.
  • Run the test => It will hit the breakpoint and open the same file with different path(../..).

See attached pictures:
screenshot 2019-02-17 at 9 06 28
screenshot 2019-02-17 at 9 09 21

I made some proof of concept changes in here which seems fixes the problem:

function normalize(value: any) {
	if (Array.isArray(value)) {
		if (value.length === 2 && value[0] === 'fullname') {
			value[1] = path.normalize(value[1]);
		} else {
			(<any[]>value).forEach((v: any) => { normalize(v); });
		}
	} else if (typeof value == 'object') {
		for (const prop in value) {
			normalize(value[prop]);
		}
	}
}

export class MINode implements MIInfo {
	token: number;
	outOfBandRecord: { isStream: boolean, type: string, asyncClass: string, output: [string, any][], content: string }[];
	resultRecords: { resultClass: string, results: [string, any][] };

	constructor(token: number, info: { isStream: boolean, type: string, asyncClass: string, output: [string, any][], content: string }[], result: { resultClass: string, results: [string, any][] }) {
		this.token = token;
		normalize(info);
		this.outOfBandRecord = info;
		normalize(result);
		this.resultRecords = result;
	}
...

Maybe it should be handled in vscode not in the extension.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions