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

Added exit msgs #54

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Added exit msgs #54

wants to merge 4 commits into from

Conversation

khlevin
Copy link
Contributor

@khlevin khlevin commented Nov 13, 2024

Added exit msgs with link to success stories page.
GDB/PDB: Msg prints when GDB/PDB is quit, returning to CLI.
LLDB: Doesn't have an on-exit event, so prints every time ChatDBG is exited and returns to LLDB interface. Maybe should just remove entirely?

Copy link
Collaborator

@nicovank nicovank left a comment

Choose a reason for hiding this comment

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

This feels like it should be a single function in src/chatdbg/util/exit_message.py.

def print_exit_message(event):
    print("Thank you for using ChatDBG!")
    print("Share your success stories here: github.com/plasma-umass/ChatDBG/issues/53")

src/chatdbg/chatdbg_gdb.py Outdated Show resolved Hide resolved
src/chatdbg/chatdbg_pdb.py Outdated Show resolved Hide resolved
src/chatdbg/native_util/dbg_dialog.py Outdated Show resolved Hide resolved
src/chatdbg/chatdbg_lldb.py Outdated Show resolved Hide resolved
@nicovank
Copy link
Collaborator

Did you try something like this re:LLDB?

import atexit

@atexit.register
def goodbye():
    print('You are now leaving the Python sector.')

@khlevin
Copy link
Contributor Author

khlevin commented Nov 13, 2024

Atexit doesn't work with LLDB. Something about how LLDB exits doesn't interact as expected with Python interpreter.
Tried also having a listener wait for LLDB exit code on a separate thread--still doesn't work, because for some reason, other LLDB processes can throw the exit code. :(

@nicovank
Copy link
Collaborator

This should work for LLDB:

debugger.SetDestroyCallback(print_exit_message)

Another thing: we should only print if ChatDBG was actually used (not if the debugger exited without any use of ChatDBG).
So I think add callback on first ChatDBG call, and gate it with a callback_was_added variable.

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.

2 participants