Check log shared pointer before using it.

llvm-svn: 137228
This commit is contained in:
Johnny Chen
2011-08-10 17:58:11 +00:00
parent 3ff111c12d
commit 9e916e8096

View File

@@ -69,7 +69,8 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
if (!executableModuleSP)
{
log->Printf ("Can't execute code without an executable module.");
if (log)
log->Printf ("Can't execute code without an executable module.");
return;
}
else
@@ -77,15 +78,17 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
ObjectFile *objectFile = executableModuleSP->GetObjectFile();
if (!objectFile)
{
log->Printf ("Could not find object file for module \"%s\".",
executableModuleSP->GetFileSpec().GetFilename().AsCString());
if (log)
log->Printf ("Could not find object file for module \"%s\".",
executableModuleSP->GetFileSpec().GetFilename().AsCString());
return;
}
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;
}
}
@@ -182,7 +185,8 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
if (!executableModuleSP)
{
log->Printf ("Can't execute code without an executable module.");
if (log)
log->Printf ("Can't execute code without an executable module.");
return;
}
else
@@ -190,8 +194,9 @@ ThreadPlanCallFunction::ThreadPlanCallFunction (Thread &thread,
ObjectFile *objectFile = executableModuleSP->GetObjectFile();
if (!objectFile)
{
log->Printf ("Could not find object file for module \"%s\".",
executableModuleSP->GetFileSpec().GetFilename().AsCString());
if (log)
log->Printf ("Could not find object file for module \"%s\".",
executableModuleSP->GetFileSpec().GetFilename().AsCString());
return;
}
m_start_addr = objectFile->GetEntryPointAddress();