cxiao,

🦀 Small Rust reversing tip: The Rust standard library documentation hides a lot of fields and items by default. For example, the documentation for the struct std::vec::Vec does not show you what a Vec's internal fields are. This can be annoying if you're looking for the implementation details of a certain type - I found that I kept having to click the "source" button on every single struct I wanted to get more information about, to look at the source code directly.

The site https://stdrs.dev/ hosts a version of the Rust standard library documentation which shows internal fields. Here's its documentation for std::vec::Vec, with the internal fields.

pub struct Vec<T, A = Global> where A: Allocator,<br></br>{<br></br>    buf: RawVec<T, A>,<br></br>    len: usize,<br></br>}<br></br>

This version of the documentation also documents some items which are hidden from the regular documentation (i.e. items marked as #[doc(hidden)]). One example is core::panic::panic_info::PanicInfo::internal_constructor, which is an implementation detail of core::panic::panic_info::PanicInfo.

Having the hosted https://stdrs.dev/ site is handy for quickly looking up certain standard library structs, but you can also generate the same information locally with rustdoc, via the --document-private-items and --document-hidden-items flags. The script used to generate the stdrs.dev site is here, and you can tweak the version of the standard library docs you want to generate as required (stdrs.dev has the nightly docs). There are some more details about the site from the author's initial Reddit post about it.

#rust #rustlang #ReverseEngineering #MalwareAnalysis

  • All
  • Subscribed
  • Moderated
  • Favorites
  • rust
  • DreamBathrooms
  • magazineikmin
  • thenastyranch
  • modclub
  • everett
  • rosin
  • Youngstown
  • slotface
  • ethstaker
  • mdbf
  • kavyap
  • osvaldo12
  • InstantRegret
  • Durango
  • megavids
  • ngwrru68w68
  • tester
  • khanakhh
  • love
  • tacticalgear
  • cubers
  • GTA5RPClips
  • Leos
  • normalnudes
  • provamag3
  • cisconetworking
  • anitta
  • JUstTest
  • All magazines