-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
Fix incorrect lru_cache usage #668
Conversation
7d8df11
to
43be1d7
Compare
43be1d7
to
0749012
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find.
def get_register(regname): | ||
"""Return a register's value.""" | ||
return get_register_for_selected_frame(id(gdb.selected_frame()), regname) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you confirmed that gdb.selected_frame()
, if called more than once, returns the same object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for review. Unfortunately, no. It changes.
Maybe just remove lru_cache
for get_register
in such case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would slow things down a lot. Maybe we can use gdb.selected_frame().pc()
? Although that could break on recursive functions. We should play with the frame object to see if there something we can use.
The bug is confirmed and can be reproduced as such void f10(){ __asm__("int3"); }
void f9(){ f10(); }
void f8(){ f9(); }
void f7(){ f8(); }
void f6(){ f7(); }
void f5(){ f6(); }
void f4(){ f5(); }
void f3(){ f4(); }
void f2(){ f3(); }
void f1(){ f2(); }
void main(){ f1(); } Using the following command
I get
To the exception that now the context code pane is properly filled. Thanks for the PR @borismol |
Fix incorrect lru_cache usage
Description/Motivation/Screenshots
@lru_cache
forgef_disassemble
since it returns generator and repetitivecontext_code
shows empty codeget_register_for_selected_frame
to correctly cache register values depending on selected frame.How Has This Been Tested?
make tests
Checklist
dev
branch, notmaster
.