Generator and future layout

When I create and use a generator, can I get the specific memory layout of the generator?
I want to get the current state of a generator in sometime . So the state information maybe stored in the specific memory.
I also want to know how to get the layout information of a Future function, the memory stores what information.Becoause Future is created from generator.

Responding to your comment from Better greedy layout computation for generators · Issue #62575 · rust-lang/rust · GitHub

Actually, I'm programming in assembly code. It makes sense to get the current state of a generator.Of cource I can use size_of_val to get the size of a Future function, but I dont' know what information is stored in which byte. So the information is recorded in debuginfo, but how can I get it?

Why do you want to access the generator state from assembly code. It is an implementation detail of the current version of rustc. Future versions may drastically change it.

Reading debuginfo depends on the platform. Windows uses pdb, pretty much all other systems use DWARF. You will need to use a library that can read it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.