vadimcn / codelldb

A native debugger extension for VSCode based on LLDB
https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb
MIT License
2.43k stars 237 forks source link

Breakpoints in vscode are never hit #907

Closed lylythechosenone closed 1 year ago

lylythechosenone commented 1 year ago

OS: MacOS Ventura 13.1 (aarch64-apple-darwin) VSCode version: 1.77.1 CodeLLDB version: 1.9.0 Compiler: rust nightly 1.70.0 Debuggee: linux-like kernel within qemu (raw binary in qemu with ELF symbol file in lldb)

Setting breakpoints in vscode does not work (sometimes). Setting them in the console always works, but breakpoints set in vscode are never reached. If I set a breakpoint on a function in the console, further breakpoints in the same function (possibly same file) work fine.

This is my launch config:

{
    "type": "lldb",
    "name": "Remote",
    "request": "custom",
    "targetCreateCommands": [
        "target create --no-dependents --arch arm64 ${workspaceFolder}/kernel",
        "target modules load --file ${workspaceFolder}/kernel --slide 0x40080000"
    ],
    "processCreateCommands": [
        "gdb-remote localhost:1234"
    ],
}

Log shows nothing unusual, just setting the breakpoints by filenames and lines.

GimpMaster commented 1 year ago

I'm having the same issue. Using Windows WSL 2.

Program runs but breakpoints never get hit. Even when adding breakpoints in the console.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug (LLDB)",
      "type": "lldb",
      "request": "launch",
      "program": "${workspaceFolder}/Application",
      "args": [
      ],
      "cwd": "${workspaceFolder}",
      "env": {
        "LD_LIBRARY_PATH": "/home/lib_a64/code/bin"
      },
      "preLaunchTask": "build"
    }
  ]
}
vadimcn commented 1 year ago

@lylythechosenone: This sounds like a source path mapping issue.
You can also try a new feature in v1.9.1, which allows resolving breakpoints using file name only, like it works in the console. See breakpointMode.

@GimpMaster: Given that you are using Windows/WSL and the original issue is about Linux, it is unlikely that they are related.

... Even when adding breakpoints in the console.

I strongly suspect this isn't a CodeLLDB issue, but rather something about the debug info for your binary. Try to diagnose it as described here.

SplitGemini commented 1 year ago

But Microsoft C/C++ plugin works fine.