Added code in the Host layer that can report system log messages

so that we don't have "fprintf (stderr, ...)" calls sprinkled everywhere.
Changed all needed locations over to using this.

For non-darwin, we log to stderr only. On darwin, we log to stderr _and_
to ASL (Apple System Log facility). This will allow GUI apps to have a place
for these error and warning messages to go, and also allows the command line
apps to log directly to the terminal.

llvm-svn: 147596
This commit is contained in:
Greg Clayton
2012-01-05 03:57:59 +00:00
parent 71c8055f8e
commit e38a5edd9e
19 changed files with 422 additions and 292 deletions

View File

@@ -15,6 +15,7 @@
// Project includes
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Symbol/ClangNamespaceDecl.h"
#include "lldb/Symbol/ObjectFile.h"
@@ -700,11 +701,12 @@ ModuleList::GetModuleSP (const Module *module_ptr)
char uuid_cstr[256];
const_cast<Module *>(module_ptr)->GetUUID().GetAsCString (uuid_cstr, sizeof(uuid_cstr));
const FileSpec &module_file_spec = module_ptr->GetFileSpec();
fprintf (stderr, "warning: module not in shared module list: %s (%s) \"%s/%s\"\n",
uuid_cstr,
module_ptr->GetArchitecture().GetArchitectureName(),
module_file_spec.GetDirectory().GetCString(),
module_file_spec.GetFilename().GetCString());
Host::SystemLog (Host::eSystemLogWarning,
"warning: module not in shared module list: %s (%s) \"%s/%s\"\n",
uuid_cstr,
module_ptr->GetArchitecture().GetArchitectureName(),
module_file_spec.GetDirectory().GetCString(),
module_file_spec.GetFilename().GetCString());
}
}
return module_sp;