Skip to content

Commit 8f7770f

Browse files
author
Greg Clayton
committed
Always try and lookup the address in a register if it is encoded as an
integer and the register byte size matches the size of a pointer. This removes the "--lookup" option. llvm-svn: 130910
1 parent ce1035c commit 8f7770f

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

lldb/source/Commands/CommandObjectRegister.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#include "lldb/Interpreter/NamedOptionValue.h"
2323
#include "lldb/Interpreter/Options.h"
2424
#include "lldb/Target/ExecutionContext.h"
25+
#include "lldb/Target/Process.h"
2526
#include "lldb/Target/RegisterContext.h"
27+
#include "lldb/Target/Thread.h"
2628

2729
using namespace lldb;
2830
using namespace lldb_private;
@@ -90,7 +92,8 @@ class CommandObjectRegisterRead : public CommandObject
9092
format = m_options.format;
9193

9294
reg_data.Dump(&strm, 0, format, reg_info->byte_size, 1, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0);
93-
if (m_options.lookup_addresses && ((reg_info->encoding == eEncodingUint) || (reg_info->encoding == eEncodingSint)))
95+
if (((reg_info->encoding == eEncodingUint) || (reg_info->encoding == eEncodingSint)) &&
96+
(reg_info->byte_size == reg_ctx->GetThread().GetProcess().GetAddressByteSize()))
9497
{
9598
addr_t reg_addr = reg_ctx->ReadRegisterAsUnsigned (reg, 0);
9699
if (reg_addr)
@@ -101,9 +104,6 @@ class CommandObjectRegisterRead : public CommandObject
101104
strm.PutCString (" ");
102105
so_reg_addr.Dump(&strm, exe_ctx.GetBestExecutionContextScope(), Address::DumpStyleResolvedDescription);
103106
}
104-
else
105-
{
106-
}
107107
}
108108
}
109109
strm.EOL();
@@ -246,8 +246,7 @@ class CommandObjectRegisterRead : public CommandObject
246246
CommandOptions (CommandInterpreter &interpreter) :
247247
Options(interpreter),
248248
set_indexes (OptionValue::ConvertTypeToMask (OptionValue::eTypeUInt64)),
249-
dump_all_sets (false, false), // Initial and default values are false
250-
lookup_addresses (false, false) // Initial and default values are false
249+
dump_all_sets (false, false) // Initial and default values are false
251250
{
252251
OptionParsingStarting();
253252
}
@@ -280,10 +279,6 @@ class CommandObjectRegisterRead : public CommandObject
280279
dump_all_sets.SetCurrentValue(true);
281280
break;
282281

283-
case 'l':
284-
lookup_addresses.SetCurrentValue(true);
285-
break;
286-
287282
default:
288283
error.SetErrorStringWithFormat("Unrecognized short option '%c'\n", short_option);
289284
break;
@@ -297,7 +292,6 @@ class CommandObjectRegisterRead : public CommandObject
297292
format = eFormatDefault;
298293
set_indexes.Clear();
299294
dump_all_sets.Clear();
300-
lookup_addresses.Clear();
301295
}
302296

303297
const OptionDefinition*
@@ -314,7 +308,6 @@ class CommandObjectRegisterRead : public CommandObject
314308
lldb::Format format;
315309
OptionValueArray set_indexes;
316310
OptionValueBoolean dump_all_sets;
317-
OptionValueBoolean lookup_addresses;
318311
};
319312

320313
CommandOptions m_options;
@@ -324,7 +317,6 @@ OptionDefinition
324317
CommandObjectRegisterRead::CommandOptions::g_option_table[] =
325318
{
326319
{ LLDB_OPT_SET_ALL, false, "format", 'f', required_argument, NULL, 0, eArgTypeExprFormat, "Specify the format to use when dumping register values."},
327-
{ LLDB_OPT_SET_ALL, false, "lookup", 'l', no_argument , NULL, 0, eArgTypeNone , "Lookup the register values as addresses and show that each value maps to in the address space."},
328320
{ LLDB_OPT_SET_1 , false, "set" , 's', required_argument, NULL, 0, eArgTypeIndex , "Specify which register sets to dump by index."},
329321
{ LLDB_OPT_SET_2 , false, "all" , 'a', no_argument , NULL, 0, eArgTypeNone , "Show all register sets."},
330322
{ 0, false, NULL, 0, 0, NULL, NULL, eArgTypeNone, NULL }

0 commit comments

Comments
 (0)