aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectTarget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands/CommandObjectTarget.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp45
1 files changed, 29 insertions, 16 deletions
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 38aa841..3af2c73 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -50,6 +50,7 @@
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/State.h"
#include "lldb/Utility/Timer.h"
+#include "lldb/lldb-private-enumerations.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/FileSystem.h"
@@ -1429,7 +1430,8 @@ static bool DumpModuleSymbolFile(Stream &strm, Module *module) {
}
static void DumpAddress(ExecutionContextScope *exe_scope,
- const Address &so_addr, bool verbose, Stream &strm) {
+ const Address &so_addr, bool verbose, bool all_ranges,
+ Stream &strm) {
strm.IndentMore();
strm.Indent(" Address: ");
so_addr.Dump(&strm, exe_scope, Address::DumpStyleModuleWithFileAddress);
@@ -1444,7 +1446,8 @@ static void DumpAddress(ExecutionContextScope *exe_scope,
// Print out detailed address information when verbose is enabled
if (verbose) {
strm.EOL();
- so_addr.Dump(&strm, exe_scope, Address::DumpStyleDetailedSymbolContext);
+ so_addr.Dump(&strm, exe_scope, Address::DumpStyleDetailedSymbolContext,
+ Address::DumpStyleInvalid, UINT32_MAX, all_ranges);
}
strm.IndentLess();
}
@@ -1452,7 +1455,7 @@ static void DumpAddress(ExecutionContextScope *exe_scope,
static bool LookupAddressInModule(CommandInterpreter &interpreter, Stream &strm,
Module *module, uint32_t resolve_mask,
lldb::addr_t raw_addr, lldb::addr_t offset,
- bool verbose) {
+ bool verbose, bool all_ranges) {
if (module) {
lldb::addr_t addr = raw_addr - offset;
Address so_addr;
@@ -1470,7 +1473,7 @@ static bool LookupAddressInModule(CommandInterpreter &interpreter, Stream &strm,
ExecutionContextScope *exe_scope =
interpreter.GetExecutionContext().GetBestExecutionContextScope();
- DumpAddress(exe_scope, so_addr, verbose, strm);
+ DumpAddress(exe_scope, so_addr, verbose, all_ranges, strm);
// strm.IndentMore();
// strm.Indent (" Address: ");
// so_addr.Dump (&strm, exe_scope,
@@ -1502,7 +1505,7 @@ static bool LookupAddressInModule(CommandInterpreter &interpreter, Stream &strm,
static uint32_t LookupSymbolInModule(CommandInterpreter &interpreter,
Stream &strm, Module *module,
const char *name, bool name_is_regex,
- bool verbose) {
+ bool verbose, bool all_ranges) {
if (!module)
return 0;
@@ -1535,7 +1538,7 @@ static uint32_t LookupSymbolInModule(CommandInterpreter &interpreter,
if (symbol && symbol->ValueIsAddress()) {
DumpAddress(
interpreter.GetExecutionContext().GetBestExecutionContextScope(),
- symbol->GetAddressRef(), verbose, strm);
+ symbol->GetAddressRef(), verbose, all_ranges, strm);
}
}
strm.IndentLess();
@@ -1545,7 +1548,7 @@ static uint32_t LookupSymbolInModule(CommandInterpreter &interpreter,
static void DumpSymbolContextList(ExecutionContextScope *exe_scope,
Stream &strm, SymbolContextList &sc_list,
- bool verbose) {
+ bool verbose, bool all_ranges) {
strm.IndentMore();
const uint32_t num_matches = sc_list.GetSize();
@@ -1557,7 +1560,7 @@ static void DumpSymbolContextList(ExecutionContextScope *exe_scope,
sc.GetAddressRange(eSymbolContextEverything, 0, true, range);
- DumpAddress(exe_scope, range.GetBaseAddress(), verbose, strm);
+ DumpAddress(exe_scope, range.GetBaseAddress(), verbose, all_ranges, strm);
}
}
strm.IndentLess();
@@ -1567,7 +1570,7 @@ static size_t LookupFunctionInModule(CommandInterpreter &interpreter,
Stream &strm, Module *module,
const char *name, bool name_is_regex,
const ModuleFunctionSearchOptions &options,
- bool verbose) {
+ bool verbose, bool all_ranges) {
if (module && name && name[0]) {
SymbolContextList sc_list;
size_t num_matches = 0;
@@ -1588,7 +1591,7 @@ static size_t LookupFunctionInModule(CommandInterpreter &interpreter,
strm.PutCString(":\n");
DumpSymbolContextList(
interpreter.GetExecutionContext().GetBestExecutionContextScope(),
- strm, sc_list, verbose);
+ strm, sc_list, verbose, all_ranges);
}
return num_matches;
}
@@ -1693,7 +1696,7 @@ static uint32_t LookupFileAndLineInModule(CommandInterpreter &interpreter,
Stream &strm, Module *module,
const FileSpec &file_spec,
uint32_t line, bool check_inlines,
- bool verbose) {
+ bool verbose, bool all_ranges) {
if (module && file_spec) {
SymbolContextList sc_list;
const uint32_t num_matches = module->ResolveSymbolContextsForFileSpec(
@@ -1710,7 +1713,7 @@ static uint32_t LookupFileAndLineInModule(CommandInterpreter &interpreter,
strm.PutCString(":\n");
DumpSymbolContextList(
interpreter.GetExecutionContext().GetBestExecutionContextScope(),
- strm, sc_list, verbose);
+ strm, sc_list, verbose, all_ranges);
return num_matches;
}
}
@@ -3598,6 +3601,10 @@ public:
case 'r':
m_use_regex = true;
break;
+
+ case '\x01':
+ m_all_ranges = true;
+ break;
default:
llvm_unreachable("Unimplemented option");
}
@@ -3614,6 +3621,7 @@ public:
m_line_number = 0;
m_use_regex = false;
m_include_inlines = true;
+ m_all_ranges = false;
m_verbose = false;
m_print_all = false;
}
@@ -3632,6 +3640,7 @@ public:
bool m_use_regex; // Name lookups in m_str are regular expressions.
bool m_include_inlines; // Check for inline entries when looking up by
// file/line.
+ bool m_all_ranges; // Print all ranges or single range.
bool m_verbose; // Enable verbose lookup info
bool m_print_all; // Print all matches, even in cases where there's a best
// match.
@@ -3714,7 +3723,8 @@ public:
(m_options.m_verbose
? static_cast<int>(eSymbolContextVariable)
: 0),
- m_options.m_addr, m_options.m_offset, m_options.m_verbose)) {
+ m_options.m_addr, m_options.m_offset, m_options.m_verbose,
+ m_options.m_all_ranges)) {
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}
@@ -3725,7 +3735,8 @@ public:
if (!m_options.m_str.empty()) {
if (LookupSymbolInModule(m_interpreter, result.GetOutputStream(),
module, m_options.m_str.c_str(),
- m_options.m_use_regex, m_options.m_verbose)) {
+ m_options.m_use_regex, m_options.m_verbose,
+ m_options.m_all_ranges)) {
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}
@@ -3737,7 +3748,8 @@ public:
if (LookupFileAndLineInModule(
m_interpreter, result.GetOutputStream(), module,
m_options.m_file, m_options.m_line_number,
- m_options.m_include_inlines, m_options.m_verbose)) {
+ m_options.m_include_inlines, m_options.m_verbose,
+ m_options.m_all_ranges)) {
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}
@@ -3755,7 +3767,8 @@ public:
if (LookupFunctionInModule(m_interpreter, result.GetOutputStream(),
module, m_options.m_str.c_str(),
m_options.m_use_regex, function_options,
- m_options.m_verbose)) {
+ m_options.m_verbose,
+ m_options.m_all_ranges)) {
result.SetStatus(eReturnStatusSuccessFinishResult);
return true;
}