Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] fix gdb completion of core file and pid after the program
- X-seq: zsh-workers 55218
- From: tiandic <2323748675@xxxxxx>
- To: zsh-workers@xxxxxxx
- Cc: tiandic <2323748675@xxxxxx>
- Subject: [PATCH] fix gdb completion of core file and pid after the program
- Date: Thu, 15 Oct 2026 12:46:52 +0800
- Archived-at: <https://zsh.org/workers/55218>
- List-id: <zsh-workers.zsh.org>
if [[ $#w -gt 1 ]]; then
This conditional judgment will cause `gdb ./myprog <TAB>` to enter the else branch, so that it cannot complete the procID or core.
---
Completion/Unix/Command/_gdb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb
index 7470e6102..051812325 100644
--- a/Completion/Unix/Command/_gdb
+++ b/Completion/Unix/Command/_gdb
@@ -46,10 +46,10 @@ else
(( $#w )) && shift 1 w
done
- if [[ $#w -gt 1 ]]; then
- _alternative "files:: _files -g '*core*(-.)'" "processes:: _pids -m ${w[1]:t}"
- else
+ if [[ $#w -eq 0 ]]; then
_description files expl executable
_files "$expl[@]" -g '*(-*)'
+ elif [[ $#w -eq 1 ]]; then
+ _alternative "files:: _files -g '*core*(-.)'" "processes:: _pids -m ${w[1]:t}"
fi
fi
--
2.56.0
Messages sorted by:
Reverse Date,
Date,
Thread,
Author