Closed Bug 1605268 Opened 4 years ago Closed 4 years ago

Figure out why Xcode invoked lldb has started outputting `KeyError: 'topsrcdir'`

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox73 fixed)

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: jwatt, Assigned: jwatt)

Details

Attachments

(1 file)

I just updated to Xcode 11.3 and now when I start debugging the console starts with the following error:

Traceback (most recent call last):
  File "temp.py", line 33, in lldb_autogen_python_bp_callback_func__21
KeyError: 'topsrcdir'

This turns out to be coming from the 'topsrcdir' variable in the .lldbinit that is generated from .lldbinit.in (which is placed in the top object directory).

Surprisingly, this error does not occur when the variable is set, but rather it appears that the error occurs when the temporary global object created for HandleCommand() calls is torn down (and an unexpected global variable is found?...or something like that?). This is apparent because the Python statement after the assignment (another, nested, HandleCommand() call) is still run successfully).

Further backing up the observation that this is a teardown issue is that if I add the following at the end of the .lldbinit file to delete 'topsrcdir' from the global scope, then the error goes away:

script del globals()["topsrcdir"]

Or more accurately, it just switches to complaining about lldbutils instead. Getting rid of all errors requires:

script del globals()["topsrcdir"]
script del globals()["lldbutils"]

This is presumably a new bug in lldb when invoked through the driver that Xcode uses by linking to liblldb (it does not invoke the lldb binary as a separate process - see bug 942133).

There's not much we can do about this on our end. Either we remove the global variables as per the previous comment, or alternatively we could define a dummy variable with this bugs number in the variable name so that users are at least alerted to the fact that they can ignore the error. I would lean towards the latter since it seems unexpected that we would scrub the global scope of topsrcdir and the lldbutils module reference.

Pushed by jwatt@jwatt.org:
https://hg.mozilla.org/integration/autoland/rev/0433c276ce9b
Notify Xcode debugger users that the KeyError can be ignored. r=heycam
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73

I reported this to LLVM upstream: https://bugs.llvm.org/show_bug.cgi?id=44352

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: