about summary refs log tree commit diff
path: root/src/rustllvm/CoverageMappingWrapper.cpp
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-06-25 18:00:08 -0700
committerGitHub <noreply@github.com>2020-06-25 18:00:08 -0700
commit3f5b8c800e546809b374aecad992689712ab00d6 (patch)
tree0d0b6054ebaa66d33b34294e06bb96206f009cf7 /src/rustllvm/CoverageMappingWrapper.cpp
parentc50d9816c7b8fee1a7fa2fb7c6c47fc9b9ddd83f (diff)
parent887fbd9d3411ea7def2cc7a508d74bea6b7f19bb (diff)
downloadrust-3f5b8c800e546809b374aecad992689712ab00d6.tar.gz
rust-3f5b8c800e546809b374aecad992689712ab00d6.zip
Rollup merge of #73460 - tmandry:variant-lineinfo, r=oli-obk
Emit line info for generator variants

Debuggers should be able to read a generator / async fn state machine and show the line it's suspended at. Eventually, this could grow into an "async stack trace" feature of sorts. While no debugger support this for Rust today, this PR adds the debuginfo necessary for that support to exist.

[This gist](https://gist.github.com/tmandry/6d7004fa008684f76809208847459f9b) shows the resulting debuginfo for a simple example. Here's a snippet:

```
0x00000986:           DW_TAG_variant
                        DW_AT_discr_value       (0x03)

0x00000988:             DW_TAG_member
                          DW_AT_name    ("3")
                          DW_AT_type    (0x000009bc "Suspend0")
                          DW_AT_decl_file       ("/home/tmandry/code/playground/generator-simple.rs")
                          DW_AT_decl_line       (6)
                          DW_AT_alignment       (8)
                          DW_AT_data_member_location    (0x00)
```

The file and line have been added here. The line currently points to the beginning of the statement containing the yield (or await), because that's what the MIR source info points to for the yield terminator. (We may want to point to the yield or await line specifically, but that can be done independently of this change.)

Debuggers don't know how to use this kind of info yet. However, we're hoping to experiment with adding such support to Fuchsia's debugger. It would be exciting if someone were interested in adding similar to support to gdb/lldb.

r? @oli-obk
cc @eddyb @jonas-schievink

Part of #73524.
Diffstat (limited to 'src/rustllvm/CoverageMappingWrapper.cpp')
0 files changed, 0 insertions, 0 deletions