Use top of tree lldb with xcode

筅森魡賤 提交于 2019-12-05 10:10:12

问题


I built the top of tree of lldb in /usr/local/bin and I would like to tell xcode to use this binary instead of the default one. But I can't find how/where to set this.


回答1:


Unfortunately this won't work. There have been a couple of API changes made to the svn repository lldb since lldb-179 was branched off (c. early December 2012) for Xcode 4.6.x. If you were to put the LLDB.framework built from current svn in /Applications/Xcode.app/Contents/SharedFrameworks/ it will cause Xcode to crash when you try to debug anything.

As background, remember that lldb is really a debugger library. The lldb library is LLDB.framework on Mac OS X, which driver programs link against. The command line "lldb" program is one driver, Xcode is another driver. There could be additional driver programs in the future, we sometimes joke about "llgdb", a driver program that has the look & feel of gdb but uses the lldb library to do all the work.

The lldb library provides an API that the driver programs code to/link against. It is a C++ API. It is not intended to be long-term stable at this point; occasionally changes to the existing methods need to be made and driver programs have to be updated / relinked against the newer version. This is why a driver program (Xcode) which is compiled to link against an early December 2012 lldb (Xcode 4.6.x) will break if you drop in a newer LLDB.framework - the APIs have been changed incompatibly a few times since December and so the Xcode would crash if you tried to intermix them.

There isn't an exact revision you can check out from svn to get the same lldb-179 lldb that was included in Xcode 4.6. When it came time to tag that release, a stable version of lldb was picked and imported into an apple internal repository. It was around the first week of December '12, any revision from there will be indistinguishable from lldb-179. There have been a few minor updates to Xcode 4.6/lldb-179 since then, e.g. lldb-179.1, lldb-179.2, etc. These are made off of the apple internal branch and are lldb-179 plus a handful of cherry-picked fixes from later in the public svn repository.

In addition to the C++ API provided by LLDB.framework, it's interesting to note that lldb also provides an "SB API". This is a term for the python scripting interface. You can write a real debugger driver program entirely in Python, using the SB APIs to do the actual debugger work behind the scenes. These python APIs are more stable than the C++ APIs when you link directly against LLDB.framework, but they do occasionally still have to change if design decisions need to be revisited in the future.

As an aside, if I remember correctly the first API change which made Xcode 4.6 not linkable against the svn lldb was committed in January or February. Some method had to change from taking an int to taking a uint64_t or something along those lines. These are C++ methods so the mangled name of the function changed and Xcode had to be recompiled against the new version of lldb to continue to link.




回答2:


You could try replacing the lldb binary in the following folder /Applications/Xcode.app/Contents/Developer/usr/bin or this one: /usr/bin/lldb

However, I haven't tried this and I'm not sure if unofficial builds of the library will work with Xcode.



来源:https://stackoverflow.com/questions/16312877/use-top-of-tree-lldb-with-xcode

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!