summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/RegularExpression.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-10-10 23:55:27 +0000
committerGreg Clayton <gclayton@apple.com>2010-10-10 23:55:27 +0000
commit46747022d292d2d1568eb0b8044030f4aee6a5b6 (patch)
treef94b146815a1f72fce71dffb739df75768b80614 /lldb/source/Core/RegularExpression.cpp
parent00765e5be04e556a06c48d9b5ac5da4c00ae1d02 (diff)
downloadbcm5719-llvm-46747022d292d2d1568eb0b8044030f4aee6a5b6.tar.gz
bcm5719-llvm-46747022d292d2d1568eb0b8044030f4aee6a5b6.zip
Added the ability to get error strings back from failed
lldb_private::RegularExpression compiles and matches with: size_t RegularExpression::GetErrorAsCString (char *err_str, size_t err_str_max_len) const; Added the ability to search a variable list for variables whose names match a regular expression: size_t VariableList::AppendVariablesIfUnique (const RegularExpression& regex, VariableList &var_list, size_t& total_matches); Also added the ability to append a variable to a VariableList only if it is not already in the list: bool VariableList::AddVariableIfUnique (const lldb::VariableSP &var_sp); Cleaned up the "frame variable" command: - Removed the "-n NAME" option as this is the default way for the command to work. - Enable uniqued regex searches on variable names by fixing the "--regex RE" command to work correctly. It will match all variables that match any regular expressions and only print each variable the first time it matches. - Fixed the option type for the "--regex" command to by eArgTypeRegularExpression instead of eArgTypeCount llvm-svn: 116178
Diffstat (limited to 'lldb/source/Core/RegularExpression.cpp')
-rw-r--r--lldb/source/Core/RegularExpression.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/lldb/source/Core/RegularExpression.cpp b/lldb/source/Core/RegularExpression.cpp
index b632c2eb0b0..45ed9cc6374 100644
--- a/lldb/source/Core/RegularExpression.cpp
+++ b/lldb/source/Core/RegularExpression.cpp
@@ -153,3 +153,18 @@ RegularExpression::Free()
m_comp_err = 1;
}
}
+
+size_t
+RegularExpression::GetErrorAsCString (char *err_str, size_t err_str_max_len) const
+{
+ if (m_comp_err == 0)
+ {
+ if (err_str && err_str_max_len)
+ *err_str = '\0';
+ return 0;
+ }
+
+ return ::regerror (m_comp_err, &m_preg, err_str, err_str_max_len);
+}
+
+
OpenPOWER on IntegriCloud