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

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 18 10:10:32 PST 2017


ok, good starting point then. We can submit another patch to add the find types by regex functionality.

Greg

> On Dec 18, 2017, at 9:54 AM, Zachary Turner <zturner at google.com> wrote:
> 
> 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 <mailto: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 <https://reviews.llvm.org/D41086>
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171218/b784d331/attachment-0001.html>


More information about the lldb-commits mailing list