Update lldb to trunk r256945.
This commit is contained in:
parent
90a2cc030c
commit
1545bf9b10
@ -132,9 +132,16 @@ class StringList
|
||||
StringList&
|
||||
operator << (const char* str);
|
||||
|
||||
StringList&
|
||||
operator << (const std::string &s);
|
||||
|
||||
StringList&
|
||||
operator << (StringList strings);
|
||||
|
||||
// Copy assignment for a vector of strings
|
||||
StringList&
|
||||
operator = (const std::vector<std::string> &rhs);
|
||||
|
||||
// This string list contains a list of valid auto completion
|
||||
// strings, and the "s" is passed in. "matches" is filled in
|
||||
// with zero or more string values that start with "s", and
|
||||
@ -147,6 +154,23 @@ class StringList
|
||||
StringList &matches,
|
||||
size_t &exact_matches_idx) const;
|
||||
|
||||
// Dump the StringList to the given lldb_private::Log, `log`, one item per line.
|
||||
// If given, `name` will be used to identify the start and end of the list in the output.
|
||||
virtual void LogDump(Log *log, const char *name = nullptr);
|
||||
|
||||
// Static helper to convert an iterable of strings to a StringList, and then
|
||||
// dump it with the semantics of the `LogDump` method.
|
||||
template<typename T> static void LogDump(Log *log, T s_iterable, const char *name = nullptr)
|
||||
{
|
||||
if (!log)
|
||||
return;
|
||||
// Make a copy of the iterable as a StringList
|
||||
StringList l{};
|
||||
for (const auto &s : s_iterable)
|
||||
l << s;
|
||||
|
||||
l.LogDump(log, name);
|
||||
}
|
||||
private:
|
||||
STLStringArray m_strings;
|
||||
};
|
||||
|
@ -995,7 +995,14 @@ SBProcess::GetStateFromEvent (const SBEvent &event)
|
||||
bool
|
||||
SBProcess::GetRestartedFromEvent (const SBEvent &event)
|
||||
{
|
||||
return Process::ProcessEventData::GetRestartedFromEvent (event.get());
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
|
||||
bool ret_val = Process::ProcessEventData::GetRestartedFromEvent (event.get());
|
||||
|
||||
if (log)
|
||||
log->Printf ("SBProcess::%s (event.sp=%p) => %d", __FUNCTION__, event.get(), ret_val);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
size_t
|
||||
|
@ -89,7 +89,7 @@ PyInit__lldb(void);
|
||||
#define LLDBSwigPyInit PyInit__lldb
|
||||
|
||||
#else
|
||||
extern "C" void
|
||||
extern "C" void
|
||||
init_lldb(void);
|
||||
|
||||
#define LLDBSwigPyInit init_lldb
|
||||
@ -286,7 +286,7 @@ SystemInitializerFull::Initialize()
|
||||
EmulateInstructionARM64::Initialize();
|
||||
SymbolFileDWARFDebugMap::Initialize();
|
||||
ItaniumABILanguageRuntime::Initialize();
|
||||
|
||||
|
||||
CPlusPlusLanguage::Initialize();
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
@ -394,7 +394,7 @@ SystemInitializerFull::Terminate()
|
||||
ItaniumABILanguageRuntime::Terminate();
|
||||
|
||||
CPlusPlusLanguage::Terminate();
|
||||
|
||||
|
||||
#if defined(__APPLE__)
|
||||
ProcessMachCore::Terminate();
|
||||
ProcessKDP::Terminate();
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "lldb/Symbol/Symbol.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Target/SectionLoadList.h"
|
||||
#include "lldb/Target/StackFrame.h"
|
||||
#include "lldb/Target/TargetList.h"
|
||||
#include "lldb/Interpreter/CommandCompletions.h"
|
||||
#include "lldb/Interpreter/Options.h"
|
||||
@ -34,9 +35,11 @@
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// CommandObjectSourceInfo
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#pragma mark CommandObjectSourceInfo
|
||||
//----------------------------------------------------------------------
|
||||
// CommandObjectSourceInfo - debug line entries dumping command
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class CommandObjectSourceInfo : public CommandObjectParsed
|
||||
{
|
||||
@ -44,14 +47,9 @@ class CommandObjectSourceInfo : public CommandObjectParsed
|
||||
class CommandOptions : public Options
|
||||
{
|
||||
public:
|
||||
CommandOptions (CommandInterpreter &interpreter) :
|
||||
Options(interpreter)
|
||||
{
|
||||
}
|
||||
CommandOptions (CommandInterpreter &interpreter) : Options(interpreter) {}
|
||||
|
||||
~CommandOptions () override
|
||||
{
|
||||
}
|
||||
~CommandOptions () override {}
|
||||
|
||||
Error
|
||||
SetOptionValue (uint32_t option_idx, const char *option_arg) override
|
||||
@ -60,19 +58,44 @@ class CommandObjectSourceInfo : public CommandObjectParsed
|
||||
const int short_option = g_option_table[option_idx].short_option;
|
||||
switch (short_option)
|
||||
{
|
||||
case 'l':
|
||||
start_line = StringConvert::ToUInt32 (option_arg, 0);
|
||||
if (start_line == 0)
|
||||
error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg);
|
||||
break;
|
||||
case 'l':
|
||||
start_line = StringConvert::ToUInt32(option_arg, 0);
|
||||
if (start_line == 0)
|
||||
error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
file_name = option_arg;
|
||||
break;
|
||||
case 'e':
|
||||
end_line = StringConvert::ToUInt32(option_arg, 0);
|
||||
if (end_line == 0)
|
||||
error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
|
||||
case 'c':
|
||||
num_lines = StringConvert::ToUInt32(option_arg, 0);
|
||||
if (num_lines == 0)
|
||||
error.SetErrorStringWithFormat("invalid line count: '%s'", option_arg);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
file_name = option_arg;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
symbol_name = option_arg;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
{
|
||||
ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
|
||||
address = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
modules.push_back(std::string(option_arg));
|
||||
break;
|
||||
default:
|
||||
error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
|
||||
break;
|
||||
}
|
||||
|
||||
return error;
|
||||
@ -83,10 +106,15 @@ class CommandObjectSourceInfo : public CommandObjectParsed
|
||||
{
|
||||
file_spec.Clear();
|
||||
file_name.clear();
|
||||
symbol_name.clear();
|
||||
address = LLDB_INVALID_ADDRESS;
|
||||
start_line = 0;
|
||||
end_line = 0;
|
||||
num_lines = 0;
|
||||
modules.clear();
|
||||
}
|
||||
|
||||
const OptionDefinition*
|
||||
const OptionDefinition *
|
||||
GetDefinitions () override
|
||||
{
|
||||
return g_option_table;
|
||||
@ -96,24 +124,24 @@ class CommandObjectSourceInfo : public CommandObjectParsed
|
||||
// Instance variables to hold the values for command options.
|
||||
FileSpec file_spec;
|
||||
std::string file_name;
|
||||
std::string symbol_name;
|
||||
lldb::addr_t address;
|
||||
uint32_t start_line;
|
||||
|
||||
uint32_t end_line;
|
||||
uint32_t num_lines;
|
||||
STLStringArray modules;
|
||||
};
|
||||
|
||||
public:
|
||||
CommandObjectSourceInfo(CommandInterpreter &interpreter) :
|
||||
CommandObjectParsed (interpreter,
|
||||
"source info",
|
||||
"Display information about the source lines from the current executable's debug info.",
|
||||
"source info [<cmd-options>]"),
|
||||
m_options (interpreter)
|
||||
{
|
||||
}
|
||||
|
||||
~CommandObjectSourceInfo () override
|
||||
|
||||
public:
|
||||
CommandObjectSourceInfo (CommandInterpreter &interpreter)
|
||||
: CommandObjectParsed(interpreter, "source info", "Display source line information (as specified) based "
|
||||
"on the current executable's debug info.",
|
||||
NULL, eCommandRequiresTarget),
|
||||
m_options(interpreter)
|
||||
{
|
||||
}
|
||||
|
||||
~CommandObjectSourceInfo () override {}
|
||||
|
||||
Options *
|
||||
GetOptions () override
|
||||
@ -122,25 +150,576 @@ class CommandObjectSourceInfo : public CommandObjectParsed
|
||||
}
|
||||
|
||||
protected:
|
||||
bool
|
||||
DoExecute (Args& command, CommandReturnObject &result) override
|
||||
|
||||
// Dump the line entries in each symbol context.
|
||||
// Return the number of entries found.
|
||||
// If module_list is set, only dump lines contained in one of the modules.
|
||||
// If file_spec is set, only dump lines in the file.
|
||||
// If the start_line option was specified, don't print lines less than start_line.
|
||||
// If the end_line option was specified, don't print lines greater than end_line.
|
||||
// If the num_lines option was specified, dont print more than num_lines entries.
|
||||
uint32_t
|
||||
DumpLinesInSymbolContexts (Stream &strm, const SymbolContextList &sc_list,
|
||||
const ModuleList &module_list, const FileSpec &file_spec)
|
||||
{
|
||||
result.AppendError ("Not yet implemented");
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
return false;
|
||||
uint32_t start_line = m_options.start_line;
|
||||
uint32_t end_line = m_options.end_line;
|
||||
uint32_t num_lines = m_options.num_lines;
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
|
||||
uint32_t num_matches = 0;
|
||||
bool has_path = false;
|
||||
if (file_spec)
|
||||
{
|
||||
assert(file_spec.GetFilename().AsCString());
|
||||
has_path = (file_spec.GetDirectory().AsCString() != 0);
|
||||
}
|
||||
|
||||
// Dump all the line entries for the file in the list.
|
||||
ConstString last_module_file_name;
|
||||
uint32_t num_scs = sc_list.GetSize();
|
||||
for (uint32_t i = 0; i < num_scs; ++i)
|
||||
{
|
||||
SymbolContext sc;
|
||||
sc_list.GetContextAtIndex(i, sc);
|
||||
if (sc.comp_unit)
|
||||
{
|
||||
Module *module = sc.module_sp.get();
|
||||
CompileUnit *cu = sc.comp_unit;
|
||||
const LineEntry &line_entry = sc.line_entry;
|
||||
assert(module && cu);
|
||||
|
||||
// Are we looking for specific modules, files or lines?
|
||||
if (module_list.GetSize() && module_list.GetIndexForModule(module) == LLDB_INVALID_INDEX32)
|
||||
continue;
|
||||
if (file_spec && !lldb_private::FileSpec::Equal(file_spec, line_entry.file, has_path))
|
||||
continue;
|
||||
if (start_line > 0 && line_entry.line < start_line)
|
||||
continue;
|
||||
if (end_line > 0 && line_entry.line > end_line)
|
||||
continue;
|
||||
if (num_lines > 0 && num_matches > num_lines)
|
||||
continue;
|
||||
|
||||
// Print a new header if the module changed.
|
||||
const ConstString &module_file_name = module->GetFileSpec().GetFilename();
|
||||
assert(module_file_name);
|
||||
if (module_file_name != last_module_file_name)
|
||||
{
|
||||
if (num_matches > 0)
|
||||
strm << "\n\n";
|
||||
strm << "Lines found in module `" << module_file_name << "\n";
|
||||
}
|
||||
// Dump the line entry.
|
||||
line_entry.GetDescription(&strm, lldb::eDescriptionLevelBrief, cu,
|
||||
target, /*show_address_only=*/false);
|
||||
strm << "\n";
|
||||
last_module_file_name = module_file_name;
|
||||
num_matches++;
|
||||
}
|
||||
}
|
||||
return num_matches;
|
||||
}
|
||||
|
||||
// Dump the requested line entries for the file in the compilation unit.
|
||||
// Return the number of entries found.
|
||||
// If module_list is set, only dump lines contained in one of the modules.
|
||||
// If the start_line option was specified, don't print lines less than start_line.
|
||||
// If the end_line option was specified, don't print lines greater than end_line.
|
||||
// If the num_lines option was specified, dont print more than num_lines entries.
|
||||
uint32_t
|
||||
DumpFileLinesInCompUnit (Stream &strm, Module *module, CompileUnit *cu, const FileSpec &file_spec)
|
||||
{
|
||||
uint32_t start_line = m_options.start_line;
|
||||
uint32_t end_line = m_options.end_line;
|
||||
uint32_t num_lines = m_options.num_lines;
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
|
||||
uint32_t num_matches = 0;
|
||||
assert(module);
|
||||
if (cu)
|
||||
{
|
||||
assert(file_spec.GetFilename().AsCString());
|
||||
bool has_path = (file_spec.GetDirectory().AsCString() != 0);
|
||||
const FileSpecList &cu_file_list = cu->GetSupportFiles();
|
||||
size_t file_idx = cu_file_list.FindFileIndex(0, file_spec, has_path);
|
||||
if (file_idx != UINT32_MAX)
|
||||
{
|
||||
// Update the file to how it appears in the CU.
|
||||
const FileSpec &cu_file_spec = cu_file_list.GetFileSpecAtIndex(file_idx);
|
||||
|
||||
// Dump all matching lines at or above start_line for the file in the CU.
|
||||
const ConstString &file_spec_name = file_spec.GetFilename();
|
||||
const ConstString &module_file_name = module->GetFileSpec().GetFilename();
|
||||
bool cu_header_printed = false;
|
||||
uint32_t line = start_line;
|
||||
while (true)
|
||||
{
|
||||
LineEntry line_entry;
|
||||
|
||||
// Find the lowest index of a line entry with a line equal to
|
||||
// or higher than 'line'.
|
||||
uint32_t start_idx = 0;
|
||||
start_idx = cu->FindLineEntry(start_idx, line, &cu_file_spec,
|
||||
/*exact=*/false, &line_entry);
|
||||
if (start_idx == UINT32_MAX)
|
||||
// No more line entries for our file in this CU.
|
||||
break;
|
||||
|
||||
if (end_line > 0 && line_entry.line > end_line)
|
||||
break;
|
||||
|
||||
// Loop through to find any other entries for this line, dumping each.
|
||||
line = line_entry.line;
|
||||
do
|
||||
{
|
||||
num_matches++;
|
||||
if (num_lines > 0 && num_matches > num_lines)
|
||||
break;
|
||||
assert(lldb_private::FileSpec::Equal(cu_file_spec, line_entry.file, has_path));
|
||||
if (!cu_header_printed)
|
||||
{
|
||||
if (num_matches > 0)
|
||||
strm << "\n\n";
|
||||
strm << "Lines found for file " << file_spec_name
|
||||
<< " in compilation unit " << cu->GetFilename()
|
||||
<< " in `" << module_file_name << "\n";
|
||||
cu_header_printed = true;
|
||||
}
|
||||
line_entry.GetDescription(&strm, lldb::eDescriptionLevelBrief, cu,
|
||||
target, /*show_address_only=*/false);
|
||||
strm << "\n";
|
||||
|
||||
// Anymore after this one?
|
||||
start_idx++;
|
||||
start_idx = cu->FindLineEntry(start_idx, line, &cu_file_spec,
|
||||
/*exact=*/true, &line_entry);
|
||||
} while (start_idx != UINT32_MAX);
|
||||
|
||||
// Try the next higher line, starting over at start_idx 0.
|
||||
line++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return num_matches;
|
||||
}
|
||||
|
||||
// Dump the requested line entries for the file in the module.
|
||||
// Return the number of entries found.
|
||||
// If module_list is set, only dump lines contained in one of the modules.
|
||||
// If the start_line option was specified, don't print lines less than start_line.
|
||||
// If the end_line option was specified, don't print lines greater than end_line.
|
||||
// If the num_lines option was specified, dont print more than num_lines entries.
|
||||
uint32_t
|
||||
DumpFileLinesInModule (Stream &strm, Module *module, const FileSpec &file_spec)
|
||||
{
|
||||
uint32_t num_matches = 0;
|
||||
if (module)
|
||||
{
|
||||
// Look through all the compilation units (CUs) in this module for ones that
|
||||
// contain lines of code from this source file.
|
||||
for (size_t i = 0; i < module->GetNumCompileUnits(); i++)
|
||||
{
|
||||
// Look for a matching source file in this CU.
|
||||
CompUnitSP cu_sp(module->GetCompileUnitAtIndex(i));
|
||||
if (cu_sp)
|
||||
{
|
||||
num_matches += DumpFileLinesInCompUnit(strm, module, cu_sp.get(), file_spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
return num_matches;
|
||||
}
|
||||
|
||||
// Given an address and a list of modules, append the symbol contexts of all line entries
|
||||
// containing the address found in the modules and return the count of matches. If none
|
||||
// is found, return an error in 'error_strm'.
|
||||
size_t
|
||||
GetSymbolContextsForAddress (const ModuleList &module_list, lldb::addr_t addr,
|
||||
SymbolContextList &sc_list, StreamString &error_strm)
|
||||
{
|
||||
Address so_addr;
|
||||
size_t num_matches = 0;
|
||||
assert(module_list.GetSize() > 0);
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
if (target->GetSectionLoadList().IsEmpty())
|
||||
{
|
||||
// The target isn't loaded yet, we need to lookup the file address in
|
||||
// all modules. Note: the module list option does not apply to addresses.
|
||||
const size_t num_modules = module_list.GetSize();
|
||||
for (size_t i = 0; i < num_modules; ++i)
|
||||
{
|
||||
ModuleSP module_sp(module_list.GetModuleAtIndex(i));
|
||||
if (!module_sp)
|
||||
continue;
|
||||
if (module_sp->ResolveFileAddress(addr, so_addr))
|
||||
{
|
||||
SymbolContext sc;
|
||||
sc.Clear(true);
|
||||
if (module_sp->ResolveSymbolContextForAddress(so_addr, eSymbolContextEverything, sc) &
|
||||
eSymbolContextLineEntry)
|
||||
{
|
||||
sc_list.AppendIfUnique(sc, /*merge_symbol_into_function=*/false);
|
||||
++num_matches;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_matches == 0)
|
||||
error_strm.Printf("Source information for file address 0x%" PRIx64
|
||||
" not found in any modules.\n", addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The target has some things loaded, resolve this address to a
|
||||
// compile unit + file + line and display
|
||||
if (target->GetSectionLoadList().ResolveLoadAddress(addr, so_addr))
|
||||
{
|
||||
ModuleSP module_sp(so_addr.GetModule());
|
||||
// Check to make sure this module is in our list.
|
||||
if (module_sp &&
|
||||
module_list.GetIndexForModule(module_sp.get()) != LLDB_INVALID_INDEX32)
|
||||
{
|
||||
SymbolContext sc;
|
||||
sc.Clear(true);
|
||||
if (module_sp->ResolveSymbolContextForAddress(so_addr, eSymbolContextEverything, sc) &
|
||||
eSymbolContextLineEntry)
|
||||
{
|
||||
sc_list.AppendIfUnique(sc, /*merge_symbol_into_function=*/false);
|
||||
++num_matches;
|
||||
}
|
||||
else
|
||||
{
|
||||
StreamString addr_strm;
|
||||
so_addr.Dump(&addr_strm, NULL, Address::DumpStyleModuleWithFileAddress);
|
||||
error_strm.Printf("Address 0x%" PRIx64 " resolves to %s, but there is"
|
||||
" no source information available for this address.\n",
|
||||
addr, addr_strm.GetData());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StreamString addr_strm;
|
||||
so_addr.Dump(&addr_strm, NULL, Address::DumpStyleModuleWithFileAddress);
|
||||
error_strm.Printf("Address 0x%" PRIx64 " resolves to %s, but it cannot"
|
||||
" be found in any modules.\n",
|
||||
addr, addr_strm.GetData());
|
||||
}
|
||||
}
|
||||
else
|
||||
error_strm.Printf("Unable to resolve address 0x%" PRIx64 ".\n", addr);
|
||||
}
|
||||
return num_matches;
|
||||
}
|
||||
|
||||
// Dump the line entries found in functions matching the name specified in the option.
|
||||
bool
|
||||
DumpLinesInFunctions (CommandReturnObject &result)
|
||||
{
|
||||
SymbolContextList sc_list_funcs;
|
||||
ConstString name(m_options.symbol_name.c_str());
|
||||
SymbolContextList sc_list_lines;
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
|
||||
|
||||
// Note: module_list can't be const& because FindFunctionSymbols isn't const.
|
||||
ModuleList module_list = (m_module_list.GetSize() > 0) ?
|
||||
m_module_list : target->GetImages();
|
||||
size_t num_matches = module_list.FindFunctions(name,
|
||||
eFunctionNameTypeAuto,
|
||||
/*include_symbols=*/false,
|
||||
/*include_inlines=*/true,
|
||||
/*append=*/true,
|
||||
sc_list_funcs);
|
||||
if (!num_matches)
|
||||
{
|
||||
// If we didn't find any functions with that name, try searching for
|
||||
// symbols that line up exactly with function addresses.
|
||||
SymbolContextList sc_list_symbols;
|
||||
size_t num_symbol_matches = module_list.FindFunctionSymbols(name,
|
||||
eFunctionNameTypeAuto,
|
||||
sc_list_symbols);
|
||||
for (size_t i = 0; i < num_symbol_matches; i++)
|
||||
{
|
||||
SymbolContext sc;
|
||||
sc_list_symbols.GetContextAtIndex(i, sc);
|
||||
if (sc.symbol && sc.symbol->ValueIsAddress())
|
||||
{
|
||||
const Address &base_address = sc.symbol->GetAddressRef();
|
||||
Function *function = base_address.CalculateSymbolContextFunction();
|
||||
if (function)
|
||||
{
|
||||
sc_list_funcs.Append(SymbolContext(function));
|
||||
num_matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num_matches == 0)
|
||||
{
|
||||
result.AppendErrorWithFormat("Could not find function named \'%s\'.\n",
|
||||
m_options.symbol_name.c_str());
|
||||
return false;
|
||||
}
|
||||
for (size_t i = 0; i < num_matches; i++)
|
||||
{
|
||||
SymbolContext sc;
|
||||
sc_list_funcs.GetContextAtIndex(i, sc);
|
||||
bool context_found_for_symbol = false;
|
||||
// Loop through all the ranges in the function.
|
||||
AddressRange range;
|
||||
for (uint32_t r = 0;
|
||||
sc.GetAddressRange(eSymbolContextEverything,
|
||||
r,
|
||||
/*use_inline_block_range=*/true,
|
||||
range);
|
||||
++r)
|
||||
{
|
||||
// Append the symbol contexts for each address in the range to sc_list_lines.
|
||||
const Address &base_address = range.GetBaseAddress();
|
||||
const addr_t size = range.GetByteSize();
|
||||
lldb::addr_t start_addr = base_address.GetLoadAddress(target);
|
||||
if (start_addr == LLDB_INVALID_ADDRESS)
|
||||
start_addr = base_address.GetFileAddress();
|
||||
lldb::addr_t end_addr = start_addr + size;
|
||||
for (lldb::addr_t addr = start_addr; addr < end_addr; addr += addr_byte_size)
|
||||
{
|
||||
StreamString error_strm;
|
||||
if (!GetSymbolContextsForAddress(module_list, addr, sc_list_lines, error_strm))
|
||||
result.AppendWarningWithFormat("in symbol '%s': %s",
|
||||
sc.GetFunctionName().AsCString(),
|
||||
error_strm.GetData());
|
||||
else
|
||||
context_found_for_symbol = true;
|
||||
}
|
||||
}
|
||||
if (!context_found_for_symbol)
|
||||
result.AppendWarningWithFormat("Unable to find line information"
|
||||
" for matching symbol '%s'.\n",
|
||||
sc.GetFunctionName().AsCString());
|
||||
}
|
||||
if (sc_list_lines.GetSize() == 0)
|
||||
{
|
||||
result.AppendErrorWithFormat("No line information could be found"
|
||||
" for any symbols matching '%s'.\n",
|
||||
name.AsCString());
|
||||
return false;
|
||||
}
|
||||
FileSpec file_spec;
|
||||
if (!DumpLinesInSymbolContexts(result.GetOutputStream(),
|
||||
sc_list_lines, module_list, file_spec))
|
||||
{
|
||||
result.AppendErrorWithFormat("Unable to dump line information for symbol '%s'.\n",
|
||||
name.AsCString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Dump the line entries found for the address specified in the option.
|
||||
bool
|
||||
DumpLinesForAddress (CommandReturnObject &result)
|
||||
{
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
SymbolContextList sc_list;
|
||||
|
||||
StreamString error_strm;
|
||||
if (!GetSymbolContextsForAddress(target->GetImages(), m_options.address, sc_list, error_strm))
|
||||
{
|
||||
result.AppendErrorWithFormat("%s.\n", error_strm.GetData());
|
||||
return false;
|
||||
}
|
||||
ModuleList module_list;
|
||||
FileSpec file_spec;
|
||||
if (!DumpLinesInSymbolContexts(result.GetOutputStream(),
|
||||
sc_list, module_list, file_spec))
|
||||
{
|
||||
result.AppendErrorWithFormat("No modules contain load address 0x%" PRIx64 ".\n",
|
||||
m_options.address);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Dump the line entries found in the file specified in the option.
|
||||
bool
|
||||
DumpLinesForFile (CommandReturnObject &result)
|
||||
{
|
||||
FileSpec file_spec(m_options.file_name, false);
|
||||
const char *filename = m_options.file_name.c_str();
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
const ModuleList &module_list = (m_module_list.GetSize() > 0) ?
|
||||
m_module_list : target->GetImages();
|
||||
|
||||
bool displayed_something = false;
|
||||
const size_t num_modules = module_list.GetSize();
|
||||
for (uint32_t i = 0; i < num_modules; ++i)
|
||||
{
|
||||
// Dump lines for this module.
|
||||
Module *module = module_list.GetModulePointerAtIndex(i);
|
||||
assert(module);
|
||||
if (DumpFileLinesInModule(result.GetOutputStream(), module, file_spec))
|
||||
displayed_something = true;
|
||||
}
|
||||
if (!displayed_something)
|
||||
{
|
||||
result.AppendErrorWithFormat("No source filenames matched '%s'.\n", filename);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Dump the line entries for the current frame.
|
||||
bool
|
||||
DumpLinesForFrame (CommandReturnObject &result)
|
||||
{
|
||||
StackFrame *cur_frame = m_exe_ctx.GetFramePtr();
|
||||
if (cur_frame == NULL)
|
||||
{
|
||||
result.AppendError("No selected frame to use to find the default source.");
|
||||
return false;
|
||||
}
|
||||
else if (!cur_frame->HasDebugInformation())
|
||||
{
|
||||
result.AppendError("No debug info for the selected frame.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
const SymbolContext &sc = cur_frame->GetSymbolContext(eSymbolContextLineEntry);
|
||||
SymbolContextList sc_list;
|
||||
sc_list.Append(sc);
|
||||
ModuleList module_list;
|
||||
FileSpec file_spec;
|
||||
if (!DumpLinesInSymbolContexts(result.GetOutputStream(), sc_list, module_list, file_spec))
|
||||
{
|
||||
result.AppendError("No source line info available for the selected frame.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DoExecute (Args &command, CommandReturnObject &result) override
|
||||
{
|
||||
const size_t argc = command.GetArgumentCount();
|
||||
|
||||
if (argc != 0)
|
||||
{
|
||||
result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n",
|
||||
GetCommandName());
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
|
||||
Target *target = m_exe_ctx.GetTargetPtr();
|
||||
if (target == NULL)
|
||||
{
|
||||
target = m_interpreter.GetDebugger().GetSelectedTarget().get();
|
||||
if (target == NULL)
|
||||
{
|
||||
result.AppendError("invalid target, create a debug target using the "
|
||||
"'target create' command.");
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
|
||||
result.GetOutputStream().SetAddressByteSize(addr_byte_size);
|
||||
result.GetErrorStream().SetAddressByteSize(addr_byte_size);
|
||||
|
||||
// Collect the list of modules to search.
|
||||
m_module_list.Clear();
|
||||
if (m_options.modules.size() > 0)
|
||||
{
|
||||
for (size_t i = 0, e = m_options.modules.size(); i < e; ++i)
|
||||
{
|
||||
FileSpec module_file_spec(m_options.modules[i].c_str(), false);
|
||||
if (module_file_spec)
|
||||
{
|
||||
ModuleSpec module_spec(module_file_spec);
|
||||
if (target->GetImages().FindModules(module_spec, m_module_list) == 0)
|
||||
result.AppendWarningWithFormat("No module found for '%s'.\n",
|
||||
m_options.modules[i].c_str());
|
||||
}
|
||||
}
|
||||
if (!m_module_list.GetSize())
|
||||
{
|
||||
result.AppendError("No modules match the input.");
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (target->GetImages().GetSize() == 0)
|
||||
{
|
||||
result.AppendError("The target has no associated executable images.");
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check the arguments to see what lines we should dump.
|
||||
if (!m_options.symbol_name.empty())
|
||||
{
|
||||
// Print lines for symbol.
|
||||
if (DumpLinesInFunctions(result))
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
else
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
}
|
||||
else if (m_options.address != LLDB_INVALID_ADDRESS)
|
||||
{
|
||||
// Print lines for an address.
|
||||
if (DumpLinesForAddress(result))
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
else
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
}
|
||||
else if (!m_options.file_name.empty())
|
||||
{
|
||||
// Dump lines for a file.
|
||||
if (DumpLinesForFile(result))
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
else
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Dump the line for the current frame.
|
||||
if (DumpLinesForFrame(result))
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
else
|
||||
result.SetStatus(eReturnStatusFailed);
|
||||
}
|
||||
return result.Succeeded();
|
||||
}
|
||||
|
||||
CommandOptions m_options;
|
||||
ModuleList m_module_list;
|
||||
};
|
||||
|
||||
OptionDefinition
|
||||
CommandObjectSourceInfo::CommandOptions::g_option_table[] =
|
||||
{
|
||||
{ LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum, "The line number at which to start the display source."},
|
||||
{ LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
|
||||
{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
|
||||
OptionDefinition CommandObjectSourceInfo::CommandOptions::g_option_table[] = {
|
||||
{LLDB_OPT_SET_ALL, false, "count", 'c', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeCount,
|
||||
"The number of line entries to display."},
|
||||
{LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib", 's', OptionParser::eRequiredArgument, NULL, NULL,
|
||||
CommandCompletions::eModuleCompletion, eArgTypeShlibName,
|
||||
"Look up the source in the given module or shared library (can be "
|
||||
"specified more than once)."},
|
||||
{LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, NULL, NULL,
|
||||
CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "The file from which to display source."},
|
||||
{LLDB_OPT_SET_1, false, "line", 'l', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,
|
||||
"The line number at which to start the displaying lines."},
|
||||
{LLDB_OPT_SET_1, false, "end-line", 'e', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeLineNum,
|
||||
"The line number at which to stop displaying lines."},
|
||||
{LLDB_OPT_SET_2, false, "name", 'n', OptionParser::eRequiredArgument, NULL, NULL,
|
||||
CommandCompletions::eSymbolCompletion, eArgTypeSymbol, "The name of a function whose source to display."},
|
||||
{LLDB_OPT_SET_3, false, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression,
|
||||
"Lookup the address and display the source information for the "
|
||||
"corresponding file and line."},
|
||||
{0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL}
|
||||
};
|
||||
|
||||
|
||||
#pragma mark CommandObjectSourceList
|
||||
//-------------------------------------------------------------------------
|
||||
// CommandObjectSourceList
|
||||
@ -906,7 +1485,6 @@ CommandObjectSourceList::CommandOptions::g_option_table[] =
|
||||
};
|
||||
|
||||
#pragma mark CommandObjectMultiwordSource
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// CommandObjectMultiwordSource
|
||||
//-------------------------------------------------------------------------
|
||||
@ -917,8 +1495,7 @@ CommandObjectMultiwordSource::CommandObjectMultiwordSource (CommandInterpreter &
|
||||
"A set of commands for accessing source file information",
|
||||
"source <subcommand> [<subcommand-options>]")
|
||||
{
|
||||
// "source info" isn't implemented yet...
|
||||
//LoadSubCommand ("info", CommandObjectSP (new CommandObjectSourceInfo (interpreter)));
|
||||
LoadSubCommand ("info", CommandObjectSP (new CommandObjectSourceInfo (interpreter)));
|
||||
LoadSubCommand ("list", CommandObjectSP (new CommandObjectSourceList (interpreter)));
|
||||
}
|
||||
|
||||
|
@ -2577,8 +2577,9 @@ class CommandObjectTargetModulesDumpLineTable : public CommandObjectTargetModule
|
||||
|
||||
if (command.GetArgumentCount() == 0)
|
||||
{
|
||||
result.AppendErrorWithFormat ("\nSyntax: %s\n", m_cmd_syntax.c_str());
|
||||
result.AppendError ("file option must be specified.");
|
||||
result.SetStatus (eReturnStatusFailed);
|
||||
return result.Succeeded();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1396,11 +1396,6 @@ class CommandObjectTypeFormatterList : public CommandObjectParsed
|
||||
|
||||
auto category_closure = [&result, &formatter_regex] (const lldb::TypeCategoryImplSP& category) -> void {
|
||||
result.GetOutputStream().Printf("-----------------------\nCategory: %s\n-----------------------\n", category->GetName());
|
||||
|
||||
typedef const std::shared_ptr<FormatterType> Bar;
|
||||
typedef std::function<bool(ConstString,Bar)> Func1Type;
|
||||
typedef std::function<bool(RegularExpressionSP,Bar)> Func2Type;
|
||||
|
||||
TypeCategoryImpl::ForEachCallbacks<FormatterType> foreach;
|
||||
foreach.SetExact([&result, &formatter_regex] (ConstString name, const FormatterSharedPointer& format_sp) -> bool {
|
||||
if (formatter_regex)
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include "lldb/Core/StreamString.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Core/StreamString.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -304,6 +306,13 @@ StringList::operator << (const char* str)
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringList&
|
||||
StringList::operator << (const std::string& str)
|
||||
{
|
||||
AppendString(str);
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringList&
|
||||
StringList::operator << (StringList strings)
|
||||
{
|
||||
@ -311,6 +320,16 @@ StringList::operator << (StringList strings)
|
||||
return *this;
|
||||
}
|
||||
|
||||
StringList&
|
||||
StringList::operator = (const std::vector<std::string> &rhs)
|
||||
{
|
||||
Clear();
|
||||
for (const auto &s : rhs)
|
||||
m_strings.push_back(s);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t
|
||||
StringList::AutoComplete (const char *s, StringList &matches, size_t &exact_idx) const
|
||||
{
|
||||
@ -339,3 +358,21 @@ StringList::AutoComplete (const char *s, StringList &matches, size_t &exact_idx)
|
||||
return matches.GetSize();
|
||||
}
|
||||
|
||||
void
|
||||
StringList::LogDump(Log *log, const char *name)
|
||||
{
|
||||
if (!log)
|
||||
return;
|
||||
|
||||
StreamString strm;
|
||||
if (name)
|
||||
strm.Printf("Begin %s:\n", name);
|
||||
for (const auto &s : m_strings) {
|
||||
strm.Indent();
|
||||
strm.Printf("%s\n", s.c_str());
|
||||
}
|
||||
if (name)
|
||||
strm.Printf("End %s.\n", name);
|
||||
|
||||
log->Debug("%s", strm.GetData());
|
||||
}
|
||||
|
@ -130,9 +130,9 @@ CommandHistory::Dump (Stream& stream,
|
||||
size_t stop_idx) const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
stop_idx = std::min(stop_idx, m_history.size() - 1);
|
||||
stop_idx = std::min(stop_idx + 1, m_history.size());
|
||||
for (size_t counter = start_idx;
|
||||
counter <= stop_idx;
|
||||
counter < stop_idx;
|
||||
counter++)
|
||||
{
|
||||
const std::string hist_item = m_history[counter];
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -160,122 +160,38 @@ class EmulateInstructionMIPS : public lldb_private::EmulateInstruction
|
||||
Emulate_LDST_Reg (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BEQ (llvm::MCInst& insn);
|
||||
Emulate_BXX_3ops (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BNE (llvm::MCInst& insn);
|
||||
Emulate_BXX_3ops_C (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BEQL (llvm::MCInst& insn);
|
||||
Emulate_BXX_2ops (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BNEL (llvm::MCInst& insn);
|
||||
Emulate_BXX_2ops_C (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGEZALL (llvm::MCInst& insn);
|
||||
Emulate_Bcond_Link_C (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_Bcond_Link (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_FP_branch (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_3D_branch (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BAL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGEZAL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BALC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGEZ (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLEZALC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGEZALC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLTZALC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGTZALC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BEQZALC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BNEZALC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BEQC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BNEC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLTC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGEC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLTUC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGEUC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLTZC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLEZC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGEZC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGTZC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BEQZC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BNEZC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGEZL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGTZ (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BGTZL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLEZ (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLEZL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLTZ (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLTZAL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLTZALL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BLTZL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BOVC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BNVC (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_J (llvm::MCInst& insn);
|
||||
|
||||
@ -294,36 +210,12 @@ class EmulateInstructionMIPS : public lldb_private::EmulateInstruction
|
||||
bool
|
||||
Emulate_JR (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1F (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1T (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1FL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1TL (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1EQZ (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1NEZ (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1ANY2F (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1ANY2T (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1ANY4F (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BC1ANY4T (llvm::MCInst& insn);
|
||||
|
||||
bool
|
||||
Emulate_BNZB (llvm::MCInst& insn);
|
||||
|
||||
|
@ -452,7 +452,7 @@ RenderScriptRuntime::GetPluginNameStatic()
|
||||
return g_name;
|
||||
}
|
||||
|
||||
RenderScriptRuntime::ModuleKind
|
||||
RenderScriptRuntime::ModuleKind
|
||||
RenderScriptRuntime::GetModuleKind(const lldb::ModuleSP &module_sp)
|
||||
{
|
||||
if (module_sp)
|
||||
@ -493,7 +493,7 @@ RenderScriptRuntime::IsRenderScriptModule(const lldb::ModuleSP &module_sp)
|
||||
return GetModuleKind(module_sp) != eModuleKindIgnored;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
RenderScriptRuntime::ModulesDidLoad(const ModuleList &module_list )
|
||||
{
|
||||
Mutex::Locker locker (module_list.GetMutex ());
|
||||
@ -640,11 +640,11 @@ RenderScriptRuntime::HookCallback(void *baton, StoppointCallbackContext *ctx, ll
|
||||
RenderScriptRuntime *lang_rt = (RenderScriptRuntime *)context.GetProcessPtr()->GetLanguageRuntime(eLanguageTypeExtRenderScript);
|
||||
|
||||
lang_rt->HookCallback(hook_info, context);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
RenderScriptRuntime::HookCallback(RuntimeHook* hook_info, ExecutionContext& context)
|
||||
{
|
||||
Log* log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
|
||||
@ -652,7 +652,7 @@ RenderScriptRuntime::HookCallback(RuntimeHook* hook_info, ExecutionContext& cont
|
||||
if (log)
|
||||
log->Printf ("RenderScriptRuntime::HookCallback - '%s' .", hook_info->defn->name);
|
||||
|
||||
if (hook_info->defn->grabber)
|
||||
if (hook_info->defn->grabber)
|
||||
{
|
||||
(this->*(hook_info->defn->grabber))(hook_info, context);
|
||||
}
|
||||
@ -706,7 +706,6 @@ RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, uint6
|
||||
*data = result;
|
||||
success = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case llvm::Triple::ArchType::x86_64:
|
||||
@ -741,6 +740,7 @@ RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, uint6
|
||||
case llvm::Triple::ArchType::arm:
|
||||
{
|
||||
// arm 32 bit
|
||||
// first 4 arguments are passed via registers
|
||||
if (arg < 4)
|
||||
{
|
||||
const RegisterInfo* rArg = reg_ctx->GetRegisterInfoAtIndex(arg);
|
||||
@ -760,18 +760,19 @@ RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, uint6
|
||||
{
|
||||
uint64_t sp = reg_ctx->GetSP();
|
||||
uint32_t offset = (arg-4) * sizeof(uint32_t);
|
||||
process->ReadMemory(sp + offset, &data, sizeof(uint32_t), error);
|
||||
if (error.Fail())
|
||||
uint32_t value = 0;
|
||||
size_t bytes_read = process->ReadMemory(sp + offset, &value, sizeof(value), error);
|
||||
if (error.Fail() || bytes_read != sizeof(value))
|
||||
{
|
||||
if (log)
|
||||
log->Printf("RenderScriptRuntime::GetArgSimple - error reading ARM stack: %s.", error.AsCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
*data = value;
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case llvm::Triple::ArchType::aarch64:
|
||||
@ -803,8 +804,8 @@ RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, uint6
|
||||
}
|
||||
case llvm::Triple::ArchType::mipsel:
|
||||
{
|
||||
|
||||
// read from the registers
|
||||
// first 4 arguments are passed in registers
|
||||
if (arg < 4){
|
||||
const RegisterInfo* rArg = reg_ctx->GetRegisterInfoAtIndex(arg + 4);
|
||||
RegisterValue rVal;
|
||||
@ -818,26 +819,25 @@ RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, uint6
|
||||
if (log)
|
||||
log->Printf("RenderScriptRuntime::GetArgSimple() - Mips - Error while reading the argument #%d", arg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// read from the stack
|
||||
// arguments > 4 are read from the stack
|
||||
else
|
||||
{
|
||||
uint64_t sp = reg_ctx->GetSP();
|
||||
uint32_t offset = arg * sizeof(uint32_t);
|
||||
process->ReadMemory(sp + offset, &data, sizeof(uint32_t), error);
|
||||
if (error.Fail())
|
||||
uint32_t value = 0;
|
||||
size_t bytes_read = process->ReadMemory(sp + offset, &value, sizeof(value), error);
|
||||
if (error.Fail() || bytes_read != sizeof(value))
|
||||
{
|
||||
if (log)
|
||||
log->Printf("RenderScriptRuntime::GetArgSimple - error reading Mips stack: %s.", error.AsCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
*data = value;
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case llvm::Triple::ArchType::mips64el:
|
||||
@ -858,24 +858,24 @@ RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, uint6
|
||||
log->Printf("RenderScriptRuntime::GetArgSimple - Mips64 - Error reading the argument #%d", arg);
|
||||
}
|
||||
}
|
||||
|
||||
// read from the stack
|
||||
// arguments > 8 are read from the stack
|
||||
else
|
||||
{
|
||||
uint64_t sp = reg_ctx->GetSP();
|
||||
uint32_t offset = (arg - 8) * sizeof(uint64_t);
|
||||
process->ReadMemory(sp + offset, &data, sizeof(uint64_t), error);
|
||||
if (error.Fail())
|
||||
uint64_t value = 0;
|
||||
size_t bytes_read = process->ReadMemory(sp + offset, &value, sizeof(value), error);
|
||||
if (error.Fail() || bytes_read != sizeof(value))
|
||||
{
|
||||
if (log)
|
||||
log->Printf("RenderScriptRuntime::GetArgSimple - Mips64 - Error reading Mips64 stack: %s.", error.AsCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
*data = value;
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -883,7 +883,6 @@ RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, uint6
|
||||
// invalid architecture
|
||||
if (log)
|
||||
log->Printf("RenderScriptRuntime::GetArgSimple - Architecture not supported");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -895,11 +894,11 @@ RenderScriptRuntime::GetArgSimple(ExecutionContext &context, uint32_t arg, uint6
|
||||
return success;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
RenderScriptRuntime::CaptureSetGlobalVar1(RuntimeHook* hook_info, ExecutionContext& context)
|
||||
{
|
||||
Log* log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
|
||||
|
||||
|
||||
//Context, Script, int, data, length
|
||||
|
||||
uint64_t rs_context_u64 = 0U;
|
||||
@ -921,7 +920,7 @@ RenderScriptRuntime::CaptureSetGlobalVar1(RuntimeHook* hook_info, ExecutionConte
|
||||
log->Printf("RenderScriptRuntime::CaptureSetGlobalVar1 - Error while reading the function parameters");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("RenderScriptRuntime::CaptureSetGlobalVar1 - 0x%" PRIx64 ",0x%" PRIx64 " slot %" PRIu64 " = 0x%" PRIx64 ":%" PRIu64 "bytes.",
|
||||
@ -934,18 +933,18 @@ RenderScriptRuntime::CaptureSetGlobalVar1(RuntimeHook* hook_info, ExecutionConte
|
||||
if (rs_id_u64 < rsm->m_globals.size())
|
||||
{
|
||||
auto rsg = rsm->m_globals[rs_id_u64];
|
||||
log->Printf ("RenderScriptRuntime::CaptureSetGlobalVar1 - Setting of '%s' within '%s' inferred", rsg.m_name.AsCString(),
|
||||
log->Printf ("RenderScriptRuntime::CaptureSetGlobalVar1 - Setting of '%s' within '%s' inferred", rsg.m_name.AsCString(),
|
||||
rsm->m_module->GetFileSpec().GetFilename().AsCString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
RenderScriptRuntime::CaptureAllocationInit1(RuntimeHook* hook_info, ExecutionContext& context)
|
||||
{
|
||||
Log* log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
|
||||
|
||||
|
||||
//Context, Alloc, bool
|
||||
|
||||
uint64_t rs_context_u64 = 0U;
|
||||
@ -1009,7 +1008,7 @@ RenderScriptRuntime::CaptureAllocationDestroy(RuntimeHook* hook_info, ExecutionC
|
||||
log->Printf("RenderScriptRuntime::CaptureAllocationDestroy - Couldn't find destroyed allocation");
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
RenderScriptRuntime::CaptureScriptInit1(RuntimeHook* hook_info, ExecutionContext& context)
|
||||
{
|
||||
Log* log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
|
||||
@ -1045,16 +1044,16 @@ RenderScriptRuntime::CaptureScriptInit1(RuntimeHook* hook_info, ExecutionContext
|
||||
{
|
||||
if (log)
|
||||
log->Printf ("RenderScriptRuntime::CaptureScriptInit1 - error reading resname: %s.", error.AsCString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
process->ReadCStringFromMemory((lldb::addr_t)rs_cachedirptr_u64, cachedir, error);
|
||||
if (error.Fail())
|
||||
{
|
||||
if (log)
|
||||
log->Printf ("RenderScriptRuntime::CaptureScriptInit1 - error reading cachedir: %s.", error.AsCString());
|
||||
log->Printf ("RenderScriptRuntime::CaptureScriptInit1 - error reading cachedir: %s.", error.AsCString());
|
||||
}
|
||||
|
||||
|
||||
if (log)
|
||||
log->Printf ("RenderScriptRuntime::CaptureScriptInit1 - 0x%" PRIx64 ",0x%" PRIx64 " => '%s' at '%s' .",
|
||||
rs_context_u64, rs_script_u64, resname.c_str(), cachedir.c_str());
|
||||
@ -1077,7 +1076,7 @@ RenderScriptRuntime::CaptureScriptInit1(RuntimeHook* hook_info, ExecutionContext
|
||||
if (log)
|
||||
log->Printf ("RenderScriptRuntime::CaptureScriptInit1 - '%s' tagged with context 0x%" PRIx64 " and script 0x%" PRIx64 ".",
|
||||
strm.GetData(), rs_context_u64, rs_script_u64);
|
||||
}
|
||||
}
|
||||
else if (log)
|
||||
{
|
||||
log->Printf ("RenderScriptRuntime::CaptureScriptInit1 - resource name invalid, Script not tagged");
|
||||
@ -1134,7 +1133,7 @@ RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module, ModuleKind kind)
|
||||
if (addr == LLDB_INVALID_ADDRESS)
|
||||
{
|
||||
if (log)
|
||||
log->Printf ("RenderScriptRuntime::LoadRuntimeHooks - Unable to resolve the address of hook function '%s' with symbol '%s'.",
|
||||
log->Printf ("RenderScriptRuntime::LoadRuntimeHooks - Unable to resolve the address of hook function '%s' with symbol '%s'.",
|
||||
hook_defn->name, symbol_name);
|
||||
continue;
|
||||
}
|
||||
@ -1152,7 +1151,7 @@ RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module, ModuleKind kind)
|
||||
m_runtimeHooks[addr] = hook;
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("RenderScriptRuntime::LoadRuntimeHooks - Successfully hooked '%s' in '%s' version %" PRIu64 " at 0x%" PRIx64 ".",
|
||||
log->Printf ("RenderScriptRuntime::LoadRuntimeHooks - Successfully hooked '%s' in '%s' version %" PRIu64 " at 0x%" PRIx64 ".",
|
||||
hook_defn->name, module->GetFileSpec().GetFilename().AsCString(), (uint64_t)hook_defn->version, (uint64_t)addr);
|
||||
}
|
||||
}
|
||||
@ -2231,7 +2230,7 @@ RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, const
|
||||
// Write allocation data to file
|
||||
num_bytes = static_cast<size_t>(*alloc->size.get());
|
||||
if (log)
|
||||
log->Printf("RenderScriptRuntime::SaveAllocation - Writing 0x%" PRIx64 " bytes from %p", (uint64_t) num_bytes, buffer.get());
|
||||
log->Printf("RenderScriptRuntime::SaveAllocation - Writing 0x%" PRIx64 " bytes from %p", (uint64_t) num_bytes, (void*) buffer.get());
|
||||
|
||||
err = file.Write(buffer.get(), num_bytes);
|
||||
if (!err.Success())
|
||||
@ -2299,7 +2298,7 @@ RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp)
|
||||
}
|
||||
case eModuleKindLibRS:
|
||||
{
|
||||
if (!m_libRS)
|
||||
if (!m_libRS)
|
||||
{
|
||||
m_libRS = module_sp;
|
||||
static ConstString gDbgPresentStr("gDebuggerPresent");
|
||||
@ -2334,7 +2333,7 @@ RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp)
|
||||
break;
|
||||
}
|
||||
if (module_loaded)
|
||||
Update();
|
||||
Update();
|
||||
return module_loaded;
|
||||
}
|
||||
return false;
|
||||
@ -2408,7 +2407,7 @@ RSModuleDescriptor::ParseRSInfo()
|
||||
m_kernels.push_back(RSKernelDescriptor(this, name, slot));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sscanf(line.c_str(), "pragmaCount: %u", &numDefns) == 1)
|
||||
{
|
||||
char name[MAXLINE];
|
||||
@ -2417,7 +2416,7 @@ RSModuleDescriptor::ParseRSInfo()
|
||||
{
|
||||
name[0] = '\0';
|
||||
value[0] = '\0';
|
||||
if (sscanf(info_lines[++offset].c_str(), "%s - %s", &name[0], &value[0]) != 0
|
||||
if (sscanf(info_lines[++offset].c_str(), "%s - %s", &name[0], &value[0]) != 0
|
||||
&& (name[0] != '\0'))
|
||||
{
|
||||
m_pragmas[std::string(name)] = value;
|
||||
@ -2466,7 +2465,7 @@ RenderScriptRuntime::Status(Stream &strm) const
|
||||
strm.Printf("CPU Reference Implementation discovered.");
|
||||
strm.EOL();
|
||||
}
|
||||
|
||||
|
||||
if (m_runtimeHooks.size())
|
||||
{
|
||||
strm.Printf("Runtime functions hooked:");
|
||||
@ -2476,7 +2475,7 @@ RenderScriptRuntime::Status(Stream &strm) const
|
||||
strm.Indent(b.second->defn->name);
|
||||
strm.EOL();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strm.Printf("Runtime is not hooked.");
|
||||
@ -2484,7 +2483,7 @@ RenderScriptRuntime::Status(Stream &strm) const
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
RenderScriptRuntime::DumpContexts(Stream &strm) const
|
||||
{
|
||||
strm.Printf("Inferred RenderScript Contexts:");
|
||||
@ -2519,7 +2518,7 @@ RenderScriptRuntime::DumpContexts(Stream &strm) const
|
||||
strm.IndentLess();
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
RenderScriptRuntime::DumpKernels(Stream &strm) const
|
||||
{
|
||||
strm.Printf("RenderScript Kernels:");
|
||||
|
@ -119,7 +119,7 @@ class ELFRelocation
|
||||
///
|
||||
/// @param type Either DT_REL or DT_RELA. Any other value is invalid.
|
||||
ELFRelocation(unsigned type);
|
||||
|
||||
|
||||
~ELFRelocation();
|
||||
|
||||
bool
|
||||
@ -156,7 +156,7 @@ class ELFRelocation
|
||||
};
|
||||
|
||||
ELFRelocation::ELFRelocation(unsigned type)
|
||||
{
|
||||
{
|
||||
if (type == DT_REL || type == SHT_REL)
|
||||
reloc = new ELFRel();
|
||||
else if (type == DT_RELA || type == SHT_RELA)
|
||||
@ -172,7 +172,7 @@ ELFRelocation::~ELFRelocation()
|
||||
if (reloc.is<ELFRel*>())
|
||||
delete reloc.get<ELFRel*>();
|
||||
else
|
||||
delete reloc.get<ELFRela*>();
|
||||
delete reloc.get<ELFRela*>();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -315,7 +315,7 @@ kalimbaVariantFromElfFlags(const elf::elf_word e_flags)
|
||||
kal_arch_variant = llvm::Triple::KalimbaSubArch_v5;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
return kal_arch_variant;
|
||||
}
|
||||
@ -470,9 +470,9 @@ ObjectFileELF::CreateInstance (const lldb::ModuleSP &module_sp,
|
||||
|
||||
|
||||
ObjectFile*
|
||||
ObjectFileELF::CreateMemoryInstance (const lldb::ModuleSP &module_sp,
|
||||
DataBufferSP& data_sp,
|
||||
const lldb::ProcessSP &process_sp,
|
||||
ObjectFileELF::CreateMemoryInstance (const lldb::ModuleSP &module_sp,
|
||||
DataBufferSP& data_sp,
|
||||
const lldb::ProcessSP &process_sp,
|
||||
lldb::addr_t header_addr)
|
||||
{
|
||||
if (data_sp && data_sp->GetByteSize() > (llvm::ELF::EI_NIDENT))
|
||||
@ -561,7 +561,7 @@ calc_crc32(uint32_t crc, const void *buf, size_t size)
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
|
||||
0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
|
||||
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
|
||||
};
|
||||
};
|
||||
const uint8_t *p = (const uint8_t *)buf;
|
||||
|
||||
crc = crc ^ ~0U;
|
||||
@ -826,12 +826,12 @@ ObjectFileELF::GetPluginVersion()
|
||||
// ObjectFile protocol
|
||||
//------------------------------------------------------------------
|
||||
|
||||
ObjectFileELF::ObjectFileELF (const lldb::ModuleSP &module_sp,
|
||||
ObjectFileELF::ObjectFileELF (const lldb::ModuleSP &module_sp,
|
||||
DataBufferSP& data_sp,
|
||||
lldb::offset_t data_offset,
|
||||
const FileSpec* file,
|
||||
const FileSpec* file,
|
||||
lldb::offset_t file_offset,
|
||||
lldb::offset_t length) :
|
||||
lldb::offset_t length) :
|
||||
ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
|
||||
m_header(),
|
||||
m_uuid(),
|
||||
@ -901,7 +901,7 @@ ObjectFileELF::SetLoadAddress (Target &target,
|
||||
|
||||
if (header->p_type != PT_LOAD || header->p_offset != 0)
|
||||
continue;
|
||||
|
||||
|
||||
value = value - header->p_vaddr;
|
||||
found_offset = true;
|
||||
break;
|
||||
@ -1176,7 +1176,7 @@ ObjectFileELF::GetImageInfoAddress(Target *target)
|
||||
}
|
||||
|
||||
lldb_private::Address
|
||||
ObjectFileELF::GetEntryPointAddress ()
|
||||
ObjectFileELF::GetEntryPointAddress ()
|
||||
{
|
||||
if (m_entry_point_address.IsValid())
|
||||
return m_entry_point_address;
|
||||
@ -1187,7 +1187,7 @@ ObjectFileELF::GetEntryPointAddress ()
|
||||
SectionList *section_list = GetSectionList();
|
||||
addr_t offset = m_header.e_entry;
|
||||
|
||||
if (!section_list)
|
||||
if (!section_list)
|
||||
m_entry_point_address.SetOffset(offset);
|
||||
else
|
||||
m_entry_point_address.ResolveAddressUsingFileSections(offset, section_list);
|
||||
@ -1545,16 +1545,16 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
|
||||
{
|
||||
switch (header.e_flags & llvm::ELF::EF_MIPS_ARCH_ASE)
|
||||
{
|
||||
case llvm::ELF::EF_MIPS_MICROMIPS:
|
||||
arch_spec.SetFlags (ArchSpec::eMIPSAse_micromips);
|
||||
case llvm::ELF::EF_MIPS_MICROMIPS:
|
||||
arch_spec.SetFlags (ArchSpec::eMIPSAse_micromips);
|
||||
break;
|
||||
case llvm::ELF::EF_MIPS_ARCH_ASE_M16:
|
||||
arch_spec.SetFlags (ArchSpec::eMIPSAse_mips16);
|
||||
case llvm::ELF::EF_MIPS_ARCH_ASE_M16:
|
||||
arch_spec.SetFlags (ArchSpec::eMIPSAse_mips16);
|
||||
break;
|
||||
case llvm::ELF::EF_MIPS_ARCH_ASE_MDMX:
|
||||
arch_spec.SetFlags (ArchSpec::eMIPSAse_mdmx);
|
||||
case llvm::ELF::EF_MIPS_ARCH_ASE_MDMX:
|
||||
arch_spec.SetFlags (ArchSpec::eMIPSAse_mdmx);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1617,7 +1617,7 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
|
||||
DataExtractor data;
|
||||
if (sheader.sh_type == SHT_MIPS_ABIFLAGS)
|
||||
{
|
||||
|
||||
|
||||
if (section_size && (data.SetData (object_data, sheader.sh_offset, section_size) == section_size))
|
||||
{
|
||||
lldb::offset_t ase_offset = 12; // MIPS ABI Flags Version: 0
|
||||
@ -1626,12 +1626,12 @@ ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers,
|
||||
}
|
||||
// Settings appropriate ArchSpec ABI Flags
|
||||
if (header.e_flags & llvm::ELF::EF_MIPS_ABI2)
|
||||
{
|
||||
{
|
||||
arch_flags |= lldb_private::ArchSpec::eMIPSABI_N32;
|
||||
}
|
||||
else if (header.e_flags & llvm::ELF::EF_MIPS_ABI_O32)
|
||||
{
|
||||
arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;
|
||||
arch_flags |= lldb_private::ArchSpec::eMIPSABI_O32;
|
||||
}
|
||||
arch_spec.SetFlags (arch_flags);
|
||||
}
|
||||
@ -1705,7 +1705,7 @@ ObjectFileELF::GetProgramHeaderByIndex(lldb::user_id_t id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DataExtractor
|
||||
DataExtractor
|
||||
ObjectFileELF::GetSegmentDataByIndex(lldb::user_id_t id)
|
||||
{
|
||||
const elf::ELFProgramHeader *segment_header = GetProgramHeaderByIndex(id);
|
||||
@ -1810,12 +1810,12 @@ ObjectFileELF::CreateSections(SectionList &unified_section_list)
|
||||
else if (name == g_sect_name_tdata)
|
||||
{
|
||||
sect_type = eSectionTypeData;
|
||||
is_thread_specific = true;
|
||||
is_thread_specific = true;
|
||||
}
|
||||
else if (name == g_sect_name_tbss)
|
||||
{
|
||||
sect_type = eSectionTypeZeroFill;
|
||||
is_thread_specific = true;
|
||||
sect_type = eSectionTypeZeroFill;
|
||||
is_thread_specific = true;
|
||||
}
|
||||
// .debug_abbrev – Abbreviations used in the .debug_info section
|
||||
// .debug_aranges – Lookup table for mapping addresses to compilation units
|
||||
@ -1882,12 +1882,12 @@ ObjectFileELF::CreateSections(SectionList &unified_section_list)
|
||||
{
|
||||
// the kalimba toolchain assumes that ELF section names are free-form. It does
|
||||
// support linkscripts which (can) give rise to various arbitrarily named
|
||||
// sections being "Code" or "Data".
|
||||
// sections being "Code" or "Data".
|
||||
sect_type = kalimbaSectionType(m_header, header);
|
||||
}
|
||||
|
||||
const uint32_t target_bytes_size =
|
||||
(eSectionTypeData == sect_type || eSectionTypeZeroFill == sect_type) ?
|
||||
(eSectionTypeData == sect_type || eSectionTypeZeroFill == sect_type) ?
|
||||
m_arch_spec.GetDataByteSize() :
|
||||
eSectionTypeCode == sect_type ?
|
||||
m_arch_spec.GetCodeByteSize() : 1;
|
||||
@ -2027,7 +2027,7 @@ ObjectFileELF::ParseSymbols (Symtab *symtab,
|
||||
{
|
||||
if (symbol.Parse(symtab_data, &offset) == false)
|
||||
break;
|
||||
|
||||
|
||||
const char *symbol_name = strtab_data.PeekCStr(symbol.st_name);
|
||||
|
||||
// No need to add non-section symbols that have no names
|
||||
@ -2330,7 +2330,7 @@ ObjectFileELF::ParseSymbolTable(Symtab *symbol_table, user_id_t start_id, lldb_p
|
||||
|
||||
user_id_t symtab_id = symtab->GetID();
|
||||
const ELFSectionHeaderInfo *symtab_hdr = GetSectionHeaderByIndex(symtab_id);
|
||||
assert(symtab_hdr->sh_type == SHT_SYMTAB ||
|
||||
assert(symtab_hdr->sh_type == SHT_SYMTAB ||
|
||||
symtab_hdr->sh_type == SHT_DYNSYM);
|
||||
|
||||
// sh_link: section header index of associated string table.
|
||||
@ -2606,16 +2606,16 @@ ObjectFileELF::ParseTrampolineSymbols(Symtab *symbol_table,
|
||||
if (!rel_type)
|
||||
return 0;
|
||||
|
||||
return ParsePLTRelocations (symbol_table,
|
||||
start_id,
|
||||
return ParsePLTRelocations (symbol_table,
|
||||
start_id,
|
||||
rel_type,
|
||||
&m_header,
|
||||
rel_hdr,
|
||||
plt_hdr,
|
||||
&m_header,
|
||||
rel_hdr,
|
||||
plt_hdr,
|
||||
sym_hdr,
|
||||
plt_section_sp,
|
||||
rel_data,
|
||||
symtab_data,
|
||||
plt_section_sp,
|
||||
rel_data,
|
||||
symtab_data,
|
||||
strtab_data);
|
||||
}
|
||||
|
||||
@ -2802,24 +2802,24 @@ ObjectFileELF::GetSymtab()
|
||||
// Synthesize trampoline symbols to help navigate the PLT.
|
||||
addr_t addr = symbol->d_ptr;
|
||||
Section *reloc_section = section_list->FindSectionContainingFileAddress(addr).get();
|
||||
if (reloc_section)
|
||||
if (reloc_section)
|
||||
{
|
||||
user_id_t reloc_id = reloc_section->GetID();
|
||||
const ELFSectionHeaderInfo *reloc_header = GetSectionHeaderByIndex(reloc_id);
|
||||
assert(reloc_header);
|
||||
|
||||
|
||||
if (m_symtab_ap == nullptr)
|
||||
m_symtab_ap.reset(new Symtab(reloc_section->GetObjectFile()));
|
||||
|
||||
ParseTrampolineSymbols (m_symtab_ap.get(), symbol_id, reloc_header, reloc_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If we still don't have any symtab then create an empty instance to avoid do the section
|
||||
// lookup next time.
|
||||
if (m_symtab_ap == nullptr)
|
||||
m_symtab_ap.reset(new Symtab(this));
|
||||
|
||||
|
||||
m_symtab_ap->CalculateSymbolSizes();
|
||||
}
|
||||
|
||||
@ -3279,7 +3279,7 @@ ObjectFileELF::CalculateStrata()
|
||||
{
|
||||
switch (m_header.e_type)
|
||||
{
|
||||
case llvm::ELF::ET_NONE:
|
||||
case llvm::ELF::ET_NONE:
|
||||
// 0 - No file type
|
||||
return eStrataUnknown;
|
||||
|
||||
@ -3290,21 +3290,21 @@ ObjectFileELF::CalculateStrata()
|
||||
case llvm::ELF::ET_EXEC:
|
||||
// 2 - Executable file
|
||||
// TODO: is there any way to detect that an executable is a kernel
|
||||
// related executable by inspecting the program headers, section
|
||||
// related executable by inspecting the program headers, section
|
||||
// headers, symbols, or any other flag bits???
|
||||
return eStrataUser;
|
||||
|
||||
case llvm::ELF::ET_DYN:
|
||||
// 3 - Shared object file
|
||||
// TODO: is there any way to detect that an shared library is a kernel
|
||||
// related executable by inspecting the program headers, section
|
||||
// related executable by inspecting the program headers, section
|
||||
// headers, symbols, or any other flag bits???
|
||||
return eStrataUnknown;
|
||||
|
||||
case ET_CORE:
|
||||
// 4 - Core file
|
||||
// TODO: is there any way to detect that an core file is a kernel
|
||||
// related executable by inspecting the program headers, section
|
||||
// related executable by inspecting the program headers, section
|
||||
// headers, symbols, or any other flag bits???
|
||||
return eStrataUnknown;
|
||||
|
||||
|
@ -88,7 +88,7 @@ class ProcessFreeBSD :
|
||||
DoAttachToProcessWithID (lldb::pid_t pid, const lldb_private::ProcessAttachInfo &attach_info) override;
|
||||
|
||||
lldb_private::Error
|
||||
DoLaunch (lldb_private::Module *exe_module,
|
||||
DoLaunch (lldb_private::Module *exe_module,
|
||||
lldb_private::ProcessLaunchInfo &launch_info) override;
|
||||
|
||||
void
|
||||
@ -160,7 +160,7 @@ class ProcessFreeBSD :
|
||||
UpdateThreadListIfNeeded();
|
||||
|
||||
bool
|
||||
UpdateThreadList(lldb_private::ThreadList &old_thread_list,
|
||||
UpdateThreadList(lldb_private::ThreadList &old_thread_list,
|
||||
lldb_private::ThreadList &new_thread_list) override;
|
||||
|
||||
virtual lldb::ByteOrder
|
||||
|
@ -317,7 +317,7 @@ ReadRegOperation::Execute(ProcessMonitor *monitor)
|
||||
else if (m_size == sizeof(uint64_t))
|
||||
m_value = *(uint64_t *)(((caddr_t)®s) + m_offset);
|
||||
else
|
||||
memcpy(&m_value, (((caddr_t)®s) + m_offset), m_size);
|
||||
memcpy((void *)&m_value, (((caddr_t)®s) + m_offset), m_size);
|
||||
m_result = true;
|
||||
}
|
||||
}
|
||||
@ -393,7 +393,7 @@ ReadDebugRegOperation::Execute(ProcessMonitor *monitor)
|
||||
if (m_size == sizeof(uintptr_t))
|
||||
m_value = *(uintptr_t *)(((caddr_t)®s) + m_offset);
|
||||
else
|
||||
memcpy(&m_value, (((caddr_t)®s) + m_offset), m_size);
|
||||
memcpy((void *)&m_value, (((caddr_t)®s) + m_offset), m_size);
|
||||
m_result = true;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -69,7 +69,7 @@ NameToDIE::Dump (Stream *s)
|
||||
{
|
||||
const char *cstr = m_map.GetCStringAtIndex(i);
|
||||
const DIERef& die_ref = m_map.GetValueAtIndexUnchecked(i);
|
||||
s->Printf("%p: {0x%8.8x/0x%8.8x} \"%s\"\n", cstr, die_ref.cu_offset, die_ref.die_offset, cstr);
|
||||
s->Printf("%p: {0x%8.8x/0x%8.8x} \"%s\"\n", (const void*) cstr, die_ref.cu_offset, die_ref.die_offset, cstr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3980,7 +3980,7 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
|
||||
{
|
||||
Vote stop_vote = m_thread_list.ShouldReportStop (event_ptr);
|
||||
if (log)
|
||||
log->Printf ("Process::ShouldBroadcastEvent: should_stop: %i state: %s was_restarted: %i stop_vote: %d.",
|
||||
log->Printf ("Process::ShouldBroadcastEvent: should_resume: %i state: %s was_restarted: %i stop_vote: %d.",
|
||||
should_resume, StateAsCString(state),
|
||||
was_restarted, stop_vote);
|
||||
|
||||
|
@ -82,11 +82,7 @@ CMICmdCmdSymbolListLines::Execute()
|
||||
CMICMDBASE_GETOPTION(pArgFile, File, m_constStrArgNameFile);
|
||||
|
||||
const CMIUtilString &strFilePath(pArgFile->GetValue());
|
||||
// FIXME: this won't work for header files! To try and use existing
|
||||
// commands to get this to work for header files would be too slow.
|
||||
// Instead, this code should be rewritten to use APIs and/or support
|
||||
// should be added to lldb which would work for header files.
|
||||
const CMIUtilString strCmd(CMIUtilString::Format("target modules dump line-table \"%s\"", strFilePath.AddSlashes().c_str()));
|
||||
const CMIUtilString strCmd(CMIUtilString::Format("source info --file \"%s\"", strFilePath.AddSlashes().c_str()));
|
||||
|
||||
CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
|
||||
const lldb::ReturnStatus rtn = rSessionInfo.GetDebugger().GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult);
|
||||
@ -110,10 +106,10 @@ ParseLLDBLineAddressHeader(const char *input, CMIUtilString &file)
|
||||
{
|
||||
// Match LineEntry using regex.
|
||||
static MIUtilParse::CRegexParser g_lineentry_header_regex(
|
||||
"^ *Line table for (.+) in `(.+)$");
|
||||
// ^1=file ^2=module
|
||||
"^ *Lines found for file (.+) in compilation unit (.+) in `(.+)$");
|
||||
// ^1=file ^2=cu ^3=module
|
||||
|
||||
MIUtilParse::CRegexParser::Match match(3);
|
||||
MIUtilParse::CRegexParser::Match match(4);
|
||||
|
||||
const bool ok = g_lineentry_header_regex.Execute(input, match);
|
||||
if (ok)
|
||||
@ -146,12 +142,12 @@ ParseLLDBLineAddressEntry(const char *input, CMIUtilString &addr,
|
||||
|
||||
// Match LineEntry using regex.
|
||||
static MIUtilParse::CRegexParser g_lineentry_nocol_regex(
|
||||
"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+)$");
|
||||
"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+)$");
|
||||
static MIUtilParse::CRegexParser g_lineentry_col_regex(
|
||||
"^ *(0x[0-9a-fA-F]+): (.+):([0-9]+):[0-9]+$");
|
||||
// ^1=addr ^2=f ^3=line ^4=:col(opt)
|
||||
"^ *\\[(0x[0-9a-fA-F]+)-(0x[0-9a-fA-F]+)\\): (.+):([0-9]+):[0-9]+$");
|
||||
// ^1=start ^2=end ^3=f ^4=line ^5=:col(opt)
|
||||
|
||||
MIUtilParse::CRegexParser::Match match(5);
|
||||
MIUtilParse::CRegexParser::Match match(6);
|
||||
|
||||
// First try matching the LineEntry with the column,
|
||||
// then try without the column.
|
||||
@ -160,8 +156,8 @@ ParseLLDBLineAddressEntry(const char *input, CMIUtilString &addr,
|
||||
if (ok)
|
||||
{
|
||||
addr = match.GetMatchAtIndex(1);
|
||||
file = match.GetMatchAtIndex(2);
|
||||
line = match.GetMatchAtIndex(3);
|
||||
file = match.GetMatchAtIndex(3);
|
||||
line = match.GetMatchAtIndex(4);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -222,10 +218,6 @@ CMICmdCmdSymbolListLines::Acknowledge()
|
||||
if (!ParseLLDBLineAddressEntry(rLine.c_str(), strAddr, strFile, strLine))
|
||||
continue;
|
||||
|
||||
// Skip entries which don't match the desired source.
|
||||
if (strWantFile != strFile)
|
||||
continue;
|
||||
|
||||
const CMICmnMIValueConst miValueConst(strAddr);
|
||||
const CMICmnMIValueResult miValueResult("pc", miValueConst);
|
||||
CMICmnMIValueTuple miValueTuple(miValueResult);
|
||||
|
Loading…
Reference in New Issue
Block a user