[Lldb-commits] [PATCH] Make llgs build on Android. No functionality change.

Todd Fiala tfiala at google.com
Fri Sep 26 13:31:03 PDT 2014


The bulk of the (shared) static method impls will occasionally need to call
a virtual function where the behavior differs.

Am I missing something?

static shared_method_probably_in_HostInfoPOSIX()
{
    LotsOfSharedCode();
    VirtualMethodA();   // differs between straight-up POSIX, Linux and
Android
    LotsOfSharedCode();
    VIrtualMethodB();  // similar.
}

I'm not sure I'm following how that will work in a static method.  Don't we
need an instance here?

-Todd

On Fri, Sep 26, 2014 at 1:28 PM, Zachary Turner <zturner at google.com> wrote:

> That shouldn't affect anything.  HostInfoLinux already inherits from
> HostInfoPosix.  Just because the methods are static doesn't prevent
> overriding them through inheritance.  That's the reason for the HostInfo
> typedef.  In the end, on Android, HostInfo will be typedefed to
> HostInfoAndroid.  If a method has been overridden in HostInfoAndroid, then
> HostInfo::Foo() will call the version in HostInfoAndroid.  If it hasn't, it
> will call the version in HostInfoLinux (or HostInfoPosix, or wherever it
> has been declared).
>
>
>
> On Fri, Sep 26, 2014 at 1:19 PM, Todd Fiala <tfiala at google.com> wrote:
>
>> Have a look Jim :-)  I'd love to do that but right now everything appears
>> to be static AFAICT.
>>
>> On Fri, Sep 26, 2014 at 1:18 PM, <jingham at apple.com> wrote:
>>
>>> Sorry, I must be missing something.  Why can't HostInfoAndroid just
>>> derive from HostInfoLinux, and only modify the methods it actually changes?
>>>
>>> Jim
>>>
>>> > On Sep 26, 2014, at 1:16 PM, Tong Shen <endlessroad at google.com> wrote:
>>> >
>>> > Actually, Todd suggested me to add Android specific files for
>>> > HostInfo, HostThread, etc.
>>> >
>>> > What's the best way to avoid duplicating HostInfoLinux functions into
>>> > HostInfoAndroid?
>>> >
>>> > On Fri, Sep 26, 2014 at 1:09 PM, Zachary Turner <zturner at google.com>
>>> wrote:
>>> >> const char *
>>> >> HostInfoLinux::LookupGroupName(uint32_t gid, std::string &group_name)
>>> >> {
>>> >> #if defined(__ANDROID__)
>>> >>    assert(false && "getgrgid_r() not supported on Android");
>>> >> #else
>>> >>    return HostInfoPosix::LookupGroupName(gid, group_name);
>>> >> #endif
>>> >> }
>>> >>
>>> >> On Fri, Sep 26, 2014 at 1:03 PM, Tong Shen <endlessroad at google.com>
>>> wrote:
>>> >>>
>>> >>> HostThreadLinux can overwrite Cancel() so ifdef only happens in
>>> >>> HostThreadLinux::Cancel().
>>> >>> I've done that and will upload later.
>>> >>>
>>> >>> Do you have any suggestion on HostInfoPosix, though? How can we move
>>> >>> the ifdef to HostInfoLinux without duplicating
>>> >>> HostInfoPosix::LookupGroupName() ?
>>> >>>
>>> >>> On Fri, Sep 26, 2014 at 12:35 PM, Zachary Turner <zturner at google.com
>>> >
>>> >>> wrote:
>>> >>>> I'm not seeing the changes to HostInfoPosix and HostThreadPosix
>>> that I
>>> >>>> suggested.  Are those still coming in a followup?
>>> >>>>
>>> >>>> On Fri, Sep 26, 2014 at 11:59 AM, Tong Shen <endlessroad at google.com
>>> >
>>> >>>> wrote:
>>> >>>>>
>>> >>>>> http://reviews.llvm.org/D5495
>>> >>>>>
>>> >>>>> Files:
>>> >>>>>  include/lldb/Core/IOHandler.h
>>> >>>>>  include/lldb/Host/linux/Config.h
>>> >>>>>  source/Core/IOHandler.cpp
>>> >>>>>  source/Host/common/Host.cpp
>>> >>>>>  source/Host/common/Socket.cpp
>>> >>>>>  source/Host/linux/Host.cpp
>>> >>>>>  source/Host/posix/HostInfoPosix.cpp
>>> >>>>>  source/Host/posix/HostThreadPosix.cpp
>>> >>>>>  source/Interpreter/CommandInterpreter.cpp
>>> >>>>>  source/Plugins/Process/Linux/LinuxThread.h
>>> >>>>>  source/Plugins/Process/Linux/NativeProcessLinux.cpp
>>> >>>>>  source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.h
>>> >>>>>  source/Plugins/Process/Linux/ProcessLinux.cpp
>>> >>>>>  source/Plugins/Process/Linux/ProcessLinux.h
>>> >>>>>  source/Plugins/Process/Linux/ProcessMonitor.cpp
>>> >>>>>  source/Plugins/Process/POSIX/POSIXThread.cpp
>>> >>>>>  source/Plugins/Process/POSIX/POSIXThread.h
>>> >>>>>  source/Plugins/Process/POSIX/ProcessPOSIX.cpp
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_arm64.cpp
>>> >>>>>
>>> >>>>>
>>> >>>>>
>>> source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_mips64.cpp
>>> >>>>>
>>> >>>>>
>>> source/Plugins/Process/POSIX/RegisterContextPOSIXProcessMonitor_x86.cpp
>>> >>>>>  source/Plugins/Process/Utility/RegisterInfos_arm64.h
>>> >>>>>
>>> source/Plugins/Process/elf-core/RegisterContextPOSIXCore_mips64.cpp
>>> >>>>>
>>> source/Plugins/Process/elf-core/RegisterContextPOSIXCore_x86_64.cpp
>>> >>>>>  source/Plugins/Process/elf-core/ThreadElfCore.cpp
>>> >>>>>  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
>>> >>>>>  source/Target/ProcessLaunchInfo.cpp
>>> >>>>>  source/Target/Thread.cpp
>>> >>>>>  tools/lldb-gdbserver/lldb-gdbserver.cpp
>>> >>>>
>>> >>>>
>>> >>>
>>> >>>
>>> >>>
>>> >>> --
>>> >>> Best Regards, Tong Shen
>>> >>
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > Best Regards, Tong Shen
>>>
>>>
>>
>>
>> --
>> Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
>>
>
>


-- 
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140926/8676a172/attachment.html>


More information about the lldb-commits mailing list