ruslo / CGold

:whale2: The Hitchhiker’s Guide to the CMake
https://cgold.readthedocs.io
BSD 2-Clause "Simplified" License
521 stars 57 forks source link

lldb: working with debug symbols #6

Open ruslo opened 8 years ago

ruslo commented 8 years ago

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 commented 8 years ago
/Build

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

ruslo commented 8 years ago
/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.

pretyman commented 8 years ago

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 commented 8 years ago

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=.

ruslo commented 8 years ago

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? :)

pretyman commented 8 years ago

What have you tried to say? :)

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

pretyman commented 8 years ago

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

👍

ruslo commented 8 years ago

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 commented 8 years ago

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/