NAME¶
nccnav, nccnavi - explore the output of nccgen on a text-mode console
SYNOPSIS¶
nccnav [
Code.map]
nccnavi [
Code.map]
DESCRIPTION¶
This manual page documents briefly the
nccnav command which can be used
to browse the output generated by nccgen on a set of C / C++ files.
COMMANDS (Mode 1)¶
When first invoked, nccnav will display a list of source files.
- Arrow keys / Page up / Page down
- Can be used to navigate to the desired file
- Enter
- Selects a file and takes the user to Mode 2
- q
- Takes the user back to the previous screen
- O
- Displays a list of all the functions in the selected file
- a-z A-Z (except q)
- Moves the cursor to the function beginning with the specified
character
- E
- Displays a list of all functions not called by any other function
- G
- Displays a list of all the global variables
COMMANDS (Mode 2)¶
This mode is oriented around a resource which can be a: file, function, global
variable, member of structure, structure
For any of the above, all the related resources are listed. For example, in the
case of a <function> there are:
1. File(s) with <function> definition (may not exist)
2. Functions calling <function> (Blue)
3. Global variables used by <function> (Red)
4. <function-herself>
5. Functions called by <function>
Dim grey: functions that do not call any other functions.
Brown: functions that do call other functions.
Red: Recursion detector alert (if enabled)
6. Structure members used by <function> (Dark grey)
- 1-6 <ENTER>
- Recursively enter MODE 2 for that resource.
- q
- Pressing enter on 4 or typing 'q' will return to the previous screen.
- BACKSPACE
- The INITIAL SCREENS with a longjmp.
- <
- The HISTORY MODE.
- r
- Pressing 'r' on a red 5 get you to the UNROLL MODE.
- m
- Pressing 'm' on a function will get you to the POP-UP MODE
- C
- Pressing 'C' will run system("bash")
INTERNAL SOURCE VIEWER¶
Pressing <SPACE> on:
- ... a structure:
- Will extract and display the structure and declaration text.
- ... a function:
- Will display the function text as found in the file which contains the
function definition. For this to work, nccnav must be in the correct root
directory or paths should be absolute. The ncc option -ncfabs is rather
useful.
Note that if a function reports to be defined in more than one files, this
will probably fail. This happens because nccgen does not distinguish
different static functions with the same name. They are considered the
same thing and their resources are mixed in nccnav. Currently, if nccnav
detects more than one files for a function it will issue a warning.
- ... a file in Mode 2:
- Will display the contents of the entire file.
By default, the internal source viewer uses less. When invoked via
the nccnavi command, the source code is automatically indented and
viewed through less.
RECURSION DETECTOR¶
The recursion detector is enabled by default.
It can be disabled by pressing 'R' while in MODE 2. (it's supposed to be
expensive and may be confusing)
The recursion detector works in MODE 2 and if the current resource is a
function. In this case it will paint RED all the functions called by the
current function, which will eventually lead back to it by some way of
recursion.
Pressing 'r' on one of the red ones will display one of the possible paths
through which recursion can happen. Currently there is no way to view
alternative paths.
In this mode, 'q' will get you back while enter will proceed ahead deeper into
MODE 2 for the selected resource.
This is an alternative way to browse the call flow and is entered by pressing
'm' on a function in MODE 2.
Pop-up menus are generated, where the top element is a function and below it all
the functions called by it. Movement is possible with the UP/DOWN arrows.
<enter> or RIGHT will expand a new pop-up for the current function.
q or LEFT will close the current pop-up and activate the previous one.
SPACE is available to view the source code.
BACKSPACE will close all the popups and return to MODE 2.
Pressing '2' will enter MODE 2 for the current selected element. In this case,
HISTORY and BACKSPACE are set at this breakpoint.
HISTORY MODE¶
At any time you can press '<' and '>' to browse through all the previous
screens. <enter> on one of them will jump back to that screen. Any other
key will exit the HISTORY MODE.
EXAMPLE¶
Supposing you've compiled the linux kernel with nccgen. Collecting all the
.nccout files can be done with :
- find . -name \*.nccout | xargs cat > kernel.map
-
- You can use pathremover to truncate long paths in `kernel.map'.
-
- find . -name \*.nccout | xargs cat | pathremover
/mnt/src/hacks/linux-2.4.10/ > kernel.map
-
- Then, that's viewed with:
-
- nccnav kernel.map
-
- For more information on using nccgen on the Linux kernel, please refer
to:
- /usr/share/doc/ncc/hacking.LINUX-KERNEL
-
SEE ALSO¶
nccgen(1)
AUTHOR¶
nccnav was written by Stelios Xanthakis <sxanth@ceid.upatras.gr>.