diff --git a/lldb/include/lldb/Utility/OptionDefinition.h b/lldb/include/lldb/Utility/OptionDefinition.h --- a/lldb/include/lldb/Utility/OptionDefinition.h +++ b/lldb/include/lldb/Utility/OptionDefinition.h @@ -12,6 +12,8 @@ #include "lldb/lldb-enumerations.h" #include "lldb/lldb-private-types.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Support/MathExtras.h" +#include #include namespace lldb_private { @@ -47,7 +49,8 @@ /// Whether this has a short option character. bool HasShortOption() const { // See the short_option documentation for more. - return llvm::isPrint(short_option); + return llvm::isUInt(short_option) && + llvm::isPrint(short_option); } }; } // namespace lldb_private diff --git a/lldb/test/API/commands/help/TestHelp.py b/lldb/test/API/commands/help/TestHelp.py --- a/lldb/test/API/commands/help/TestHelp.py +++ b/lldb/test/API/commands/help/TestHelp.py @@ -56,6 +56,11 @@ self.runCmd("help disasm", check=False) self.runCmd("help unsigned-integer") + @no_debug_info_test + def test_help_memory_read_should_not_crash_lldb(self): + """Command 'help memory read' should not crash lldb.""" + self.runCmd("help memory read", check=False) + @no_debug_info_test def test_help_should_not_hang_emacsshell(self): """Command 'settings set term-width 0' should not hang the help command."""