Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] fix gdb completion of core file and pid after the program



  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