diff options
| author | Alexey Gladkov <gladkov.alexey@gmail.com> | 2020-03-11 18:22:46 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-03-11 22:43:59 +0100 |
| commit | 9d31ee5fc730cd3e3e9bb61fc55a7c3a19e3e07f (patch) | |
| tree | 7d588b7d99d2989e2ce47d0fb50655b689c6dd46 /.gitignore | |
| parent | 094d5a948d8c3d8c36f26f14c03cccae66e053a1 (diff) | |
| download | sparse-dev-9d31ee5fc730cd3e3e9bb61fc55a7c3a19e3e07f.tar.gz | |
Add semantic index utility
sindex is the simple to use cscope-like tool based on sparse/dissect.
Unlike cscope it runs after pre-processor and thus it can't index the
code filtered out by ifdef's, but otoh it understands how the symbol
is used and it can track the usage of struct members.
To create an index for your linux kernel configuration:
$ make C=2 CHECK="sindex add --"
Now, to find where a definition of the pid field from the task_struct
structure:
$ sindex search -m def task_struct.pid
(def) include/linux/sched.h 793 11 pid_t pid;
default output format:
SOURCE-FILE \t LINE-NUMBER \t COLUMN \t IN FUNCTION NAME \t CODE LINE
To find where this field changes:
$ sindex search -m w task_struct.pid
(-w-) fs/exec.c 1154 6 de_thread tsk->pid = leader->pid;
(-w-) kernel/fork.c 2155 3 copy_process p->pid = pid_nr(pid);
To get only filenames and line number you can change output format:
$ sindex search -f '%f:%l' -m w task_struct.pid
fs/exec.c:1154
kernel/fork.c:2155
Current limitations:
* inline functions are ignored;
* enums are ignored;
* unknown #include leads to a fatal error.
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to '.gitignore')
| -rw-r--r-- | .gitignore | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -19,6 +19,7 @@ graph obfuscate sparse sparse-llvm +sindex test-dissect test-inspect test-lexing |
