tips for debugging the swift executable


(Jon Rafkind) #1

I use gdb on linux to debug the swift binary. I find that gdb takes about 20 seconds just to read the symbols before I can even interact with gdb. I was wondering if anyone knew of a way to decrease the symbol load time, either by some gdb settings or by compiling swift/llvm/clang in such a way as to get a usefully debuggable binary but without so many symbols.

My swift binary is a massive 1.1gb.

$ ls -lh swift
-rwxr-xr-x 1 jon jon 1.1G Dec 8 18:43 swift*

I built all of llvm/clang/swift in Debug mode.

(Tangentially related, but using gold instead of ld to link swift is about 2-3x faster)

···

--


(Joe Groff) #2

You might give lldb a shot, if you haven't already. It seems to cope better with large binaries, and expr evaluation is more stable IME.

-Joe

···

On Dec 17, 2015, at 2:57 PM, Rafkind, Jon via swift-dev <swift-dev@swift.org> wrote:

I use gdb on linux to debug the swift binary. I find that gdb takes about 20 seconds just to read the symbols before I can even interact with gdb. I was wondering if anyone knew of a way to decrease the symbol load time, either by some gdb settings or by compiling swift/llvm/clang in such a way as to get a usefully debuggable binary but without so many symbols.

My swift binary is a massive 1.1gb.

$ ls -lh swift
-rwxr-xr-x 1 jon jon 1.1G Dec 8 18:43 swift*

I built all of llvm/clang/swift in Debug mode.

(Tangentially related, but using gold instead of ld to link swift is about 2-3x faster)


(Kate Stone) #3

Better yet, since LLDB is where we have comprehensive support for debugging Swift binaries you'll have a common debugger experience across your C/C++/Swift code.

Kate Stone k8stone@apple.com
 Xcode Low Level Tools

···

On Dec 17, 2015, at 3:09 PM, Joe Groff via swift-dev <swift-dev@swift.org> wrote:

On Dec 17, 2015, at 2:57 PM, Rafkind, Jon via swift-dev <swift-dev@swift.org> wrote:

I use gdb on linux to debug the swift binary. I find that gdb takes about 20 seconds just to read the symbols before I can even interact with gdb. I was wondering if anyone knew of a way to decrease the symbol load time, either by some gdb settings or by compiling swift/llvm/clang in such a way as to get a usefully debuggable binary but without so many symbols.

My swift binary is a massive 1.1gb.

$ ls -lh swift
-rwxr-xr-x 1 jon jon 1.1G Dec 8 18:43 swift*

I built all of llvm/clang/swift in Debug mode.

(Tangentially related, but using gold instead of ld to link swift is about 2-3x faster)

You might give lldb a shot, if you haven't already. It seems to cope better with large binaries, and expr evaluation is more stable IME.

-Joe

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev