vadimcn / codelldb

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

"Step Over" from a BP at a line calling dlopen on an existing .so results in "Continue" #793

Open Aster89 opened 2 years ago

Aster89 commented 2 years ago

OS: up-to-date ArchLinux VSCode version: 1.72.1 CodeLLDB version: v1.8.1 Compiler: g++ 12.2.0 Debuggee: what??

With a config file like this:

{
  "launch": {
    "adapter": "CodeLLDB", // but vscode-cpptools behaves the same
    "configurations": [
      {
        "type": "lldb",
        "name": "Launch",
        "program": "repro",
        "request": "launch",
        "args": []
      }
    ]
  }
}

and a C++ file to be debugged as the following

#include <dlfcn.h>

int main()
{
    void * lib = dlopen("/usr/share/teams/libffmpeg.so", RTLD_LAZY); // BP here
    int x{};
    ++x;
    ++x;
    ++x; // BP here
}

where the shared object /usr/share/teams/libffmpeg.so does exist on the system, hitting "Step Over" from the first breakpoint jumps directly to the second breakpoint, suggesting that "Step Over" is acting like it was "Continue".

Below is a GIF showing the weird behavior

codelldb

I've originally hit this problem on Vim + Vimspector, but only with "adapter": "CodeLLDB". With "adapter": "vscode-cpptools" I can't reproduce the issue. Below is the screencast

asciicast

Command line lldb is not affected by this problem.

vadimcn commented 2 years ago

Did you compile with -O0?

Aster89 commented 2 years ago

Did you compile with -O0?

Yes. The behavior is the same.

vadimcn commented 2 years ago

Yeah, I can repro this. The bug is somewhere in LLDB though, in my experiments cli lldb has the same problem.

Aster89 commented 2 years ago

@vadimcn , waiting for info from me? If so, what info do I need to provide?

vadimcn commented 2 years ago

The above says that I removed the "waiting for info" tag.