Skip to content

Commit 4dfcad5

Browse files
Steven TrotterSteven Trotter
authored andcommitted
Reworked all of PADRE to use Tokio 1.0 with superior architecture.
Added LLDB as a full debugger. Full reworking, too much detail to go into here. Fixed all tests apart from python/node based stuff which will come in a later commit. Added Python debugger
1 parent d803146 commit 4dfcad5

54 files changed

Lines changed: 4719 additions & 5740 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
all:
22
cd padre && cargo build
3+
4+
clean:
5+
cd padre && cargo clean

autoload/padre/debugger.vim

Lines changed: 35 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ function! padre#debugger#Debug(...)
135135
endfunction
136136

137137
function! padre#debugger#Run()
138-
call padre#socket#Send({"cmd": "run"}, function('padre#debugger#RunCallback'))
138+
call padre#socket#Send({"cmd": "run"}, function('padre#debugger#GenericCallback'))
139139
endfunction
140140

141141
function! padre#debugger#Stop()
@@ -161,7 +161,7 @@ function! padre#debugger#Stop()
161161
endfunction
162162

163163
function! s:SetBreakpointInDebugger(line, file)
164-
call padre#socket#Send({"cmd": "breakpoint", "file": a:file, "line": str2nr(a:line)}, function('padre#debugger#BreakpointCallback'))
164+
call padre#socket#Send({"cmd": "breakpoint", "file": a:file, "line": str2nr(a:line)}, function('padre#debugger#GenericCallback'))
165165
endfunction
166166

167167
function! padre#debugger#Breakpoint()
@@ -173,19 +173,19 @@ function! padre#debugger#Breakpoint()
173173
endfunction
174174

175175
function! padre#debugger#StepIn()
176-
call padre#socket#Send({"cmd": "stepIn"}, function('padre#debugger#StepInCallback'))
176+
call padre#socket#Send({"cmd": "stepIn"}, function('padre#debugger#GenericCallback'))
177177
endfunction
178178

179179
function! padre#debugger#StepOver()
180-
call padre#socket#Send({"cmd": "stepOver"}, function('padre#debugger#StepOverCallback'))
180+
call padre#socket#Send({"cmd": "stepOver"}, function('padre#debugger#GenericCallback'))
181181
endfunction
182182

183183
function! padre#debugger#PrintVariable(variable)
184184
call padre#socket#Send({"cmd": "print", "variable": a:variable}, function('padre#debugger#PrintVariableCallback'))
185185
endfunction
186186

187187
function! padre#debugger#Continue()
188-
call padre#socket#Send({"cmd": "continue"}, function('padre#debugger#ContinueCallback'))
188+
call padre#socket#Send({"cmd": "continue"}, function('padre#debugger#GenericCallback'))
189189
endfunction
190190

191191
""""""""""""""""
@@ -198,63 +198,12 @@ function! padre#debugger#SignalPADREStarted()
198198
endfor
199199
endfunction
200200

201-
function! padre#debugger#RunCallback(channel_id, data)
202-
if a:data['status'] != 'OK'
203-
call padre#debugger#Log(2, 'Error: ' . string(a:data))
204-
return
205-
endif
206-
207-
if has_key(a:data, 'pid')
208-
call padre#debugger#Log(4, 'Process ' . a:data['pid'] . ' Running')
209-
endif
210-
endfunction
211-
212-
function! padre#debugger#BreakpointCallback(channel_id, data)
213-
if a:data['status'] == 'OK'
214-
elseif a:data['status'] == 'PENDING'
215-
call padre#debugger#Log(4, 'Breakpoint pending')
216-
else
217-
call padre#debugger#Log(2, 'Error: ' . string(a:data))
218-
endif
219-
endfunction
220-
221-
function! padre#debugger#BreakpointSet(fileName, lineNum)
222-
let l:msg = 'Breakpoint set file=' . a:fileName . ', line=' . a:lineNum
223-
call padre#debugger#Log(4, l:msg)
224-
endfunction
225-
226-
function! padre#debugger#StepInCallback(channel_id, data)
201+
function! padre#debugger#GenericCallback(channel_id, data)
227202
if a:data['status'] != 'OK'
228203
call padre#debugger#Log(2, 'Error: ' . string(a:data))
229204
endif
230205
endfunction
231206

232-
function! padre#debugger#StepOverCallback(channel_id, data)
233-
if a:data['status'] != 'OK'
234-
call padre#debugger#Log(2, 'Error: ' . string(a:data))
235-
endif
236-
endfunction
237-
238-
function! padre#debugger#ContinueCallback(channel_id, data)
239-
if a:data['status'] != 'OK'
240-
call padre#debugger#Log(2, 'Error: ' . string(a:data))
241-
endif
242-
endfunction
243-
244-
function! padre#debugger#PrintVariableCallback(channel_id, data)
245-
let l:status = remove(a:data, 'status')
246-
if l:status != 'OK'
247-
call padre#debugger#Log(2, 'Error printing variable: ' . string(a:data))
248-
return
249-
endif
250-
251-
let l:variable_name = remove(a:data, 'variable')
252-
253-
execute "let l:json = system('python -m json.tool', '" . substitute(json_encode(a:data), "'", "''", "g") . "')"
254-
let l:msg = 'Variable ' . l:variable_name . "=\n" . l:json
255-
call padre#debugger#Log(4, l:msg)
256-
endfunction
257-
258207
function! padre#debugger#JumpToPosition(file, line)
259208
let l:msg = 'Stopped file=' . a:file . ' line=' . a:line
260209
call padre#debugger#Log(4, l:msg)
@@ -304,8 +253,35 @@ function! padre#debugger#JumpToPosition(file, line)
304253
redraw
305254
endfunction
306255

307-
function! padre#debugger#ProcessExited(exit_code, pid)
308-
call padre#debugger#Log(4, 'Process ' . a:pid . ' finished with exit code=' . a:exit_code)
256+
function! padre#debugger#PrintVariableCallback(channel_id, data)
257+
if a:data['status'] != 'OK'
258+
call padre#debugger#Log(2, 'Error: ' . string(a:data))
259+
endif
260+
261+
let s:text = 'Variable (' . a:data['type'] . ') ' . a:data['variable'] . '=' . a:data['value']
262+
263+
let l:current_tabpagenr = tabpagenr()
264+
265+
call padre#layout#OpenTabWithBuffer('PADRE_Logs_' . s:PadreNumber)
266+
267+
let l:current_window = winnr()
268+
let l:logs_window = padre#layout#GetLogsWindow()
269+
270+
if l:current_window != l:logs_window
271+
execute l:logs_window . ' wincmd w'
272+
endif
273+
274+
call padre#buffer#AppendBuffer(strftime('%y/%m/%d %H:%M:%S ') . s:text, 0)
275+
276+
if l:current_window != l:logs_window
277+
execute l:current_window . ' wincmd w'
278+
endif
279+
280+
if l:current_tabpagenr != tabpagenr()
281+
execute l:current_tabpagenr . 'tabnext'
282+
endif
283+
284+
redraw
309285
endfunction
310286

311287
function! padre#debugger#Log(level, text)

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ trigger:
33
- feature/*
44

55
jobs:
6-
- job: rustfmt
6+
- job: rust_static
77
pool:
88
vmImage: 'ubuntu-latest'
99
timeoutInMinutes: 5
1010

1111
steps:
12-
- template: ci/rustfmt.yml
12+
- template: ci/rust-static.yml
1313

1414
- job: padre_tests
1515
pool:

ci/install-rust.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ steps:
22
- script: |
33
set -e
44
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain stable
5-
echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin"
5+
echo "##vso[task.setvariable variable=PATH;]$HOME/.cargo/bin:$PATH"
6+
rustup update
67
displayName: Install rust
78
89
- script: |

ci/padre-tests.yml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,16 @@ steps:
22
- template: install-rust.yml
33

44
- script: |
5-
cargo install cargo-junit
6-
displayName: Install test reporters
7-
8-
- script: |
9-
sudo apt-get install software-properties-common python3 python3-pip python3-setuptools
10-
pip3 install wheel
11-
pip3 install behave pyhamcrest psutil
12-
displayName: Install python dependencies
13-
14-
- script: |
15-
cd padre
16-
cargo test -- --nocapture
17-
env:
18-
RUST_BACKTRACE: 1
19-
RUSTFLAGS: '-D warnings'
20-
displayName: Run Padre CLI unit testing
21-
22-
- script: |
23-
cd padre
24-
cargo junit --name TESTS-cargo.xml
25-
displayName: Run Padre CLI unit testing reporting
26-
27-
- script: |
28-
sudo apt-get install -y lldb-5.0 gcc
5+
sudo apt-get install -y software-properties-common python3 python3-pip python3-setuptools lldb-5.0 gcc
296
sudo ln -s /usr/bin/lldb-5.0 /usr/bin/lldb
307
sudo ln -s /usr/bin/lldb-server-5.0 /usr/bin/lldb-server
318
sudo ln -s /usr/bin/lldb-server-5.0 /usr/lib/llvm-5.0/bin/lldb-server-5.0.0
329
sudo rm /usr/local/bin/node
3310
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
3411
sudo apt-get install -y nodejs
35-
displayName: Install lldb-5, node-12 and build essentials
12+
pip3 install wheel
13+
pip3 install behave pyhamcrest psutil
14+
displayName: Install lldb-5, node-12 and build and test essentials
3615
3716
- script: |
3817
cd padre

ci/rust-static.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
steps:
2+
- template: install-rust.yml
3+
4+
- script: |
5+
cd padre
6+
cargo fmt --all -- --check
7+
displayName: Check formatting
8+
9+
- script: |
10+
rustup component add rustfmt
11+
displayName: Install rustfmt
12+
13+
- script: |
14+
cargo install cargo-junit
15+
displayName: Install test reporters
16+
17+
- script: |
18+
cd padre
19+
cargo test -- --nocapture
20+
env:
21+
RUST_BACKTRACE: 1
22+
displayName: Run Padre CLI unit testing
23+
24+
- script: |
25+
cd padre
26+
cargo junit --name TESTS-cargo.xml
27+
displayName: Run Padre CLI unit testing reporting

ci/rustfmt.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)