Skip to content

Commit 695a2fe

Browse files
committed
fixup! improve error message
1 parent e6622bd commit 695a2fe

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

lldb/source/Commands/CommandObjectMemory.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -908,14 +908,11 @@ static llvm::Error CopyExpressionResult(ValueObject &result,
908908
case 8: {
909909
buffer.CopyData(&value, 8);
910910
} break;
911-
case 3:
912-
case 5:
913-
case 6:
914-
case 7:
915-
return llvm::createStringError("unknown type. pass a string instead");
916911
default:
917912
return llvm::createStringError(
918-
"result size larger than 8 bytes. pass a string instead");
913+
"Only expressions resulting in 1, 2, 4, or 8-byte-sized values are "
914+
"supported. For other pattern sizes the --string (-s) option may be "
915+
"used.");
919916
}
920917

921918
return llvm::Error::success();

lldb/test/API/functionalities/memory/find/TestMemoryFind.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,30 +83,30 @@ def test_memory_find(self):
8383
# Expression results with unsupported result types.
8484
self.expect(
8585
'memory find -e "ThreeBytes{}" `&bytedata[0]` `&bytedata[2]`',
86-
substrs=["unknown type."],
86+
substrs=["Only expressions resulting in 1, 2, 4, or 8-byte-sized values are supported"],
8787
error=True,
8888
)
8989

9090
self.expect(
9191
'memory find -e "FiveBytes{}" `&bytedata[0]` `&bytedata[2]`',
92-
substrs=["unknown type."],
92+
substrs=["Only expressions resulting in 1, 2, 4, or 8-byte-sized values are supported"],
9393
error=True,
9494
)
9595

9696
self.expect(
9797
'memory find -e "SixBytes{}" `&bytedata[0]` `&bytedata[2]`',
98-
substrs=["unknown type."],
98+
substrs=["Only expressions resulting in 1, 2, 4, or 8-byte-sized values are supported"],
9999
error=True,
100100
)
101101

102102
self.expect(
103103
'memory find -e "SevenBytes{}" `&bytedata[0]` `&bytedata[2]`',
104-
substrs=["unknown type."],
104+
substrs=["Only expressions resulting in 1, 2, 4, or 8-byte-sized values are supported"],
105105
error=True,
106106
)
107107

108108
self.expect(
109109
'memory find -e "NineBytes{}" `&bytedata[0]` `&bytedata[2]`',
110-
substrs=["result size larger than 8 bytes."],
110+
substrs=["Only expressions resulting in 1, 2, 4, or 8-byte-sized values are supported"],
111111
error=True,
112112
)

0 commit comments

Comments
 (0)