当我使用以下命令搜索 C 符号或全局定义时cscope
,它显示文件名和行号。我想查看完整的文件路径,以便我可以跳转到我的拱门特定文件。例如,当搜索全局定义时__switch_to
on cscope
在 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
显示完整的文件路径?
使用 args -pn 运行 cscope
-pn 显示最后 n 个文件路径组成部分,而不是默认值 (1)。使用 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)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)