[Lldb-commits] [PATCH] D41086: [lldb] Check that a regex is valid before searching by regex for a symbol in a pdb.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 18 09:54:13 PST 2017


I agree that's better long term, but this code was already there, and the
patch makes things strictly better than before (literally just fixes a
crash in existing code).  So I think we can agree that this should be
fixed, but as it's a bigger change I don't think it should hold up fixing a
crash.

On Mon, Dec 18, 2017 at 9:44 AM Greg Clayton via Phabricator <
reviews at reviews.llvm.org> wrote:

> clayborg added inline comments.
>
>
> ================
> Comment at: source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp:393
>    // try really hard not to use a regex match.
> -  bool is_regex = false;
> -  if (name_str.find_first_of("[]?*.-+\\") != std::string::npos) {
> -    // Trying to compile an invalid regex could throw an exception.
> -    // Only search by regex when it's valid.
> -    lldb_private::RegularExpression name_regex(name_str);
> -    is_regex = name_regex.IsValid();
> -  }
> -  if (is_regex)
> -    FindTypesByRegex(name_str, max_matches, types);
> +  if (name_str.find_first_of("[]?*.-+\\") != std::string::npos)
> +    FindTypesByRegex(RegularExpression(name_str), max_matches, types);
> ----------------
> I would rather not sniff the string passed in to see if this could be a
> regex and add a new FindTypesByRegex() call to lldb_private::SymbolFile
> that anyone can use. Do we have PDB tests that are using this functionality?
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D41086
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171218/0f9fef76/attachment.html>


More information about the lldb-commits mailing list