From 6d9ace9f62a8f2c5a4719325d789486c7c8ce9d3 Mon Sep 17 00:00:00 2001 From: IdanArye Date: Tue, 13 Jan 2015 00:22:02 +0200 Subject: [PATCH 1/3] Fix paths for MDbg in Cygwin --- autoload/vebugger/mdbg.vim | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/autoload/vebugger/mdbg.vim b/autoload/vebugger/mdbg.vim index a2b013f..9e867a5 100644 --- a/autoload/vebugger/mdbg.vim +++ b/autoload/vebugger/mdbg.vim @@ -26,11 +26,13 @@ function! vebugger#mdbg#start(binaryFile,args) if !get(a:args,'noConsole') call l:debugger.writeLine('mode nc on') endif - call l:debugger.writeLine('run '.shellescape(fnamemodify(a:binaryFile,':p')).' '.vebugger#util#commandLineArgsForProgram(a:args)) + if has('win32unix') + call l:debugger.writeLine('run '.(substitute(system('cygpath -am '.shellescape(fnamemodify(a:binaryFile,':p'))),'\n$','','')).' '.vebugger#util#commandLineArgsForProgram(a:args)) + else + call l:debugger.writeLine('run '.shellescape(fnamemodify(a:binaryFile,':p')).' '.vebugger#util#commandLineArgsForProgram(a:args)) + endif call l:debugger.writeLine('where') end - - call l:debugger.addReadHandler(function('s:readProgramOutput')) call l:debugger.addReadHandler(function('s:readWhere')) call l:debugger.addReadHandler(function('s:readFinish')) @@ -53,11 +55,16 @@ function! vebugger#mdbg#start(binaryFile,args) endfunction function! s:findFilePath(src,fileName,methodName) - if vebugger#util#isPathAbsolute(a:fileName) - return fnamemodify(a:fileName,':p') "Return the normalized full path + if has('win32unix') + let l:fileName = substitute(system('cygpath -au "'.a:fileName.'"'),'\n$','','') + else + let l:fileName = a:fileName + endif + if vebugger#util#isPathAbsolute(l:fileName) + return fnamemodify(l:fileName,':p') "Return the normalized full path endif let l:path=fnamemodify(a:src,':p') - let l:files=glob(l:path.'**/'.a:fileName,0,1) + let l:files=glob(l:path.'**/'.l:fileName,0,1) for l:dirname in split(a:methodName,'\.') if empty(l:files) return '' From 31a8bd64c8779e705a41f3da1a047698934f4e2f Mon Sep 17 00:00:00 2001 From: IdanArye Date: Wed, 14 Jan 2015 00:53:36 +0200 Subject: [PATCH 2/3] Fixed breakpoints for MDBG in Cygwin Now I just need to see that everything works in regular Vim under Windows... --- autoload/vebugger/mdbg.vim | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/autoload/vebugger/mdbg.vim b/autoload/vebugger/mdbg.vim index 9e867a5..b2da06e 100644 --- a/autoload/vebugger/mdbg.vim +++ b/autoload/vebugger/mdbg.vim @@ -26,11 +26,7 @@ function! vebugger#mdbg#start(binaryFile,args) if !get(a:args,'noConsole') call l:debugger.writeLine('mode nc on') endif - if has('win32unix') - call l:debugger.writeLine('run '.(substitute(system('cygpath -am '.shellescape(fnamemodify(a:binaryFile,':p'))),'\n$','','')).' '.vebugger#util#commandLineArgsForProgram(a:args)) - else - call l:debugger.writeLine('run '.shellescape(fnamemodify(a:binaryFile,':p')).' '.vebugger#util#commandLineArgsForProgram(a:args)) - endif + call l:debugger.writeLine('run "'.s:pathToMdbgStyle(fnamemodify(a:binaryFile, ':p')).'" '.vebugger#util#commandLineArgsForProgram(a:args)) call l:debugger.writeLine('where') end call l:debugger.addReadHandler(function('s:readProgramOutput')) @@ -54,12 +50,24 @@ function! vebugger#mdbg#start(binaryFile,args) return l:debugger endfunction +function! s:pathToMdbgStyle(path) + if has('win32unix') + return substitute(system('cygpath -w '.shellescape(a:path)),'\n$','','') + else + return a:path + endif +endfunction + +function! s:pathToVimStyle(path) + if has('win32unix') + return substitute(system('cygpath -u '.shellescape(a:path)),'\n$','','') + else + return a:path + endif +endfunction + function! s:findFilePath(src,fileName,methodName) - if has('win32unix') - let l:fileName = substitute(system('cygpath -au "'.a:fileName.'"'),'\n$','','') - else - let l:fileName = a:fileName - endif + let l:fileName = s:pathToVimStyle(a:fileName) if vebugger#util#isPathAbsolute(l:fileName) return fnamemodify(l:fileName,':p') "Return the normalized full path endif @@ -128,8 +136,8 @@ function! s:writeBreakpoints(writeAction,debugger) for l:breakpoint in a:writeAction let l:fullFileName=fnamemodify(l:breakpoint.file,':p') if 'add'==(l:breakpoint.action) - call a:debugger.writeLine('break '.fnameescape(l:fullFileName).':'.l:breakpoint.line) - let a:debugger.state.mdbg.breakpointNumbers[l:fullFileName.':'.l:breakpoint.line]={} + call a:debugger.writeLine('break '.s:pathToMdbgStyle(l:fullFileName).':'.l:breakpoint.line) + let a:debugger.state.mdbg.breakpointNumbers[s:pathToVimStyle(l:fullFileName).':'.l:breakpoint.line]={} elseif 'remove'==l:breakpoint.action call a:debugger.writeLine('delete '.a:debugger.state.mdbg.breakpointNumbers[l:fullFileName.':'.l:breakpoint.line].number) call remove(a:debugger.state.mdbg.breakpointNumbers,l:fullFileName.':'.l:breakpoint.line) @@ -142,7 +150,7 @@ function! s:readBreakpointBound(pipeName,line,readResult,debugger) let l:matches=matchlist(a:line,'\vBreakpoint \#(\d+) bound\s*\(line (\d+) in ([^)]+)\)') if 3 Date: Wed, 14 Jan 2015 22:08:41 +0200 Subject: [PATCH 3/3] Fix indentation and bump bugfix version --- autoload/vebugger/mdbg.vim | 260 ++++++++++++++++++------------------- doc/vebugger.txt | 2 +- 2 files changed, 131 insertions(+), 131 deletions(-) diff --git a/autoload/vebugger/mdbg.vim b/autoload/vebugger/mdbg.vim index b2da06e..2688798 100644 --- a/autoload/vebugger/mdbg.vim +++ b/autoload/vebugger/mdbg.vim @@ -1,53 +1,53 @@ function! vebugger#mdbg#searchAndAttach(binaryFile,srcpath) - let l:processId=vebugger#util#selectProcessOfFile(a:binaryFile) - if 0]+)\s*\((.+):(\d+)\)') - if 3]+)\s*\((.+):(\d+)\)') + if 3\s*([^=]+)\=(.*)$') - if 2\s*([^=]+)\=(.*)$') + if 2 License: Same terms as Vim itself (see |license|) -Version: 1.2.0 +Version: 1.2.1 INTRODUCTION *vebugger*