Skip to content

Commit

Permalink
gdbinit: add new regex based parser
Browse files Browse the repository at this point in the history
Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed Jul 23, 2015
1 parent cc28344 commit dc1427d
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ PRELOAD_OPTLIB = \
\
coffee.ctags \
ctags.ctags \
gdbinit.ctags \
m4.ctags \
mib.ctags \
\
Expand Down
4 changes: 4 additions & 0 deletions Units/gdbinit-simple.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--options=gdbinit
--languages=+gdbinit
--kinds-gdbinit=*

4 changes: 4 additions & 0 deletions Units/gdbinit-simple.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ybuffer-contents input.gdb /^define ybuffer-contents$/;" d
ybuffer-contents input.gdb /^document ybuffer-contents$/;" D
yfile_buffers_only input.gdb /^set $yfile_buffers_only = 0$/;" t
yverbose input.gdb /^set $yverbose = 1$/;" t
20 changes: 20 additions & 0 deletions Units/gdbinit-simple.d/input.gdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Taken from /usr/share/emacs/24.5/etc/emacs-buffer.gdb

set main
set $yverbose = 1
set $yfile_buffers_only = 0

define ybuffer-contents
ydump-buffer $arg0 /dev/stdout
if $yverbose && $buf->z_byte <= 1
yget-current-buffer-name
printf "[Buffer \"%s\" is empty.]\n", $ycurrent_buffer_name
else
if *($endptr-1) != '\n'
echo \n
end
end
end
document ybuffer-contents
Write contents of buffer N (numbered according to `ybuffer-list') to stdout.
end
52 changes: 52 additions & 0 deletions data/optlib/gdbinit.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
#
# Copyright (c) 2015, Red Hat, Inc.
# Copyright (c) 2015, Masatake YAMATO
#
# Author: Masatake YAMATO <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
#
#
--langdef=gdbinit
--languages=-gdbinit
--map-gdbinit=+(.gdbinit)
--map-gdbinit=+.gdb

##
## Ignore comments
##
--regex-gdbinit=/^#.*//{exclusive}

##
## define
##
--regex-gdbinit=/^define[[:space:]]+([^[:space:]]+)$/\1/d,definition/

##
## document
##
--regex-gdbinit=/^document[[:space:]]+([^[:space:]]+)$/\1/D,document/{optional}

##
## set $...
##
--regex-gdbinit=/^set[[:space:]]+\$([a-zA-Z0-9_]+)[[:space:]]*=/\1/t,toplevel-variable/

##
## __...set $...
##
--regex-gdbinit=/^[[:space:]]+set[[:space:]]+\$([a-zA-Z0-9_]+)[[:space:]]*=/\1/l,local-variable/{optional}
1 change: 1 addition & 0 deletions misc/tinst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ check()
T_existing /share/ctags/optlib/m4.ctags -f -r
T_existing /share/ctags/optlib/coffee.ctags -f -r
T_existing /share/ctags/optlib/ctags.ctags -f -r
T_existing /share/ctags/optlib/gdbinit.ctags -f -r
T_existing /share/ctags/optlib/mib.ctags -f -r

T_existing /share/ctags/preload/default.ctags -f -r
Expand Down

0 comments on commit dc1427d

Please sign in to comment.