From dc1427d521c47e82e636b68da214730855b07941 Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Fri, 17 Jul 2015 04:25:07 +0900 Subject: [PATCH] gdbinit: add new regex based parser Signed-off-by: Masatake YAMATO --- Makefile.in | 1 + Units/gdbinit-simple.d/args.ctags | 4 +++ Units/gdbinit-simple.d/expected.tags | 4 +++ Units/gdbinit-simple.d/input.gdb | 20 +++++++++++ data/optlib/gdbinit.ctags | 52 ++++++++++++++++++++++++++++ misc/tinst | 1 + 6 files changed, 82 insertions(+) create mode 100644 Units/gdbinit-simple.d/args.ctags create mode 100644 Units/gdbinit-simple.d/expected.tags create mode 100644 Units/gdbinit-simple.d/input.gdb create mode 100644 data/optlib/gdbinit.ctags diff --git a/Makefile.in b/Makefile.in index cbc15b3bba..cff47d2148 100644 --- a/Makefile.in +++ b/Makefile.in @@ -121,6 +121,7 @@ PRELOAD_OPTLIB = \ \ coffee.ctags \ ctags.ctags \ + gdbinit.ctags \ m4.ctags \ mib.ctags \ \ diff --git a/Units/gdbinit-simple.d/args.ctags b/Units/gdbinit-simple.d/args.ctags new file mode 100644 index 0000000000..b1d0f12ab4 --- /dev/null +++ b/Units/gdbinit-simple.d/args.ctags @@ -0,0 +1,4 @@ +--options=gdbinit +--languages=+gdbinit +--kinds-gdbinit=* + diff --git a/Units/gdbinit-simple.d/expected.tags b/Units/gdbinit-simple.d/expected.tags new file mode 100644 index 0000000000..6290d50046 --- /dev/null +++ b/Units/gdbinit-simple.d/expected.tags @@ -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 diff --git a/Units/gdbinit-simple.d/input.gdb b/Units/gdbinit-simple.d/input.gdb new file mode 100644 index 0000000000..0b2185f04c --- /dev/null +++ b/Units/gdbinit-simple.d/input.gdb @@ -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 diff --git a/data/optlib/gdbinit.ctags b/data/optlib/gdbinit.ctags new file mode 100644 index 0000000000..d8b4c2530e --- /dev/null +++ b/data/optlib/gdbinit.ctags @@ -0,0 +1,52 @@ +# +# +# Copyright (c) 2015, Red Hat, Inc. +# Copyright (c) 2015, Masatake YAMATO +# +# Author: Masatake YAMATO +# +# 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} diff --git a/misc/tinst b/misc/tinst index 11820e8e47..df99a76e2d 100644 --- a/misc/tinst +++ b/misc/tinst @@ -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