lebr0nli / GEP

GEP (GDB Enhanced Prompt) - a GDB plug-in to enhance your GDB with fzf history search, fish-like autosuggestions, tab auto-completion with fzf, and more!
MIT License
98 stars 7 forks source link

Consider using GDB MI commands #41

Closed lebr0nli closed 5 months ago

lebr0nli commented 5 months ago

gdb.execute_mi is added after GDB 14.1

GDB MI -complete command somehow can provide better competitions then normal complete command:

>>> gdb.execute_mi("-complete","enable ")
{'completion': 'enable ', 'matches': ['enable breakpoints', 'enable count', 'enable delete', 'enable display', 'enable frame-filter', 'enable mem', 'enable once', 'enable pretty-printer', 'enable probes', 'enable type-printer', 'enable unwinder', 'enable xmethod'], 'max_completions_reached': '0'}
>>> gdb.execute("complete enable ")
enable
lebr0nli commented 5 months ago

Wow, the performance seems also better:

>>> timeit.timeit("import gdb;gdb.execute('complete',to_string=True)", number=1000)
2.3764819998759776
>>> timeit.timeit("import gdb;gdb.execute_mi('-complete','')",number=1000)
1.2388369999825954
lebr0nli commented 5 months ago

Should be resolved in #42