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

Naive and frame pointer stack unwinders #61

Merged
merged 12 commits into from Aug 4, 2020

Conversation

bjorn3
Copy link
Contributor

@bjorn3 bjorn3 commented Jul 30, 2020

The naive unwinder scans the stack for words that could be function pointers, while the frame pointer unwinder uses the frame pointer linked list.

cc #60

(headcrab) exec tests/testees/hello
Starting program: tests/testees/hello
Stopped(Pid(11513), SIGTRAP)
(headcrab) _patch_breakpoint_function
(headcrab) cont
Stopped(Pid(11513), SIGTRAP)
(headcrab) bt
0000555555559265 breakpoint
000055555555927d _ZN5hello4main17hd078db076938ab99E
0000555555559316 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hcdd26100bac59f1bE
0000555555562ce8 _ZN3std2rt19lang_start_internal17he05790f0cb2000dfE
(headcrab) bt naive
0000555555559265 breakpoint
000055555555927d _ZN5hello4main17hd078db076938ab99E
0000555555559316 _ZN3std2rt10lang_start28_$u7b$$u7b$closure$u7d$$u7d$17hcdd26100bac59f1bE
0000555555562ce8 _ZN3std2rt19lang_start_internal17he05790f0cb2000dfE
00007ffff7fdf38f _dl_rtld_di_serinfo
0000555555559150 _start
0000555555559150 _start
0000555555559300 main
0000555555559270 _ZN5hello4main17hd078db076938ab99E
0000555555581790 __libc_csu_init
00005555555592d0 main
0000555555559150 _start
00007ffff7fe4476 _dl_rtld_di_serinfo
0000555555559150 _start
000055555555917a _start
0000555555559150 _start
(headcrab)

@bjorn3 bjorn3 requested a review from nbaksalyar July 30, 2020 09:51
Copy link
Member

@nbaksalyar nbaksalyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, sorry for a delay with the review - this is very cool, thanks! I left a few general comments and suggestions, and this can be merged after the merge conflict is resolved.

Later we can also integrate this with rustc-demangle to have a quick win with getting real function names. I'll create a new issue for that.

tests/test_utils.rs Outdated Show resolved Hide resolved
tests/test_utils.rs Show resolved Hide resolved
tests/test_utils.rs Show resolved Hide resolved
@bjorn3 bjorn3 requested a review from nbaksalyar August 4, 2020 07:50
Copy link
Member

@nbaksalyar nbaksalyar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍 Merge seems to be blocked by a conflict though, could you please take a look at it?

@nbaksalyar nbaksalyar merged commit 2b8dc1b into headcrab-rs:master Aug 4, 2020
1 check passed
@bjorn3 bjorn3 deleted the unwind_the_stack branch August 4, 2020 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants