diff options
author | Greg Clayton <gclayton@apple.com> | 2011-05-19 03:54:16 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-05-19 03:54:16 +0000 |
commit | af247d7b98c9bfac07602907c34a4bf5bac806b0 (patch) | |
tree | 050933809c9aac94fd63199d49b32621993baad6 | |
parent | 41025dc95bd215cf5aeb5e3eb675f835183e1f7e (diff) | |
download | bcm5719-llvm-af247d7b98c9bfac07602907c34a4bf5bac806b0.tar.gz bcm5719-llvm-af247d7b98c9bfac07602907c34a4bf5bac806b0.zip |
Fixed a crasher that was happened when a log shared pointer wasn't valid.
Fixed ThreadPlanCallFunction::ReportRegisterState(...) to only dump when
verbose logging is enabled and fixed the function to use the new
RegisterValue method of reading registers.
Fixed the GDB remote client to not send a continue packet after receiving
stdout or stderr from the inferior process.
llvm-svn: 131628
-rw-r--r-- | lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp | 18 | ||||
-rw-r--r-- | lldb/source/Target/Thread.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanCallFunction.cpp | 27 |
3 files changed, 31 insertions, 16 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp index f4e67022fc6..bfb4755931b 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -361,14 +361,21 @@ GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse // make change if we are interrupted and we continue after an async packet... std::string continue_packet(payload, packet_length); + bool got_stdout = false; + while (state == eStateRunning) { - if (log) - log->Printf ("GDBRemoteCommunicationClient::%s () sending continue packet: %s", __FUNCTION__, continue_packet.c_str()); - if (SendPacket(continue_packet.c_str(), continue_packet.size()) == 0) - state = eStateInvalid; + if (!got_stdout) + { + if (log) + log->Printf ("GDBRemoteCommunicationClient::%s () sending continue packet: %s", __FUNCTION__, continue_packet.c_str()); + if (SendPacket(continue_packet.c_str(), continue_packet.size()) == 0) + state = eStateInvalid; + + m_private_is_running.SetValue (true, eBroadcastNever); + } - m_private_is_running.SetValue (true, eBroadcastNever); + got_stdout = false; if (log) log->Printf ("GDBRemoteCommunicationClient::%s () WaitForPacket(%.*s)", __FUNCTION__); @@ -489,6 +496,7 @@ GDBRemoteCommunicationClient::SendContinuePacketAndWaitForResponse case 'O': // STDOUT { + got_stdout = true; std::string inferior_stdout; inferior_stdout.reserve(response.GetBytesLeft () / 2); char ch; diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 9f77e61dfb8..288694bfffd 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -266,7 +266,7 @@ Thread::ShouldStop (Event* event_ptr) { should_stop = current_plan->ShouldStop (event_ptr); if (log) - log->Printf("Base plan says should stop: %d.", current_plan->GetName(), should_stop); + log->Printf("Base plan says should stop: %i.", should_stop); } else { diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index 7d798fc6b20..40ee45f749b 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -197,8 +197,9 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread, m_start_addr = objectFile->GetEntryPointAddress(); if (!m_start_addr.IsValid()) { - log->Printf ("Could not find entry point address for executable module \"%s\".", - executableModuleSP->GetFileSpec().GetFilename().AsCString()); + if (log) + log->Printf ("Could not find entry point address for executable module \"%s\".", + executableModuleSP->GetFileSpec().GetFilename().AsCString()); return; } } @@ -247,22 +248,28 @@ ThreadPlanCallFunction::~ThreadPlanCallFunction () void ThreadPlanCallFunction::ReportRegisterState (const char *message) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP | LIBLLDB_LOG_VERBOSE)); if (log) { + StreamString strm; RegisterContext *reg_ctx = m_thread.GetRegisterContext().get(); log->PutCString(message); - for (uint32_t register_index = 0, num_registers = reg_ctx->GetRegisterCount(); - register_index < num_registers; - ++register_index) + RegisterValue reg_value; + + for (uint32_t reg_idx = 0, num_registers = reg_ctx->GetRegisterCount(); + reg_idx < num_registers; + ++reg_idx) { - const char *register_name = reg_ctx->GetRegisterName(register_index); - uint64_t register_value = reg_ctx->ReadRegisterAsUnsigned(register_index, LLDB_INVALID_ADDRESS); - - log->Printf(" %s = 0x%llx", register_name, register_value); + const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex (reg_idx); + if (reg_ctx->ReadRegister(reg_info, reg_value)) + { + reg_value.Dump(&strm, reg_info, true, false, eFormatDefault); + strm.EOL(); + } } + log->PutCString(strm.GetData()); } } |