[Lldb-commits] [lldb] r219377 - logging: added more logging to the Target/Platform launch & attach sequence.
Todd Fiala
todd.fiala at gmail.com
Wed Oct 8 18:02:08 PDT 2014
Author: tfiala
Date: Wed Oct 8 20:02:08 2014
New Revision: 219377
URL: http://llvm.org/viewvc/llvm-project?rev=219377&view=rev
Log:
logging: added more logging to the Target/Platform launch & attach sequence.
Modified:
lldb/trunk/source/Target/Platform.cpp
lldb/trunk/source/Target/Target.cpp
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=219377&r1=219376&r2=219377&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Wed Oct 8 20:02:08 2014
@@ -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 (ProcessLaunchIn
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 (ProcessLaunchIn
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 (ProcessLaunchInf
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 (ProcessLaunchInf
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 (ProcessLaunchInf
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;
}
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=219377&r1=219376&r2=219377&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Wed Oct 8 20:02:08 2014
@@ -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, Proc
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, Proc
// 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, Proc
}
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, Proc
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)
More information about the lldb-commits
mailing list