[lldb-dev] Calling Host methods from Platform plugins

Greg Clayton gclayton at apple.com
Thu Aug 21 10:07:13 PDT 2014


> On Aug 20, 2014, at 4:29 PM, Zachary Turner <zturner at google.com> wrote:
> 
> There are many examples of this, but just to pick one at random, PlatformDarwin::GetSharedModule() has a codepath which calls Host::GetBundleDirectory.  This is probably the correct thing to do if it's the local platform, but it seems to be always the wrong thing to do if this is not the local platform.  Is there something I'm misunderstanding that makes this work?  Shouldn't this kind of thing be behind an IsHost() check?

No. If you are remote debugging a MacOSX app, the platform should still be able to find the bundle directory. 

windows% lldb
(lldb) platform select remote-macosx
(lldb) file Foo.app

That being said, the code that uses native code to find the bundle directory should be placed into the Host directory and then PlatformDarwin should check #if defined(__APPLE__) and only use the host layer if it is running on Apple and fall back to other code when not native.

Greg




More information about the lldb-dev mailing list