Re: [RFC 3/6] scripts/simpletrace-rust: Add helpers to parse trace file

2024-05-28 Thread Zhao Liu
> > +fn read_type(mut fobj: &File) -> Result > > +{ > > +let mut tbuf = [0u8; 8]; > > +if let Err(e) = fobj.read_exact(&mut tbuf) { > > +if e.kind() == ErrorKind::UnexpectedEof { > > +return Ok(RecordType::Empty); > > +} else { > > +

Re: [RFC 3/6] scripts/simpletrace-rust: Add helpers to parse trace file

2024-05-27 Thread Stefan Hajnoczi
On Mon, May 27, 2024 at 04:14:18PM +0800, Zhao Liu wrote: > Refer to scripts/simpletrace.py, add the helpers to read the trace file > and parse the record type field, record header and log header. > > Suggested-by: Paolo Bonzini > Signed-off-by: Zhao Liu > --- > scripts/simpletrace-rust/src/mai