Skip to content

Instantly share code, notes, and snippets.

@tmandry
Created June 17, 2020 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmandry/6d7004fa008684f76809208847459f9b to your computer and use it in GitHub Desktop.
Save tmandry/6d7004fa008684f76809208847459f9b to your computer and use it in GitHub Desktop.
Generator variant line info
0x00000935: DW_TAG_namespace
DW_AT_name ("generator_simple")
0x0000093a: DW_TAG_namespace
DW_AT_name ("example")
0x0000093f: DW_TAG_structure_type
DW_AT_name ("generator-0")
DW_AT_byte_size (0x20)
DW_AT_alignment (8)
0x00000946: DW_TAG_variant_part
DW_AT_discr (0x0000094b)
0x0000094b: DW_TAG_member
DW_AT_name ("__state")
DW_AT_type (0x00000927 "u8")
DW_AT_alignment (1)
DW_AT_data_member_location (0x18)
DW_AT_artificial (true)
0x00000956: DW_TAG_variant
DW_AT_discr_value (0x00)
0x00000958: DW_TAG_member
DW_AT_name ("0")
DW_AT_type (0x000009a7 "Unresumed")
DW_AT_decl_file ("/home/tmandry/code/playground/generator-simple.rs")
DW_AT_decl_line (5)
DW_AT_alignment (8)
DW_AT_data_member_location (0x00)
0x00000965: NULL
0x00000966: DW_TAG_variant
DW_AT_discr_value (0x01)
0x00000968: DW_TAG_member
DW_AT_name ("1")
DW_AT_type (0x000009ae "Returned")
DW_AT_decl_file ("/home/tmandry/code/playground/generator-simple.rs")
DW_AT_decl_line (9)
DW_AT_alignment (8)
DW_AT_data_member_location (0x00)
0x00000975: NULL
0x00000976: DW_TAG_variant
DW_AT_discr_value (0x02)
0x00000978: DW_TAG_member
DW_AT_name ("2")
DW_AT_type (0x000009b5 "Panicked")
DW_AT_decl_file ("/home/tmandry/code/playground/generator-simple.rs")
DW_AT_decl_line (9)
DW_AT_alignment (8)
DW_AT_data_member_location (0x00)
0x00000985: NULL
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)
0x00000995: NULL
0x00000996: DW_TAG_variant
DW_AT_discr_value (0x04)
0x00000998: DW_TAG_member
DW_AT_name ("4")
DW_AT_type (0x000009c3 "Suspend1")
DW_AT_decl_file ("/home/tmandry/code/playground/generator-simple.rs")
DW_AT_decl_line (8)
DW_AT_alignment (8)
DW_AT_data_member_location (0x00)
0x000009a5: NULL
0x000009a6: NULL
0x000009a7: DW_TAG_structure_type
DW_AT_name ("Unresumed")
DW_AT_byte_size (0x20)
DW_AT_alignment (8)
0x000009ae: DW_TAG_structure_type
DW_AT_name ("Returned")
DW_AT_byte_size (0x20)
DW_AT_alignment (8)
0x000009b5: DW_TAG_structure_type
DW_AT_name ("Panicked")
DW_AT_byte_size (0x20)
DW_AT_alignment (8)
0x000009bc: DW_TAG_structure_type
DW_AT_name ("Suspend0")
DW_AT_byte_size (0x20)
DW_AT_alignment (8)
0x000009c3: DW_TAG_structure_type
DW_AT_name ("Suspend1")
DW_AT_byte_size (0x20)
DW_AT_alignment (8)
0x000009ca: DW_TAG_member
DW_AT_name ("s")
DW_AT_type (0x00000905 "String")
DW_AT_alignment (8)
DW_AT_data_member_location (0x00)
0x000009d5: NULL
0x000009d6: NULL
0x000009d7: NULL
0x000009d8: NULL
#![feature(generators, generator_trait)]
use std::ops::Generator;
fn example() -> impl Generator<Yield = i32, Return = ()> {
|| {
yield 0;
let s = String::from("foo");
yield 1;
}
}
fn main() {
example();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment