Correct path seperator in DWARF debug info on Windows
Yaron Keren
yaron.keren at gmail.com
Mon Mar 17 00:18:08 PDT 2014
The path seperator is hardcoded in MCDwarf.cpp:649 as '/'. This is worng on
Windows.
A patch to use the correct path seperator is attached. I had to expose
the path seperator from llvm::sys::path.
Yaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140317/b419aa61/attachment.html>
-------------- next part --------------
Index: include/llvm/Support/Path.h
===================================================================
--- include/llvm/Support/Path.h (revision 203906)
+++ include/llvm/Support/Path.h (working copy)
@@ -165,6 +165,10 @@
/// @name Transforms (or some other better name)
/// @{
+/// Return the preferred separator for this platform, null-terminated.
+///
+const char *get_preferred_separator();
+
/// Convert path to the native form. This is used to give paths to users and
/// operating system calls in the platform's normal way. For example, on Windows
/// all '/' are converted to '\'.
Index: lib/Support/Path.cpp
===================================================================
--- lib/Support/Path.cpp (revision 203906)
+++ lib/Support/Path.cpp (working copy)
@@ -513,6 +513,12 @@
path.append(ext.begin(), ext.end());
}
+static const char preferred_separator_string[] = { preferred_separator, '\0' };
+
+const char *get_preferred_separator() {
+ return preferred_separator_string;
+}
+
void native(const Twine &path, SmallVectorImpl<char> &result) {
assert((!path.isSingleStringRef() ||
path.getSingleStringRef().data() != result.data()) &&
Index: lib/MC/MCDwarf.cpp
===================================================================
--- lib/MC/MCDwarf.cpp (revision 203906)
+++ lib/MC/MCDwarf.cpp (working copy)
@@ -659,7 +659,7 @@
const SmallVectorImpl<std::string> &MCDwarfDirs = context.getMCDwarfDirs();
if (MCDwarfDirs.size() > 0) {
MCOS->EmitBytes(MCDwarfDirs[0]);
- MCOS->EmitBytes("/");
+ MCOS->EmitBytes(sys::path::get_preferred_separator());
}
const SmallVectorImpl<MCDwarfFile> &MCDwarfFiles =
MCOS->getContext().getMCDwarfFiles();
More information about the cfe-commits
mailing list