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

LLDB driver invoked LLDB gets upset if SBDebugger.HandleCommand invoked commands set Python variables (KeyError) #43697

Open
jwatt mannequin opened this issue Dec 20, 2019 · 4 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla confirmed Verified by a second party lldb

Comments

@jwatt
Copy link
Mannequin

jwatt mannequin commented Dec 20, 2019

Bugzilla Link 44352
Version 9.0
OS MacOS X
CC @JDevlieghere

Extended Description

Xcode invoked lldb gets upset if SBDebugger.HandleCommand() invoked commands set Python variables, but not (apparently) until the temporary global created in order to run the HandleCommand() commands is destroyed. Specifically it throws a KeyError complaining that those variables are not present after all the commands run under HandleCommand have completed.

This is an upstreaming of the following report in Mozilla's Bugzilla:

https://bugzilla.mozilla.org/show_bug.cgi?id=1605268

@jwatt
Copy link
Mannequin Author

jwatt mannequin commented Dec 20, 2019

assigned to @JDevlieghere

@jwatt
Copy link
Mannequin Author

jwatt mannequin commented Dec 20, 2019

In case it's relevant, I should note that this all occurs under a breakpoint script. The script can be found at:

https://developer.mozilla.org/en-US/docs/Mozilla/Debugging/Debugging_on_Mac_OS_X#Setting_up_lldb

I should also note that when lldb is invoked directly from a terminal (i.e. not invoked by Xcode linking to liblldb to invoke the driver) and this breakpoint is set and runs, this problem does not occur.

@JDevlieghere
Copy link
Member

I can reproduce this:

$ echo "script foo = 1" > test.lldb
$ lldb ./a.out
(lldb) b main
(lldb) breakpoint command add -s python
Enter your Python command(s). Type 'DONE' to end.
def function (frame, bp_loc, internal_dict):
"""frame: the lldb.SBFrame for the location at which you stopped
bp_loc: an lldb.SBBreakpointLocation for the breakpoint location information
internal_dict: an LLDB support object not to be used"""
target = frame.GetThread().GetProcess().GetTarget()
debugger = target.GetDebugger()
debugger.HandleCommand("command source -s true ./test.lldb")
DONE
(lldb) run
Traceback (most recent call last):
File "temp.py", line 11, in lldb_autogen_python_bp_callback_func__0
KeyError: 'foo'

@JDevlieghere
Copy link
Member

Although unrelated, the repro is also hitting an assert in the editline implementation: lldbassert(m_editor_status != EditorStatus::Editing) in Editline::GetLine().

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@llvmbot llvmbot added the confirmed Verified by a second party label Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla confirmed Verified by a second party lldb
Projects
None yet
Development

No branches or pull requests

2 participants