Using NCC to analyze code

Source: Internet
Author: User

1 NCC is a compiler for outputting Some of the program's call information, etc. , can view function call relation , support function pointer To view the data structure and code . can be used to analyze and understand the code .

"" ... with NCC, in less than minutes I am able to comprehend the console I/O subsystem of the Linux kernel and within An hour I had already submitted a patch to the L-K mailing list. I ' m waiting for Linus to apply ... "an NCC user who wishes to remain anonymous

2 installing NCC, Pacman, yum or apt-get , or HTTP/// students.ceid.upatras.gr/~sxanth/ncc/

3 Change makefile

GCC changed to ncc-ncgcc-ncld-ncfabs-ncspp-nccpp= compiler

AR changed to nccar ld to nccld

Man NCC can see Help , NCC source package inside the README has detailed help .

Directory of the Build program, can seeXxx.nccout,note files in the dynamic-link library are not included, View the dynamic link library,can be used where the dynamic link library is compiledNCCand so replace the defaultGCCwait, some programswill clean up temporary files when compiling., so the dynamic link libraryXxx.nccoutThe files will be cleaned out ., the solution is, View detailed output information for compilation, copy it down ., ChangeGCCwait, then manually execute, can generateXxx.nccout

4 using Nccnavi to view the generated nccout file , man Nccnavi Helpful

G Global variables and functions, etc.

E the topmost function

Q Exit or previous level

O all functions in the file

Enter the mode2 and return

in Mode2

< > historical records

Spaces , viewing code

C execute shell command

Can be moved up and down, the first letter can be quickly positioned .

Refer to the Help documentation for a short period of time, and be sure to work with gdb and Nccnavi to analyze program flow and code .

5 If there is a function with the same name in different files , It may be an error , This time it is not suitable to put multiple files xxx.nccout Files grouped together

6 C99 and other new standards of code may be error, may need to change a bit.

7 If you cannot view the code, you can use the Clang compiler instead of the GCC compiler, which seems to be a poor format compatibility with the high version of GCC, unrecognized. c file (Clang will not install can Baidu)

Using NCC to analyze code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.