[lldb] Fix crash when completing register names after program exit
authorDavid Spickett <david.spickett@linaro.org>
Tue, 4 Jul 2023 08:10:59 +0000 (08:10 +0000)
committerDavid Spickett <david.spickett@linaro.org>
Thu, 6 Jul 2023 08:35:04 +0000 (08:35 +0000)
commitfd8929904d8820629bae940bce5141ef65bcaa11
tree0492b5fef17cdfa3965ebe8021df8f205a3c0866
parentac03e3f51c271b985efeb0fe6b9782cd6928be33
[lldb] Fix crash when completing register names after program exit

Previously the following would crash:
(lldb) run
Process 2594053 launched: '/tmp/test.o' (aarch64)
Process 2594053 exited with status = 0 (0x00000000)
(lldb) register read <tab>

As the completer assumed that the execution context would always
have a register context. After a program has finished, it does not.

Split out the generic parts of the test from the x86 specific tests,
and added "register info" to both.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D154413
lldb/source/Commands/CommandCompletions.cpp
lldb/test/API/functionalities/completion/TestCompletion.py