vadimcn / codelldb

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

Breakpoint in dynamic link library cannot be hit #986

Open liu8526 opened 10 months ago

liu8526 commented 10 months ago

OS: ubuntu20.04 VSCode version: 1.81.1 x64 windows CodeLLDB version: v1.9.2 Compiler: gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 Debuggee: Dynamic link library, selectively loaded through the address in the configuration file

The breakpoint in dynamic link library cannot be hit, but there is no such problem in the native lldb. When i debug dynamic link library, which is selectively loaded through the address in the configuration file. The config file is similar to the following:

        "preRunCommands": [
            "module_id": "Segment",
            "class_name": "map_Segment",
            "package": "./lib/lib_my.so",
            "inputs": [
              {
                "port_id": "port_id_0",
                "topic": "/topic/seg/map"
              }
            ],
        ]

the "lib/lib_my.so" is my dynamic link library, The breakpoint in it cannot be hit

But when I add the following command in launch.json, the problem is solved:

        "preRunCommands": [
            "settings set target.exec-search-paths ./lib",
            "target modules add ./lib/lib_my.so",
        ]
Verbose log
  
vadimcn commented 10 months ago

The config file is similar to the following:

Um, what config file? This certainly does not look like a valid Codelldb's "preRunCommands" section...

But when I add the following command in launch.json,

Well, sounds like you have a solution?

The difference in behavior with CLI lldb could be due to debugger's current working directory. Codelldb always launches adapter with cwd=${workspaceFolder}, whereas you probably launch CLI lldb from your app's directory?