Transform filenames to absolute paths when reading debugger locations

Before this commit, many debugger `where` functions transformed the
filename of the current debugger location to a path relative to vim's
current working directory. When the user changed the current working
directory in the meantime, the previously saved location could not
resolved any more and lead to errors. This commit fixes this problem by
storing absolute paths instead.
This commit is contained in:
Ingo Heimbach 2018-06-25 16:15:41 +02:00
parent f881b44b4c
commit 1f2553a71b
4 changed files with 4 additions and 4 deletions

View File

@ -128,7 +128,7 @@ function! vebugger#gdb#_readWhere(pipeName,line,readResult,debugger)
let l:matches=matchlist(a:line,'\v^\*stopped.*fullname\=\"([^"]+)\",line\=\"(\d+)"') let l:matches=matchlist(a:line,'\v^\*stopped.*fullname\=\"([^"]+)\",line\=\"(\d+)"')
if 2<len(l:matches) if 2<len(l:matches)
let l:file=l:matches[1] let l:file=l:matches[1]
let l:file=fnamemodify(l:file,':~:.') let l:file=fnamemodify(l:file,':p')
let a:readResult.std.location={ let a:readResult.std.location={
\'file':(l:file), \'file':(l:file),
\'line':str2nr(l:matches[2])} \'line':str2nr(l:matches[2])}

View File

@ -116,7 +116,7 @@ function! vebugger#jdb#_readWhere(pipeName,line,readResult,debugger)
if 4<len(l:matches) if 4<len(l:matches)
let l:frameNumber=str2nr(l:matches[1]) let l:frameNumber=str2nr(l:matches[1])
let l:file=s:findFolderFromStackTrace(a:debugger.state.jdb.srcpath,l:matches[2],l:frameNumber).'/'.l:matches[3] let l:file=s:findFolderFromStackTrace(a:debugger.state.jdb.srcpath,l:matches[2],l:frameNumber).'/'.l:matches[3]
let l:file=fnamemodify(l:file,':~:.') let l:file=fnamemodify(l:file,':p')
if 1==l:frameNumber " first stackframe is the current location if 1==l:frameNumber " first stackframe is the current location
let a:readResult.std.location={ let a:readResult.std.location={
\'file':(l:file), \'file':(l:file),

View File

@ -60,7 +60,7 @@ function! vebugger#lldb#_readWhere(pipeName,line,readResult,debugger)
let l:matches=matchlist(a:line,'\v^where:\s([^:]+):(\d+)') let l:matches=matchlist(a:line,'\v^where:\s([^:]+):(\d+)')
if 2<len(l:matches) if 2<len(l:matches)
let l:file=l:matches[1] let l:file=l:matches[1]
let l:file=fnamemodify(l:file,':~:.') let l:file=fnamemodify(l:file,':p')
let a:readResult.std.location={ let a:readResult.std.location={
\'file':(l:file), \'file':(l:file),
\'line':str2nr(l:matches[2])} \'line':str2nr(l:matches[2])}

View File

@ -95,7 +95,7 @@ function! vebugger#mdbg#_readWhere(pipeName,line,readResult,debugger)
if 3<len(l:matches) if 3<len(l:matches)
let l:frameNumber=str2nr(l:matches[1]) let l:frameNumber=str2nr(l:matches[1])
let l:file=s:findFilePath(a:debugger.state.mdbg.srcpath,l:matches[3],l:matches[2]) let l:file=s:findFilePath(a:debugger.state.mdbg.srcpath,l:matches[3],l:matches[2])
let l:file=fnamemodify(l:file,':~:.') let l:file=fnamemodify(l:file,':p')
if 0==l:frameNumber " first stackframe is the current location if 0==l:frameNumber " first stackframe is the current location
let a:readResult.std.location={ let a:readResult.std.location={
\'file':(l:file), \'file':(l:file),