[Bug 17438] New: POSIX dyld plugin doesn't use sysroot

Bug ID 17438
Summary POSIX dyld plugin doesn’t use sysroot
Product lldb
Version unspecified
Hardware PC
OS FreeBSD
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter emaste@freebsd.org
Classification Unclassified

I should be able to use "target create foo -c foo.core -s /path/to/target/root"
for debugging a core file from a different system, but it appears the POSIX
dyld plugin does not use the sysroot information.

DynamicLoaderPOSIXDYLD::RefreshModules() 
DynamicLoaderPOSIXDYLD::LoadAllCurrentModules()

I should be able to use "target create foo -c foo.core -s /path/to/target/root" for debugging a core file from a different system, but it appears the POSIX dyld plugin does not use the sysroot information.

It seems that sysroot is a platform option, not a target option, which
is a bit surprising to me -- I might want two targets loaded, with
different sysroots.

source/Target/TargetList.cpp has this logic:

    if (platform_options)
    {
        if (platform_options->PlatformWasSpecified ())
        {
            const bool select_platform = true;
            platform_sp = platform_options->CreatePlatformWithOptions
(interpreter,
                                                                       arch,

select_platform,
                                                                       error,

platform_arch);

which means that "target create foo -c foo.core -S
/path/to/target/root" silently discards the sysroot option. What is
the expected behaviour here?