forked from dbgx/lldb.nvim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
50 lines (43 loc) · 1.19 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys
import os
import logging
logger = logging.getLogger(__name__)
logfile = ('test.log')
handler = logging.FileHandler(logfile, 'w')
handler.formatter = logging.Formatter(
'%(asctime)s [%(levelname)s @ '
'%(filename)s:%(funcName)s:%(lineno)s] %(process)s - %(message)s')
logging.root.addHandler(handler)
logger.setLevel(logging.INFO)
NV_SOCK = 'NVIM_LISTEN_ADDRESS' #'LLTEST_SOCK'
if NV_SOCK not in os.environ:
print '$%s not set!' % NV_SOCK
exit(1)
import neovim
vim = neovim.attach('socket', path=os.environ[NV_SOCK])
vim.command('leftabove vsp ab.c')
plugpath = os.path.realpath('../rplugin/python')
sys.path.append(plugpath)
try:
from lldb_nvim import Middleman
iface = Middleman(vim)
from time import sleep
delay = 1
iface._session(['load', 'lldb-nvim.json'])
sleep(delay)
iface._mode('debug')
sleep(2*delay)
iface._exec('continue')
sleep(delay)
iface._stdin('4\n')
sleep(delay)
iface._exec('continue')
sleep(delay)
iface._mode('code')
iface._exit() # Don't forget to exit!
except:
import traceback
traceback.print_exc()
print ('Debugger terminated! If you see no errors, everything\'s cool!')
vim.command("wincmd w")
vim.command("belowright sp test.log")