Make sure that DWARF line information generated by Windows can be properly read by Posix OS and vice versa.
Details
Diff Detail
Event Timeline
This will also need a testcase.
lib/DebugInfo/DWARF/DWARFDebugLine.cpp | ||
---|---|---|
956 | Shouldn't this function be provided in libSupport? For example, by adding a new enumerator sys::path::Style::any ? |
Is there some kind of field we can write inside the DWARF that can tell us what path syntax to assume? I'm a little weary about trying to guess. It seems like there could be lots of edge cases where we incorrectly determine what syntax a path is using.
lib/DebugInfo/DWARF/DWARFDebugLine.cpp | ||
---|---|---|
956 | It seems pretty special purpose. If we were going to put something in support I would rather have it be something like sys::path::guess_path_syntax(const Twine &Path) |
As far as I know DWARF doesn't have a field like this.
I'm a little weary about trying to guess. It seems like there could be lots of edge cases where we incorrectly determine what syntax a path is using.
I share your worry for the general practice, but in this particular case I think it's ok.
If path is absolute on any OS (starts with / or X:) the code will treat it like it is absolute, and just won't try to concatenate more things together.
On Windows Android NDK produces binaries where different CUs have different path styles. Those binaries need to be symbolized on Linux and Mac OS, hence this change removing assumption that path style is always native.
I think that adding a path-style field to dwarf (it would probably have to be a vendor extension) is an excellent idea. However, that won't help us with parsing the existing debug info corpus. This isn't going to be 100% correct (e.g. c:\foo.cpp is a valid relative path on unix), but I hope nobody actually uses file names where that matters. If someone like that turns up, then we'd probably have to add a some flag about how the user wants the paths to be treated, as there is no way we can figure out the correct behavior automatically.
Shouldn't this function be provided in libSupport? For example, by adding a new enumerator sys::path::Style::any ?