diff options
Diffstat (limited to 'lldb/source')
| -rw-r--r-- | lldb/source/Core/Address.cpp | 36 | ||||
| -rw-r--r-- | lldb/source/Core/DataExtractor.cpp | 21 |
2 files changed, 48 insertions, 9 deletions
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index e4dc06312f3..0308812bc56 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -354,9 +354,10 @@ Address::SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target) bool Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style, uint32_t addr_size) const { - // If the section was NULL, only load address is going to work. + // If the section was NULL, only load address is going to work unless we are + // trying to deref a pointer SectionSP section_sp (GetSection()); - if (!section_sp) + if (!section_sp && style != DumpStyleResolvedPointerDescription) style = DumpStyleLoadAddress; ExecutionContext exe_ctx (exe_scope); @@ -728,6 +729,37 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum return false; } break; + case DumpStyleResolvedPointerDescription: + { + Process *process = exe_ctx.GetProcessPtr(); + if (process) + { + addr_t load_addr = GetLoadAddress (target); + if (load_addr != LLDB_INVALID_ADDRESS) + { + Error memory_error; + addr_t dereferenced_load_addr = process->ReadPointerFromMemory(load_addr, memory_error); + if (dereferenced_load_addr != LLDB_INVALID_ADDRESS) + { + Address dereferenced_addr; + if (dereferenced_addr.SetLoadAddress(dereferenced_load_addr, target)) + { + StreamString strm; + if (dereferenced_addr.Dump (&strm, exe_scope, DumpStyleResolvedDescription, DumpStyleInvalid, addr_size)) + { + s->Address (dereferenced_load_addr, addr_size, " -> ", " "); + s->Write(strm.GetData(), strm.GetSize()); + return true; + } + } + } + } + } + if (fallback_style != DumpStyleInvalid) + return Dump (s, exe_scope, fallback_style, DumpStyleInvalid, addr_size); + return false; + } + break; } return true; diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index da52be8d865..24d1dc12c27 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -1737,14 +1737,21 @@ DataExtractor::Dump (Stream *s, { TargetSP target_sp (exe_scope->CalculateTarget()); lldb_private::Address so_addr; - if (target_sp && target_sp->GetSectionLoadList().ResolveLoadAddress(addr, so_addr)) + if (target_sp) { - s->PutChar(' '); - so_addr.Dump (s, - exe_scope, - Address::DumpStyleResolvedDescription, - Address::DumpStyleModuleWithFileAddress); - break; + if (target_sp->GetSectionLoadList().ResolveLoadAddress(addr, so_addr)) + { + s->PutChar(' '); + so_addr.Dump (s, + exe_scope, + Address::DumpStyleResolvedDescription, + Address::DumpStyleModuleWithFileAddress); + } + else + { + so_addr.SetOffset(addr); + so_addr.Dump (s, exe_scope, Address::DumpStyleResolvedPointerDescription); + } } } } |

