diff options
author | Richard Mitton <richard@codersnotes.com> | 2013-09-12 02:20:34 +0000 |
---|---|---|
committer | Richard Mitton <richard@codersnotes.com> | 2013-09-12 02:20:34 +0000 |
commit | f86248d9ba1909392211968400ea97bd06da04c6 (patch) | |
tree | b736518b47f1be3be3c3d89530f1e753ce38e9fc /lldb/source/Core/Module.cpp | |
parent | 50c003b5774247b12655f439be959d23ee356614 (diff) | |
download | bcm5719-llvm-f86248d9ba1909392211968400ea97bd06da04c6.tar.gz bcm5719-llvm-f86248d9ba1909392211968400ea97bd06da04c6.zip |
Added a 'jump' command, similar to GDBs.
This allows the PC to be directly changed to a different line.
It's similar to the example python script in examples/python/jump.py, except implemented as a builtin.
Also this version will track the current function correctly even if the target line resolves to multiple addresses. (e.g. debugging a templated function)
llvm-svn: 190572
Diffstat (limited to 'lldb/source/Core/Module.cpp')
-rw-r--r-- | lldb/source/Core/Module.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 4252ed4cb6c..859ec866ac0 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -9,6 +9,7 @@ #include "lldb/lldb-python.h" +#include "lldb/Core/AddressResolverFileLine.h" #include "lldb/Core/Error.h" #include "lldb/Core/Module.h" #include "lldb/Core/DataBuffer.h" @@ -752,6 +753,27 @@ Module::FindFunctions (const RegularExpression& regex, return sc_list.GetSize() - start_size; } +void +Module::FindAddressesForLine (const lldb::TargetSP target_sp, + const FileSpec &file, uint32_t line, + Function *function, + std::vector<Address> &output_local, std::vector<Address> &output_extern) +{ + SearchFilterByModule filter(target_sp, m_file); + AddressResolverFileLine resolver(file, line, true); + resolver.ResolveAddress (filter); + + for (size_t n=0;n<resolver.GetNumberOfAddresses();n++) + { + Address addr = resolver.GetAddressRangeAtIndex(n).GetBaseAddress(); + Function *f = addr.CalculateSymbolContextFunction(); + if (f && f == function) + output_local.push_back (addr); + else + output_extern.push_back (addr); + } +} + size_t Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, @@ -1606,4 +1628,4 @@ Module::PrepareForFunctionNameLookup (const ConstString &name, lookup_name = name; match_name_after_lookup = false; } -}
\ No newline at end of file +} |