sindex: Add option to search by location
PATCH 1/1 sindex: Add option to search by location
To create plugin for text editor, it may be useful to be able to search by position in a file.
$ sindex search -l include/uapi/linux/msdos_fs.h:91:8 (---) fs/fat/dir.c 759 1 fat_ioctl_filldir FAT_IOCTL_FILLDIR_FUNC(fat_ioctl_filldir, __fat_dirent) (r--) fs/fat/dir.c 759 1 fat_ioctl_filldir FAT_IOCTL_FILLDIR_FUNC(fat_ioctl_filldir, __fat_dirent) (m--) fs/fat/dir.c 759 1 fat_ioctl_filldir FAT_IOCTL_FILLDIR_FUNC(fat_ioctl_filldir, __fat_dirent) (def) include/uapi/linux/msdos_fs.h 91 8 long d_ino;
$ sindex search -l -m w include/uapi/linux/msdos_fs.h:91:8 (m--) fs/fat/dir.c 759 1 fat_ioctl_filldir FAT_IOCTL_FILLDIR_FUNC(fat_ioctl_filldir, __fat_dirent)
Another use is to get the full name of symbol in case of a high level of nesting:
$ sindex search -e fs/dcache.c:567 (--r) fs/dcache.c 567 9 __dentry_kill dentry->d_op->d_prune(dentry); (--r) fs/dcache.c 567 15 __dentry_kill dentry->d_op->d_prune(dentry);
$ sindex search -e --format='%n' fs/dcache.c:567 dentry.d_op dentry_operations.d_prune
$ sindex search -e --format='%n' fs/dcache.c:567:9 dentry.d_op
Signed-off-by Alexey Gladkov <[email protected]>
--- sindex.1 | 8 ++++++ sindex.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 80 insertions(+), 2 deletions(-)
sindex.1 +8 -0
@@ -17,6 +17,8 @@ sindex \- Semantic Indexer for C .B sindex [\fIoptions\fR] \fIsearch\fR [\fIcommand options\fR] [\fIpattern\fR] .br +.B sindex [\fIoptions\fR] \fIsearch\fR [\fIcommand options\fR] (\fI-e\fR|\fI-l\fR) \fIfilename\fR:\fIlinenr\fR:\fIcolumn\fR +.br .SH DESCRIPTION .P sindex is the simple to use cscope-like tool based on sparse/dissect. Unlike
@@ -75,6 +77,12 @@ specify a kind of symbol (see .BR KIND below). .TP +\fB-e\fR, \fB--explain\fR +Show what happens in the specified file position; +.TP +\fB-l\fR, \fB--location\fR +Show usage of symbols from a specific file position; +.TP \fB-v\fR, \fB--verbose\fR show information about what is being done; .TP
sindex.c +72 -2
119 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 2 lines · Alexey Gladkov
To create plugin for text editor, it may be useful to be able to search by position in a file.
Look Good. Thanks.
Applied and pushed.
-- Luc