Skip to content

Commit b77b6a1

Browse files
committed
feat(event): Define Error event
1 parent d793b27 commit b77b6a1

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
@@ -24,6 +24,7 @@ mod tests {
2424
tracer.register_asm(&["asm0".to_string(), "asm1".to_string()]);
2525
tracer.register_special_event(EventLogKind::Write, "test");
2626
tracer.register_special_event(EventLogKind::Write, "test2");
27+
tracer.register_special_event(EventLogKind::Error, "testError");
2728

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

91-
assert_eq!(tracer.events.len(), 33);
92+
assert_eq!(tracer.events.len(), 34);
9293
// visible with
9394
// cargo tets -- --nocapture
9495
// 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),
@@ -19,12 +25,17 @@ pub enum TraceLowLevelEvent {
1925
Return(ReturnRecord),
2026
Event(RecordEvent),
2127
Asm(Vec<String>),
28+
29+
// experimental modification value tracking events
2230
CompoundValue(CompoundValueRecord),
2331
CellValue(CellValueRecord),
2432
AssignCompoundItem(AssignCompoundItemRecord),
2533
AssignCell(AssignCellRecord),
2634
VariableCell(VariableCellRecord),
2735
DropVariable(VariableId),
36+
37+
// normal event, workaround for cases when we need to drop
38+
// a step event, but the trace needs to be append-only
2839
DropLastStep,
2940
}
3041

@@ -371,6 +382,7 @@ pub enum EventLogKind {
371382
CloseDir,
372383
Socket,
373384
Open,
385+
Error,
374386
// used for trace events
375387
TraceLogEvent,
376388
}

0 commit comments

Comments
 (0)