Skip to content

Commit 88793fb

Browse files
andreaslynvim-scripts
authored andcommitted
Version 0.13
* Added command (ConqueGdbExe) to change path to GDB executable at runtime, useful for cross development. Thanks to Anatolii Sakhnik for implementing this feature.
1 parent c10f0d7 commit 88793fb

File tree

4 files changed

+40
-8
lines changed

4 files changed

+40
-8
lines changed

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Although you can run any CLI program with Conque GDB. The main reason for this p
66

77
If you start a new debugging session with the ConqueGdb command, Conque GDB will automatically open the appropriate source files when break points are hit, and highlight the line where program execution has stopped.
88

9-
Conque GDB runs on both Unix and Windows. However if you install Conque GDB on a Unix system with GDB 7.0+ and full python 2.7 support, Conque GDB will be able to highlight lines to mark where you have currently placed break points.
9+
Conque GDB runs on both Unix and Windows. However if you install Conque GDB on a Unix system with GDB 7.0+ compiled with python support, Conque GDB will be able to highlight lines to mark where you have currently placed break points.
1010

1111
Conque GDB ships with a modified version of Conque Term (Conque Shell) version 2.3. This new version of Conque Term comes with new options and new features. The most noticeable new feature is the ability to update windows that are not in focus.

autoload/conque_gdb.vim

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ let g:conque_gdb_gdb_py_support = 0
6565
" and ('ConqueSoleGdb()') for Windows
6666
let s:term_object = ''
6767

68+
" Original path to the GDB executable
69+
let s:orig_gdb_path = g:ConqueGdb_GdbExe
70+
6871
" Define the current gdb break point sign
6972
sil exe 'sign define ' . s:SIGN_POINTER . ' linehl=Search'
7073

@@ -401,7 +404,7 @@ function! conque_gdb#open(...)
401404
" Find out if gdb was found on the system
402405
if s:gdb_command == ''
403406
echohl WarningMsg
404-
echomsg "ConqueGdb: Unable to find gdb executable, see :help ConqueGdb_GdbExe for more information."
407+
echomsg "ConqueGdb: Unable to find gdb executable, see :help ConqueGdb_GdbExe and :help ConqueGdbExe for more information."
405408
echohl None
406409
return
407410
endif
@@ -589,5 +592,15 @@ function! conque_gdb#load_python()
589592
let s:gdb_command = s:get_gdb_command()
590593
endfunction
591594

595+
" Change path to GDB executable at runtime.
596+
function! conque_gdb#change_gdb_exe(gdb_path)
597+
if a:gdb_path == ""
598+
let g:ConqueGdb_GdbExe = s:orig_gdb_path
599+
else
600+
let g:ConqueGdb_GdbExe = a:gdb_path
601+
endif
602+
let s:gdb_command = s:get_gdb_command()
603+
endfunction
604+
592605
call conque_term#register_function('after_startup', 'conque_gdb#after_startup')
593606
call conque_term#register_function('after_close', 'conque_gdb#after_close')

doc/conque_gdb.txt

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ GDB command line interface (CLI).
1414
When debugging a program with one of the |ConqueGdb|* commands, Conque GDB will
1515
automatically open the appropriate source files when break points are hit,
1616
and highlight the line where program execution has stopped. And if you install
17-
Conque GDB on a Unix system with GDB 7.0+ with full python support, Conque GDB
18-
will place signs on lines to mark where you have placed break points.
17+
Conque GDB on a Unix system with GDB 7.0+ compiled with python support, Conque
18+
GDB will place signs on lines to mark where you have placed break points.
1919

2020
Conque GDB ships with a modified version of Conque Term 2.3. This new version
2121
of Conque Term comes with new options and new features. Please see the
@@ -37,6 +37,7 @@ Contents
3737
2.1 Opening Conque GDB CLI |conque-gdb-open|
3838
2.2 Delete unneeded buffers |conque-gdb-delete-buffers|
3939
2.3 Send command to GDB |conque-gdb-command|
40+
2.4 Send command to GDB |conque-gdb-exe|
4041
3. Options |conque-gdb-options|
4142
3.1 GDB Source code split |conque-gdb-src-split|
4243
3.2 Path to GDB |conque-gdb-path|
@@ -79,7 +80,8 @@ Even tough you have GDB 7.0+ installed on your system it is not 100% sure that
7980
it will support all the Conque GDB features, namely the ability to place signs
8081
on lines to mark where break points are currently placed. If you encounter
8182
this problem with GDB 7.0+ installed on your system, then go ahead and build
82-
GDB 7.0+ from source with the '--with-python' configuration option specified.
83+
GDB 7.0+ from source with python support by specifying the '--with-python'
84+
configuration option.
8385

8486
1.2 Requirements for Windows *conque-gdb-windows-requirements*
8587

@@ -158,6 +160,18 @@ command to GDB use |ConqueGdbCommand| to send any command to GDB. E.g.
158160
This will only work properly if the |ConqueTerm_ReadUnfocused| option is
159161
enabled. See the help file |conque_term.txt| for information.
160162

163+
2.4 Set path to GDB *conque-gdb-exe*
164+
*ConqueGdbExe*
165+
166+
If switch is needed between different GDB executables, for instance, during
167+
cross-development, you can specify path to a GDB executable as follows:
168+
>
169+
:ConqueGdbExe /path/to/gdb-cross
170+
:ConqueGdbExe
171+
>
172+
When zero arguments are given to the |ConqueGdbExe| command, Conque GDB will
173+
use the default path to GDB, as specified by the |g:ConqueGdb_GdbExe| option
174+
on startup. See |g:ConqueGdb_GdbExe|.
161175
==============================================================================
162176

163177
3. Options *conque-gdb-options*
@@ -184,12 +198,14 @@ GDB CLI window.
184198
If the |ConqueGdb| commands can't find GDB in the system path, then you might
185199
need to specify the path to the GDB executable manually. However on Windows
186200
Conque will also look for GDB in C:\MinGW\bin. To define the path to the GDB
187-
executable you can change the value of ConqueGdb_GdbExe. By default this is:
201+
executable you can change the value of |g:ConqueGdb_GdbExe|. By default this
202+
option is:
188203
>
189204
let g:ConqueGdb_GdbExe = ''
190205
<
191206
Note that you have to restart Vim before changes to |g:ConqueGdb_GdbExe| are
192-
recognized.
207+
recognized. If you would like to change path to the GDB executable at runtime,
208+
use the |ConqueGdbExe| command.
193209

194210
3.3 Disable GDB commands *conque-gdb-disable*
195211
*g:ConqueGdb_Disable*

plugin/conque_gdb.vim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,14 @@ command! -nargs=* -complete=file ConqueGdbTab call conque_gdb#open(<q-args>, [
9191
\ 'buffer ' . bufnr("%"),
9292
\ 'wincmd w'])
9393

94+
" Command to change path to GDB executable at runtime
95+
command! -nargs=? -complete=file ConqueGdbExe call conque_gdb#change_gdb_exe(<q-args>)
96+
9497
" Command to delete the buffers ConqueGdb has opened
9598
command! -nargs=0 ConqueGdbBDelete call conque_gdb#delete_opened_buffers()
9699

97100
" Command to write a command to the gdb tertminal
98-
command! -nargs=* ConqueGdbCommand call conque_gdb#command(<q-args>)
101+
command! -nargs=+ ConqueGdbCommand call conque_gdb#command(<q-args>)
99102

100103
if g:conque_gdb_gdb_py_support
101104
exe 'nnoremap <silent> ' . g:ConqueGdb_ToggleBreak . ' :call conque_gdb#toggle_breakpoint(expand("%:p"), line("."))<CR>'

0 commit comments

Comments
 (0)