diff options
author | Jim Ingham <jingham@apple.com> | 2011-09-21 01:17:13 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2011-09-21 01:17:13 +0000 |
commit | 969795f14bed2c9af7167d0d07b234193c82034c (patch) | |
tree | 2e4f23507b807790ac4806cb0957929194947afb /lldb/source/Core/RegularExpression.cpp | |
parent | 699128e58af0015061f2da8477261aef6464dca9 (diff) | |
download | bcm5719-llvm-969795f14bed2c9af7167d0d07b234193c82034c.tar.gz bcm5719-llvm-969795f14bed2c9af7167d0d07b234193c82034c.zip |
Add a new breakpoint type "break by source regular expression".
Fix the RegularExpression class so it has a real copy constructor.
Fix the breakpoint setting with multiple shared libraries so it makes
one breakpoint not one per shared library.
Add SBFileSpecList, to be used to expose the above to the SB interface (not done yet.)
llvm-svn: 140225
Diffstat (limited to 'lldb/source/Core/RegularExpression.cpp')
-rw-r--r-- | lldb/source/Core/RegularExpression.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/lldb/source/Core/RegularExpression.cpp b/lldb/source/Core/RegularExpression.cpp index 6fb94d98bb5..c3953aae068 100644 --- a/lldb/source/Core/RegularExpression.cpp +++ b/lldb/source/Core/RegularExpression.cpp @@ -19,6 +19,7 @@ RegularExpression::RegularExpression() : m_re(), m_comp_err (1), m_preg(), + m_compile_flags(REG_EXTENDED), m_matches() { memset(&m_preg,0,sizeof(m_preg)); @@ -31,13 +32,43 @@ RegularExpression::RegularExpression() : RegularExpression::RegularExpression(const char* re, int flags) : m_re(), m_comp_err (1), + m_compile_flags(flags), m_preg() { memset(&m_preg,0,sizeof(m_preg)); - Compile(re, flags); + Compile(re); } //---------------------------------------------------------------------- +// Constructor that compiles "re" using "flags" and stores the +// resulting compiled regular expression into this object. +//---------------------------------------------------------------------- +RegularExpression::RegularExpression(const char* re) : + m_re(), + m_comp_err (1), + m_compile_flags(REG_EXTENDED), + m_preg() +{ + memset(&m_preg,0,sizeof(m_preg)); + Compile(re); +} + +RegularExpression::RegularExpression(const RegularExpression &rhs) +{ + memset(&m_preg,0,sizeof(m_preg)); + Compile(rhs.GetText(), rhs.GetCompileFlags()); +} + +const RegularExpression & +RegularExpression::operator= (const RegularExpression &rhs) +{ + if (&rhs != this) + { + Compile (rhs.GetText(), rhs.GetCompileFlags()); + } + return *this; +} +//---------------------------------------------------------------------- // Destructor // // Any previosuly compiled regular expression contained in this @@ -61,9 +92,17 @@ RegularExpression::~RegularExpression() // otherwise. //---------------------------------------------------------------------- bool +RegularExpression::Compile(const char* re) +{ + return Compile (re, m_compile_flags); +} + +bool RegularExpression::Compile(const char* re, int flags) { Free(); + m_compile_flags = flags; + if (re && re[0]) { m_re = re; |