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

Cannot print stack frame using stack-view when in main method #66

Closed
noahboegli opened this issue Jun 22, 2022 · 0 comments · Fixed by #67
Closed

Cannot print stack frame using stack-view when in main method #66

noahboegli opened this issue Jun 22, 2022 · 0 comments · Fixed by #67

Comments

@noahboegli
Copy link
Contributor

noahboegli commented Jun 22, 2022

I'm having a small issue when willing to display the stack being in the main method.

It would seem that this condition is executed when main's stackframe is selected:

if not frame.older():
#reason = frame.unwind_stop_reason()
reason_str = gdb.frame_stop_reason_string( frame.unwind_stop_reason() )
warn("Cannot determine frame boundary, reason: {:s}".format(reason_str))
return

Which does not make sense to me, because when I execute info frame, it clearly shows that the frame has a calling frame (thus frame.older() should not return None)

Stack level 0, frame at 0xffffce20:
eip = 0x804863e in simple_echo; saved eip = 0x8048700
called by frame at 0xffffcff0
Arglist at 0xffffce18, args:
Locals at 0xffffce18, Previous frame's sp is 0xffffce20
Saved registers:
ebp at 0xffffce18, eip at 0xffffce1c

Edit: After a bit more investigation, I have found a way to fix it and proposed a PR (#67), the spoiler below contains the former content of the issue

Click to expand There is probably an easy fix but I'm not at ease with the Python-GDB API and I have not been able to work around it. The only issue I'm not able to fix is finding the stack HI adress without using the calling frame SP:
# Could something like this exist?
stack_hi = align_address(int(frame.read_register("bp")))

If someone has the code to find the HI address of the frame, I'm open to make a PR.

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 a pull request may close this issue.

1 participant