-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lldb crashes when using tab completion. #81536
Comments
@llvm/issue-subscribers-lldb Author: Zequan Wu (ZequanWu)
lldb version: trunk.
a.cpp
command: Enter
|
Looks like the problem is that we're trying to determine the longest common prefix of the completions to display, but don't account for the possibility of a
|
Actually looks like the list of possible completions we get for
Which doesn't seem right. |
This is happening since in the checks for completions we check to see if a member name starts with a partial_member_name and in this case both B t and int t2 start with t and we are getting a.t2 as a completion for a.t. which is incorrect. This happens in the function if (partial_member_name.empty() ||
llvm::StringRef(member_name).starts_with(partial_member_name)) {
if (member_name == partial_member_name) {
PrivateAutoComplete(
frame, partial_path,
prefix_path + member_name, // Anything that has been resolved
// already will be in here
member_compiler_type.GetCanonicalType(), request);
} else {
request.AddCompletion((prefix_path + member_name).str());
} Changing this to the block below seems to work and not crash. if (partial_member_name.empty()) {
request.AddCompletion((prefix_path + member_name).str());
} else if (llvm::StringRef(member_name).starts_with(partial_member_name)) {
if (member_name == partial_member_name) {
PrivateAutoComplete(
frame, partial_path,
prefix_path + member_name, // Anything that has been resolved
// already will be in here
member_compiler_type.GetCanonicalType(), request);
} else if (partial_path.empty()) {
request.AddCompletion((prefix_path + member_name).str());
} I'll still need to figure out how to add a test for this since the existing test |
Yea that seems about right. We don't want to add completions if there's still user input left to check |
Is there an open pr to fix this? |
I haven't been able to get to this due to other work that I was busy. Shall try to push a patch this week. |
…3234) We weren't checking to see if the partial_path was empty before adding completions and this led to crashes when the class object and a variable both start with the same substring. Fixes [llvm#81536](llvm#81536) --------- Co-authored-by: Michael Buch <michaelbuch12@gmail.com> (cherry picked from commit de55188)
lldb version: trunk.
a.cpp
command:
clang++ -g a.cpp && lldb a.out -o "b a.cpp:11" -o "r"
Enter
a.t.
and use tab completion causes lldb to crash:The text was updated successfully, but these errors were encountered: