summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp10
-rw-r--r--lldb/source/Commands/CommandObjectDisassemble.cpp26
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp32
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp11
4 files changed, 39 insertions, 40 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index d8cfe0e22af..2bd768901eb 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -125,12 +125,10 @@ public:
switch (short_option)
{
case 'a':
- m_load_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 0);
- if (m_load_addr == LLDB_INVALID_ADDRESS)
- m_load_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 16);
-
- if (m_load_addr == LLDB_INVALID_ADDRESS)
- error.SetErrorStringWithFormat ("invalid address string '%s'", option_arg);
+ {
+ ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
+ m_load_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
+ }
break;
case 'b':
diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp
index 84172dc87ed..291b527ae4a 100644
--- a/lldb/source/Commands/CommandObjectDisassemble.cpp
+++ b/lldb/source/Commands/CommandObjectDisassemble.cpp
@@ -88,23 +88,21 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c
break;
case 's':
- start_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 0);
- if (start_addr == LLDB_INVALID_ADDRESS)
- start_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 16);
-
- if (start_addr == LLDB_INVALID_ADDRESS)
- error.SetErrorStringWithFormat ("invalid start address string '%s'", option_arg);
- some_location_specified = true;
+ {
+ ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
+ start_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
+ if (start_addr != LLDB_INVALID_ADDRESS)
+ some_location_specified = true;
+ }
break;
case 'e':
- end_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 0);
- if (end_addr == LLDB_INVALID_ADDRESS)
- end_addr = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS, 16);
-
- if (end_addr == LLDB_INVALID_ADDRESS)
- error.SetErrorStringWithFormat ("invalid end address string '%s'", option_arg);
+ {
+ ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
+ end_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
+ if (end_addr != LLDB_INVALID_ADDRESS)
+ some_location_specified = true;
+ }
break;
- some_location_specified = true;
case 'n':
func_name.assign (option_arg);
some_location_specified = true;
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 09c2e4859cb..9de5af4bbf6 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -369,8 +369,7 @@ public:
protected:
virtual bool
- DoExecute (Args& command,
- CommandReturnObject &result)
+ DoExecute (Args& command, CommandReturnObject &result)
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
Target *target = exe_ctx.GetTargetPtr();
@@ -385,7 +384,8 @@ protected:
if ((argc == 0 && m_next_addr == LLDB_INVALID_ADDRESS) || argc > 2)
{
- result.AppendErrorWithFormat ("%s takes 1 or two args.\n", m_cmd_name.c_str());
+ result.AppendErrorWithFormat ("%s takes a start address expression with an optional end address expression.\n", m_cmd_name.c_str());
+ result.AppendRawWarning("Expressions should be quoted if they contain spaces or other special characters.");
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -565,7 +565,7 @@ protected:
// Look for invalid combinations of settings
if (error.Fail())
{
- result.AppendErrorWithFormat("%s", error.AsCString());
+ result.AppendError(error.AsCString());
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -602,21 +602,23 @@ protected:
}
if (argc > 0)
- addr = Args::StringToUInt64(command.GetArgumentAtIndex(0), LLDB_INVALID_ADDRESS, 0);
+ addr = Args::StringToAddress(&exe_ctx, command.GetArgumentAtIndex(0), LLDB_INVALID_ADDRESS, &error);
if (addr == LLDB_INVALID_ADDRESS)
{
- result.AppendErrorWithFormat("invalid start address string '%s'.\n", command.GetArgumentAtIndex(0));
+ result.AppendError("invalid start address expression.");
+ result.AppendError(error.AsCString());
result.SetStatus(eReturnStatusFailed);
return false;
}
if (argc == 2)
{
- lldb::addr_t end_addr = Args::StringToUInt64(command.GetArgumentAtIndex(1), LLDB_INVALID_ADDRESS, 0);
+ lldb::addr_t end_addr = Args::StringToAddress(&exe_ctx, command.GetArgumentAtIndex(1), LLDB_INVALID_ADDRESS, 0);
if (end_addr == LLDB_INVALID_ADDRESS)
{
- result.AppendErrorWithFormat("invalid end address string '%s'.\n", command.GetArgumentAtIndex(1));
+ result.AppendError("invalid end address expression.");
+ result.AppendError(error.AsCString());
result.SetStatus(eReturnStatusFailed);
return false;
}
@@ -667,7 +669,7 @@ protected:
}
if (bytes_read < total_byte_size)
- result.AppendWarningWithFormat("Not all bytes (%lu/%lu) were able to be read from 0x%" PRIx64 ".\n", bytes_read, total_byte_size, addr);
+ result.AppendWarningWithFormat("Not all bytes (%lu/%lu) were able to be read from 0x%" PRIx64 ".", bytes_read, total_byte_size, addr);
else
{
m_next_addr = addr + bytes_read;
@@ -987,7 +989,8 @@ protected:
virtual bool
DoExecute (Args& command, CommandReturnObject &result)
{
- Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
+ ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
+ Process *process = exe_ctx.GetProcessPtr();
if (process == NULL)
{
result.AppendError("need a process to read memory");
@@ -1020,11 +1023,16 @@ protected:
OptionValueUInt64 &byte_size_value = m_format_options.GetByteSizeValue();
size_t item_byte_size = byte_size_value.GetCurrentValue();
- lldb::addr_t addr = Args::StringToUInt64(command.GetArgumentAtIndex(0), LLDB_INVALID_ADDRESS, 0);
+ Error error;
+ lldb::addr_t addr = Args::StringToAddress (&exe_ctx,
+ command.GetArgumentAtIndex(0),
+ LLDB_INVALID_ADDRESS,
+ &error);
if (addr == LLDB_INVALID_ADDRESS)
{
- result.AppendErrorWithFormat("Invalid address string '%s'.\n", command.GetArgumentAtIndex(0));
+ result.AppendError("invalid address expression\n");
+ result.AppendError(error.AsCString());
result.SetStatus(eReturnStatusFailed);
return false;
}
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index d5eb34eaf1b..e44c2d79b20 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -3026,6 +3026,8 @@ public:
virtual Error
SetOptionValue (uint32_t option_idx, const char *option_arg)
{
+ Error error;
+
const int short_option = m_getopt_table[option_idx].val;
if (short_option == 'g')
{
@@ -3033,13 +3035,7 @@ public:
}
else if (short_option == 'a')
{
- bool success;
- m_module_addr = Args::StringToAddress(option_arg, LLDB_INVALID_ADDRESS, &success);
- if (!success)
- {
- Error error;
- error.SetErrorStringWithFormat("invalid address: \"%s\"", option_arg);
- }
+ m_module_addr = Args::StringToAddress(NULL, option_arg, LLDB_INVALID_ADDRESS, &error);
}
else
{
@@ -3048,7 +3044,6 @@ public:
width = strtoul (option_arg, NULL, 0);
m_format_array.push_back(std::make_pair(short_option, width));
}
- Error error;
return error;
}
OpenPOWER on IntegriCloud