diff options
author | Greg Clayton <gclayton@apple.com> | 2011-07-11 05:12:02 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2011-07-11 05:12:02 +0000 |
commit | c749eb89adaa6622abf8098203b0dcff145db704 (patch) | |
tree | 11727870011f1c5fb6e33f71e43e185e42e3c40c /lldb/source/Core/Address.cpp | |
parent | 279f2907ed38a4ea8909ffc30a9d5ff995d7db43 (diff) | |
download | bcm5719-llvm-c749eb89adaa6622abf8098203b0dcff145db704.tar.gz bcm5719-llvm-c749eb89adaa6622abf8098203b0dcff145db704.zip |
Added the ability to see block variables when looking up addresses
with the "target modules lookup --address <addr>" command. The variable
ID's, names, types, location for the address, and declaration is
displayed.
This can really help with crash logs since we get, on MacOSX at least,
the registers for the thread that crashed so it is often possible to
figure out some of the variable contents.
llvm-svn: 134886
Diffstat (limited to 'lldb/source/Core/Address.cpp')
-rw-r--r-- | lldb/source/Core/Address.cpp | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 49d38ad5c61..9d7af37493e 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -11,6 +11,8 @@ #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Symbol/Variable.h" +#include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -682,11 +684,43 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum sc.symbol = NULL; } sc.GetDescription(s, eDescriptionLevelBrief, target); + + if (sc.block) + { + bool can_create = true; + bool get_parent_variables = true; + bool stop_if_block_is_inlined_function = false; + VariableList variable_list; + sc.block->AppendVariables (can_create, + get_parent_variables, + stop_if_block_is_inlined_function, + &variable_list); + + uint32_t num_variables = variable_list.GetSize(); + for (uint32_t var_idx = 0; var_idx < num_variables; ++var_idx) + { + Variable *var = variable_list.GetVariableAtIndex (var_idx).get(); + if (var && var->LocationIsValidForAddress (*this)) + { + s->Printf (" Variable: id = {0x%8.8x}, name = \"%s\", type= \"%s\", location =", + var->GetID(), + var->GetName().GetCString(), + var->GetType()->GetName().GetCString()); + var->DumpLocationForAddress(s, *this); + s->PutCString(", decl = "); + var->GetDeclaration().DumpStopContext(s, false); + s->EOL(); + } + } + } } } - if (fallback_style != DumpStyleInvalid) - return Dump (s, exe_scope, fallback_style, DumpStyleInvalid, addr_size); - return false; + else + { + if (fallback_style != DumpStyleInvalid) + return Dump (s, exe_scope, fallback_style, DumpStyleInvalid, addr_size); + return false; + } break; } |