In this post, I will provide some useful resources to browse indexed linux code on the web.
The order below reflects my preference (it can be different for others, just try it out):
- Missing Link Electronics: lxr.linux.no was my earlier preference, but that seems to be down for a while now. After it's down, I found this website that seems to be the next best alternative. These are based on LXRng engine, which is a light weight variation of LXR engine.
- lxr.free-electrons.com: This is based on LXR engine which is more robust I believe, but I haven't tried using the engine myself yet. I also don't like the interface as much as I like the LXRng engine based websites.
The other non-web based indexing alternative I used before switching to web based indexer was cscope/ctags combo. The primary advantage of web based indexer is being able to browse code via links.
In fact, I liked web based indexing over cscope/ctags combo so much that I created an internal website at Brocade that helps developers and managers to browse the latest code for Brocade's internal development and release branches. LXrng engine can index any code not just linux. It became popular enough at Brocade to draw more than 1000 hits/day on average & has been up for more than 3 years now. Creating this service wasn't as simple of just using LXRng engine, but involved the following challenges:
- Bring up LXRng engine on a linux machine: LXRng engine just indexes the code repositories it is fed with.
- Scripting engine for auto updation of code repositories: As internal developmental branches are very dynamic and change on daily basis, I thought a daily indexer based on latest time stamps is a better idea. So, I created an additional scripting engine that can be run in a crontab on a daily basis. This engine updates the LXRng engine's code repositories and configuration files daily.
- DNS entry for internal Website: Pick an internal website name & create a DNS entry to the IP address of linux server on which LXRng engine is being run.
- Statistics: Develop a page that helps find the usage of the web service.
The main advantage of the service I created was in the scripting engine that automatically updates the latest code. That helps developers access latest code without having to spend time to index their code daily - which can take more than a hour for cscope/ctags users.
Some of the issues I observed while indxing code using LXRng engine are:
- Issue1 - Incorrect Results for Text Search: The results displayed in "Freetext Search" are found to be incorrect in some cases.
- Issue2 - Some Defunct Inlcude file links within C files: Reasons for this:
- The ability to click on an include file link is an advanced feature provided by the open source engine (LXRng) used for indexing. To provide this feature, LXRng requires information about include file directory names in it's configuration file. Linux's include files are all located in one directory: include/linux & hence configuring LXRng config file for linux code repository is easy. However, this need not be same with all code repositories. Include files may be distributed than centralized. So, providing information about all include paths of a code repository can be challenging for those who may not be aware of code organization thoroughly. If you miss any of the include paths, it results in this issue.
- If the directory name, under which your files exist, is not unique directory name in the system, local include file links of the c files in those directories will not open. For example, lets take linux code repository. And lets say a.h is used in a.c file under linux_2_6_34/mm. "a.h" in "a.c" doesn't open, as the directory (linux_2_6_34/mm) in which these files reside is not a unique directory name in linux codebase (there exists linux_2_6_34/arch/powerpc/mm is the duplicate directory). I haven't yet found a solution for this issue.
- Issue3 - Incorrect references for symbols in defunct h files: Another issue observed due to last two issues mentioned in Issue2 above is is that search results of structures or functions defined in defunct .h files would show references only to the h file in which it is defined, but ignores references in .c files. You can work around this issue by searching for the symbol in "Search" box instead.
- Issue4 - References not displayed in Compile macro "Code Search" results: "Code Search" section of Compile macro search results doesn't display the references. However, the references can be found in "Free text search" section.
- Issue5 - Incorrect interpretation of EXPORT_SYMBOL argument: The argument of EXPORT_SYMBOL calls is incorrectly reported as variable definitions.
- Issue6 - Links result on "Code search" results but not "Free text search" results: When displayed links are clicked, only "Code Search" results are displayed, but not "Free text Search" results. To get even "Free text results", search box can be used though.
For those interested in downloading the LXRng engine, here is the reference to my githib repository: https://github.com/babuneelam/lxrng.
Hope this helps.
References:
No comments:
Post a Comment