Fixed up disassembly to not emit the module name before all function names
that are in the disassembly comments since most of them are in the same module (shared library). Fixed a crasher that could happen when disassembling special section data. Added an address dump style that shows the symbol context without the module (used in the disassembly code). llvm-svn: 107366
This commit is contained in:
parent
05166740eb
commit
54b8b8c1a7
|
@ -86,6 +86,7 @@ public:
|
||||||
///< be anything from a symbol context summary (module, function/symbol,
|
///< be anything from a symbol context summary (module, function/symbol,
|
||||||
///< and file and line), to information about what the pointer points to
|
///< and file and line), to information about what the pointer points to
|
||||||
///< if the address is in a section (section of pointers, c strings, etc).
|
///< if the address is in a section (section of pointers, c strings, etc).
|
||||||
|
DumpStyleResolvedDescriptionNoModule,
|
||||||
DumpStyleDetailedSymbolContext ///< Detailed symbol context information for an address for all symbol
|
DumpStyleDetailedSymbolContext ///< Detailed symbol context information for an address for all symbol
|
||||||
///< context members.
|
///< context members.
|
||||||
} DumpStyle;
|
} DumpStyle;
|
||||||
|
|
|
@ -410,9 +410,13 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||||
if (m_section == NULL)
|
if (m_section == NULL)
|
||||||
style = DumpStyleLoadAddress;
|
style = DumpStyleLoadAddress;
|
||||||
|
|
||||||
|
Target *target = NULL;
|
||||||
Process *process = NULL;
|
Process *process = NULL;
|
||||||
if (exe_scope)
|
if (exe_scope)
|
||||||
|
{
|
||||||
|
target = exe_scope->CalculateTarget();
|
||||||
process = exe_scope->CalculateProcess();
|
process = exe_scope->CalculateProcess();
|
||||||
|
}
|
||||||
// If addr_byte_size is UINT32_MAX, then determine the correct address
|
// If addr_byte_size is UINT32_MAX, then determine the correct address
|
||||||
// byte size for the process or default to the size of addr_t
|
// byte size for the process or default to the size of addr_t
|
||||||
if (addr_size == UINT32_MAX)
|
if (addr_size == UINT32_MAX)
|
||||||
|
@ -475,6 +479,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DumpStyleResolvedDescription:
|
case DumpStyleResolvedDescription:
|
||||||
|
case DumpStyleResolvedDescriptionNoModule:
|
||||||
if (IsSectionOffset())
|
if (IsSectionOffset())
|
||||||
{
|
{
|
||||||
lldb::AddressType addr_type = eAddressTypeLoad;
|
lldb::AddressType addr_type = eAddressTypeLoad;
|
||||||
|
@ -524,12 +529,12 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||||
{
|
{
|
||||||
if (ReadAddress (exe_scope, *this, pointer_size, so_addr))
|
if (ReadAddress (exe_scope, *this, pointer_size, so_addr))
|
||||||
{
|
{
|
||||||
if (so_addr.IsSectionOffset())
|
if (target && so_addr.IsSectionOffset())
|
||||||
{
|
{
|
||||||
lldb_private::SymbolContext func_sc;
|
lldb_private::SymbolContext func_sc;
|
||||||
process->GetTarget().GetImages().ResolveSymbolContextForAddress (so_addr,
|
target->GetImages().ResolveSymbolContextForAddress (so_addr,
|
||||||
eSymbolContextEverything,
|
eSymbolContextEverything,
|
||||||
func_sc);
|
func_sc);
|
||||||
if (func_sc.function || func_sc.symbol)
|
if (func_sc.function || func_sc.symbol)
|
||||||
{
|
{
|
||||||
showed_info = true;
|
showed_info = true;
|
||||||
|
@ -541,7 +546,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||||
#endif
|
#endif
|
||||||
Address cstr_addr(*this);
|
Address cstr_addr(*this);
|
||||||
cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
|
cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
|
||||||
func_sc.DumpStopContext(s, process, so_addr, true);
|
func_sc.DumpStopContext(s, exe_scope, so_addr, true);
|
||||||
if (ReadAddress (exe_scope, cstr_addr, pointer_size, so_addr))
|
if (ReadAddress (exe_scope, cstr_addr, pointer_size, so_addr))
|
||||||
{
|
{
|
||||||
#if VERBOSE_OUTPUT
|
#if VERBOSE_OUTPUT
|
||||||
|
@ -625,7 +630,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||||
if (pointer_sc.function || pointer_sc.symbol)
|
if (pointer_sc.function || pointer_sc.symbol)
|
||||||
{
|
{
|
||||||
s->PutCString(": ");
|
s->PutCString(": ");
|
||||||
pointer_sc.DumpStopContext(s, process, so_addr, false);
|
pointer_sc.DumpStopContext(s, exe_scope, so_addr, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -644,20 +649,24 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
|
||||||
if (sc.function || sc.symbol)
|
if (sc.function || sc.symbol)
|
||||||
{
|
{
|
||||||
bool show_stop_context = true;
|
bool show_stop_context = true;
|
||||||
|
bool show_module = (style == DumpStyleResolvedDescription);
|
||||||
if (sc.function == NULL && sc.symbol != NULL)
|
if (sc.function == NULL && sc.symbol != NULL)
|
||||||
{
|
{
|
||||||
// If we have just a symbol make sure it is in the right section
|
// If we have just a symbol make sure it is in the right section
|
||||||
if (sc.symbol->GetAddressRangePtr())
|
if (sc.symbol->GetAddressRangePtr())
|
||||||
{
|
{
|
||||||
if (sc.symbol->GetAddressRangePtr()->GetBaseAddress().GetSection() != GetSection())
|
if (sc.symbol->GetAddressRangePtr()->GetBaseAddress().GetSection() != GetSection())
|
||||||
|
{
|
||||||
|
// don't show the module if the symbol is a trampoline symbol
|
||||||
show_stop_context = false;
|
show_stop_context = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (show_stop_context)
|
if (show_stop_context)
|
||||||
{
|
{
|
||||||
// We have a function or a symbol from the same
|
// We have a function or a symbol from the same
|
||||||
// sections as this address.
|
// sections as this address.
|
||||||
sc.DumpStopContext(s, process, *this, true);
|
sc.DumpStopContext(s, exe_scope, *this, show_module);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -245,7 +245,7 @@ DisassemblerLLVM::Instruction::Dump
|
||||||
if (process && process->IsAlive())
|
if (process && process->IsAlive())
|
||||||
{
|
{
|
||||||
if (process->ResolveLoadAddress (operand_value, so_addr))
|
if (process->ResolveLoadAddress (operand_value, so_addr))
|
||||||
so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescription, Address::DumpStyleSectionNameOffset);
|
so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
|
||||||
}
|
}
|
||||||
else if (inst_addr_ptr)
|
else if (inst_addr_ptr)
|
||||||
{
|
{
|
||||||
|
@ -253,7 +253,7 @@ DisassemblerLLVM::Instruction::Dump
|
||||||
if (module)
|
if (module)
|
||||||
{
|
{
|
||||||
if (module->ResolveFileAddress (operand_value, so_addr))
|
if (module->ResolveFileAddress (operand_value, so_addr))
|
||||||
so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescription, Address::DumpStyleSectionNameOffset);
|
so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue