[Lldb-commits] [PATCH] D30094: Fix a couple of corner cases in NameMatches

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Feb 17 07:24:46 PST 2017


labath created this revision.
Herald added a subscriber: mgorny.

I originally set out to move the NameMatches closer to the relevant
function and add some unit tests. However, in the process I've found a
couple of bugs in the implementation:

- the early exits where not always correct:
  - (test==pattern) does not mean the match will always suceed because of regular expressions
  - pattern.empty() does not mean the match will fail because the "" is a valid prefix of any string

So I cleaned up those and added some tests. The only tricky part here
was that regcomp() implementation on darwin did not recognise the empty
string as a regular expression and returned an REG_EMPTY error instead.
The simples fix here seemed to be to replace the empty expression with
an equivalent non-empty one.


https://reviews.llvm.org/D30094

Files:
  include/lldb/Target/Process.h
  include/lldb/Utility/NameMatches.h
  include/lldb/lldb-private-enumerations.h
  source/Commands/CommandObjectPlatform.cpp
  source/Commands/CommandObjectProcess.cpp
  source/Core/ArchSpec.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  source/Target/Process.cpp
  source/Utility/NameMatches.cpp
  source/Utility/RegularExpression.cpp
  unittests/Utility/CMakeLists.txt
  unittests/Utility/NameMatchesTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30094.88885.patch
Type: text/x-patch
Size: 17176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170217/ff50bc28/attachment-0001.bin>


More information about the lldb-commits mailing list