[lldb-dev] Calling Host methods from Platform plugins

Zachary Turner zturner at google.com
Thu Aug 21 11:03:35 PDT 2014

But then wouldn't the appropriate way to do it be to send a request to the
debugserver which would then ask its PlatformMacOSX, which would find out
it's the local platform, and then call into the Host layer?  Even remote
debugging from MacOSX -> MacOSX, it's possible that some value returned by
the host layer (we'll use the bundle directory since it was the original
example) might be different on the two machines.  Now your #if
defined(__APPLE__) preprocessor check passes, you get the bundle directory
from the host layer, and it's different from the value on the remote.

On Thu, Aug 21, 2014 at 10:07 AM, Greg Clayton <gclayton at apple.com> wrote:

> > 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140821/50109061/attachment.html>

More information about the lldb-dev mailing list