You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 28, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/dwarf.md
+132Lines changed: 132 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -19,3 +19,135 @@ debugger won't find the line number information. On macOS the debuginfo relocati
19
19
section relative and not symbol relative.
20
20
See [#303 (comment)](https://github.com/bjorn3/rustc_codegen_cranelift/issues/303#issuecomment-457825535)
21
21
for more information.
22
+
23
+
# Function debuginfo
24
+
25
+
## Tips
26
+
27
+
`DW_TAG_subprogram` requires `DW_AT_name`, `DW_AT_low_pc` and `DW_AT_high_pc`**or**`DW_AT_ranges`.
28
+
Otherwise gdb will silently skip it. When `DW_AT_high_pc` is a length instead of an address, the
29
+
DWARF version must be at least 4.
30
+
31
+
<details>
32
+
<summary>IRC log of #gdb on irc.freenode.org at 2020-04-23</summary>
33
+
34
+
```
35
+
(13:46:11) bjorn3: i am writing a backend for a compiler that uses DWARF for debuginfo. for some reason gdb seems to completely ignore all DW_TAG_subprogram, while lldb works fine. any idea what the problem could be?
36
+
(13:47:49) bjorn3: this is the output of llvm-dwarfdump: https://gist.github.com/bjorn3/8a34e333c80f13cb048381e94b4a3756
37
+
(13:47:50) osa1: luispm: why is that problem not exists in 'commands'? (the target vs. host)
38
+
(13:52:16) luispm: osa1, commands is a bit more high level. It executes isolated commands. Breakpoint conditions need to be evaluated in the context of a valid expression. That expression may involve variables, symbols etc.
39
+
(13:52:36) luispm: osa1, Oh, i see your point now. Commands is only executed on the host.
40
+
(13:53:18) luispm: osa1, The commands are not tied to the execution context of the debugged program. The breakpoint conditions determine if execution must stop or continue etc.
41
+
(13:55:00) luispm: bjorn3, Likely something GDB thinks is wrong. Does enabling "set debug dwarf*" show anything?
42
+
(13:56:01) bjorn3: luispm: no
43
+
(13:56:12) bjorn3: for more context: https://github.com/bjorn3/rustc_codegen_cranelift/pull/978
44
+
(13:58:16) osa1 verliet de ruimte (quit: Quit: osa1).
45
+
(13:58:28) bjorn3: luispm: wait, for b m<TAB> it shows nothing, but when stepping into a new function it does
46
+
(13:58:45) bjorn3: it still doesn't show anything for `info args` though
47
+
(13:58:50) bjorn3: No symbol table info available.
48
+
(14:00:50) luispm: bjorn3, Is that expected given the nature of the binary?
49
+
(14:01:17) bjorn3: b main<TAB> may show nothing as I only set DW_AT_linkage_name and not DW_AT_name
50
+
(14:01:24) bjorn3: info args should work though
51
+
(14:03:26) luispm: Sorry, I'm not sure what's up. There may be a genuine bug there.
52
+
(14:03:41) luispm: tromey (not currently in the channel, but maybe later today) may have more input.
53
+
(14:04:08) bjorn3: okay, thanks luispm!
54
+
(14:04:27) luispm: In the worst case, reporting a bug may prompt someone to look into that as well.
55
+
(14:04:48) luispm: Or send an e-mail to the [email protected] mailing list.
56
+
(14:05:11) bjorn3: I don't know if it is a bug in gdb, or just me producing (slightly) wrong DWARF
(15:22:45) irker749: gdb: tromey binutils-gdb.git:master * ecc6c6066b5 / gdb/ChangeLog gdb/dwarf2/read.c gdb/unittests/lookup_name_info-selftests.c: Fix Ada crash with .debug_names
59
+
(15:23:13) bjorn3: tromey: ping
60
+
(15:23:29) tromey: bjorn3: hey
61
+
(15:24:16) bjorn3: I am writing a backend for a compiler which uses DWARF for debuginfo. I unfortunately can't get gdb to show arguments. lldb works fine.
62
+
(15:25:13) bjorn3: it just says: No symbol table info available.
(16:06:12) ryoshu: just soft ping, I have a queue of patches :)
140
+
(16:06:22) tromey: using this as a length requires DWARF 4
141
+
(16:06:36) tromey: for gdb at least it's fine to always emit DWARF 4
142
+
(16:06:44) bjorn3: trying dwarf 4 now
143
+
(16:06:48) tromey: I think there are some DWARF 5 features still in the works but DWARF 4 should be solid AFAIK
144
+
(16:07:03) tromey: fini
145
+
(16:07:08) tromey: lol wrong window
146
+
(16:07:56) mjw: Maybe you can accept it for DWARF < 4. But if I remember correctly it might be that people might have been using udata as if it was an address...
147
+
(16:08:13) tromey: yeah, I vaguely recall this as well, though I'd expect there to be a comment
148
+
(16:08:21) mjw: Cannot really remember why it needed version >= 4. Maybe there was no good reason?
149
+
(16:08:32) bjorn3: tromey: it works!!!! thanks for all the help!
0 commit comments