Skip to content

Commit 233d93a

Browse files
committed
Fix skipping
1 parent 5510d0f commit 233d93a

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

src/memray/_memray/ghost_stack/src/ghost_stack.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -421,15 +421,6 @@ class GhostStackImpl {
421421
unw_init_local(&cursor, &ctx);
422422
LOG_DEBUG(" Initialized libunwind cursor\n");
423423

424-
// Skip internal frames (platform-specific due to backtrace/libunwind differences)
425-
#ifdef __APPLE__
426-
// macOS: Skip fewer frames due to backtrace()/libunwind difference
427-
for (int i = 0; i < 1 && unw_step(&cursor) > 0; ++i) {}
428-
#else
429-
// Linux: Skip internal frames (this function + backtrace)
430-
for (int i = 0; i < 3 && unw_step(&cursor) > 0; ++i) {}
431-
#endif
432-
433424
// Process frames: read current frame, then step to next
434425
// Note: After skip loop, cursor is positioned AT the first frame we want
435426
// We need to read first, then step (not step-then-read)

src/memray/_memray/tracking_api.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class NativeTrace
197197
d_data.resize(d_data.size() * 2);
198198
}
199199
d_size = size > skip ? size - skip : 0;
200-
d_skip = skip;
200+
d_skip = skip + (s_use_fast_unwind ? 2 : 0);
201201
return d_size > 0;
202202
}
203203

0 commit comments

Comments
 (0)