[Lldb-commits] [lldb] r169342 - in /lldb/trunk: include/lldb/lldb-private-log.h source/Target/Target.cpp source/lldb-log.cpp
Jason Molenda
jmolenda at apple.com
Tue Dec 4 16:25:49 PST 2012
Author: jmolenda
Date: Tue Dec 4 18:25:49 2012
New Revision: 169342
URL: http://llvm.org/viewvc/llvm-project?rev=169342&view=rev
Log:
Add an LLDB_LOG_TARGET logging channel (log eanble lldb target).
Update the Target methods which can change the target log to this
channel.
Modified:
lldb/trunk/include/lldb/lldb-private-log.h
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/lldb-log.cpp
Modified: lldb/trunk/include/lldb/lldb-private-log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=169342&r1=169341&r2=169342&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-log.h (original)
+++ lldb/trunk/include/lldb/lldb-private-log.h Tue Dec 4 18:25:49 2012
@@ -41,6 +41,7 @@
#define LIBLLDB_LOG_TYPES (1u << 19)
#define LIBLLDB_LOG_SYMBOLS (1u << 20)
#define LIBLLDB_LOG_MODULES (1u << 21)
+#define LIBLLDB_LOG_TARGET (1u << 22)
#define LIBLLDB_LOG_ALL (UINT32_MAX)
#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\
LIBLLDB_LOG_THREAD |\
@@ -50,6 +51,7 @@
LIBLLDB_LOG_STEP |\
LIBLLDB_LOG_STATE |\
LIBLLDB_LOG_SYMBOLS |\
+ LIBLLDB_LOG_TARGET |\
LIBLLDB_LOG_COMMANDS)
namespace lldb_private {
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=169342&r1=169341&r2=169342&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Tue Dec 4 18:25:49 2012
@@ -94,6 +94,11 @@
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Target::Target()", this);
+ if (m_arch.IsValid())
+ {
+ LogSP log_target(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
+ log_target->Printf("Target::Target created with architecture %s (%s)", m_arch.GetArchitectureName(), m_arch.GetTriple().getTriple().c_str());
+ }
}
//----------------------------------------------------------------------
@@ -978,6 +983,7 @@
void
Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files)
{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
m_images.Clear();
m_scratch_ast_context_ap.reset();
m_scratch_ast_source_ap.reset();
@@ -994,8 +1000,12 @@
// If we haven't set an architecture yet, reset our architecture based on what we found in the executable module.
if (!m_arch.IsValid())
+ {
m_arch = executable_sp->GetArchitecture();
-
+ if (log)
+ log->Printf ("Target::SetExecutableModule setting architecture to %s (%s) based on executable file", m_arch.GetArchitectureName(), m_arch.GetTriple().getTriple().c_str());
+ }
+
FileSpecList dependent_files;
ObjectFile *executable_objfile = executable_sp->GetObjectFile();
@@ -1028,6 +1038,7 @@
bool
Target::SetArchitecture (const ArchSpec &arch_spec)
{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET));
if (m_arch == arch_spec || !m_arch.IsValid())
{
// If we haven't got a valid arch spec, or the architectures are
@@ -1035,11 +1046,15 @@
// equal, yet the triple OS and vendor might change, so we need to do
// the assignment here just in case.
m_arch = arch_spec;
+ if (log)
+ log->Printf ("Target::SetArchitecture setting architecture to %s (%s)", arch_spec.GetArchitectureName(), arch_spec.GetTriple().getTriple().c_str());
return true;
}
else
{
// If we have an executable file, try to reset the executable to the desired architecture
+ if (log)
+ printf ("Target::SetArchitecture changing architecture to %s (%s)", arch_spec.GetArchitectureName(), arch_spec.GetTriple().getTriple().c_str());
m_arch = arch_spec;
ModuleSP executable_sp = GetExecutableModule ();
m_images.Clear();
@@ -1050,6 +1065,8 @@
if (executable_sp)
{
+ if (log)
+ log->Printf("Target::SetArchitecture Trying to select executable file architecture %s (%s)", arch_spec.GetArchitectureName(), arch_spec.GetTriple().getTriple().c_str());
ModuleSpec module_spec (executable_sp->GetFileSpec(), arch_spec);
Error error = ModuleList::GetSharedModule (module_spec,
executable_sp,
Modified: lldb/trunk/source/lldb-log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=169342&r1=169341&r2=169342&view=diff
==============================================================================
--- lldb/trunk/source/lldb-log.cpp (original)
+++ lldb/trunk/source/lldb-log.cpp Tue Dec 4 18:25:49 2012
@@ -126,6 +126,7 @@
else if (0 == ::strcasecmp(arg, "state")) flag_bits &= ~LIBLLDB_LOG_STATE;
else if (0 == ::strcasecmp(arg, "step")) flag_bits &= ~LIBLLDB_LOG_STEP;
else if (0 == ::strcasecmp(arg, "thread")) flag_bits &= ~LIBLLDB_LOG_THREAD;
+ else if (0 == ::strcasecmp(arg, "target")) flag_bits &= ~LIBLLDB_LOG_TARGET;
else if (0 == ::strcasecmp(arg, "verbose")) flag_bits &= ~LIBLLDB_LOG_VERBOSE;
else if (0 == ::strncasecmp(arg, "watch", 5)) flag_bits &= ~LIBLLDB_LOG_WATCHPOINTS;
else if (0 == ::strncasecmp(arg, "temp", 4)) flag_bits &= ~LIBLLDB_LOG_TEMPORARY;
@@ -193,6 +194,7 @@
else if (0 == ::strcasecmp(arg, "state")) flag_bits |= LIBLLDB_LOG_STATE;
else if (0 == ::strcasecmp(arg, "step")) flag_bits |= LIBLLDB_LOG_STEP;
else if (0 == ::strcasecmp(arg, "thread")) flag_bits |= LIBLLDB_LOG_THREAD;
+ else if (0 == ::strcasecmp(arg, "target")) flag_bits |= LIBLLDB_LOG_TARGET;
else if (0 == ::strcasecmp(arg, "verbose")) flag_bits |= LIBLLDB_LOG_VERBOSE;
else if (0 == ::strncasecmp(arg, "watch", 5)) flag_bits |= LIBLLDB_LOG_WATCHPOINTS;
else if (0 == ::strncasecmp(arg, "temp", 4)) flag_bits |= LIBLLDB_LOG_TEMPORARY;
@@ -237,6 +239,7 @@
" state - log private and public process state changes\n"
" step - log step related activities\n"
" symbol - log symbol related issues and warnings\n"
+ " target - log target events and activities\n"
" thread - log thread events and activities\n"
" types - log type system related activities\n"
" unwind - log stack unwind activities\n"
More information about the lldb-commits
mailing list