如何在搜索过程中使cscope显示完整的文件路径 [英] How to make cscope display full file paths during search

查看:141
本文介绍了如何在搜索过程中使cscope显示完整的文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 cscope 搜索C符号或全局定义时,它会显示文件名和行号。我想看到完整的文件路径,以便我可以跳转到我的arch特定文件。例如,在基于Linux代码库的 cscope build上搜索 __ switch_to 的全局定义时,我得到:

When I search for a C symbol or global definition using cscope, it displays the file-names and line numbers. I would like to see the full file-paths so that I can jump to my arch specific file. For example, when searching for global definition of __switch_to on cscope build on Linux code-base, I get:

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 每个<$ c不同$ C>拱。如何使 cscope 显示完整的文件路径?

Now, the file process.c is different for each arch. How to make cscope display the full file-paths?

推荐答案

运行cscope with args -pn

Run cscope with args -pn


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

-pn Display the last n file path components instead of the default (1). Use 0 not to display the file name at all.

使用cscope -p4运行并搜索__switch_to的全局定义会导致

Running with cscope -p4 and searching for global definition of __switch_to results in

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)

这篇关于如何在搜索过程中使cscope显示完整的文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆