Changeset View
Changeset View
Standalone View
Standalone View
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
Show First 20 Lines • Show All 804 Lines • ▼ Show 20 Lines | if (auto dyld = GetDynamicLoader()) | ||||
dyld->OnLoadModule(nullptr, module_spec, module_addr); | dyld->OnLoadModule(nullptr, module_spec, module_addr); | ||||
} | } | ||||
void ProcessWindows::OnUnloadDll(lldb::addr_t module_addr) { | void ProcessWindows::OnUnloadDll(lldb::addr_t module_addr) { | ||||
if (auto dyld = GetDynamicLoader()) | if (auto dyld = GetDynamicLoader()) | ||||
dyld->OnUnloadModule(module_addr); | dyld->OnUnloadModule(module_addr); | ||||
} | } | ||||
void ProcessWindows::OnDebugString(const std::string &string) {} | void ProcessWindows::OnDebugString(lldb::addr_t debug_string_addr, | ||||
bool is_unicode, | |||||
uint16_t length_lower_word) { | |||||
Log *log = GetLog(WindowsLog::DbgPrint); | |||||
// TODO: Support Unicode debug string: Unicode debug strings are supplied | |||||
// only if WaitForDebugEventEx was called instead of WaitForDebugEvent. | |||||
if (!is_unicode) { | |||||
std::vector<char> str(static_cast<size_t>(length_lower_word)); | |||||
Status error; | |||||
size_t bytes_read = DoReadMemory(debug_string_addr, str.data(), | |||||
str.size() * sizeof(char), error); | |||||
if (bytes_read == str.size() * sizeof(char)) { | |||||
llvm::StringRef str_ref(str.data(), str.size()); | |||||
// The string should contain a trailing NUL terminator. Remove it because | |||||
// it interferes with consume_back. | |||||
labath: How exactly does it interfere? Have you tried a `consume_back(StringRef("\0", 1))` ? | |||||
if (!str_ref.empty() && str_ref.back() == '\0') | |||||
str_ref = str_ref.drop_back(); | |||||
// Remove one trailing newline because LLDB_LOG also adds one. | |||||
if (!str_ref.empty() && str_ref.back() == '\n') | |||||
str_ref = str_ref.drop_back(); | |||||
if (!str_ref.empty() && str_ref.back() == '\r') | |||||
str_ref = str_ref.drop_back(); | |||||
if (!str_ref.empty()) | |||||
LLDB_LOG(log, "DEBUG: {0}", str_ref); | |||||
} | |||||
} | |||||
} | |||||
void ProcessWindows::OnDebuggerError(const Status &error, uint32_t type) { | void ProcessWindows::OnDebuggerError(const Status &error, uint32_t type) { | ||||
llvm::sys::ScopedLock lock(m_mutex); | llvm::sys::ScopedLock lock(m_mutex); | ||||
Log *log = GetLog(WindowsLog::Process); | Log *log = GetLog(WindowsLog::Process); | ||||
if (m_session_data->m_initial_stop_received) { | if (m_session_data->m_initial_stop_received) { | ||||
// This happened while debugging. Do we shutdown the debugging session, | // This happened while debugging. Do we shutdown the debugging session, | ||||
// try to continue, or do something else? | // try to continue, or do something else? | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |
How exactly does it interfere? Have you tried a consume_back(StringRef("\0", 1)) ?