... | @@ -284,6 +284,45 @@ DWARF information allows `perf` to locate the source code that belongs |
... | @@ -284,6 +284,45 @@ DWARF information allows `perf` to locate the source code that belongs |
|
to the "hot" assembler code. Note that the fairly nonsensical `add %al,(%r8)` instructions is info table data, which `perf` is
|
|
to the "hot" assembler code. Note that the fairly nonsensical `add %al,(%r8)` instructions is info table data, which `perf` is
|
|
interpreting as code.
|
|
interpreting as code.
|
|
|
|
|
|
|
|
## lldb
|
|
|
|
|
|
|
|
`lldb` can interpret the DWARF data produced by GHC, and in some respects it can do it better than `gdb`.
|
|
|
|
|
|
|
|
```wiki
|
|
|
|
$ lldb ./fib
|
|
|
|
Current executable set to './fib' (x86_64).
|
|
|
|
(lldb) break set -f fib.hs -l 3
|
|
|
|
Breakpoint 1: where = fib`rnf_info + 207 [inlined] c2rw_entry, address = 0x00000000004056f7
|
|
|
|
(lldb) r
|
|
|
|
Process 1901610 launched: './fib' (x86_64)
|
|
|
|
Process 1901610 stopped
|
|
|
|
* thread #1: tid = 1901610, 0x00000000004056f7 fib`rnf_info [inlined] c2rw_entry at fib.hs:3, name = 'fib', stop reason = breakpoint 1.1
|
|
|
|
frame #0: 0x00000000004056f7 fib`rnf_info [inlined] c2rw_entry at fib.hs:3
|
|
|
|
1 fib :: Int -> Int
|
|
|
|
2 fib 0 = 0
|
|
|
|
-> 3 fib 1 = 1
|
|
|
|
4 fib n = fib (n-1) + fib (n-2)
|
|
|
|
5 main :: IO ()
|
|
|
|
6 main = print $ sum [ fib i | i <- [3..20]]
|
|
|
|
(lldb) image lookup -a 0x00000000004056f7 -v
|
|
|
|
Address: fib[0x00000000004056f7] (fib..text + 10967)
|
|
|
|
Summary: fib`rnf_info + 207 [inlined] c2rw_entry
|
|
|
|
fib`rnf_info + 207 [inlined] c2rr_entry
|
|
|
|
fib`rnf_info + 207 at
|
|
|
|
Module: file = "./fib", arch = "x86_64"
|
|
|
|
CompileUnit: id = {0x00000000}, file = "/data/users/bnitka/tmp/fib.hs", language = "Language(language = 0x0018)"
|
|
|
|
Function: id = {0x000003b1}, name = "fib", range = [0x0000000000405628-0x0000000000405707)
|
|
|
|
FuncType: id = {0x000003b1}, clang_type = "void (void)"
|
|
|
|
Blocks: id = {0x000003b1}, range = [0x00405628-0x00405707)
|
|
|
|
id = {0x00000495}, ranges = [0x00405675-0x0040567f)[0x0040567f-0x00405685)[0x004056e2-0x004056e7)[0x004056d2-0x004056e2)[0x00405685-0x004056c9)[0x004056f7-0x00405707)[0x004056e7-0x004056f7), name = "c2rr_entry"
|
|
|
|
id = {0x00000539}, range = [0x004056f7-0x00405707), name = "c2rw_entry"
|
|
|
|
LineEntry: [0x00000000004056f7-0x0000000000405720): /data/users/bnitka/tmp/fib.hs:3:9
|
|
|
|
Symbol: id = {0x00000057}, range = [0x0000000000405628-0x0000000000405707), name="rnf_info"
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
Note that we get line number + column number, AFAICT there's no way to do that in gdb.
|
|
|
|
|
|
## Open Issues
|
|
## Open Issues
|
|
|
|
|
|
|
|
|
... | | ... | |