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
This commit is contained in:
Richard Mitton
2013-09-12 02:20:34 +00:00
parent 50c003b577
commit f86248d9ba
19 changed files with 579 additions and 9 deletions

View File

@@ -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;
}
}
}