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
Expose all static crate variables as sysfs-style entries, to aid in debugging and analysis of program states.
Inspired by Cristiano Giuffrida's PeekFS (which I cannot find any public references to).
We can parse the debug_ sections of each object file and then use the DWARF DIE trees to get the string name of the variable symbol and it's type. And based on the sysfs directory we're in, we'll know which crate to look it.
Speaking of, the sysfs root will have a namespaces directory, which will have all of the CrateNamespaces, and each CrateNamespace has a list of LoadedCrates. In each LoadedCrate, there is a list of LoadedSections, each of which will comprise another directory.
Finally, in each LoadedCrate, there will be a directory for every static variable defined in that crate. Within each variable's directory, there will be a debug__ and display__ file that you can cat to invoke the Display or Debug traits implementations for that variable type.
Stretch goal: show the variable type's struct members as subdirectories in the variable's directory, so we can recurse into each member to further explore the struct. This should be do-able since we'll know what the type of the struct is; though we might not be able to read the struct definition directly (unless it's in the Dwarf debug sections somewhere?).
The text was updated successfully, but these errors were encountered:
As of late September 2019, around commit d4ca13c, we have full support for parsing DWARF-formatted sections and obtaining debug information, so it should be quite straightforward to leverage it to get type information at runtime.
We can use this both for outputting symbol debug files to use with GDB externally (e.g., a GDB instance connected to QEMU running Theseus), as well as for the above PeekFS-style filesystem state explorer.
Expose all static crate variables as sysfs-style entries, to aid in debugging and analysis of program states.
Inspired by Cristiano Giuffrida's PeekFS (which I cannot find any public references to).
We can parse the
debug_
sections of each object file and then use the DWARF DIE trees to get the string name of the variable symbol and it's type. And based on the sysfs directory we're in, we'll know which crate to look it.Speaking of, the sysfs root will have a
namespaces
directory, which will have all of theCrateNamespace
s, and eachCrateNamespace
has a list ofLoadedCrates
. In eachLoadedCrate
, there is a list ofLoadedSection
s, each of which will comprise another directory.Finally, in each
LoadedCrate
, there will be a directory for every static variable defined in that crate. Within each variable's directory, there will be adebug__
anddisplay__
file that you cancat
to invoke theDisplay
orDebug
traits implementations for that variable type.Stretch goal: show the variable type's struct members as subdirectories in the variable's directory, so we can recurse into each member to further explore the struct. This should be do-able since we'll know what the type of the struct is; though we might not be able to read the struct definition directly (unless it's in the Dwarf debug sections somewhere?).
The text was updated successfully, but these errors were encountered: