llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.38k stars 11.72k forks source link

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

Open borjamunozf opened 1 week ago

borjamunozf commented 1 week ago

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

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 commented 1 week ago

Probaby related to #63973

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

llvmbot commented 5 days ago

@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 ```json { "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: ```json { "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](https://github.com/user-attachments/assets/18b2c208-8cde-419c-8e67-e05535c1540f) I'll be happy to provide any info! Thanks a lot.
vogelsgesang commented 5 days ago

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

jimingham commented 5 days ago

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 commented 5 days ago

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 commented 4 days ago

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:

Edited:

gdb-multiarch /mnt/disk1/app/bin/WhateverApp coreDump
> bt 

imagen