summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp18
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp2
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp2
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp26
-rw-r--r--lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp2
-rw-r--r--lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp19
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp32
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp4
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp6
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp11
-rw-r--r--lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp63
13 files changed, 78 insertions, 111 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
index 7b22bec666e..8908108eff4 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.cpp
@@ -463,19 +463,13 @@ lldb_private::UUID CommunicationKDP::GetUUID() {
bool CommunicationKDP::RemoteIsEFI() {
if (GetKernelVersion() == NULL)
return false;
- if (strncmp(m_kernel_version.c_str(), "EFI", 3) == 0)
- return true;
- else
- return false;
+ return strncmp(m_kernel_version.c_str(), "EFI", 3) == 0;
}
bool CommunicationKDP::RemoteIsDarwinKernel() {
if (GetKernelVersion() == NULL)
return false;
- if (m_kernel_version.find("Darwin Kernel") != std::string::npos)
- return true;
- else
- return false;
+ return m_kernel_version.find("Darwin Kernel") != std::string::npos;
}
lldb::addr_t CommunicationKDP::GetLoadAddress() {
@@ -1258,9 +1252,7 @@ bool CommunicationKDP::SendRequestResume() {
request_packet.PutHex32(GetCPUMask());
DataExtractor reply_packet;
- if (SendRequestAndGetReply(command, request_packet, reply_packet))
- return true;
- return false;
+ return SendRequestAndGetReply(command, request_packet, reply_packet);
}
bool CommunicationKDP::SendRequestBreakpoint(bool set, addr_t addr) {
@@ -1293,7 +1285,5 @@ bool CommunicationKDP::SendRequestSuspend() {
const uint32_t command_length = 8;
MakeRequestPacketHeader(command, request_packet, command_length);
DataExtractor reply_packet;
- if (SendRequestAndGetReply(command, request_packet, reply_packet))
- return true;
- return false;
+ return SendRequestAndGetReply(command, request_packet, reply_packet);
}
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
index 6de7e885ea5..9ad896abd0b 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp
@@ -1670,7 +1670,7 @@ uint32_t RegisterContextDarwin_arm::SetHardwareWatchpoint(lldb::addr_t addr,
return LLDB_INVALID_INDEX32;
// We must watch for either read or write
- if (read == false && write == false)
+ if (!read && !write)
return LLDB_INVALID_INDEX32;
// Can't watch more than 4 bytes per WVR/WCR pair
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
index ff8a787a11f..b478645e035 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp
@@ -956,7 +956,7 @@ uint32_t RegisterContextDarwin_arm64::SetHardwareWatchpoint(lldb::addr_t addr,
return LLDB_INVALID_INDEX32;
// We must watch for either read or write
- if (read == false && write == false)
+ if (!read && !write)
return LLDB_INVALID_INDEX32;
// Can't watch more than 4 bytes per WVR/WCR pair
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
index 3a1f2fb37b7..8c420a87e1b 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
@@ -324,7 +324,7 @@ void RegisterContextLLDB::InitializeNonZerothFrame() {
above_trap_handler = true;
if (pc == 0 || pc == 0x1) {
- if (above_trap_handler == false) {
+ if (!above_trap_handler) {
m_frame_type = eNotAValidFrame;
UnwindLogMsg("this frame has a pc of 0x0");
return;
@@ -474,7 +474,7 @@ void RegisterContextLLDB::InitializeNonZerothFrame() {
bool decr_pc_and_recompute_addr_range = false;
// If the symbol lookup failed...
- if (m_sym_ctx_valid == false)
+ if (!m_sym_ctx_valid)
decr_pc_and_recompute_addr_range = true;
// Or if we're in the middle of the stack (and not "above" an asynchronous
@@ -1250,7 +1250,7 @@ RegisterContextLLDB::SavedLocationForRegister(
// Address register and it hasn't been saved anywhere yet -- that is,
// it's still live in the actual register. Handle this specially.
- if (have_unwindplan_regloc == false && return_address_reg.IsValid() &&
+ if (!have_unwindplan_regloc && return_address_reg.IsValid() &&
IsFrameZero()) {
if (return_address_reg.GetAsKind(eRegisterKindLLDB) !=
LLDB_INVALID_REGNUM) {
@@ -1329,11 +1329,7 @@ RegisterContextLLDB::SavedLocationForRegister(
}
}
- if (can_fetch_pc_value && can_fetch_cfa) {
- have_unwindplan_regloc = true;
- } else {
- have_unwindplan_regloc = false;
- }
+ have_unwindplan_regloc = can_fetch_pc_value && can_fetch_cfa;
} else {
// We were unable to fall back to another unwind plan
have_unwindplan_regloc = false;
@@ -1344,7 +1340,7 @@ RegisterContextLLDB::SavedLocationForRegister(
ExecutionContext exe_ctx(m_thread.shared_from_this());
Process *process = exe_ctx.GetProcessPtr();
- if (have_unwindplan_regloc == false) {
+ if (!have_unwindplan_regloc) {
// If the UnwindPlan failed to give us an unwind location for this
// register, we may be able to fall back to some ABI-defined default. For
// example, some ABIs allow to determine the caller's SP via the CFA. Also,
@@ -1363,7 +1359,7 @@ RegisterContextLLDB::SavedLocationForRegister(
}
}
- if (have_unwindplan_regloc == false) {
+ if (!have_unwindplan_regloc) {
if (IsFrameZero()) {
// This is frame 0 - we should return the actual live register context
// value
@@ -1409,7 +1405,7 @@ RegisterContextLLDB::SavedLocationForRegister(
}
if (unwindplan_regloc.IsSame()) {
- if (IsFrameZero() == false &&
+ if (!IsFrameZero() &&
(regnum.GetAsKind(eRegisterKindGeneric) == LLDB_REGNUM_GENERIC_PC ||
regnum.GetAsKind(eRegisterKindGeneric) == LLDB_REGNUM_GENERIC_RA)) {
UnwindLogMsg("register %s (%d) is marked as 'IsSame' - it is a pc or "
@@ -2051,12 +2047,8 @@ bool RegisterContextLLDB::ReadPC(addr_t &pc) {
pc = abi->FixCodeAddress(pc);
}
- if (m_all_registers_available == false && above_trap_handler == false &&
- (pc == 0 || pc == 1)) {
- return false;
- }
-
- return true;
+ return !(m_all_registers_available == false &&
+ above_trap_handler == false && (pc == 0 || pc == 1));
} else {
return false;
}
diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
index b846b447809..78f561a0f04 100644
--- a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_x86.cpp
@@ -376,7 +376,7 @@ RegisterContextPOSIX_x86::FPRType RegisterContextPOSIX_x86::GetFPRType() {
if (m_fpr_type == eNotValid) {
// TODO: Use assembly to call cpuid on the inferior and query ebx or ecx
m_fpr_type = eXSAVE; // extended floating-point registers, if available
- if (false == ReadFPR())
+ if (!ReadFPR())
m_fpr_type = eFXSAVE; // assume generic floating-point registers
}
return m_fpr_type;
diff --git a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
index 49c06fea78a..b34c87230bd 100644
--- a/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
+++ b/lldb/source/Plugins/Process/Utility/UnwindLLDB.cpp
@@ -212,15 +212,15 @@ UnwindLLDB::CursorSP UnwindLLDB::GetOneMoreFrame(ABI *abi) {
// On Mac OS X, the _sigtramp asynchronous signal trampoline frame may not
// have its (constructed) CFA aligned correctly -- don't do the abi
// alignment check for these.
- if (reg_ctx_sp->IsTrapHandlerFrame() == false) {
+ if (!reg_ctx_sp->IsTrapHandlerFrame()) {
// See if we can find a fallback unwind plan for THIS frame. It may be
// that the UnwindPlan we're using for THIS frame was bad and gave us a
// bad CFA. If that's not it, then see if we can change the UnwindPlan
// for the frame below us ("NEXT") -- see if using that other UnwindPlan
// gets us a better unwind state.
- if (reg_ctx_sp->TryFallbackUnwindPlan() == false ||
- reg_ctx_sp->GetCFA(cursor_sp->cfa) == false ||
- abi->CallFrameAddressIsValid(cursor_sp->cfa) == false) {
+ if (!reg_ctx_sp->TryFallbackUnwindPlan() ||
+ !reg_ctx_sp->GetCFA(cursor_sp->cfa) ||
+ !abi->CallFrameAddressIsValid(cursor_sp->cfa)) {
if (prev_frame->reg_ctx_lldb_sp->TryFallbackUnwindPlan()) {
// TryFallbackUnwindPlan for prev_frame succeeded and updated
// reg_ctx_lldb_sp field of prev_frame. However, cfa field of
@@ -385,10 +385,8 @@ bool UnwindLLDB::AddOneMoreFrame(ABI *abi) {
// Cursor::m_frames[m_frames.size() - 2], reg_ctx_lldb_sp field was already
// updated during TryFallbackUnwindPlan call above. However, cfa field
// still needs to be updated. Hence updating it here and then returning.
- if (!(m_frames[m_frames.size() - 2]->reg_ctx_lldb_sp->GetCFA(
- m_frames[m_frames.size() - 2]->cfa)))
- return false;
- return true;
+ return m_frames[m_frames.size() - 2]->reg_ctx_lldb_sp->GetCFA(
+ m_frames[m_frames.size() - 2]->cfa);
}
// The new frame hasn't helped in unwinding. Fall back to the original one as
@@ -470,10 +468,7 @@ bool UnwindLLDB::SearchForSavedLocationForRegister(
UnwindLLDB::RegisterSearchResult result;
result = m_frames[frame_num]->reg_ctx_lldb_sp->SavedLocationForRegister(
lldb_regnum, regloc);
- if (result == UnwindLLDB::RegisterSearchResult::eRegisterFound)
- return true;
- else
- return false;
+ return result == UnwindLLDB::RegisterSearchResult::eRegisterFound;
}
while (frame_num >= 0) {
UnwindLLDB::RegisterSearchResult result;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
index 4e20b56fb11..a3a4aa05326 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp
@@ -379,7 +379,7 @@ void GDBRemoteClientBase::Lock::SyncWithContinueThread(bool interrupt) {
log->PutCString("GDBRemoteClientBase::Lock::Lock sent packet: \\x03");
m_comm.m_interrupt_time = steady_clock::now();
}
- m_comm.m_cv.wait(lock, [this] { return m_comm.m_is_running == false; });
+ m_comm.m_cv.wait(lock, [this] { return !m_comm.m_is_running; });
m_did_interrupt = true;
}
m_acquired = true;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index 1e0db84c5c2..4605bd2e90e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -656,7 +656,7 @@ GDBRemoteCommunication::CheckForPacket(const uint8_t *src, size_t src_len,
// Size of packet before it is decompressed, for logging purposes
size_t original_packet_size = m_bytes.size();
if (CompressionIsEnabled()) {
- if (DecompressPacket() == false) {
+ if (!DecompressPacket()) {
packet.Clear();
return GDBRemoteCommunication::PacketType::Standard;
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
index 1b14e8cb7af..92bde0323a9 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -252,10 +252,7 @@ bool GDBRemoteCommunicationClient::GetVAttachOrWaitSupported() {
m_attach_or_wait_reply = eLazyBoolYes;
}
}
- if (m_attach_or_wait_reply == eLazyBoolYes)
- return true;
- else
- return false;
+ return m_attach_or_wait_reply == eLazyBoolYes;
}
bool GDBRemoteCommunicationClient::GetSyncThreadStateSupported() {
@@ -269,14 +266,11 @@ bool GDBRemoteCommunicationClient::GetSyncThreadStateSupported() {
m_prepare_for_reg_writing_reply = eLazyBoolYes;
}
}
- if (m_prepare_for_reg_writing_reply == eLazyBoolYes)
- return true;
- else
- return false;
+ return m_prepare_for_reg_writing_reply == eLazyBoolYes;
}
void GDBRemoteCommunicationClient::ResetDiscoverableSettings(bool did_exec) {
- if (did_exec == false) {
+ if (!did_exec) {
// Hard reset everything, this is when we first connect to a GDB server
m_supports_not_sending_acks = eLazyBoolCalculate;
m_supports_thread_suffix = eLazyBoolCalculate;
@@ -745,7 +739,7 @@ lldb::pid_t GDBRemoteCommunicationClient::GetCurrentProcessID(bool allow_lazy) {
bool sequence_mutex_unavailable;
size_t size;
size = GetCurrentThreadIDs(thread_ids, sequence_mutex_unavailable);
- if (size && sequence_mutex_unavailable == false) {
+ if (size && !sequence_mutex_unavailable) {
m_curr_pid = thread_ids.front();
m_curr_pid_is_valid = eLazyBoolYes;
return m_curr_pid;
@@ -839,8 +833,8 @@ int GDBRemoteCommunicationClient::SendEnvironmentPacket(
if (name_equal_value && name_equal_value[0]) {
StreamString packet;
bool send_hex_encoding = false;
- for (const char *p = name_equal_value;
- *p != '\0' && send_hex_encoding == false; ++p) {
+ for (const char *p = name_equal_value; *p != '\0' && !send_hex_encoding;
+ ++p) {
if (isprint(*p)) {
switch (*p) {
case '$':
@@ -1693,7 +1687,7 @@ Status GDBRemoteCommunicationClient::GetWatchpointSupportInfo(uint32_t &num) {
found_num_field = true;
}
}
- if (found_num_field == false) {
+ if (!found_num_field) {
m_supports_watchpoint_support_info = eLazyBoolNo;
}
} else {
@@ -1728,12 +1722,10 @@ GDBRemoteCommunicationClient::GetWatchpointsTriggerAfterInstruction(
// On targets like MIPS and ppc64le, watchpoint exceptions are always
// generated before the instruction is executed. The connected target may
// not support qHostInfo or qWatchpointSupportInfo packets.
- if (atype == llvm::Triple::mips || atype == llvm::Triple::mipsel ||
- atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el ||
- atype == llvm::Triple::ppc64le)
- after = false;
- else
- after = true;
+ after =
+ !(atype == llvm::Triple::mips || atype == llvm::Triple::mipsel ||
+ atype == llvm::Triple::mips64 || atype == llvm::Triple::mips64el ||
+ atype == llvm::Triple::ppc64le);
} else {
// For MIPS and ppc64le, set m_watchpoints_trigger_after_instruction to
// eLazyBoolNo if it is not calculated before.
@@ -3776,7 +3768,7 @@ void GDBRemoteCommunicationClient::ServeSymbolLookups(
// Is this the initial qSymbol:: packet?
bool first_qsymbol_query = true;
- if (m_supports_qSymbol && m_qSymbol_requests_done == false) {
+ if (m_supports_qSymbol && !m_qSymbol_requests_done) {
Lock lock(*this, false);
if (lock) {
StreamString packet;
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
index 98a2745b6d8..e58f47f4bef 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp
@@ -458,7 +458,7 @@ bool GDBRemoteRegisterContext::ReadAllRegisterValues(
((ProcessGDBRemote *)process)->GetGDBRemote());
const bool use_g_packet =
- gdb_comm.AvoidGPackets((ProcessGDBRemote *)process) == false;
+ !gdb_comm.AvoidGPackets((ProcessGDBRemote *)process);
GDBRemoteClientBase::Lock lock(gdb_comm, false);
if (lock) {
@@ -521,7 +521,7 @@ bool GDBRemoteRegisterContext::WriteAllRegisterValues(
((ProcessGDBRemote *)process)->GetGDBRemote());
const bool use_g_packet =
- gdb_comm.AvoidGPackets((ProcessGDBRemote *)process) == false;
+ !gdb_comm.AvoidGPackets((ProcessGDBRemote *)process);
GDBRemoteClientBase::Lock lock(gdb_comm, false);
if (lock) {
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 5959d9bc2fa..ef0915f70c1 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1528,7 +1528,7 @@ Status ProcessGDBRemote::DoResume() {
new EventDataBytes(continue_packet.GetString().data(),
continue_packet.GetSize()));
- if (listener_sp->GetEvent(event_sp, std::chrono::seconds(5)) == false) {
+ if (!listener_sp->GetEvent(event_sp, std::chrono::seconds(5))) {
error.SetErrorString("Resume timed out.");
if (log)
log->Printf("ProcessGDBRemote::DoResume: Resume timed out.");
@@ -1984,7 +1984,7 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo(
}
}
- if (!handled && signo && did_exec == false) {
+ if (!handled && signo && !did_exec) {
if (signo == SIGTRAP) {
// Currently we are going to assume SIGTRAP means we are either
// hitting a breakpoint or hardware single stepping.
@@ -2698,7 +2698,7 @@ void ProcessGDBRemote::SetLastStopPacket(
// We are are not using non-stop mode, there can only be one last stop
// reply packet, so clear the list.
- if (GetTarget().GetNonStopModeEnabled() == false)
+ if (!GetTarget().GetNonStopModeEnabled())
m_stop_packet_stack.clear();
// Add this stop packet to the stop packet stack This stack will get popped
diff --git a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
index 36a2cffec3b..db7dc3eae0b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -197,13 +197,10 @@ void ThreadGDBRemote::SetQueueLibdispatchQueueAddress(
}
bool ThreadGDBRemote::ThreadHasQueueInformation() const {
- if (m_thread_dispatch_qaddr != 0 &&
- m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS &&
- m_dispatch_queue_t != LLDB_INVALID_ADDRESS &&
- m_queue_kind != eQueueKindUnknown && m_queue_serial_number != 0) {
- return true;
- }
- return false;
+ return m_thread_dispatch_qaddr != 0 &&
+ m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS &&
+ m_dispatch_queue_t != LLDB_INVALID_ADDRESS &&
+ m_queue_kind != eQueueKindUnknown && m_queue_serial_number != 0;
}
LazyBool ThreadGDBRemote::GetAssociatedWithLibdispatchQueue() {
diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
index bdb6a604118..08b9f08a47f 100644
--- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -302,36 +302,38 @@ Status ProcessMachCore::DoLoadCore() {
// LC_IDENT is very obsolete and should not be used in new code, but if the
// load command is present, let's use the contents.
std::string corefile_identifier = core_objfile->GetIdentifierString();
- if (found_main_binary_definitively == false
- && corefile_identifier.find("Darwin Kernel") != std::string::npos) {
- UUID uuid;
- addr_t addr = LLDB_INVALID_ADDRESS;
- if (corefile_identifier.find("UUID=") != std::string::npos) {
- size_t p = corefile_identifier.find("UUID=") + strlen("UUID=");
- std::string uuid_str = corefile_identifier.substr(p, 36);
- uuid.SetFromStringRef(uuid_str);
- }
- if (corefile_identifier.find("stext=") != std::string::npos) {
- size_t p = corefile_identifier.find("stext=") + strlen("stext=");
- if (corefile_identifier[p] == '0' && corefile_identifier[p + 1] == 'x') {
- errno = 0;
- addr = ::strtoul(corefile_identifier.c_str() + p, NULL, 16);
- if (errno != 0 || addr == 0)
- addr = LLDB_INVALID_ADDRESS;
- }
- }
- if (uuid.IsValid() && addr != LLDB_INVALID_ADDRESS) {
- m_mach_kernel_addr = addr;
- found_main_binary_definitively = true;
- if (log)
- log->Printf("ProcessMachCore::DoLoadCore: Using the kernel address 0x%" PRIx64
- " from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'", addr, corefile_identifier.c_str());
+ if (!found_main_binary_definitively &&
+ corefile_identifier.find("Darwin Kernel") != std::string::npos) {
+ UUID uuid;
+ addr_t addr = LLDB_INVALID_ADDRESS;
+ if (corefile_identifier.find("UUID=") != std::string::npos) {
+ size_t p = corefile_identifier.find("UUID=") + strlen("UUID=");
+ std::string uuid_str = corefile_identifier.substr(p, 36);
+ uuid.SetFromStringRef(uuid_str);
+ }
+ if (corefile_identifier.find("stext=") != std::string::npos) {
+ size_t p = corefile_identifier.find("stext=") + strlen("stext=");
+ if (corefile_identifier[p] == '0' && corefile_identifier[p + 1] == 'x') {
+ errno = 0;
+ addr = ::strtoul(corefile_identifier.c_str() + p, NULL, 16);
+ if (errno != 0 || addr == 0)
+ addr = LLDB_INVALID_ADDRESS;
}
+ }
+ if (uuid.IsValid() && addr != LLDB_INVALID_ADDRESS) {
+ m_mach_kernel_addr = addr;
+ found_main_binary_definitively = true;
+ if (log)
+ log->Printf(
+ "ProcessMachCore::DoLoadCore: Using the kernel address 0x%" PRIx64
+ " from LC_IDENT/LC_NOTE 'kern ver str' string: '%s'",
+ addr, corefile_identifier.c_str());
+ }
}
- if (found_main_binary_definitively == false
- && (m_dyld_addr == LLDB_INVALID_ADDRESS
- || m_mach_kernel_addr == LLDB_INVALID_ADDRESS)) {
+ if (!found_main_binary_definitively &&
+ (m_dyld_addr == LLDB_INVALID_ADDRESS ||
+ m_mach_kernel_addr == LLDB_INVALID_ADDRESS)) {
// We need to locate the main executable in the memory ranges we have in
// the core file. We need to search for both a user-process dyld binary
// and a kernel binary in memory; we must look at all the pages in the
@@ -352,16 +354,15 @@ Status ProcessMachCore::DoLoadCore() {
}
}
- if (found_main_binary_definitively == false
- && m_mach_kernel_addr != LLDB_INVALID_ADDRESS) {
+ if (!found_main_binary_definitively &&
+ m_mach_kernel_addr != LLDB_INVALID_ADDRESS) {
// In the case of multiple kernel images found in the core file via
// exhaustive search, we may not pick the correct one. See if the
// DynamicLoaderDarwinKernel's search heuristics might identify the correct
// one. Most of the time, I expect the address from SearchForDarwinKernel()
// will be the same as the address we found via exhaustive search.
- if (GetTarget().GetArchitecture().IsValid() == false &&
- m_core_module_sp.get()) {
+ if (!GetTarget().GetArchitecture().IsValid() && m_core_module_sp.get()) {
GetTarget().SetArchitecture(m_core_module_sp->GetArchitecture());
}
OpenPOWER on IntegriCloud