Open Bug 1956038 Opened 1 year ago Updated 8 months ago

Create vscode launch configurations when running ./mach ide vscode

Categories

(Developer Infrastructure :: Developer Environment Integration, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: simonf, Unassigned)

Details

Attachments

(1 file)

It would be great to have launch configurations for debugging Firefox with

  1. launching a new process
  2. attaching to an existing process

Hey :simonf, do you have more details on this?

I found https://code.visualstudio.com/docs/debugtest/debugging-configuration but I assume you already have your own launch.json file, and you want ./mach ide to create one like it? I'm not a vscode user, so I'm unsure of the specifics, but if you can provide the specifics I'd be happy to improve ./mach ide.

Flags: needinfo?(sfriedberger)
Severity: -- → S3
Priority: -- → P3

Gijs and Malte, could you share your configurations?

Flags: needinfo?(sfriedberger)
Flags: needinfo?(maltejur)
Flags: needinfo?(gijskruitbosch+bugs)
Attached file Basic lldb launch.json

This is the launch.json I use. It should be usable on both Linux and macOS with the CodeLLDB VSCode extension. The path to the binary and profile in it would need to be generated dynamically when ./mach ide is run. We may want to provide a GDB configuration on Linux though, as that won't require an additional VSCode extension.

Flags: needinfo?(maltejur)

(In reply to Malte Jürgens [:maltejur] from comment #3)

Created attachment 9477806 [details]
Basic lldb launch.json

This is the launch.json I use. It should be usable on both Linux and macOS with the CodeLLDB VSCode extension. The path to the binary and profile in it would need to be generated dynamically when ./mach ide is run. We may want to provide a GDB configuration on Linux though, as that won't require an additional VSCode extension.

Right, I think the question here is how we'd determine the binary. I use multiple mozconfigs and objdirs with a single source dir, and if the vscode settings live in the source dir then I don't want to re-run ./mach ide every time I switch. I feel like we should be able to somehow use the active mozconfig's output "by reference" instead of hardcoding it into launch.json, but I don't know if vscode provides any facilities for that.

Flags: needinfo?(gijskruitbosch+bugs)
Component: Mach Core → Developer Environment Integration
Product: Firefox Build System → Developer Infrastructure

I have struggled to get lldb working on VS Code to debug the rust files and this has been very frustrating. This is on Windows so maybe things are different. @malte’s attach config definitely doesn’t work at all.

If someone has a solution to this it would be great to see, also i do think we should be generating a launch file with a working solution for those who don’t want to spend ages setting this up.

{
      "name": "Firefox (attach to content process)",
      "type": "lldb",
      "request": "attach",
      "pid": "${command:pickProcess}",
      "initCommands": [
        "command source \"${workspaceFolder}/.lldbinit\""
      ],
      "program": "${workspaceFolder}/obj-x86_64-pc-windows-msvc/dist/bin/firefox.exe",
      "sourceLanguages": ["c", "cpp", "rust"]
    },

Doesn't seem to work for me, i have CodeLLDB installed, firefox built and i think symbols built (xul.pdb has been created)

I have raised a separate issue here for the CodeLLDB debugging not working, if anyone knows your help would be appreciated:
https://bugzilla.mozilla.org/show_bug.cgi?id=1994666

After playing with this some more i would add "process handle -s false SIGSYS" to the config as this reduces the amount of exceptions which get thrown that you can't do anything about.

So now my configuration is this:

{
    "configurations": [
        {
            "name": "Firefox (attach to content process)",
            "type": "lldb",
            "request": "attach",
            "pid": "${command:pickProcess}",
            "initCommands": [
                "command source \"${workspaceFolder}/.lldbinit\"",
                "process handle -s false SIGSYS"
            ],
            "sourceLanguages": ["c", "cpp", "rust"]
        },
    ]
}
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: