mib created this revision. mib added reviewers: teemperor, friss. mib added a project: LLDB. Herald added a subscriber: lldb-commits.
One way to register a recognizer is to use RegularExpressionSP for the module and symbol. In order to match a symbol regardless of the module, the recognizer can be registered with a nullptr for the module. However, this cause the `frame recognizer list` command to crash because it calls RegularExpression::GetText without checking if the shared pointer is valid. This patch add checks for the symbol and module RegularExpressionSP. Signed-off-by: Med Ismail Bennani <medismail.benn...@gmail.com> Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D74212 Files: lldb/source/Target/StackFrameRecognizer.cpp Index: lldb/source/Target/StackFrameRecognizer.cpp =================================================================== --- lldb/source/Target/StackFrameRecognizer.cpp +++ lldb/source/Target/StackFrameRecognizer.cpp @@ -70,9 +70,17 @@ std::string symbol, bool regexp)> const &callback) { for (auto entry : m_recognizers) { if (entry.is_regexp) { - callback(entry.recognizer_id, entry.recognizer->GetName(), - std::string(entry.module_regexp->GetText()), - std::string(entry.symbol_regexp->GetText()), true); + std::string module_name; + std::string symbol_name; + + if (entry.module_regexp) + module_name = entry.module_regexp->GetText().str(); + if (entry.symbol_regexp) + symbol_name = entry.symbol_regexp->GetText().str(); + + callback(entry.recognizer_id, entry.recognizer->GetName(), module_name, + symbol_name, true); + } else { callback(entry.recognizer_id, entry.recognizer->GetName(), entry.module.GetCString(), entry.symbol.GetCString(), false);
Index: lldb/source/Target/StackFrameRecognizer.cpp =================================================================== --- lldb/source/Target/StackFrameRecognizer.cpp +++ lldb/source/Target/StackFrameRecognizer.cpp @@ -70,9 +70,17 @@ std::string symbol, bool regexp)> const &callback) { for (auto entry : m_recognizers) { if (entry.is_regexp) { - callback(entry.recognizer_id, entry.recognizer->GetName(), - std::string(entry.module_regexp->GetText()), - std::string(entry.symbol_regexp->GetText()), true); + std::string module_name; + std::string symbol_name; + + if (entry.module_regexp) + module_name = entry.module_regexp->GetText().str(); + if (entry.symbol_regexp) + symbol_name = entry.symbol_regexp->GetText().str(); + + callback(entry.recognizer_id, entry.recognizer->GetName(), module_name, + symbol_name, true); + } else { callback(entry.recognizer_id, entry.recognizer->GetName(), entry.module.GetCString(), entry.symbol.GetCString(), false);
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits