<rdar://problem/12820334>
I modified the "Args::StringtoAddress(...)" function to be able to evaluate address expressions. This is now used for any command line arguments or options that takes addresses like:
memory read <addr> [<end-addr>]
memory write <addr>
breakpoint set --address <addr>
disassemble --start-address <addr> --end-address <addr>
It calls the expression parser to evaluate the address expression and will also work around the issue where the compiler doesn't like to add offsets to function pointers (which is what happens when you try to evaluate "main + 12"). So there is a temp fix in the Args::StringtoAddress() to work around this until we can get special compiler support for debug expressions with function pointers.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169556 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectTarget.cpp b/source/Commands/CommandObjectTarget.cpp
index d5eb34e..e44c2d7 100644
--- a/source/Commands/CommandObjectTarget.cpp
+++ b/source/Commands/CommandObjectTarget.cpp
@@ -3026,6 +3026,8 @@
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 @@
}
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 @@
width = strtoul (option_arg, NULL, 0);
m_format_array.push_back(std::make_pair(short_option, width));
}
- Error error;
return error;
}