diff options
| author | Todd Fiala <todd.fiala@gmail.com> | 2014-10-09 01:02:08 +0000 |
|---|---|---|
| committer | Todd Fiala <todd.fiala@gmail.com> | 2014-10-09 01:02:08 +0000 |
| commit | ac33cc9ce71211b49532debf491f35d6b4c14bce (patch) | |
| tree | 83a1465d974a04c8b2c35d06939b4a7f20b62b3c | |
| parent | cb2018f57c87f980c066724174ffed75fab37b31 (diff) | |
| download | bcm5719-llvm-ac33cc9ce71211b49532debf491f35d6b4c14bce.tar.gz bcm5719-llvm-ac33cc9ce71211b49532debf491f35d6b4c14bce.zip | |
logging: added more logging to the Target/Platform launch & attach sequence.
llvm-svn: 219377
| -rw-r--r-- | lldb/source/Target/Platform.cpp | 39 | ||||
| -rw-r--r-- | lldb/source/Target/Target.cpp | 23 |
2 files changed, 59 insertions, 3 deletions
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 4f449c5fd00..edad0024ed3 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -1045,7 +1045,11 @@ Error Platform::LaunchProcess (ProcessLaunchInfo &launch_info) { Error error; - // Take care of the host case so that each subclass can just + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM)); + if (log) + log->Printf ("Platform::%s()", __FUNCTION__); + + // Take care of the host case so that each subclass can just // call this function to get the host functionality. if (IsHost()) { @@ -1058,6 +1062,12 @@ Platform::LaunchProcess (ProcessLaunchInfo &launch_info) const bool will_debug = launch_info.GetFlags().Test(eLaunchFlagDebug); const bool first_arg_is_full_shell_command = false; uint32_t num_resumes = GetResumeCountForLaunchInfo (launch_info); + if (log) + log->Printf ("Platform::%s GetResumeCountForLaunchInfo() returned %" PRIu32 ", shell is '%s'", + __FUNCTION__, + num_resumes, + launch_info.GetShell () ? launch_info.GetShell () : "<null>"); + if (!launch_info.ConvertArgumentsForLaunchingInShell (error, is_localhost, will_debug, @@ -1066,6 +1076,9 @@ Platform::LaunchProcess (ProcessLaunchInfo &launch_info) return error; } + if (log) + log->Printf ("Platform::%s final launch_info resume count: %" PRIu32, __FUNCTION__, launch_info.GetResumeCount ()); + error = Host::LaunchProcess (launch_info); } else @@ -1080,6 +1093,10 @@ Platform::DebugProcess (ProcessLaunchInfo &launch_info, Listener &listener, Error &error) { + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PLATFORM)); + if (log) + log->Printf ("Platform::%s entered (target %p)", __FUNCTION__, static_cast<void*>(target)); + ProcessSP process_sp; // Make sure we stop at the entry point launch_info.GetFlags ().Set (eLaunchFlagDebug); @@ -1091,12 +1108,16 @@ Platform::DebugProcess (ProcessLaunchInfo &launch_info, error = LaunchProcess (launch_info); if (error.Success()) { + if (log) + log->Printf ("Platform::%s LaunchProcess() call succeeded (pid=%" PRIu64 ")", __FUNCTION__, launch_info.GetProcessID ()); if (launch_info.GetProcessID() != LLDB_INVALID_PROCESS_ID) { ProcessAttachInfo attach_info (launch_info); process_sp = Attach (attach_info, debugger, target, listener, error); if (process_sp) { + if (log) + log->Printf ("Platform::%s Attach() succeeded, Process plugin: %s", __FUNCTION__, process_sp->GetPluginName ().AsCString ()); launch_info.SetHijackListener(attach_info.GetHijackListener()); // Since we attached to the process, it will think it needs to detach @@ -1115,8 +1136,24 @@ Platform::DebugProcess (ProcessLaunchInfo &launch_info, process_sp->SetSTDIOFileDescriptor(pty_fd); } } + else + { + if (log) + log->Printf ("Platform::%s Attach() failed: %s", __FUNCTION__, error.AsCString ()); + } + } + else + { + if (log) + log->Printf ("Platform::%s LaunchProcess() returned launch_info with invalid process id", __FUNCTION__); } } + else + { + if (log) + log->Printf ("Platform::%s LaunchProcess() failed: %s", __FUNCTION__, error.AsCString ()); + } + return process_sp; } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index b4341235bcb..8496463771c 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2337,7 +2337,11 @@ Error Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info) { Error error; - + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET)); + + if (log) + log->Printf ("Target::%s() called for %s", __FUNCTION__, launch_info.GetExecutableFile().GetPath().c_str ()); + StateType state = eStateInvalid; // Scope to temporarily get the process state in case someone has manually @@ -2347,7 +2351,16 @@ Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info) ProcessSP process_sp (GetProcessSP()); if (process_sp) + { state = process_sp->GetState(); + if (log) + log->Printf ("Target::%s the process exists, and its current state is %s", __FUNCTION__, StateAsCString (state)); + } + else + { + if (log) + log->Printf ("Target::%s the process instance doesn't currently exist.", __FUNCTION__); + } } launch_info.GetFlags().Set (eLaunchFlagDebug); @@ -2380,6 +2393,9 @@ Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info) // If we're not already connected to the process, and if we have a platform that can launch a process for debugging, go ahead and do that here. if (state != eStateConnected && platform_sp && platform_sp->CanDebugProcess ()) { + if (log) + log->Printf ("Target::%s asking the platform to debug the process", __FUNCTION__); + m_process_sp = GetPlatform()->DebugProcess (launch_info, debugger, this, @@ -2388,6 +2404,9 @@ Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info) } else { + if (log) + log->Printf ("Target::%s the platform doesn't know how to debug a process, getting a process plugin to do this for us.", __FUNCTION__); + if (state == eStateConnected) { assert(m_process_sp); @@ -2416,7 +2435,7 @@ Target::Launch (Listener &listener, ProcessLaunchInfo &launch_info) if (launch_info.GetFlags().Test(eLaunchFlagStopAtEntry) == false) { ListenerSP hijack_listener_sp (launch_info.GetHijackListener()); - + StateType state = m_process_sp->WaitForProcessToStop (NULL, NULL, false, hijack_listener_sp.get()); if (state == eStateStopped) |

