Index: include/lldb/Host/FileSpec.h =================================================================== --- include/lldb/Host/FileSpec.h +++ include/lldb/Host/FileSpec.h @@ -78,6 +78,8 @@ //------------------------------------------------------------------ explicit FileSpec (const char *path, bool resolve_path, PathSyntax syntax = ePathSyntaxHostNative); + explicit FileSpec (const char *path, bool resolve_path, ArchSpec arch); + //------------------------------------------------------------------ /// Copy constructor /// Index: source/Host/common/FileSpec.cpp =================================================================== --- source/Host/common/FileSpec.cpp +++ source/Host/common/FileSpec.cpp @@ -27,6 +27,7 @@ #include #endif +#include "lldb/Core/ArchSpec.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataBufferMemoryMap.h" #include "lldb/Core/RegularExpression.h" @@ -201,6 +202,11 @@ SetFile(pathname, resolve_path, syntax); } +FileSpec::FileSpec(const char *pathname, bool resolve_path, ArchSpec arch) : + FileSpec(pathname, resolve_path, arch.GetTriple().isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix) +{ +} + //------------------------------------------------------------------ // Copy constructor //------------------------------------------------------------------ @@ -605,7 +611,7 @@ void FileSpec::Dump(Stream *s) const { - static ConstString g_slash_only ("/"); + static ConstString g_slash_only("/"); if (s) { m_directory.Dump(s); @@ -810,10 +816,15 @@ void FileSpec::GetPath(llvm::SmallVectorImpl &path, bool denormalize) const { + static ConstString g_slash_only("/"); if (m_directory) - path.append(m_directory.GetCString(), m_directory.GetCString() + m_directory.GetLength()); + path.append(m_directory.GetStringRef().begin(), m_directory.GetStringRef().end()); if (m_filename) - llvm::sys::path::append(path, m_filename.GetCString()); + { + if (m_directory && m_directory != g_slash_only) + path.emplace_back('/'); + path.append(m_filename.GetStringRef().begin(), m_filename.GetStringRef().end()); + } Normalize(path, m_syntax); if (denormalize && !path.empty()) DeNormalize(path, m_syntax); Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1312,7 +1312,7 @@ const char *arg = NULL; const Args &launch_args = launch_info.GetArguments(); if (exe_file) - exe_path = exe_file.GetPath(false); + exe_path = exe_file.GetPath(); else { arg = launch_args.GetArgumentAtIndex(0); @@ -3744,8 +3744,8 @@ packet.PutCString("qModuleInfo:"); packet.PutCStringAsRawHex8(module_path.c_str()); packet.PutCString(";"); - const auto& tripple = arch_spec.GetTriple().getTriple(); - packet.PutBytesAsRawHex8(tripple.c_str(), tripple.size()); + const auto& triple = arch_spec.GetTriple().getTriple(); + packet.PutBytesAsRawHex8(triple.c_str(), triple.size()); StringExtractorGDBRemote response; if (SendPacketAndWaitForResponse (packet.GetData(), packet.GetSize(), response, false) != PacketResult::Success) @@ -3795,7 +3795,7 @@ extractor.GetStringRef ().swap (value); extractor.SetFilePos (0); extractor.GetHexByteString (value); - module_spec.GetFileSpec () = FileSpec (value.c_str(), false); + module_spec.GetFileSpec() = FileSpec(value.c_str(), false, arch_spec); } } Index: source/Target/Target.cpp =================================================================== --- source/Target/Target.cpp +++ source/Target/Target.cpp @@ -2366,8 +2366,9 @@ if (is_main_executable) // TODO: add setting for always installing main executable??? { // Always install the main executable + remote_file = FileSpec(module_sp->GetFileSpec().GetFilename().AsCString(), + false, module_sp->GetArchitecture()); remote_file.GetDirectory() = platform_sp->GetWorkingDirectory(); - remote_file.GetFilename() = module_sp->GetFileSpec().GetFilename(); } } if (remote_file)