================
@@ -19,16 +19,85 @@
#include "lldb/Host/ProcessLaunchInfo.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/FileSpec.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Error.h"
#include "DebuggerThread.h"
#include "ExceptionRecord.h"
#include "ProcessWindowsLog.h"
+#include <cctype>
+#include <string>
+#include <string_view>
+
using namespace lldb;
using namespace lldb_private;
+static void NormalizeWindowsPath(std::string &s) {
+ for (char &c : s) {
+ if (c == '/')
+ c = '\\';
+ else
+ c = std::tolower(static_cast<unsigned char>(c));
+ }
+}
+
+bool ProcessDebugger::IsSystemDLL(const FileSpec &spec) {
+ if (!spec)
+ return false;
+
+ static const std::string windows_prefix = []() {
+ std::string prefix;
+ wchar_t buf[MAX_PATH];
+ UINT len = ::GetWindowsDirectoryW(buf, MAX_PATH);
+ if (len == 0 || len >= MAX_PATH)
+ return prefix;
+ llvm::convertWideToUTF8(std::wstring_view(buf, len), prefix);
+ NormalizeWindowsPath(prefix);
+ if (!prefix.empty() && prefix.back() != '\\')
+ prefix += '\\';
+ return prefix;
+ }();
+
+ if (windows_prefix.empty())
+ return false;
+
+ std::string path = spec.GetPath();
+ NormalizeWindowsPath(path);
+ return llvm::StringRef(path).starts_with(windows_prefix);
----------------
charles-zablit wrote:
Fixed
https://github.com/llvm/llvm-project/pull/208233
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits