CGold icon indicating copy to clipboard operation
CGold copied to clipboard

lldb: working with debug symbols

Open ruslo opened this issue 8 years ago • 9 comments

Migrated from: https://github.com/ruslo/hunter/issues/359#issuecomment-240917420:

lldb [ for OSX mostly, I guess] would require a . lldbinit file with contents along the lines of:

settings set target.source-map <old-build-directory>/Build <root-id>/Install

in its project directory [ Xcode needs the plugin https://github.com/alloy/lldb-is-it-not for this to work ]. Information from stackoverflow

ruslo avatar Aug 19 '16 10:08 ruslo

/Build

we need to avoid saving full paths while building debug version. -fdebug-prefix-map should help:

  • http://stackoverflow.com/a/19290636/2288008

ruslo avatar Aug 19 '16 18:08 ruslo

/Install

Should be something like <root-id>/Install/sources/<package>/. It means on Debug build we should install sources too somewhere. Actually I think CMake has enough information about target to do it. I guess it's only possible solution if we want to leave the packages in original state.

ruslo avatar Aug 19 '16 18:08 ruslo

Note: -fdebug-prefix-map is not available with the clang that comes with Xcode 7.1.1

Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

pretyman avatar Aug 21 '16 00:08 pretyman

From: http://stackoverflow.com/questions/9607155/make-gcc-put-relative-filenames-in-debug-information

You can use the -fdebug-prefix-map flag to remap the debugging information paths. For example, to make the paths relative to the build location use: -fdebug-prefix-map=/full/build/path=.

pretyman avatar Aug 21 '16 01:08 pretyman

Note: -fdebug-prefix-map is not available with the clang that comes with Xcode 7.1.1

What about higher versions?

Actually this may be important in the future. We need to use relative paths to implement reproducible build feature, i.e. when you build same package on different machines it should produce archive with same SHA1 value. Though for now it doesn't produce same SHA1 even for one local machine because of timestamps.

From: http://stackoverflow.com/questions/9607155/make-gcc-put-relative-filenames-in-debug-information You can use the -fdebug-prefix-map flag to remap the debugging information paths. For example, to make the paths relative to the build location use: -fdebug-prefix-map=/full/build/path=.

Yes, this is how it works. What have you tried to say? :)

ruslo avatar Aug 22 '16 07:08 ruslo

What have you tried to say? :)

Didn't imply anything, just gathering the relevant information in here. ;-)

pretyman avatar Aug 22 '16 12:08 pretyman

What about higher versions?

Seems to be available in clang that comes with Xcode 7.3.1:

Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

👍

pretyman avatar Aug 22 '16 12:08 pretyman

Didn't imply anything, just gathering the relevant information in here

Okay, no problems. Just want to be sure that I didn't miss anything.

ruslo avatar Aug 22 '16 13:08 ruslo

By the way we can keep splitting issues and divide this one into general lldb usage and Xcode integration.

Also here is homepage: http://lldb.llvm.org/

ruslo avatar Aug 22 '16 13:08 ruslo