Skip to content
This repository has been archived by the owner. It is now read-only.

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

Open
jwatt mannequin opened this issue Dec 20, 2019 · 4 comments
Assignees

Comments

@jwatt
Copy link
Mannequin

@jwatt 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 jwatt mannequin commented Dec 20, 2019

assigned to @JDevlieghere

Loading

@jwatt
Copy link
Mannequin Author

@jwatt 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.

Loading

@JDevlieghere
Copy link
Member

@JDevlieghere JDevlieghere commented Jan 14, 2020

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'

Loading

@JDevlieghere
Copy link
Member

@JDevlieghere JDevlieghere commented Jan 14, 2020

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

Loading

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant