mirror of
https://github.com/intel/llvm.git
synced 2026-01-14 03:50:17 +08:00
logging: added more logging to the Target/Platform launch & attach sequence.
llvm-svn: 219377
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user