-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
debuginfo-lldb tests crash in OS X 10.11 / Xcode 7.3 #32994
Comments
I was also getting this recently, and I have no idea what's going on here unfortunately. We haven't gotten lots of reports about this so presumably it's only because of recent versions of XCode/OSX/python/etc. I managed to reduce this to: import lldb
debugger = lldb.SBDebugger.Create()
target_error = lldb.SBError()
target = debugger.CreateTarget('foo', None, None, True, target_error) That small script crashes for me, albeit I'm not sure why. @michaelwoerister perhaps the LLDB API changed recently and we're doing something to trigger a bug? Do you have some docs where the original bindings were written from that we could perhaps reference as well? |
I mostly pieced it together from the examples provided in LLDB's source code and from the API Docs (although those never get updated it seems: "Generated by Epydoc 3.0.1 on Fri Jul 19 13:22:33 2013"). |
Seems to work for a do-nothing C program. How is it crashing?
|
One thing to note is that lldb-350.0.21.3 (from Xcode 7.3) was branched off of the llvm.org sources circa mid-May 2015. If the tests depend on anything added after that, the Apple-distributed lldb 7.x series isn't going to work. |
@jasonmolenda weird! So I've got the same lldb/xcode version as you, and also all the same versions as @jonathandturner mentions, and I can also reproduce. The snippet you pasted also works for me, but the segfault happens when I exit python (same as @jonathandturner mentioned). Does the segfault not happen for you? |
Ah, I know what's going on. You need to add a call to debugger.Terminate() before you end your session. There's some problem with the order all the destructors are run if you just exit lldb without calling SBDebugger:Terminate() - this is needed now. |
Aha perfect! That does indeed make the segfault go away, thanks @jasonmolenda! Now it just appears that |
Good luck. For what it's worth, it's more stable to use lldb via the SB API instead of sending raw command line commands to it (SBTarget::EvaulateExpression or the better SBFrame::EvaluateExpression). It's a little daunting at first to figure out "how do I get lldb to do X" via the API but you don't have to deal with parsing output (& keeping the regexps up-to-date) once you do it that way. |
Hm I'll admit to not knowing much about this area (@michaelwoerister is our resident expert on these scripts), but out current script I think is using the SB API (it at least looks like it isn't doing much parsing). So specifically what's happening is that the tests are still failing for me. The failure looks the same as what @jonathandturner pasted above, except the first line about "error running LLDB" is instead:
It looks like all of the Not entirely sure what's going on... |
We can create an SBValue for the local variable in this frame:
Or we can evaluate an arbitrary expression in the context of this frame (e.g. "foo+10" would work just as well) and get that back as an SBValue object.
Or we can use HandleCommand which is what the script is doing.
for this trivial example, it seems like everything is working as expected. (btw this is what I meant by "sending lldb command line commands" vrs "using the SB API" - using HandleCommand() gets you back a raw text string. Using native SB API like SBTarget::BreakpointCreateBySourceRegex or SBFrame::GetValueForVariablePath get you back an object that you can query/use via methods that the object supports. Xcode does all of its debugger support through the SB API. About the only thing it needs to use HandleCommand for is the "settings" series of commands - that hasn't been codified in SB API yet.) |
Aha! Thanks for the pointers @jasonmolenda! Sounds like we have a rewrite of our script on the horizon for us. |
Sounds like that could be a lot of work. ;) mostly I wanted to point in the direction of Best Practices for scripting lldb. For what it's worth, when I'm working with SB objects, the way I usually use the docs is to have a command line lldb session open in a window and I'm doing things like 'script help (lldb.SBFrame)' etc which dumps the python documentation string for the SBFrame class. The docs on the website were last updated a long time ago - they should still be accurate (we don't have a deprecation mechanism for removing API) but they're definitely not inclusive for newer commands/methods. |
Thanks for all the helpful information, @jasonmolenda! The thinking behind using the SB object API as little as possible, was that we wanted to stay as close as possible to the command line interface a user would be interacting with, so that our tests gave some measure of the actual user experience. |
Sounds like your current system of using the I misspoke earlier when I said that Xcode 7.3's lldb (lldb-350) was based on May 2015. Xcode 7.0-7.2's lldb's (lldb-340) were based on mid-May 2015 lldb sources. In Xcode 7.3, a fresh import of the llvm.org sources was taken I think around mid-January -- so there's seven months of the open source lldb changes in Xcode 7.3. It is a pretty different lldb from the one in Xcode 7.2. It's entirely possible that the problem you're seeing is an lldb regression that was introduced in the llvm.org sources between May and January.. |
Likely related: #33062 |
Hm yeah, so I suspect that #33062 is the bug that I'm running into! |
Right now on the most recent version of LLDB installed on OSX we'll segfault on all the LLDB tests if this isn't called (unfortunately). Hopefully we've updated LLDB on the bots to actually get this working everywhere! Closes rust-lang#32994
PR #33097 should fix the missing output problems. |
…ichaelwoerister Sanity check Python on OSX for LLDB tests Two primary changes: * Don't get past the configure stage if `python` isn't coming from `/usr/bin` * Call `debugger.Terminate()` to prevent segfaults on newer versions of LLDB. Closes rust-lang#32994
…ster Sanity check Python on OSX for LLDB tests Two primary changes: * Don't get past the configure stage if `python` isn't coming from `/usr/bin` * Call `debugger.Terminate()` to prevent segfaults on newer versions of LLDB. Closes #32994
With a recent OS X/Xcode (here I'm using OS X 10.11.4 and Xcode 7.3), running the debuginfo-lldb tests results in a crash, even when using the system python install.
The crash pops up a window with an error: Python quit unexpectedly while using the _lldb.so plug-in.
The text was updated successfully, but these errors were encountered: