Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Guide to Unix/Commands/SW Development

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

adb A debugger. A GNU alternative is gdb. Links: adb man page, man.cat-v.org sdb man page, man.cat-v.org ar Creates an archive from files. The usual use is to create an archive from compiled object files, where the archive is fed to a linker. Links: ar, opengroup.org ar man page, man.cat-v.org ar, freebsd.org ar in GNU Binary Utilities, sourceware.org W:Ar (Unix) as Compiles assembly source code. Links: as man page, man.cat-v.org as, freebsd.org GNU as manual, sourceware.org W:GNU Assembler cc Compiles C language source code. A GNU alternative is gcc. Another alternative is clang. Links: c99, opengroup.org cc man page, man.cat-v.org clang, freebsd.org GCC online documentation, gcc.gnu.org cflow Outputs call graph for C language source code. Links: cflow, opengroup.org cflow man page, man.cat-v.org cflow, freebsd.org GNU cflow manual, gnu.org ctags Creates a tags file from source code. The tags file is a text index to object definitions and object uses where objects include variables, functions and the like. The file helps users and tools such as text editors navigate source code. Emacs uses its own variant called etags; alternatively, you can use Exuberant ctags with option -e to generated Emacs-format tags file. Links: ctags, opengroup.org ctags, freebsd.org Exuberant ctags, ctags.sourceforge.net W:Ctags cxref Outputs cross referencing information on C language source code files. Links: cxref, opengroup.org cref man page, man.cat-v.org cxref, freebsd.org f77 Compiles Fortran 77 source code. GNU Fortran compiler used to be invoked via g77, and now is invoked via gfortran. Links: fort77, opengroup.org f77 man page, man.cat-v.org The GNU Fortran Compiler manual, gcc.gnu.org; also available as pdf gcc GNU Compiler Collection is a compiler suite for C, C++ and some other languages. The C language can be compiled using gcc command: gcc test.c Compiles test.c, links it with requisite libraries, and creates a resulting executable, which is a.out or a.exe. gcc test.c -o test Compiles test.c, links it with requisite libraries, and creates test executable. gcc -c mod.c -o mod.o Compiles mod.c into mod.o object file. Linking is prevented by -c option. gcc test.c -o test mod.o Compiles test.c, links it with mod.o, and creates test executable as a result. g++ test.cpp -o test Compiles and links C++ source code. Links: GCC online documentation, gcc.gnu.org GCC and Make - Compiling, Linking and Building C/C++ Applications, ntu.edu.sg gdb Part of the GNU project, helps debug C/C++ programs and those in some other languages. A program to be debugged needs to be compiled with -g flag. Then you can start gdb like gdb myprog, which enters gdb shell without running the program. Once in the gdb shell, you can control gdb by typing commands: break main Sets a breakpoint at function main. b main Shorthand for the above. In general, prefixes of commands can be used as long as they are unambiguous. break MySource.c:145 Sets a breakpoint at line 145 of source code MySource.c. break MySource.c:145 if myvar > 3 Sets a conditional breakpoint. watch myvar Creates a watchpoint, which stops the execution when the variable or expression is changed. watch myvar if myvar > 3 Creates a conditional watchpoint. info break Lists breakpoints. info watch Lists watchpoints. run Runs the program. Initially, the program is not running. A program can be run multiple times from the same gdb session. continue Continues execution until the next breakpoint or until the end. step Executes one step of the program, entering into function calls if applicable- next Executes one step of the program without nesting into function calls. quit Quits the debugger. print myvar Outputs the value of the variable. print (myvar * 3) << 4 Outputs the value of an expression that it calculates. disp myvar Adds the variable to a list of expressions to be output on each step. set myvar = 1 Changes the value of a variable. set myvar = 1 << 4 Changes the value of a variable, supporting evaluation of an expression. where Outputs the call stack. help breakpoints Outputs help on the subject of breakpoints, including commands that deal with breakpoints. Elsewhere in Wikibooks: GCC Debugging/gdb, Linux Applications Debugging Techniques/The debugger. Links: gdb, freebsd.org Debugging with GDB, sourceware.org GDB wiki, sourceware.org GDB Quick Reference , csl.mtu.edu GDB to LLDB Command Map, lldb.llvm.org GNU Debugger, en.wikipedia.org ld Links object files into an executable. Links: ld man page, man.cat-v.org ld, freebsd.org GNU ld manual, sourceware.org LLD - The LLVM Linker, lld.llvm.org lex Generates C language source code for a lexical analyzer based on provided lexical rules. Links: lex, opengroup.org lex man page, man.cat-v.org lex, freebsd.org flex, github.com W:Lex (software) lint Outputs suspect things in C language source code. Links: lint man page, man.cat-v.org lint, freebsd.org Splint Manual, splint.org make Drives a file production process based on a specification of dependencies between production input files and output files. The file production process so driven is usually compilation and linking. Links: make, opengroup.org make man page, man.cat-v.org make, freebsd.org GNU make manual, gnu.org nm Outputs symbol names found in an object file or a similar file having symbols in it. Links: nm, opengroup.org nm man page, man.cat-v.org nm, freebsd.org nm in GNU Binary Utilities, sourceware.org objdump Outputs information from object files, such as disassembly. Not covered by POSIX. A similar tool for macOS is or used to be otool. Links: objdump, freebsd.org objdump in GNU Binary Utilities, sourceware.org otool source code, opensource.apple.com prof Profiles a program, identifying code locations that cost most time. Links: prof man page, man.cat-v.org gprof, freebsd.org GNU gprof manual, sourceware.org strip Removes certain information from executable and similar files resulting from compilation, unnecessary for certain purposes. Links: strip, opengroup.org strip man page, man.cat-v.org strip, freebsd.org strip in GNU Binary Utilities, sourceware.org yacc Generates C language source code for a parser based on a provided grammar specification. Stands for yet another compiler compiler. A GNU alternative is bison, compatible with yacc. Links: yacc, opengroup.org yacc man page, man.cat-v.org yacc, freebsd.org Bison manual, gnu.org