Skip to content

Commit 2736cc7

Browse files
Ubaldo Tiberichrisbra
authored andcommitted
runtime(termdebug): gdb file/folder check is now performed only in CWD.
closes: #15268 Signed-off-by: Ubaldo Tiberi <ubaldo.tiberi@google.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent 27f5334 commit 2736cc7

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

runtime/pack/dist/opt/termdebug/plugin/termdebug.vim

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,18 +223,23 @@ enddef
223223

224224
def SanityCheck(): bool
225225
var gdb_cmd = GetCommand()[0]
226+
var cwd = $'{getcwd()}/'
227+
if exists('+shellslash') && !&shellslash
228+
# on windows, need to handle backslash
229+
cwd->substitute('\\', '/', 'g')
230+
endif
226231
var is_check_ok = true
227232
# Need either the +terminal feature or +channel and the prompt buffer.
228233
# The terminal feature does not work with gdb on win32.
229234
if (way is Way.Prompt) && !has('channel')
230235
err = 'Cannot debug, +channel feature is not supported'
231236
elseif (way is Way.Prompt) && !exists('*prompt_setprompt')
232237
err = 'Cannot debug, missing prompt buffer support'
233-
elseif (way is Way.Prompt) && !empty(glob(gdb_cmd))
238+
elseif (way is Way.Prompt) && !empty(glob($'{cwd}{gdb_cmd}'))
234239
err = $"You have a file/folder named '{gdb_cmd}' in the current directory Termdebug may not work properly. Please exit and rename such a file/folder."
235-
elseif !empty(glob(asmbufname))
240+
elseif !empty(glob($'{cwd}{asmbufname}'))
236241
err = $"You have a file/folder named '{asmbufname}' in the current directory Termdebug may not work properly. Please exit and rename such a file/folder."
237-
elseif !empty(glob(varbufname))
242+
elseif !empty(glob($'{cwd}{varbufname}'))
238243
err = $"You have a file/folder named '{varbufname}' in the current directory Termdebug may not work properly. Please exit and rename such a file/folder."
239244
elseif !executable(gdb_cmd)
240245
err = $"Cannot execute debugger program '{gdb_cmd}'"

0 commit comments

Comments
 (0)