Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lldb] Core dump not able to resolve source locations nor loading debug symbols? #110253

Open
borjamunozf opened this issue Sep 27, 2024 · 6 comments
Labels

Comments

@borjamunozf
Copy link

borjamunozf commented Sep 27, 2024

Hello! Trying to debug a core dump that works with GDB and Vscode but it does not with lldb-dap / lldb.

  • Working config with vscode - gdb
 {
      "name": "(gdb) Launch Core Dump",
      "type": "cppdbg",
      "request": "launch",
      "program": "/mnt/disk1/sad/bin/AsdfApp",
      "args": ["-g "],
      "stopAtEntry": false,
      "coreDumpPath": "${workspaceFolder}/coreDump",
      "sourceFileMap": {
          "/asdshell": "${workspaceFolder}",
      },
      "additionalSOLibSearchPath": "/mnt/disk1/asd/app/lib",
      "cwd": "${workspaceFolder}",
      "miDebuggerPath": "/usr/bin/gdb-multiarch",
      "MIMode": "gdb",
      "logging": {
        "engineLogging":"verbose",
        "trace": true,
        "traceResponse": true,
      },
}
  • Trying to mimick functionality with lldb-dap:
 {
      "name": "(lldb-dap) Launch Core Dump",
      "type": "lldb-dap",
      "request": "attach",
      "coreFile": "${workspaceFolder}/coreDump",
      "program": "/mnt/disk1/asd/app/bin/AsdfApp",
      "sourceMap": [
        ["/asdshell", "${workspaceFolder}"]
        ],
      "preRunCommands":[
        "target symbols add /mnt/disk1/asd/app/bin/asdasda.debug",
      ],
      "initCommands":[
        "settings set target.source-map /asdshell ${workspaceFolder}",
        "settings set target.exec-search-paths /mnt/disk1/asd/app/lib:${input:asdfSysPath}/sysroots/x86-asd-linux/",
      ],
      "internalConsoleOptions": "openOnFirstSessionStart"
      
    }

The warning message with loading target symbols from .debug:

Running preRunCommands:
(lldb) target symbols add /mnt/disk1/rcs/app/bin/DispApp.debug
symbol file '/mnt/disk1/asd/app/bin/asdasddas.debug' has been added to '/mnt/disk1/asd/app/bin/asdasd'
warning: (i386) /mnt/disk1/asd/app/bin/asdasdsda 0x000cfcbd: DW_AT_specification(0x000000000009349e) has no decl

Info from breakpoints:

breakpoint list --verbose
(lldb) breakpoint list --verbose
Current breakpoints:
1: file = '/asdshell/asd/Main/Whatever/Source/WhateverInit.cpp, line = 13, exact_match = 0

2: file = '/asdshell/asd/Main/Whatever/Source/WhateverInit.cpp', line = 98, exact_match = 0

If I try to put the breakpoint other file it shows:

warning: failed to set breakpoint site at 0xc8b5630 for breakpoint 3.1: error: elf-core does not support enabling breakpoints
warning: failed to set breakpoint site at 0xc8b56ce for breakpoint 3.2: error: elf-core does not support enabling breakpoints

Show source map:

settings show target.source-map
(lldb) settings show target.source-map
target.source-map (path-map) =
[0] "/asdshell" -> "/home/borjamf/workspace/asd_shell"

imagen

I'll be happy to provide any info! Thanks a lot.

@borjamunozf
Copy link
Author

Probaby related to #63973

I guess there is no solution, we have to keep suffering cppdbg with gdb.

@llvmbot
Copy link
Collaborator

llvmbot commented Oct 3, 2024

@llvm/issue-subscribers-lldb

Author: None (borjamunozf)

Hello! Trying to debug a core dump that works with GDB and Vscode but it does not with lldb-dap / lldb.
  • Working config with vscode - gdb
 {
      "name": "(gdb) Launch Core Dump",
      "type": "cppdbg",
      "request": "launch",
      "program": "/mnt/disk1/sad/bin/AsdfApp",
      "args": ["-g "],
      "stopAtEntry": false,
      "coreDumpPath": "${workspaceFolder}/coreDump",
      "sourceFileMap": {
          "/asdshell": "${workspaceFolder}",
      },
      "additionalSOLibSearchPath": "/mnt/disk1/asd/app/lib",
      "cwd": "${workspaceFolder}",
      "miDebuggerPath": "/usr/bin/gdb-multiarch",
      "MIMode": "gdb",
      "logging": {
        "engineLogging":"verbose",
        "trace": true,
        "traceResponse": true,
      },
}
  • Trying to mimick functionality with lldb-dap:
 {
      "name": "(lldb-dap) Launch Core Dump",
      "type": "lldb-dap",
      "request": "attach",
      "coreFile": "${workspaceFolder}/coreDump",
      "program": "/mnt/disk1/asd/app/bin/AsdfApp",
      "sourceMap": [
        ["/asdshell", "${workspaceFolder}"]
        ],
      "preRunCommands":[
        "target symbols add /mnt/disk1/asd/app/bin/asdasda.debug",
      ],
      "initCommands":[
        "settings set target.source-map /asdshell ${workspaceFolder}",
        "settings set target.exec-search-paths /mnt/disk1/asd/app/lib:${input:asdfSysPath}/sysroots/x86-asd-linux/",
      ],
      "internalConsoleOptions": "openOnFirstSessionStart"
      
    }

The warning message with loading target symbols from .debug:

Running preRunCommands:
(lldb) target symbols add /mnt/disk1/rcs/app/bin/DispApp.debug
symbol file '/mnt/disk1/asd/app/bin/asdasddas.debug' has been added to '/mnt/disk1/asd/app/bin/asdasd'
warning: (i386) /mnt/disk1/asd/app/bin/asdasdsda 0x000cfcbd: DW_AT_specification(0x000000000009349e) has no decl

Info from breakpoints:

breakpoint list --verbose
(lldb) breakpoint list --verbose
Current breakpoints:
1: file = '/asdshell/asd/Main/Whatever/Source/WhateverInit.cpp, line = 13, exact_match = 0

2: file = '/asdshell/asd/Main/Whatever/Source/WhateverInit.cpp', line = 98, exact_match = 0

If I try to put the breakpoint other file it shows:

warning: failed to set breakpoint site at 0xc8b5630 for breakpoint 3.1: error: elf-core does not support enabling breakpoints
warning: failed to set breakpoint site at 0xc8b56ce for breakpoint 3.2: error: elf-core does not support enabling breakpoints

Show source map:

settings show target.source-map
(lldb) settings show target.source-map
target.source-map (path-map) =
[0] "/asdshell" -> "/home/borjamf/workspace/asd_shell"

imagen

I'll be happy to provide any info! Thanks a lot.

@vogelsgesang
Copy link
Member

Seems to be a general lldb issue, not specific to lldb-dap

@jimingham
Copy link
Collaborator

jimingham commented Oct 3, 2024

It would be useful here to separate possible problems with core files from problems with symbols. To that end, can you run a process under lldb with the same executable and symbol files, and see if you see source information in places where with core files you weren't. The speculation from the other report you linked to was that this was lack of support for some gcc DWARF constructs. If that's what is going on, just loading the executable & symbol file into lldb and running source info -f some_source_file.c should also fail.

@jimingham
Copy link
Collaborator

The title threw me off a bit because "why would you want to set breakpoints in a core file"... And certainly you can't "hit" them since core files can't execute (at least on any system I know about).

@borjamunozf
Copy link
Author

borjamunozf commented Oct 4, 2024

You're right about setting the breakpoints in the core dump, my fault. I mxied with other stuf I'm working on!
With the title I was referring for not reaching breakpoint it was more to the core dump line or source code.

It would be useful here to separate possible problems with core files from problems with symbols. To that end, can you run a process under lldb with the same executable and symbol files, and see if you see source information in places where with core files you weren't. The speculation from the other report you linked to was that this was lack of support for some gcc DWARF constructs. If that's what is going on, just loading the executable & symbol file into lldb and running source info -f some_source_file.c should also fail.

So my issue, as whole, its:

  • the core dump is not hitting or reaching anywhere as the GDB config one. I think the sourceMap it's not working properly, because it says Unknown Source File..,

Edited:

  • Running LLDB command line versus GDB it shows the blatant difference for source code location (LLDB does not anything, GDB by default already shows where it tries or where it referes to, even we have to change the sourceMap accordingly)
 lldb 
> settings set target.source-map /asdshell /mypath/whatever
> settings set target.exec-search-paths /mnt/disk1/asd/lib:blablablalba/sysroots
> target create --core /mypath/whatever/coreDump /mnt/disk1/app/bin/WhateverApp
> bt all
gdb-multiarch /mnt/disk1/app/bin/WhateverApp coreDump
> bt 

imagen

@vogelsgesang vogelsgesang changed the title [lldb-dap] vscode - Core dump debugging not hitting breakpoints nor loading debug symbols? [lldb] Core dump not able to resolve source locations nor loading debug symbols? Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants