22 lines
649 B
Python
22 lines
649 B
Python
|
# Adapted to use neovim from https://github.com/cyrus-and/gdb-dashboard/issues/20
|
||
|
# Requires neovim-remote and can only be used from within neovim terminal
|
||
|
import os
|
||
|
import gdb # type: ignore
|
||
|
|
||
|
|
||
|
class OpenNvim(gdb.Command):
|
||
|
def __init__(self):
|
||
|
super().__init__("vo", gdb.COMMAND_USER)
|
||
|
|
||
|
def complete(self, _text, _word):
|
||
|
return gdb.COMPLETE_SYMBOL
|
||
|
|
||
|
def invoke(self, _args, _from_tty):
|
||
|
sal = gdb.selected_frame().find_sal()
|
||
|
current_line = sal.line
|
||
|
if current_line != 0:
|
||
|
openInNvim = "nvr +" + str(current_line) + " " + sal.symtab.fullname()
|
||
|
os.system(openInNvim)
|
||
|
|
||
|
OpenNvim()
|