Search code examples
debugginglldb

LLDB: is it possible to display graphics from lldb session?


I would like to display a plot from LLDB session, is that possible?

plt.figure()
plt.title('Test')
plt.imshow(array, cmap='gray')
plt.show()

Right now, when i do that through the "command script import ~/script.py"; the session is stuck!


Solution

  • This works correctly in command-line lldb (or at least it does for me...)

    That it doesn't work when trying to share the connection to the Window Server with Xcode (since lldb is running in the Xcode app process) is not entirely surprising. Doing plt.figure() seems to stall, though it wasn't immediately clear to me what Python thought it was doing when you called this method. It was not stalled somewhere obvious.

    I don't think lldb has anything to do with this one way or the other (especially since command-line lldb works.) You're more likely to figure out how to get this working by asking the MatPlotLib folks if they have any experience sharing GUI's when the python is an embedded interpreter, especially in something complex like Xcode.

    You might also see if they have any way to call out to an out-of-process renderer. That might get around the complexities of living inside Xcode.