Skip to content

Commit

Permalink
feat(event): Define Error event
Browse files Browse the repository at this point in the history
  • Loading branch information
SersemPeca committed Jan 29, 2025
1 parent d793b27 commit aa37e95
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime_tracing"
version = "0.5.16"
version = "0.6.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mod tests {
tracer.register_asm(&["asm0".to_string(), "asm1".to_string()]);
tracer.register_special_event(EventLogKind::Write, "test");
tracer.register_special_event(EventLogKind::Write, "test2");
tracer.register_special_event(EventLogKind::Error, "testError");

let function_path_id = tracer.ensure_path_id(&path);
let function_line = Line(3);
Expand Down Expand Up @@ -88,7 +89,7 @@ mod tests {
tracer.register_return(NONE_VALUE);
tracer.drop_variable("test_variable3");

assert_eq!(tracer.events.len(), 33);
assert_eq!(tracer.events.len(), 34);
// visible with
// cargo tets -- --nocapture
// println!("{:#?}", tracer.events);
Expand Down
12 changes: 12 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ use num_derive::FromPrimitive;
use serde::{Deserialize, Serialize};
use serde_repr::*;

// currently, we do assume that we record the whole program
// so, we try to include minimal amount of data,
// as we can reconstruct some things like depth, id-s etc
// afterwards in postprocessing
// this assumption can change in the future

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum TraceLowLevelEvent {
Step(StepRecord),
Expand All @@ -19,12 +25,17 @@ pub enum TraceLowLevelEvent {
Return(ReturnRecord),
Event(RecordEvent),
Asm(Vec<String>),

// experimental modification value tracking events
CompoundValue(CompoundValueRecord),
CellValue(CellValueRecord),
AssignCompoundItem(AssignCompoundItemRecord),
AssignCell(AssignCellRecord),
VariableCell(VariableCellRecord),
DropVariable(VariableId),

// normal event, workaround for cases when we need to drop
// a step event, but the trace needs to be append-only
DropLastStep,
}

Expand Down Expand Up @@ -371,6 +382,7 @@ pub enum EventLogKind {
CloseDir,
Socket,
Open,
Error,
// used for trace events
TraceLogEvent,
}

0 comments on commit aa37e95

Please sign in to comment.