summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/SymbolFile.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-11-28 01:45:00 +0000
committerGreg Clayton <gclayton@apple.com>2011-11-28 01:45:00 +0000
commitc982b3d6e654b5e909948d6c511fc6c7e2b670e3 (patch)
treec321f6b5a6f1ca41bce279f735a61b9ce3767b0e /lldb/source/Symbol/SymbolFile.cpp
parentb0456936da65a3d7939428d75e7db2ebb4266a46 (diff)
downloadbcm5719-llvm-c982b3d6e654b5e909948d6c511fc6c7e2b670e3.tar.gz
bcm5719-llvm-c982b3d6e654b5e909948d6c511fc6c7e2b670e3.zip
CommandObjectProcess was recently changed to automatically use the platform
to launch a process for debugging. Since this isn't supported on all platforms, we need to do what we used to do if this isn't supported. I added: bool Platform::CanDebugProcess (); This will get checked before trying to launch a process for debugging and then fall back to launching the process through the current host debugger. This should solve the issue for linux and keep the platform code clean. Centralized logging code for logging errors, warnings and logs when reporting things for modules or symbol files. Both lldb_private::Module and lldb_private::SymbolFile now have the following member functions: void LogMessage (Log *log, const char *format, ...); void ReportWarning (const char *format, ...); void ReportError (const char *format, ...); These will all output the module name and object (if any) such as: "error: lldb.so ...." "warning: my_archive.a(foo.o) ...." This will keep the output consistent and stop a lot of logging calls from having to try and output all of the information that uniquely identifies a module or symbol file. Many places in the code were grabbing the path to the object file manually and if the module represented a .o file in an archive, we would see log messages like: error: foo.a - some error happened llvm-svn: 145219
Diffstat (limited to 'lldb/source/Symbol/SymbolFile.cpp')
-rw-r--r--lldb/source/Symbol/SymbolFile.cpp47
1 files changed, 46 insertions, 1 deletions
diff --git a/lldb/source/Symbol/SymbolFile.cpp b/lldb/source/Symbol/SymbolFile.cpp
index e729ac302e4..da107630b04 100644
--- a/lldb/source/Symbol/SymbolFile.cpp
+++ b/lldb/source/Symbol/SymbolFile.cpp
@@ -7,10 +7,13 @@
//
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-private.h"
#include "lldb/Symbol/SymbolFile.h"
+
+#include "lldb/lldb-private.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/ObjectFile.h"
using namespace lldb_private;
@@ -68,3 +71,45 @@ SymbolFile::GetClangASTContext ()
return m_obj_file->GetModule()->GetClangASTContext();
}
+
+void
+SymbolFile::ReportError (const char *format, ...)
+{
+ StreamString module_description;
+ m_obj_file->GetModule()->GetDescription (&module_description, lldb::eDescriptionLevelBrief);
+ ::fprintf (stderr, "error: %s ", module_description.GetString().c_str());
+
+ va_list args;
+ va_start (args, format);
+ vfprintf (stderr, format, args);
+ va_end (args);
+}
+
+void
+SymbolFile::ReportWarning (const char *format, ...)
+{
+ StreamString module_description;
+ m_obj_file->GetModule()->GetDescription (&module_description, lldb::eDescriptionLevelBrief);
+ ::fprintf (stderr, "warning: %s ", module_description.GetString().c_str());
+
+ va_list args;
+ va_start (args, format);
+ vfprintf (stderr, format, args);
+ va_end (args);
+}
+
+void
+SymbolFile::LogMessage (Log *log, const char *format, ...)
+{
+ if (log)
+ {
+ StreamString log_message;
+ m_obj_file->GetModule()->GetDescription (&log_message, lldb::eDescriptionLevelBrief);
+ log_message.PutChar(' ');
+ va_list args;
+ va_start (args, format);
+ log_message.PrintfVarArg (format, args);
+ va_end (args);
+ log->PutCString (log_message.GetString().c_str());
+ }
+}
OpenPOWER on IntegriCloud