This is an archive of the discontinued LLVM Phabricator instance.

[lldb/Target] Fix `frame recognizer list` crash when registered with nullptr
ClosedPublic

Authored by mib on Feb 7 2020, 3:42 AM.

Details

Summary

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 adds checks for the symbol and module RegularExpressionSP.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>

Diff Detail

Event Timeline

mib created this revision.Feb 7 2020, 3:42 AM
mib updated this revision to Diff 243160.Feb 7 2020, 7:07 AM
mib retitled this revision from [lldb/Target] Fix `recognizer list` crash when registered with nullptre to [lldb/Target] Fix `frame recognizer list` crash when registered with nullptr.
mib edited the summary of this revision. (Show Details)

Add unittest.

mib updated this revision to Diff 243161.Feb 7 2020, 7:08 AM

Removed used class member

friss accepted this revision.Feb 7 2020, 8:17 AM

LGTM

lldb/unittests/Target/StackFrameRecognizerTest.cpp
84–88

Either check what's printed to the stream or just check the boolean, but there's no reason to add the printing logic if the result is not used.

This revision is now accepted and ready to land.Feb 7 2020, 8:17 AM
mib updated this revision to Diff 243177.Feb 7 2020, 8:26 AM
mib marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.