如何使搜索过程中的cscope显示完整的文件路径(How to make cscope displa

2019-08-04 06:09发布

当我搜索了C符号或全球使用的定义cscope ,它会显示文件名和行号。 我希望看到完整的文件路径,这样我可以跳到我的拱特定的文件。 例如,对于全球定义搜索时__switch_tocscope在Linux代码库的构建,我得到:

Global definition: __switch_to

  File         Line
0 process.c    297 struct task_struct *__switch_to(struct task_struct *prev,
1 switch_to.h   44 #define __switch_to(prev,next,last) do { \
2 process.c    202 struct task_struct *__switch_to(struct task_struct *old,
3 process.c    400 struct task_struct *__switch_to(struct task_struct *prev,
4 process_32.c 211 __switch_to(struct task_struct *prev, struct task_struct *next)
5 process.c     80 void *__switch_to(struct task_struct *from, struct task_struct *to)
6 process_32.c 248 __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
7 process_64.c 272 __switch_to(struct task_struct *prev_p, struct task_struct *next_p)

现在,该文件process.c对于每个不同的arch 。 如何使cscope显示完整的文件路径?

Answer 1:

运行cscope的命令ARGS -pn

-pn显示而不是默认的(1)的最后n个文件路径的部件。 使用0完全不显示文件名。

使用cscope -p4运行和搜索的结果__switch_to全球定义

Global definition: __switch_to

  File                           Line
0 arch/arm64/kernel/process.c    297 struct task_struct *__switch_to(struct task_struct *prev,
1 ia64/include/asm/switch_to.h    44 #define __switch_to(prev,next,last) do { \
2 arch/openrisc/kernel/process.c 202 struct task_struct *__switch_to(struct task_struct *old,
3 arch/powerpc/kernel/process.c  400 struct task_struct *__switch_to(struct task_struct *prev,
4 arch/sh/kernel/process_32.c    211 __switch_to(struct task_struct *prev, struct task_struct *next)
5 arch/um/kernel/process.c        80 void *__switch_to(struct task_struct *from, struct task_struct *to)
6 arch/x86/kernel/process_32.c   248 __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
7 arch/x86/kernel/process_64.c   272 __switch_to(struct task_struct *prev_p, struct task_struct *next_p)


文章来源: How to make cscope display full file paths during search