Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: StackSnapshotType (All). #235

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/tracing/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,21 @@ pub enum StackSnapshotType {
/// Don't record stack snapshots
#[default]
None,
/// Record full, push stack
All,
/// Record only the items pushed to the stack
Pushes,
/// Record the full stack
Full,
Full
}

impl StackSnapshotType {
/// Returns true if this is the [StackSnapshotType::All] variant
#[inline]
pub const fn is_all(self) -> bool {
matches!(self, Self::All)
}

/// Returns true if this is the [StackSnapshotType::Full] variant
#[inline]
pub const fn is_full(self) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions src/tracing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ impl TracingInspector {
RecordedMemory::new(interp.shared_memory.context_memory())
});

let stack = if self.config.record_stack_snapshots.is_full() {
let stack = if self.config.record_stack_snapshots.is_all() || self.config.record_stack_snapshots.is_full() {
Some(interp.stack.data().clone())
} else {
None
Expand Down Expand Up @@ -469,7 +469,7 @@ impl TracingInspector {

let step = &mut self.traces.arena[trace_idx].trace.steps[step_idx];

if self.config.record_stack_snapshots.is_pushes() {
if self.config.record_stack_snapshots.is_all() || self.config.record_stack_snapshots.is_pushes() {
let start = interp.stack.len() - step.op.outputs() as usize;
step.push_stack = Some(interp.stack.data()[start..].to_vec());
}
Expand Down
Loading