欢迎来到天天文库
浏览记录
ID:15399818
大小:4.42 MB
页数:99页
时间:2018-08-03
《linux调试和性能剖析手段(linux debug and profiling)》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、LinuxDebuggingandProfilingBarrySong2014GCCgcc+glibc+linux-header+make!The"makeheaders_install"commandexportsthekernel'sheaderfilesinaformsuitableforusebyuserspaceprograms.!Kernelheadersarebackwardscompatible,butnotforwardscompatible.ThismeansthataprogrambuiltagainstaClibraryusin
2、golderkernelheadersshouldrunonanewerkernel(althoughitmaynothaveaccesstonewfeatures),butaprogrambuiltagainstnewerkernelheadersmaynotworkonanolderkernel.!EmbeddedGLIBC(EGLIBC)wasavariantoftheGNUCLibrary(GLIBC)thatwasdesignedtoworkwellonembeddedsystems.EGLIBCstrivedtobesourceandbin
3、arycompatiblewithGLIBC.EGLIBC'sgoalsincludedreducedfootprint,configurablecomponents,bettersupportforcross-compilationandcross-testing.GCCcompilationprocess!Preprocessing!Compilation!Assembly!Linking$lshelloworld.c$gcc-Wall-save-tempshelloworld.c-ohelloworld$lshelloworldhelloworl
4、d.chelloworld.ihelloworld.ohelloworld.sThetemporaryfilesproducedby-save-tempsflaginonegocanbeproducedonebyonebyusingthegccflags-E,-Cand-Sateachofthepreprocessing,compilationandassemblystepsrespectively.preprocessing!Thepreprocessingstep:alltheheaderfilesthatyouhaveincludedinyour
5、programareactuallyexpandedandincludedinsourcecodeofyourprogram.Otherthanthis,allthemacrosarereplacedbytheirrespectivevaluesalloverthecodeandallthecommentsarestrippedoff.!Thecompilationstep:thesourcecodeisactuallycompiledbythecompilertoproduceanassemblycode.Assemblycodeconsistofs
6、etofinstructionsthatdeterminewhatyouprogramwantstodo.!Theassemblystep:theassemblerunderstandstheassemblyinstructionsandconvertseachofthemintothecorrespondingmachinelevelcodeorabitstreamthatconsistsof0’sand1’s.Thismachinelevelcodeisknownasobjectcodeandthiscodecanbeexecutedbythepr
7、ocessor.!Thelinkingstep:Oncetheobjectfilecontainingthemachinecodeisproducedinthestepabove,thelinkingstepmakessurethatalltheundefinedsymbolsincodeareresolved.Options:-O,-O1,-O2,-O3,-O0,-Os"Variouslevelsofoptimizationofthecode"-O1to-O3arevariousdegreesofoptimizationtargetedforspee
8、d"If-Oisadded,thenthecodesizeisconsidered"-O0me
此文档下载收益归作者所有