how can I find where is the macro or function deifined
Hi; when I used libc I never memorized where each function is located beyond the basics (for example I never knew if strlen is in string.h or ctype.h or strlib.h ) I just check out the functions man pages by man strlen is their such functionality for the kernel where I dont need to memorize the dependencies for example if MODULE_LICENSE is in kernel.h or module.h with out using the internel to google them .
On Tue 28 Jul, 2015 21:41 Ahmed Soliman <ahmedsoliman0x666@gmail.com> wrote: Hi; when I used libc I never memorized where each function is located beyond the basics (for example I never knew if strlen is in string.h or ctype.h or strlib.h ) I just check out the functions man pages by man strlen is their such functionality for the kernel where I dont need to memorize the dependencies for example if MODULE_LICENSE is in kernel.h or module.h with out using the internel to google them . ______________________________________________ You can use cscope and/or ctags to jump directly to the symbol definition.
On Tue, Jul 28, 2015 at 06:03:16PM +0200, Ahmed Soliman wrote:
Hi; when I used libc I never memorized where each function is located beyond the basics (for example I never knew if strlen is in string.h or ctype.h or strlib.h ) I just check out the functions man pages by man strlen is their such functionality for the kernel where I dont need to memorize the dependencies for example if MODULE_LICENSE is in kernel.h or module.h with out using the internel to google them .
*make tags* in the root directory of the kernel tree. Then a file named TAGS is created. TAGS is treated as one part of the tree when *git status*. You can load it with Vim or emacs. Google it for details.
Can you give a procedure step by step please to answer please ? B. Regards Gnogbo Le 28 juil. 2015 17:41, "Navy Cheng" <navych@126.com> a écrit :
On Tue, Jul 28, 2015 at 06:03:16PM +0200, Ahmed Soliman wrote:
Hi; when I used libc I never memorized where each function is located beyond the basics (for example I never knew if strlen is in string.h or ctype.h or strlib.h ) I just check out the functions man pages by man strlen is their such functionality for the kernel where I dont need to memorize the dependencies for example if MODULE_LICENSE is in kernel.h or module.h with out using the internel to google them .
*make tags* in the root directory of the kernel tree. Then a file named TAGS is created. TAGS is treated as one part of the tree when *git status*. You can load it with Vim or emacs. Google it for details.
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Tue, 28 Jul 2015 23:54:36 -0000, Gnoleba GNOGBO said:
Can you give a procedure step by step please to answer please ?
http://www.lmgtfy.com/?q=ctags+vim+tutorial http://www.lmgtfy.com/?q=ctags+emacs+tutorial
On Tue, Jul 28, 2015 at 08:25:04PM -0400, Valdis.Kletnieks@vt.edu wrote:
On Tue, 28 Jul 2015 23:54:36 -0000, Gnoleba GNOGBO said:
Can you give a procedure step by step please to answer please ?
http://www.lmgtfy.com/?q=ctags+vim+tutorial http://www.lmgtfy.com/?q=ctags+emacs+tutorial
Hi, Valdis Thanks for your answer but I can't open these links. For example, you have a kernel tree, ~/linux-4.1, in your pc. steps: + cd ~/linux-4.1 + make tags => Now,TAGS is created + Both emacs and vim can use TAGS. I don't konw if other editers can do such things + for emacs: + *M-x visit-tags-table* and load TAGS + M-. =>find tag + C-u M-. =>go to the next matched tag + M-* => return to last tag + for vim: + Just open vim in ~/linux-4.1 + open the source files and put the cursor on the tags you are interested + ctrl + ] => goto the tag + ctrl + t => return to your last tag tips: Hi,gnognoleba I think these answers is easy to find on the internet, and learning from the internet is a important skill. Finding on net is faster for you. It's better to google it first. If there is not answers you want, come to here and every one is pleasure to help you. Hi
Hi, git grep is very usefull to find stuff in the kernel tree. You can find macros using: git grep -n '#define list_entry(' to find file and line number of the macro list_entry. Regards, Iuro Nascimento On Tue, Jul 28, 2015 at 06:03:16PM +0200, Ahmed Soliman wrote:
Hi; when I used libc I never memorized where each function is located beyond the basics (for example I never knew if strlen is in string.h or ctype.h or strlib.h ) I just check out the functions man pages by man strlen is their such functionality for the kernel where I dont need to memorize the dependencies for example if MODULE_LICENSE is in kernel.h or module.h with out using the internel to google them .
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
participants (6)
-
Ahmed Soliman -
Gnoleba GNOGBO -
Iuro Nascimento -
Manavendra Nath Manav -
Navy Cheng -
Valdis.Kletnieks@vt.edu