Skip to content

Commit 3b088f0

Browse files
committed
feat(event): Define Error event
1 parent 8f69cfb commit 3b088f0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ mod tests {
2323
tracer.register_step(path, Line(2));
2424
tracer.register_special_event(EventLogKind::Write, "test");
2525
tracer.register_special_event(EventLogKind::Write, "test2");
26+
tracer.register_special_event(EventLogKind::Error, "testError");
2627

2728
let function_path_id = tracer.ensure_path_id(&path);
2829
let function_line = Line(3);
@@ -87,7 +88,7 @@ mod tests {
8788
tracer.register_return(NONE_VALUE);
8889
tracer.drop_variable("test_variable3");
8990

90-
assert_eq!(tracer.events.len(), 32);
91+
assert_eq!(tracer.events.len(), 33);
9192
// visible with
9293
// cargo tets -- --nocapture
9394
// println!("{:#?}", tracer.events);

src/types.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ use num_derive::FromPrimitive;
66
use serde::{Deserialize, Serialize};
77
use serde_repr::*;
88

9+
// currently, we do assume that we record the whole program
10+
// so, we try to include minimal amount of data,
11+
// as we can reconstruct some things like depth, id-s etc
12+
// afterwards in postprocessing
13+
// this assumption can change in the future
14+
915
#[derive(Debug, Clone, Serialize, Deserialize)]
1016
pub enum TraceLowLevelEvent {
1117
Step(StepRecord),
@@ -18,12 +24,17 @@ pub enum TraceLowLevelEvent {
1824
Call(CallRecord),
1925
Return(ReturnRecord),
2026
Event(RecordEvent),
27+
28+
// experimental modification value tracking events
2129
CompoundValue(CompoundValueRecord),
2230
CellValue(CellValueRecord),
2331
AssignCompoundItem(AssignCompoundItemRecord),
2432
AssignCell(AssignCellRecord),
2533
VariableCell(VariableCellRecord),
2634
DropVariable(VariableId),
35+
36+
// normal event, workaround for cases when we need to drop
37+
// a step event, but the trace needs to be append-only
2738
DropLastStep,
2839
}
2940

@@ -370,6 +381,7 @@ pub enum EventLogKind {
370381
CloseDir,
371382
Socket,
372383
Open,
384+
Error,
373385
// used for trace events
374386
TraceLogEvent,
375387
}

0 commit comments

Comments
 (0)