[lldb-dev] filenames in a cross-platform environment

via lldb-dev lldb-dev at lists.llvm.org
Thu Aug 27 16:17:49 PDT 2015


Hi all,

The question of how to tackle filename/path issues in a cross-platform
environment arose as a result of http://reviews.llvm.org/D12115, and we would
like to continue that discussion here.  I'll start with excerpts from comments
in that review to give you some background:

zturner:
    [...] can we instead use llvm::sys::fs::root_name to check whether the path
    contains a drive letter?

dawn:
    Sadly no, because root_name only parses c:\ correctly if the platform is
    Windows. Our IDE is hosted on Windows but talks to lldb running on OSX. I've
    had this path problem with the DWARF reader and FileSpec - lldb has a core
    assumption that you only want to support Windows paths if you run on Windows.
    At least with FileSpec you can pass a PathSyntax, but you have to choose either
    Windows or Posix, not both. We want to support both Posix and Windows style
    paths. I've not come up with a clean patch for this problem so none have been
    submitted.

zturner:
    Are you saying that there is a situation where you are given a path, and you
    have no idea whether it is a posix path or a windows path?

dawn:
    Yes. For example, in lldb on OSX, we can be debugging an app that was built on
    OSX, or an app that was built on Windows targeting OSX. More likely, we would
    be debugging an app that was built on Windows but links with libraries that
    were built on OSX.

    I've thought of various ways to fit this into lldb...  One idea was to add:
        settings set target.pathsyntax [posix|windows|any|native] #default=native
    and a FileSpec::ePathSyntaxAny enum which would be set if the user chose "any".
    But that doesn't solve the problem for llvm, whose path handling appears to be
    controlled by the define LLVM_ON_WIN32.

Thoughts/ideas?

Thanks in advance,
-Dawn


More information about the lldb-dev mailing list