ch20 linux软件开发工具

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

20.12020LinuxLinux:„„„„LINUXC„LINUXC„LINUXC„admin,ar,gcc,ci,co,cvs,delta,emacs,gdb,get,grep,help,ident,indent,make,rcsmerge,nm,rcs,ranlib,rlog,strip,time20.2„LinuxzLinuxInternetWebLinuxLinuxLinuxInternetLinuxzLinuxFreeSoftwareFoundationGNUGNUGNU’snotUNIXGNUGNULinuxCshellGNU20.3LinuxLinux„GNUzzzzzzifif-elseif-elsez(typedef)20.4LinuxLinuxzifzignore_space_change_flagiCantReadThisz20.522LinuxLinux„Linux8„LinuxK&R„ThisVariableIsATemporaryCountertmp“count_active_users()”“cntusr()”„„20.620.220.2„„linuxshellperlvisualbasicvisualc++20.7Figure20.1Figure20.120.820.320.3Figure20.2Figure20.220.9Figure20.3Figure20.3TheprocessoftranslatingCprogramstoexecutablecodeTheprocessoftranslatingCprogramstoexecutablecodeC20.1020.520.5„cviemacspico„CzBrianKernighanDennisRitchie(UnixC)CC(K&R)zLINUXindentCzindentGNU20.11$moresecond.cmain(){inti,j;for(i=0,j=10;ij;i++){printf(LINUX\n);}}$indentsecond.c$lssecond.csecond.c~$moresecond.cmain(){inti,j;for(i=0,j=10;ij;i++){printf(LINUX\n);}}indentindentsecond.csecond.csecond.csecond.csecond.csecond.c~~GNU20.12CC„$moresecond.c~main(){inti,j;for(i=0,j=10;ij;i++){printf(LINUX\n);}}$20.13CC„$indent-kr-stsecond.cmain(){inti,j;for(i=0,j=10;ij;i++){printf(LINUX\n);}}„$indent-bad-kr-stsecond.cmain(){inti,j;for(i=0,j=10;ij;i++){printf(LINUX\n);}}K&R(-kr)-bad20.14CC„$indent-orig-stsecond.cmain(){inti,j;for(i=0,j=10;ij;i++){printf(LINUX\n);}}Berkeley(-orig)20.1520.5.3c20.5.3c„LinuxcgccGNUc/c++compiler„C++g++„gcczgcc[]z/-c.o-l-oa.out20.16cc$gccfirst.c#a.out$./a.out#Linux$gcc-osloganfirst.c#slogan$./slogan#Linux„-c$gcc-cdriver.c#driver.o$gcc-cstack.c#stack.o$gcc-cmisc.c#misc.o$gccdriver.ostack.omisc.o–opolish20.17cc„gcc-l„labm.apower.o„$gccpower.o-lm–opower“”20.1820.5.4make20.5.4make„make20.19makemake„makemakefile„GNUmakemakefilemakefile„makefileGNUmakefilemakefileMakefilemakemakemakefile„LinuxMakefile20.20makemake„Makefilemaketargetdependencycommand„makemake20.21makemake„Makefiletab„Makefilez“”make“clean”z“”z“”makeTAB„make“”“”“”20.22makemake„Makefile#Makefiletestprog.ocode.ogcc–otestprog.ocode.oprog.oprog.cprog.hcode.hgcc–cprog.c–oprog.ocode.ocode.ccode.hgcc–ccode.c–ocode.ocleanrm–f*.o20.23makemake„Makefiletestprog.ocode.ocleanMakefile\\„make$maketarget„targetMakefiletargetmakeMakefileMakefile“make”$maketest„testMakefilemaketesttesttestprog.ocode.o20.24makemake„prog.ocode.omakeprog.ocode.oprog.oprog.cprog.hcode.hmakeprog.omake“gcc–cprog.c–oprog.o”prog.o„code.ocode.ccode.hmakemaketestprog.ocode.o.otesttestmakegccprog.ocode.otest„MakefilecleanMakefile„makemakemakefileMakefile20.25MakefileMakefile„MakefilemakemakezgcczLinuxgcczgcc20.26MakefileMakefile„MakefileMakefile“”VARNAME=string„$${VARNAME}„makeVARNAMEMakefileMakefileMakefile20.27MakefileMakefile„MakefileOBJS=prog.ocode.oCC=gcctest${OBJS}${CC}–otest${OBJS}prog.oprog.cprog.hcode.h${CC}–cprog.c–oprog.ocode.ocode.ccode.h${CC}–ccode.c–ocode.ocleanrm–f*.o20.28MakefileMakefile„make„makemakeshellMakefile„Makefile„Makefile20.2920.4make20.4make20.3020.5make20.5make20.3120.620.6makemake20.32„(functionpoints)„gprof20.33GDBGDB„LinuxGNUgdbCC++gdbzzzzzz20.34GDBGDB20.35GDBGDB„gdbgdbgcc-g„gdb„gdbgdbgdb20.36GDBGDBGNUgdbRedHatLinux(5.3post-0.20021129.18rh)Copyright2003FreeSoftwareFoundation,Inc.GDBisfreesoftware,coveredbytheGNUGeneralPublicLicense,andyouarewelcometochangeitand/ordistributecopiesofitundercertainconditions.Typeshowcopyingtoseetheconditions.ThereisabsolutelynowarrantyforGDB.Typeshowwarrantyfordetails.ThisGDBwasconfiguredasi386-redhat-linux-gnu.(gdb)„gdbhelp.gdbbreakgdbbreakbreakbreak„LinuxShellmangdbman20.37GDBGDB„gdb,gdbz1filez2cdz3pwdz4runz5killz6listz7breakz8tbreakbreaktbreak20.38GDBGDBz9watchz10awatchwatchz11rwatchwatchz12nextrunz13steprunz14displayz15infobreak20.39GDBGDBz16infofilesz17infofuncz18infolocalz19infoprogz20printz21deletez22shellLinuxShellz23makegdbz24helpgdbz25quitgdb20.40GDBGDB„$gcc-gbugged.c-obugged„$gdb-qbugged(gdb)„gdb20.41„timeshell„“::.”„time[]z()()()20.42RCS/CVSRCSrcsRCS1RCSRCS[root@wyhlinux]#mkdirRCSciRCS[root@wyhlinux]#citest.c20.43[root@wyhlinux]#cotest.c-l[root@wyhlinux]#co-ltest.cRCS-l[root@wyhlinux]#ci-ltest.cRCS[root@wyhlinux]#rcsdifftest.c2coRCSRCS-r[root@wyhlinux]#ci-l-r3.25test.c--3.2520.44[root@wyhlinux]#co-l-r1.2test.c--RCS1.2test.crcsdiff[root@wyhlinux]#rcsdiff-r3.25test.c--3.25test.c3RCSRCS$Author$RCS$Data$RCS$Header$RCS20.451[root@wyhlinux]#vitest.c2RCS[root@wyhlinux]#ci-ltest.c3co[root@wyhlinux]#co-ltest.c[root@wyhlinux]#cattest.c20.46CVS–1CVS“”“”20.47CVSROOTCVSinit#CVSROOT=/usr/local/cvsroot;exportCVSROOT#cvsinit#ls-l$CVSROOT2$CVSROOT/cvstest/c-mvicvstest/cCVSwu,cvstest20.483$CVSROOT/CVSROOT/modules:#cvscheckoutCVSROOT/modulesmodulesSOURCEcvstest/c20.49#cvscommit–m“AddSOURCE”cvstest/c#cvscheckoutSOURCE$CVSROOT2cvsadd[-kkflags][-mmessage]files...-k-mcvsremove[options]files20.503cvscommit[-Rl][-mmesg]files-R-l-m4cvsrelease–dSOURCEcvstest/crm–rfcvstest4#cvsupdate20.51CVStest.c1.4AB1.5ACVS2cvslog[-lR][-rrev][-ddate][-wlogin][files…]-l-R-r-d-wcvsannotate[-lR][-rrev|-Ddate]files20.52-l-R-rcvsrtag–b–rrev_rootre

1 / 62
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功