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:
parent
71c8055f8e
commit
e38a5edd9e
|
@ -678,6 +678,17 @@ public:
|
|||
void
|
||||
ReportError (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
// Only report an error once when the module is first detected to be modified
|
||||
// so we don't spam the console with many messages.
|
||||
void
|
||||
ReportErrorIfModifyDetected (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
bool
|
||||
GetModified (bool use_cached_only);
|
||||
|
||||
bool
|
||||
SetModified (bool b);
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Member Variables
|
||||
|
@ -697,7 +708,8 @@ protected:
|
|||
m_did_load_symbol_vendor:1,
|
||||
m_did_parse_uuid:1,
|
||||
m_did_init_ast:1,
|
||||
m_is_dynamic_loader_module:1;
|
||||
m_is_dynamic_loader_module:1,
|
||||
m_was_modified:1; /// See if the module was modified after it was initially opened.
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Resolve a file or load virtual address.
|
||||
|
|
|
@ -116,7 +116,19 @@ public:
|
|||
|
||||
static const char *
|
||||
GetGroupName (uint32_t gid, std::string &group_name);
|
||||
|
||||
|
||||
enum SystemLogType
|
||||
{
|
||||
eSystemLogWarning,
|
||||
eSystemLogError
|
||||
};
|
||||
|
||||
static void
|
||||
SystemLog (SystemLogType type, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
static void
|
||||
SystemLog (SystemLogType type, const char *format, va_list args);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Gets the host architecture.
|
||||
///
|
||||
|
|
|
@ -148,13 +148,6 @@ public:
|
|||
ObjectFile* GetObjectFile() { return m_obj_file; }
|
||||
const ObjectFile* GetObjectFile() const { return m_obj_file; }
|
||||
|
||||
// Special error functions that can do printf style formatting that will prepend the message with
|
||||
// something appropriate for this symbol file (like the architecture, path and object name). This
|
||||
// centralizes code so that everyone doesn't need to format their error and log messages on their
|
||||
// own and keeps the output a bit more consistent.
|
||||
void LogMessage (Log *log, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
void ReportWarning (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
void ReportError (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
protected:
|
||||
ObjectFile* m_obj_file; // The object file that symbols can be extracted from.
|
||||
uint32_t m_abilities;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "lldb/Core/RegularExpression.h"
|
||||
#include "lldb/Core/StreamString.h"
|
||||
#include "lldb/Core/Timer.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
#include "lldb/lldb-private-log.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/Symbol/SymbolContext.h"
|
||||
|
@ -85,7 +86,8 @@ Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstStrin
|
|||
m_did_load_symbol_vendor (false),
|
||||
m_did_parse_uuid (false),
|
||||
m_did_init_ast (false),
|
||||
m_is_dynamic_loader_module (false)
|
||||
m_is_dynamic_loader_module (false),
|
||||
m_was_modified (false)
|
||||
{
|
||||
// Scope for locker below...
|
||||
{
|
||||
|
@ -613,27 +615,82 @@ Module::GetDescription (Stream *s, lldb::DescriptionLevel level)
|
|||
void
|
||||
Module::ReportError (const char *format, ...)
|
||||
{
|
||||
StreamString module_description;
|
||||
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);
|
||||
if (format && format[0])
|
||||
{
|
||||
StreamString strm;
|
||||
strm.PutCString("error: ");
|
||||
GetDescription(&strm, lldb::eDescriptionLevelBrief);
|
||||
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
strm.PrintfVarArg(format, args);
|
||||
va_end (args);
|
||||
|
||||
const int format_len = strlen(format);
|
||||
if (format_len > 0)
|
||||
{
|
||||
const char last_char = format[format_len-1];
|
||||
if (last_char != '\n' || last_char != '\r')
|
||||
strm.EOL();
|
||||
}
|
||||
Host::SystemLog (Host::eSystemLogError, "%s", strm.GetString().c_str());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Module::ReportErrorIfModifyDetected (const char *format, ...)
|
||||
{
|
||||
if (!GetModified(true) && GetModified(false))
|
||||
{
|
||||
if (format)
|
||||
{
|
||||
StreamString strm;
|
||||
strm.PutCString("error: the object file ");
|
||||
GetDescription(&strm, lldb::eDescriptionLevelFull);
|
||||
strm.PutCString (" has been modified\n");
|
||||
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
strm.PrintfVarArg(format, args);
|
||||
va_end (args);
|
||||
|
||||
const int format_len = strlen(format);
|
||||
if (format_len > 0)
|
||||
{
|
||||
const char last_char = format[format_len-1];
|
||||
if (last_char != '\n' || last_char != '\r')
|
||||
strm.EOL();
|
||||
}
|
||||
strm.PutCString("The debug session should be aborted as the original debug information has been overwritten.\n");
|
||||
Host::SystemLog (Host::eSystemLogError, "%s", strm.GetString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Module::ReportWarning (const char *format, ...)
|
||||
{
|
||||
StreamString module_description;
|
||||
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);
|
||||
if (format && format[0])
|
||||
{
|
||||
StreamString strm;
|
||||
strm.PutCString("warning: ");
|
||||
GetDescription(&strm, lldb::eDescriptionLevelBrief);
|
||||
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
strm.PrintfVarArg(format, args);
|
||||
va_end (args);
|
||||
|
||||
const int format_len = strlen(format);
|
||||
if (format_len > 0)
|
||||
{
|
||||
const char last_char = format[format_len-1];
|
||||
if (last_char != '\n' || last_char != '\r')
|
||||
strm.EOL();
|
||||
}
|
||||
Host::SystemLog (Host::eSystemLogWarning, "%s", strm.GetString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -652,6 +709,26 @@ Module::LogMessage (Log *log, const char *format, ...)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Module::GetModified (bool use_cached_only)
|
||||
{
|
||||
if (m_was_modified == false && use_cached_only == false)
|
||||
{
|
||||
TimeValue curr_mod_time (m_file.GetModificationTime());
|
||||
m_was_modified = curr_mod_time != m_mod_time;
|
||||
}
|
||||
return m_was_modified;
|
||||
}
|
||||
|
||||
bool
|
||||
Module::SetModified (bool b)
|
||||
{
|
||||
const bool prev_value = m_was_modified;
|
||||
m_was_modified = b;
|
||||
return prev_value;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Module::Dump(Stream *s)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -231,8 +231,24 @@ MonitorChildProcessThreadFunction (void *arg)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Host::SystemLog (SystemLogType type, const char *format, va_list args)
|
||||
{
|
||||
vfprintf (stderr, format, args);
|
||||
}
|
||||
|
||||
#endif // #if !defined (__APPLE__)
|
||||
|
||||
void
|
||||
Host::SystemLog (SystemLogType type, const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, format);
|
||||
SystemLog (type, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
size_t
|
||||
Host::GetPageSize()
|
||||
{
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "lldb/Host/Host.h"
|
||||
|
||||
#include <asl.h>
|
||||
#include <crt_externs.h>
|
||||
#include <execinfo.h>
|
||||
#include <grp.h>
|
||||
|
@ -1515,3 +1516,45 @@ Host::StartMonitoringChildProcess (Host::MonitorChildProcessCallback callback,
|
|||
}
|
||||
return thread;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Log to both stderr and to ASL Logging when running on MacOSX.
|
||||
//----------------------------------------------------------------------
|
||||
void
|
||||
Host::SystemLog (SystemLogType type, const char *format, va_list args)
|
||||
{
|
||||
if (format && format[0])
|
||||
{
|
||||
static aslmsg g_aslmsg = NULL;
|
||||
if (g_aslmsg == NULL)
|
||||
{
|
||||
g_aslmsg = ::asl_new (ASL_TYPE_MSG);
|
||||
char asl_key_sender[PATH_MAX];
|
||||
snprintf(asl_key_sender, sizeof(asl_key_sender), "com.apple.LLDB.framework");
|
||||
::asl_set (g_aslmsg, ASL_KEY_SENDER, asl_key_sender);
|
||||
}
|
||||
|
||||
// Copy the va_list so we can log this message twice
|
||||
va_list copy_args;
|
||||
va_copy (copy_args, args);
|
||||
// Log to stderr
|
||||
::vfprintf (stderr, format, copy_args);
|
||||
va_end (copy_args);
|
||||
|
||||
int asl_level;
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case eSystemLogError:
|
||||
asl_level = ASL_LEVEL_ERR;
|
||||
break;
|
||||
|
||||
case eSystemLogWarning:
|
||||
asl_level = ASL_LEVEL_WARNING;
|
||||
break;
|
||||
}
|
||||
|
||||
// Log to ASL
|
||||
::asl_vlog (NULL, g_aslmsg, asl_level, format, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -326,12 +326,11 @@ DynamicLoaderDarwinKernel::UpdateImageLoadAddress (OSKextLoadedKextSummary& info
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
"warning: unable to find and load segment named '%s' at 0x%llx in '%s/%s' in macosx dynamic loader plug-in.\n",
|
||||
info.segments[i].name.AsCString("<invalid>"),
|
||||
(uint64_t)new_section_load_addr,
|
||||
image_object_file->GetFileSpec().GetDirectory().AsCString(),
|
||||
image_object_file->GetFileSpec().GetFilename().AsCString());
|
||||
Host::SystemLog (Host::eSystemLogWarning, "warning: unable to find and load segment named '%s' at 0x%llx in '%s/%s' in macosx dynamic loader plug-in.\n",
|
||||
info.segments[i].name.AsCString("<invalid>"),
|
||||
(uint64_t)new_section_load_addr,
|
||||
image_object_file->GetFileSpec().GetDirectory().AsCString(),
|
||||
image_object_file->GetFileSpec().GetFilename().AsCString());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -389,11 +388,11 @@ DynamicLoaderDarwinKernel::UnloadImageLoadAddress (OSKextLoadedKextSummary& info
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
"warning: unable to find and unload segment named '%s' in '%s/%s' in macosx dynamic loader plug-in.\n",
|
||||
info.segments[i].name.AsCString("<invalid>"),
|
||||
image_object_file->GetFileSpec().GetDirectory().AsCString(),
|
||||
image_object_file->GetFileSpec().GetFilename().AsCString());
|
||||
Host::SystemLog (Host::eSystemLogWarning,
|
||||
"warning: unable to find and unload segment named '%s' in '%s/%s' in macosx dynamic loader plug-in.\n",
|
||||
info.segments[i].name.AsCString("<invalid>"),
|
||||
image_object_file->GetFileSpec().GetDirectory().AsCString(),
|
||||
image_object_file->GetFileSpec().GetFilename().AsCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -419,12 +419,12 @@ DynamicLoaderMacOSXDYLD::UpdateImageLoadAddress (Module *module, DYLDImageInfo&
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
"warning: unable to find and load segment named '%s' at 0x%llx in '%s/%s' in macosx dynamic loader plug-in.\n",
|
||||
info.segments[i].name.AsCString("<invalid>"),
|
||||
(uint64_t)new_section_load_addr,
|
||||
image_object_file->GetFileSpec().GetDirectory().AsCString(),
|
||||
image_object_file->GetFileSpec().GetFilename().AsCString());
|
||||
Host::SystemLog (Host::eSystemLogWarning,
|
||||
"warning: unable to find and load segment named '%s' at 0x%llx in '%s/%s' in macosx dynamic loader plug-in.\n",
|
||||
info.segments[i].name.AsCString("<invalid>"),
|
||||
(uint64_t)new_section_load_addr,
|
||||
image_object_file->GetFileSpec().GetDirectory().AsCString(),
|
||||
image_object_file->GetFileSpec().GetFilename().AsCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -461,11 +461,11 @@ DynamicLoaderMacOSXDYLD::UnloadImageLoadAddress (Module *module, DYLDImageInfo&
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
"warning: unable to find and unload segment named '%s' in '%s/%s' in macosx dynamic loader plug-in.\n",
|
||||
info.segments[i].name.AsCString("<invalid>"),
|
||||
image_object_file->GetFileSpec().GetDirectory().AsCString(),
|
||||
image_object_file->GetFileSpec().GetFilename().AsCString());
|
||||
Host::SystemLog (Host::eSystemLogWarning,
|
||||
"warning: unable to find and unload segment named '%s' in '%s/%s' in macosx dynamic loader plug-in.\n",
|
||||
info.segments[i].name.AsCString("<invalid>"),
|
||||
image_object_file->GetFileSpec().GetDirectory().AsCString(),
|
||||
image_object_file->GetFileSpec().GetFilename().AsCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/DataBuffer.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Core/FileSpecList.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Core/PluginManager.h"
|
||||
|
@ -23,6 +22,8 @@
|
|||
#include "lldb/Core/StreamString.h"
|
||||
#include "lldb/Core/Timer.h"
|
||||
#include "lldb/Core/UUID.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Symbol/ClangNamespaceDecl.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
|
||||
|
@ -705,7 +706,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "error: unable to find section for section %u\n", n_sect);
|
||||
Host::SystemLog (Host::eSystemLogError, "error: unable to find section for section %u\n", n_sect);
|
||||
}
|
||||
}
|
||||
if (m_section_infos[n_sect].vm_range.Contains(file_addr))
|
||||
|
@ -893,12 +894,12 @@ ObjectFileMachO::ParseSymtab (bool minimize)
|
|||
// No symbol should be NULL, even the symbols with no
|
||||
// string values should have an offset zero which points
|
||||
// to an empty C-string
|
||||
fprintf (stderr,
|
||||
"error: symbol[%u] has invalid string table offset 0x%x in %s/%s, ignoring symbol\n",
|
||||
nlist_idx,
|
||||
nlist.n_strx,
|
||||
m_module->GetFileSpec().GetDirectory().GetCString(),
|
||||
m_module->GetFileSpec().GetFilename().GetCString());
|
||||
Host::SystemLog (Host::eSystemLogError,
|
||||
"error: symbol[%u] has invalid string table offset 0x%x in %s/%s, ignoring symbol\n",
|
||||
nlist_idx,
|
||||
nlist.n_strx,
|
||||
m_module->GetFileSpec().GetDirectory().GetCString(),
|
||||
m_module->GetFileSpec().GetFilename().GetCString());
|
||||
continue;
|
||||
}
|
||||
const char *symbol_name = &strtab_data[nlist.n_strx];
|
||||
|
|
|
@ -170,9 +170,9 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (bool cu_die_only)
|
|||
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
|
||||
if (log)
|
||||
{
|
||||
m_dwarf2Data->LogMessage (log.get(),
|
||||
"DWARFCompileUnit::ExtractDIEsIfNeeded () for compile unit at .debug_info[0x%8.8x]",
|
||||
GetOffset());
|
||||
m_dwarf2Data->GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"DWARFCompileUnit::ExtractDIEsIfNeeded () for compile unit at .debug_info[0x%8.8x]",
|
||||
GetOffset());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,9 +266,9 @@ DWARFCompileUnit::ExtractDIEsIfNeeded (bool cu_die_only)
|
|||
// unit header).
|
||||
if (offset > next_cu_offset)
|
||||
{
|
||||
m_dwarf2Data->ReportWarning ("DWARF compile unit extends beyond its bounds cu 0x%8.8x at 0x%8.8x\n",
|
||||
GetOffset(),
|
||||
offset);
|
||||
m_dwarf2Data->GetObjectFile()->GetModule()->ReportWarning ("DWARF compile unit extends beyond its bounds cu 0x%8.8x at 0x%8.8x\n",
|
||||
GetOffset(),
|
||||
offset);
|
||||
}
|
||||
|
||||
// Since std::vector objects will double their size, we really need to
|
||||
|
@ -404,9 +404,9 @@ DWARFCompileUnit::GetFunctionAranges ()
|
|||
|
||||
if (log)
|
||||
{
|
||||
m_dwarf2Data->LogMessage (log.get(),
|
||||
"DWARFCompileUnit::GetFunctionAranges() for compile unit at .debug_info[0x%8.8x]",
|
||||
GetOffset());
|
||||
m_dwarf2Data->GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"DWARFCompileUnit::GetFunctionAranges() for compile unit at .debug_info[0x%8.8x]",
|
||||
GetOffset());
|
||||
}
|
||||
DIE()->BuildFunctionAddressRangeTable (m_dwarf2Data, this, m_func_aranges_ap.get());
|
||||
const bool minimize = false;
|
||||
|
@ -577,9 +577,9 @@ DWARFCompileUnit::Index (const uint32_t cu_idx,
|
|||
|
||||
if (log)
|
||||
{
|
||||
m_dwarf2Data->LogMessage (log.get(),
|
||||
"DWARFCompileUnit::Index() for compile unit at .debug_info[0x%8.8x]",
|
||||
GetOffset());
|
||||
m_dwarf2Data->GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"DWARFCompileUnit::Index() for compile unit at .debug_info[0x%8.8x]",
|
||||
GetOffset());
|
||||
}
|
||||
|
||||
DWARFDebugInfoEntry::const_iterator pos;
|
||||
|
@ -765,8 +765,7 @@ DWARFCompileUnit::Index (const uint32_t cu_idx,
|
|||
{
|
||||
if (specification_die_offset != DW_INVALID_OFFSET)
|
||||
{
|
||||
const DWARFDebugInfoEntry *specification_die
|
||||
= m_dwarf2Data->DebugInfo()->GetDIEPtr (specification_die_offset, NULL);
|
||||
const DWARFDebugInfoEntry *specification_die = m_dwarf2Data->DebugInfo()->GetDIEPtr (specification_die_offset, NULL);
|
||||
if (specification_die)
|
||||
{
|
||||
parent = specification_die->GetParent();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Core/Stream.h"
|
||||
#include "lldb/Expression/DWARFExpression.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
|
@ -138,9 +139,9 @@ DWARFDebugInfoEntry::FastExtract
|
|||
|
||||
if (abbrevDecl == NULL)
|
||||
{
|
||||
cu->GetSymbolFileDWARF ()->ReportError ("{0x%8.8x}: invalid abbreviation code %u, please file a bug and attach the file at the start of this error message",
|
||||
m_offset,
|
||||
(unsigned)abbr_idx);
|
||||
cu->GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError ("{0x%8.8x}: invalid abbreviation code %u, please file a bug and attach the file at the start of this error message",
|
||||
m_offset,
|
||||
(unsigned)abbr_idx);
|
||||
// WE can't parse anymore if the DWARF is borked...
|
||||
*offset_ptr = UINT32_MAX;
|
||||
return false;
|
||||
|
@ -2082,11 +2083,13 @@ DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr (SymbolFileDWARF* dwarf2Data,
|
|||
|
||||
if (abbrev_decl->Code() == abbrev_code)
|
||||
return abbrev_decl;
|
||||
|
||||
dwarf2Data->ReportError ("0x%8.8x: the DWARF debug info has been modified (abbrev code was %u, and is now %u)",
|
||||
GetOffset(),
|
||||
(uint32_t)abbrev_decl->Code(),
|
||||
(uint32_t)abbrev_code);
|
||||
|
||||
// Only log if we are the one to figure out that the module was modified
|
||||
// which is indicated by SetModified() returning false.
|
||||
dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("0x%8.8x: the DWARF debug information has been modified (abbrev code was %u, and is now %u)",
|
||||
GetOffset(),
|
||||
(uint32_t)abbrev_decl->Code(),
|
||||
(uint32_t)abbrev_code);
|
||||
}
|
||||
offset = DW_INVALID_OFFSET;
|
||||
return NULL;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "lldb/Core/FileSpecList.h"
|
||||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Core/Timer.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
|
||||
#include "SymbolFileDWARF.h"
|
||||
#include "LogChannelDWARF.h"
|
||||
|
@ -456,8 +457,11 @@ DWARFDebugLine::ParsePrologue(const DataExtractor& debug_line_data, dw_offset_t*
|
|||
|
||||
if (*offset_ptr != end_prologue_offset)
|
||||
{
|
||||
fprintf (stderr, "warning: parsing line table prologue at 0x%8.8x should have ended at 0x%8.8x but it ended ad 0x%8.8x\n",
|
||||
prologue_offset, end_prologue_offset, *offset_ptr);
|
||||
Host::SystemLog (Host::eSystemLogWarning,
|
||||
"warning: parsing line table prologue at 0x%8.8x should have ended at 0x%8.8x but it ended ad 0x%8.8x\n",
|
||||
prologue_offset,
|
||||
end_prologue_offset,
|
||||
*offset_ptr);
|
||||
}
|
||||
return end_prologue_offset;
|
||||
}
|
||||
|
@ -539,8 +543,11 @@ DWARFDebugLine::ParseSupportFiles(const DataExtractor& debug_line_data, const ch
|
|||
|
||||
if (offset != end_prologue_offset)
|
||||
{
|
||||
fprintf (stderr, "warning: parsing line table prologue at 0x%8.8x should have ended at 0x%8.8x but it ended ad 0x%8.8x\n",
|
||||
stmt_list, end_prologue_offset, offset);
|
||||
Host::SystemLog (Host::eSystemLogError,
|
||||
"warning: parsing line table prologue at 0x%8.8x should have ended at 0x%8.8x but it ended ad 0x%8.8x\n",
|
||||
stmt_list,
|
||||
end_prologue_offset,
|
||||
offset);
|
||||
}
|
||||
return end_prologue_offset;
|
||||
}
|
||||
|
|
|
@ -1452,14 +1452,14 @@ SymbolFileDWARF::ParseChildMembers
|
|||
else
|
||||
{
|
||||
if (name)
|
||||
ReportError ("0x%8.8llx: DW_TAG_member '%s' refers to type 0x%8.8llx which was unable to be parsed",
|
||||
MakeUserID(die->GetOffset()),
|
||||
name,
|
||||
encoding_uid);
|
||||
GetObjectFile()->GetModule()->ReportError ("0x%8.8llx: DW_TAG_member '%s' refers to type 0x%8.8llx which was unable to be parsed",
|
||||
MakeUserID(die->GetOffset()),
|
||||
name,
|
||||
encoding_uid);
|
||||
else
|
||||
ReportError ("0x%8.8llx: DW_TAG_member refers to type 0x%8.8llx which was unable to be parsed",
|
||||
MakeUserID(die->GetOffset()),
|
||||
encoding_uid);
|
||||
GetObjectFile()->GetModule()->ReportError ("0x%8.8llx: DW_TAG_member refers to type 0x%8.8llx which was unable to be parsed",
|
||||
MakeUserID(die->GetOffset()),
|
||||
encoding_uid);
|
||||
}
|
||||
|
||||
if (prop_name != NULL)
|
||||
|
@ -1633,10 +1633,11 @@ SymbolFileDWARF::ResolveTypeUID (DWARFCompileUnit* cu, const DWARFDebugInfoEntry
|
|||
{
|
||||
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
|
||||
if (log)
|
||||
LogMessage (log.get(), "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s'",
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(die->Tag()),
|
||||
die->GetName(this, cu));
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s'",
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(die->Tag()),
|
||||
die->GetName(this, cu));
|
||||
|
||||
// We might be coming in in the middle of a type tree (a class
|
||||
// withing a class, an enum within a class), so parse any needed
|
||||
|
@ -1650,21 +1651,23 @@ SymbolFileDWARF::ResolveTypeUID (DWARFCompileUnit* cu, const DWARFDebugInfoEntry
|
|||
{
|
||||
// Get the type, which could be a forward declaration
|
||||
if (log)
|
||||
LogMessage (log.get(), "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s' resolve parent forward type for 0x%8.8x",
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(die->Tag()),
|
||||
die->GetName(this, cu),
|
||||
decl_ctx_die->GetOffset());
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s' resolve parent forward type for 0x%8.8x",
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(die->Tag()),
|
||||
die->GetName(this, cu),
|
||||
decl_ctx_die->GetOffset());
|
||||
|
||||
Type *parent_type = ResolveTypeUID (cu, decl_ctx_die, assert_not_being_parsed);
|
||||
if (DW_TAG_is_function_tag(die->Tag()))
|
||||
{
|
||||
if (log)
|
||||
LogMessage (log.get(), "SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s' resolve parent full type for 0x%8.8x since die is a function",
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(die->Tag()),
|
||||
die->GetName(this, cu),
|
||||
decl_ctx_die->GetOffset());
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::ResolveTypeUID (die = 0x%8.8x) %s '%s' resolve parent full type for 0x%8.8x since die is a function",
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(die->Tag()),
|
||||
die->GetName(this, cu),
|
||||
decl_ctx_die->GetOffset());
|
||||
// Ask the type to complete itself if it already hasn't since if we
|
||||
// want a function (method or static) from a class, the class must
|
||||
// create itself and add it's own methods and class functions.
|
||||
|
@ -1725,11 +1728,11 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type
|
|||
|
||||
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
|
||||
if (log)
|
||||
LogMessage (log.get(),
|
||||
"0x%8.8llx: %s '%s' resolving forward declaration...\n",
|
||||
MakeUserID(die->GetOffset()),
|
||||
DW_TAG_value_to_name(tag),
|
||||
type->GetName().AsCString());
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"0x%8.8llx: %s '%s' resolving forward declaration...\n",
|
||||
MakeUserID(die->GetOffset()),
|
||||
DW_TAG_value_to_name(tag),
|
||||
type->GetName().AsCString());
|
||||
assert (clang_type);
|
||||
DWARFDebugInfoEntry::Attributes attributes;
|
||||
|
||||
|
@ -1832,8 +1835,8 @@ SymbolFileDWARF::ResolveClangOpaqueTypeDefinition (lldb::clang_type_t clang_type
|
|||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
ReportError (".apple_objc accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, class_str.c_str());
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_objc accelerator table had bad die 0x%8.8x for '%s')\n",
|
||||
die_offset, class_str.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2258,7 +2261,7 @@ SymbolFileDWARF::NamespaceDeclMatchesThisSymbolFile (const ClangNamespaceDecl *n
|
|||
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
|
||||
|
||||
if (log)
|
||||
LogMessage(log.get(), "Valid namespace does not match symbol file");
|
||||
GetObjectFile()->GetModule()->LogMessage(log.get(), "Valid namespace does not match symbol file");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -2284,7 +2287,7 @@ SymbolFileDWARF::DIEIsInNamespace (const ClangNamespaceDecl *namespace_decl,
|
|||
if (decl_ctx_die->Tag() != DW_TAG_namespace)
|
||||
{
|
||||
if (log)
|
||||
LogMessage(log.get(), "Found a match, but its parent is not a namespace");
|
||||
GetObjectFile()->GetModule()->LogMessage(log.get(), "Found a match, but its parent is not a namespace");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2293,7 +2296,7 @@ SymbolFileDWARF::DIEIsInNamespace (const ClangNamespaceDecl *namespace_decl,
|
|||
if (pos == m_decl_ctx_to_die.end())
|
||||
{
|
||||
if (log)
|
||||
LogMessage(log.get(), "Found a match in a namespace, but its parent is not the requested namespace");
|
||||
GetObjectFile()->GetModule()->LogMessage(log.get(), "Found a match in a namespace, but its parent is not the requested namespace");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -2312,7 +2315,7 @@ SymbolFileDWARF::DIEIsInNamespace (const ClangNamespaceDecl *namespace_decl,
|
|||
}
|
||||
|
||||
if (log)
|
||||
LogMessage(log.get(), "Found a match, but its parent doesn't exist");
|
||||
GetObjectFile()->GetModule()->LogMessage(log.get(), "Found a match, but its parent doesn't exist");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -2323,12 +2326,12 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_privat
|
|||
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindGlobalVariables (name=\"%s\", namespace_decl=%p, append=%u, max_matches=%u, variables)",
|
||||
name.GetCString(),
|
||||
namespace_decl,
|
||||
append,
|
||||
max_matches);
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindGlobalVariables (name=\"%s\", namespace_decl=%p, append=%u, max_matches=%u, variables)",
|
||||
name.GetCString(),
|
||||
namespace_decl,
|
||||
append,
|
||||
max_matches);
|
||||
}
|
||||
|
||||
if (!NamespaceDeclMatchesThisSymbolFile(namespace_decl))
|
||||
|
@ -2403,8 +2406,8 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, const lldb_privat
|
|||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
ReportError (".apple_names accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, name.GetCString());
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for '%s')\n",
|
||||
die_offset, name.GetCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2421,11 +2424,11 @@ SymbolFileDWARF::FindGlobalVariables(const RegularExpression& regex, bool append
|
|||
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindGlobalVariables (regex=\"%s\", append=%u, max_matches=%u, variables)",
|
||||
regex.GetText(),
|
||||
append,
|
||||
max_matches);
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindGlobalVariables (regex=\"%s\", append=%u, max_matches=%u, variables)",
|
||||
regex.GetText(),
|
||||
append,
|
||||
max_matches);
|
||||
}
|
||||
|
||||
DWARFDebugInfo* info = DebugInfo();
|
||||
|
@ -2488,8 +2491,8 @@ SymbolFileDWARF::FindGlobalVariables(const RegularExpression& regex, bool append
|
|||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
ReportError (".apple_names accelerator table had bad die 0x%8.8x for regex '%s'\n",
|
||||
die_offset, regex.GetText());
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for regex '%s')\n",
|
||||
die_offset, regex.GetText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2696,11 +2699,11 @@ SymbolFileDWARF::FindFunctions (const ConstString &name,
|
|||
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, append=%u, sc_list)",
|
||||
name.GetCString(),
|
||||
name_type_mask,
|
||||
append);
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindFunctions (name=\"%s\", name_type_mask=0x%x, append=%u, sc_list)",
|
||||
name.GetCString(),
|
||||
name_type_mask,
|
||||
append);
|
||||
}
|
||||
|
||||
// If we aren't appending the results to this list, then clear the list
|
||||
|
@ -2798,8 +2801,8 @@ SymbolFileDWARF::FindFunctions (const ConstString &name,
|
|||
}
|
||||
else
|
||||
{
|
||||
ReportError (".apple_names accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, name_cstr);
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for '%s')",
|
||||
die_offset, name_cstr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2826,8 +2829,8 @@ SymbolFileDWARF::FindFunctions (const ConstString &name,
|
|||
}
|
||||
else
|
||||
{
|
||||
ReportError (".apple_names accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, name_cstr);
|
||||
GetObjectFile()->GetModule()->ReportError ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for '%s')",
|
||||
die_offset, name_cstr);
|
||||
}
|
||||
}
|
||||
die_offsets.clear();
|
||||
|
@ -2870,8 +2873,8 @@ SymbolFileDWARF::FindFunctions (const ConstString &name,
|
|||
}
|
||||
else
|
||||
{
|
||||
ReportError (".apple_names accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, name_cstr);
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x for '%s')",
|
||||
die_offset, name_cstr);
|
||||
}
|
||||
}
|
||||
die_offsets.clear();
|
||||
|
@ -2970,10 +2973,10 @@ SymbolFileDWARF::FindFunctions(const RegularExpression& regex, bool append, Symb
|
|||
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindFunctions (regex=\"%s\", append=%u, sc_list)",
|
||||
regex.GetText(),
|
||||
append);
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindFunctions (regex=\"%s\", append=%u, sc_list)",
|
||||
regex.GetText(),
|
||||
append);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3021,11 +3024,11 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc,
|
|||
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindTypes (sc, name=\"%s\", append=%u, max_matches=%u, type_list)",
|
||||
name.GetCString(),
|
||||
append,
|
||||
max_matches);
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindTypes (sc, name=\"%s\", append=%u, max_matches=%u, type_list)",
|
||||
name.GetCString(),
|
||||
append,
|
||||
max_matches);
|
||||
}
|
||||
|
||||
// If we aren't appending the results to this list, then clear the list
|
||||
|
@ -3084,8 +3087,8 @@ SymbolFileDWARF::FindTypes (const SymbolContext& sc,
|
|||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
ReportError (".apple_types accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, name.GetCString());
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_types accelerator table had bad die 0x%8.8x for '%s')\n",
|
||||
die_offset, name.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3105,9 +3108,9 @@ SymbolFileDWARF::FindNamespace (const SymbolContext& sc,
|
|||
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindNamespace (sc, name=\"%s\")",
|
||||
name.GetCString());
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF::FindNamespace (sc, name=\"%s\")",
|
||||
name.GetCString());
|
||||
}
|
||||
|
||||
if (!NamespaceDeclMatchesThisSymbolFile(parent_namespace_decl))
|
||||
|
@ -3165,8 +3168,8 @@ SymbolFileDWARF::FindNamespace (const SymbolContext& sc,
|
|||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
ReportError (".apple_namespaces accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, name.GetCString());
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_namespaces accelerator table had bad die 0x%8.8x for '%s')\n",
|
||||
die_offset, name.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3658,22 +3661,22 @@ SymbolFileDWARF::ResolveNamespaceDIE (DWARFCompileUnit *curr_cu, const DWARFDebu
|
|||
{
|
||||
if (namespace_name)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"ASTContext => %p: 0x%8.8llx: DW_TAG_namespace with DW_AT_name(\"%s\") => clang::NamespaceDecl *%p (original = %p)",
|
||||
GetClangASTContext().getASTContext(),
|
||||
MakeUserID(die->GetOffset()),
|
||||
namespace_name,
|
||||
namespace_decl,
|
||||
namespace_decl->getOriginalNamespace());
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"ASTContext => %p: 0x%8.8llx: DW_TAG_namespace with DW_AT_name(\"%s\") => clang::NamespaceDecl *%p (original = %p)",
|
||||
GetClangASTContext().getASTContext(),
|
||||
MakeUserID(die->GetOffset()),
|
||||
namespace_name,
|
||||
namespace_decl,
|
||||
namespace_decl->getOriginalNamespace());
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"ASTContext => %p: 0x%8.8llx: DW_TAG_namespace (anonymous) => clang::NamespaceDecl *%p (original = %p)",
|
||||
GetClangASTContext().getASTContext(),
|
||||
MakeUserID(die->GetOffset()),
|
||||
namespace_decl,
|
||||
namespace_decl->getOriginalNamespace());
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"ASTContext => %p: 0x%8.8llx: DW_TAG_namespace (anonymous) => clang::NamespaceDecl *%p (original = %p)",
|
||||
GetClangASTContext().getASTContext(),
|
||||
MakeUserID(die->GetOffset()),
|
||||
namespace_decl,
|
||||
namespace_decl->getOriginalNamespace());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3703,7 +3706,7 @@ SymbolFileDWARF::GetClangDeclContextForDIE (const SymbolContext &sc, DWARFCompil
|
|||
|
||||
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
|
||||
if (log)
|
||||
LogMessage(log.get(), "SymbolFileDWARF::GetClangDeclContextForDIE (die = 0x%8.8x) %s '%s'", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), die->GetName(this, cu));
|
||||
GetObjectFile()->GetModule()->LogMessage(log.get(), "SymbolFileDWARF::GetClangDeclContextForDIE (die = 0x%8.8x) %s '%s'", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), die->GetName(this, cu));
|
||||
// This is the DIE we want. Parse it, then query our map.
|
||||
bool assert_not_being_parsed = true;
|
||||
ResolveTypeUID (cu, die, assert_not_being_parsed);
|
||||
|
@ -3950,8 +3953,8 @@ SymbolFileDWARF::FindCompleteObjCDefinitionTypeForDIE (DWARFCompileUnit* cu,
|
|||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
ReportError (".apple_types accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, type_name.GetCString());
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_types accelerator table had bad die 0x%8.8x for '%s')\n",
|
||||
die_offset, type_name.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4075,8 +4078,8 @@ SymbolFileDWARF::FindDefinitionTypeForDIE (DWARFCompileUnit* cu,
|
|||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
ReportError (".apple_types accelerator table had bad die 0x%8.8x for '%s'\n",
|
||||
die_offset, type_name.GetCString());
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_types accelerator table had bad die 0x%8.8x for '%s')\n",
|
||||
die_offset, type_name.GetCString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4098,7 +4101,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
{
|
||||
LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
|
||||
if (log)
|
||||
LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s'",
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDWARF::ParseType (die = 0x%8.8x) %s '%s'",
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(die->Tag()),
|
||||
die->GetName(this, dwarf_cu));
|
||||
|
@ -4108,7 +4111,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
// {
|
||||
// StreamString s;
|
||||
// die->DumpLocation (this, dwarf_cu, s);
|
||||
// LogMessage (log.get(), "SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData());
|
||||
// GetObjectFile()->GetModule()->LogMessage (log.get(), "SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData());
|
||||
//
|
||||
// }
|
||||
|
||||
|
@ -4432,13 +4435,13 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
{
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is an incomplete objc type, complete type is 0x%8.8llx",
|
||||
this,
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(tag),
|
||||
type_name_cstr,
|
||||
type_sp->GetID());
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is an incomplete objc type, complete type is 0x%8.8llx",
|
||||
this,
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(tag),
|
||||
type_name_cstr,
|
||||
type_sp->GetID());
|
||||
}
|
||||
|
||||
// We found a real definition for this type elsewhere
|
||||
|
@ -4460,12 +4463,12 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
// DWARF. If this fails, we need to look elsewhere...
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a forward declaration, trying to find complete type",
|
||||
this,
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(tag),
|
||||
type_name_cstr);
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a forward declaration, trying to find complete type",
|
||||
this,
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(tag),
|
||||
type_name_cstr);
|
||||
}
|
||||
|
||||
type_sp = FindDefinitionTypeForDIE (dwarf_cu, die, type_name_const_str);
|
||||
|
@ -4482,13 +4485,13 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
{
|
||||
if (log)
|
||||
{
|
||||
LogMessage (log.get(),
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a forward declaration, complete type is 0x%8.8llx",
|
||||
this,
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(tag),
|
||||
type_name_cstr,
|
||||
type_sp->GetID());
|
||||
GetObjectFile()->GetModule()->LogMessage (log.get(),
|
||||
"SymbolFileDWARF(%p) - 0x%8.8x: %s type \"%s\" is a forward declaration, complete type is 0x%8.8llx",
|
||||
this,
|
||||
die->GetOffset(),
|
||||
DW_TAG_value_to_name(tag),
|
||||
type_name_cstr,
|
||||
type_sp->GetID());
|
||||
}
|
||||
|
||||
// We found a real definition for this type elsewhere
|
||||
|
@ -4914,9 +4917,9 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
}
|
||||
else
|
||||
{
|
||||
ReportWarning ("0x%8.8llx: DW_AT_specification(0x%8.8x) has no decl\n",
|
||||
MakeUserID(die->GetOffset()),
|
||||
specification_die_offset);
|
||||
GetObjectFile()->GetModule()->ReportWarning ("0x%8.8llx: DW_AT_specification(0x%8.8x) has no decl\n",
|
||||
MakeUserID(die->GetOffset()),
|
||||
specification_die_offset);
|
||||
}
|
||||
type_handled = true;
|
||||
}
|
||||
|
@ -4937,9 +4940,9 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
}
|
||||
else
|
||||
{
|
||||
ReportWarning ("0x%8.8llx: DW_AT_abstract_origin(0x%8.8x) has no decl\n",
|
||||
MakeUserID(die->GetOffset()),
|
||||
abstract_origin_die_offset);
|
||||
GetObjectFile()->GetModule()->ReportWarning ("0x%8.8llx: DW_AT_abstract_origin(0x%8.8x) has no decl\n",
|
||||
MakeUserID(die->GetOffset()),
|
||||
abstract_origin_die_offset);
|
||||
}
|
||||
type_handled = true;
|
||||
}
|
||||
|
@ -5353,14 +5356,14 @@ SymbolFileDWARF::ParseVariablesForContext (const SymbolContext& sc)
|
|||
const DWARFDebugInfoEntry *function_die = dwarf_cu->GetDIEPtr(sc.function->GetID());
|
||||
|
||||
dw_addr_t func_lo_pc = function_die->GetAttributeValueAsUnsigned (this, dwarf_cu, DW_AT_low_pc, DW_INVALID_ADDRESS);
|
||||
assert (func_lo_pc != DW_INVALID_ADDRESS);
|
||||
|
||||
const size_t num_variables = ParseVariables(sc, dwarf_cu, func_lo_pc, function_die->GetFirstChild(), true, true);
|
||||
if (func_lo_pc != DW_INVALID_ADDRESS)
|
||||
{
|
||||
const size_t num_variables = ParseVariables(sc, dwarf_cu, func_lo_pc, function_die->GetFirstChild(), true, true);
|
||||
|
||||
// Let all blocks know they have parse all their variables
|
||||
sc.function->GetBlock (false).SetDidParseVariables (true, true);
|
||||
|
||||
return num_variables;
|
||||
// Let all blocks know they have parse all their variables
|
||||
sc.function->GetBlock (false).SetDidParseVariables (true, true);
|
||||
return num_variables;
|
||||
}
|
||||
}
|
||||
else if (sc.comp_unit)
|
||||
{
|
||||
|
@ -5421,7 +5424,7 @@ SymbolFileDWARF::ParseVariablesForContext (const SymbolContext& sc)
|
|||
{
|
||||
if (m_using_apple_tables)
|
||||
{
|
||||
ReportError (".apple_names accelerator table had bad die 0x%8.8x\n", die_offset);
|
||||
GetObjectFile()->GetModule()->ReportErrorIfModifyDetected ("the DWARF debug information has been modified (.apple_names accelerator table had bad die 0x%8.8x)\n", die_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5563,7 +5566,7 @@ SymbolFileDWARF::ParseVariableDIE
|
|||
{
|
||||
StreamString strm;
|
||||
location.DumpLocationForAddress (&strm, eDescriptionLevelFull, 0, 0, NULL);
|
||||
ReportError ("0x%8.8x: %s has an invalid location: %s", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), strm.GetString().c_str());
|
||||
GetObjectFile()->GetModule()->ReportError ("0x%8.8x: %s has an invalid location: %s", die->GetOffset(), DW_TAG_value_to_name(die->Tag()), strm.GetString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5824,11 +5827,11 @@ SymbolFileDWARF::ParseVariables
|
|||
}
|
||||
else
|
||||
{
|
||||
ReportError ("parent 0x%8.8llx %s with no valid compile unit in symbol context for 0x%8.8llx %s.\n",
|
||||
MakeUserID(sc_parent_die->GetOffset()),
|
||||
DW_TAG_value_to_name (parent_tag),
|
||||
MakeUserID(orig_die->GetOffset()),
|
||||
DW_TAG_value_to_name (orig_die->Tag()));
|
||||
GetObjectFile()->GetModule()->ReportError ("parent 0x%8.8llx %s with no valid compile unit in symbol context for 0x%8.8llx %s.\n",
|
||||
MakeUserID(sc_parent_die->GetOffset()),
|
||||
DW_TAG_value_to_name (parent_tag),
|
||||
MakeUserID(orig_die->GetOffset()),
|
||||
DW_TAG_value_to_name (orig_die->Tag()));
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -5868,9 +5871,9 @@ SymbolFileDWARF::ParseVariables
|
|||
break;
|
||||
|
||||
default:
|
||||
ReportError ("didn't find appropriate parent DIE for variable list for 0x%8.8llx %s.\n",
|
||||
MakeUserID(orig_die->GetOffset()),
|
||||
DW_TAG_value_to_name (orig_die->Tag()));
|
||||
GetObjectFile()->GetModule()->ReportError ("didn't find appropriate parent DIE for variable list for 0x%8.8llx %s.\n",
|
||||
MakeUserID(orig_die->GetOffset()),
|
||||
DW_TAG_value_to_name (orig_die->Tag()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -908,11 +908,11 @@ ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize (const char *type_name
|
|||
// to fix any issues we run into.
|
||||
if (type_name)
|
||||
{
|
||||
fprintf (stderr, "error: need to add support for DW_TAG_base_type '%s' encoded with DW_ATE = 0x%x, bit_size = %u\n", type_name, dw_ate, bit_size);
|
||||
Host::SystemLog (Host::eSystemLogError, "error: need to add support for DW_TAG_base_type '%s' encoded with DW_ATE = 0x%x, bit_size = %u\n", type_name, dw_ate, bit_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "error: need to add support for DW_TAG_base_type encoded with DW_ATE = 0x%x, bit_size = %u\n", dw_ate, bit_size);
|
||||
Host::SystemLog (Host::eSystemLogError, "error: need to add support for DW_TAG_base_type encoded with DW_ATE = 0x%x, bit_size = %u\n", dw_ate, bit_size);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -14,14 +14,15 @@
|
|||
|
||||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Core/Section.h"
|
||||
#include "lldb/Symbol/DWARFCallFrameInfo.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/Target/RegisterContext.h"
|
||||
#include "lldb/Core/Section.h"
|
||||
#include "lldb/Target/Thread.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
#include "lldb/Symbol/DWARFCallFrameInfo.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#include "lldb/Symbol/UnwindPlan.h"
|
||||
#include "lldb/Target/RegisterContext.h"
|
||||
#include "lldb/Target/Thread.h"
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
@ -146,7 +147,7 @@ DWARFCallFrameInfo::ParseCIE (const dw_offset_t cie_offset)
|
|||
|
||||
if (i == CFI_AUG_MAX_SIZE && cie_sp->augmentation[CFI_AUG_MAX_SIZE-1] != '\0')
|
||||
{
|
||||
fprintf(stderr, "CIE parse error: CIE augmentation string was too large for the fixed sized buffer of %d bytes.\n", CFI_AUG_MAX_SIZE);
|
||||
Host::SystemLog (Host::eSystemLogError, "CIE parse error: CIE augmentation string was too large for the fixed sized buffer of %d bytes.\n", CFI_AUG_MAX_SIZE);
|
||||
return cie_sp;
|
||||
}
|
||||
cie_sp->code_align = (uint32_t)m_cfi_data.GetULEB128(&offset);
|
||||
|
@ -330,11 +331,11 @@ DWARFCallFrameInfo::GetFDEIndex ()
|
|||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr,
|
||||
"error: unable to find CIE at 0x%8.8x for cie_id = 0x%8.8x for entry at 0x%8.8x.\n",
|
||||
cie_offset,
|
||||
cie_id,
|
||||
current_entry);
|
||||
Host::SystemLog (Host::eSystemLogError,
|
||||
"error: unable to find CIE at 0x%8.8x for cie_id = 0x%8.8x for entry at 0x%8.8x.\n",
|
||||
cie_offset,
|
||||
cie_id,
|
||||
current_entry);
|
||||
}
|
||||
offset = next_entry;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "lldb/Symbol/Function.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Core/Section.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
#include "lldb/Symbol/ClangASTType.h"
|
||||
#include "lldb/Symbol/ClangASTContext.h"
|
||||
#include "lldb/Symbol/CompileUnit.h"
|
||||
|
@ -313,12 +314,12 @@ Function::GetBlock (bool can_create)
|
|||
}
|
||||
else
|
||||
{
|
||||
::fprintf (stderr,
|
||||
"unable to find module shared pointer for function '%s' in %s%s%s\n",
|
||||
GetName().GetCString(),
|
||||
m_comp_unit->GetDirectory().GetCString(),
|
||||
m_comp_unit->GetDirectory() ? "/" : "",
|
||||
m_comp_unit->GetFilename().GetCString());
|
||||
Host::SystemLog (Host::eSystemLogError,
|
||||
"error: unable to find module shared pointer for function '%s' in %s%s%s\n",
|
||||
GetName().GetCString(),
|
||||
m_comp_unit->GetDirectory().GetCString(),
|
||||
m_comp_unit->GetDirectory() ? "/" : "",
|
||||
m_comp_unit->GetFilename().GetCString());
|
||||
}
|
||||
m_block.SetBlockInfoHasBeenParsed (true, true);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
#include "lldb/Interpreter/Args.h"
|
||||
#include "lldb/Symbol/CompileUnit.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
|
@ -519,16 +520,19 @@ SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc,
|
|||
}
|
||||
if (objfile)
|
||||
{
|
||||
fprintf (stderr, "warning: inlined block 0x%8.8llx doesn't have a range that contains file address 0x%llx in %s/%s\n",
|
||||
curr_inlined_block->GetID(),
|
||||
curr_frame_pc.GetFileAddress(),
|
||||
objfile->GetFileSpec().GetDirectory().GetCString(),
|
||||
objfile->GetFileSpec().GetFilename().GetCString());
|
||||
Host::SystemLog (Host::eSystemLogWarning,
|
||||
"warning: inlined block 0x%8.8llx doesn't have a range that contains file address 0x%llx in %s/%s\n",
|
||||
curr_inlined_block->GetID(),
|
||||
curr_frame_pc.GetFileAddress(),
|
||||
objfile->GetFileSpec().GetDirectory().GetCString(),
|
||||
objfile->GetFileSpec().GetFilename().GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "warning: inlined block 0x%8.8llx doesn't have a range that contains file address 0x%llx\n",
|
||||
curr_inlined_block->GetID(), curr_frame_pc.GetFileAddress());
|
||||
Host::SystemLog (Host::eSystemLogWarning,
|
||||
"warning: inlined block 0x%8.8llx doesn't have a range that contains file address 0x%llx\n",
|
||||
curr_inlined_block->GetID(),
|
||||
curr_frame_pc.GetFileAddress());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -70,46 +70,3 @@ 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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue