Resumo do conteúdo contido na página número 1
Tru64 UNIX
Kernel Debugging
Part Number: AA-RH99A-TE
July 1999
Product Version: Tru64UNIX Version 5.0or higher
Thismanualexplainshowtousetoolstodebugakernelandanalyzea
crashdumpoftheTru64UNIX(formerlyDIGITALUNIX)operating
system.Also,thismanualexplainshowtowriteextensionstothekernel
debuggingtools.
Compaq Computer Corporation
Houston, Texas
Resumo do conteúdo contido na página número 2
©1999CompaqComputerCorporation COMPAQandtheCompaqlogoRegisteredinU.S.PatentandTrademarkOffice. AlphaandTru64are trademarksofCompaqInformationTechnologiesGroup,L.PintheUnitedStatesandothercountries. MicrosoftandWindowsaretrademarksofMicrosoftCorporationintheUnitedStatesandothercountries. UNIXandTheOpenGrouparetrademarksofTheOpenGroup.Allotherproductnamesmentionedherein maybetrademarksoftheirrespectivecompanies. Confidentialcomputersoftware. ValidlicensefromCompaqrequiredforpossession,use,orcopyin
Resumo do conteúdo contido na página número 3
Contents About This Manual 1 Introduction to Kernel Debugging 1.1 LinkingaKernelImageforDebugging............................ 1–1 1.2 DebuggingKernelPrograms ........................................ 1–3 1.3 DebuggingtheRunningKernel..................................... 1–3 1.4 AnalyzingaCrashDumpFile ...................................... 1–5 2 Kernel Debugging Utilities 2.1 ThedbxDebugger .................................................... 2–2 2.1.1 InvokingthedbxDebuggerforKernelDebugging ...
Resumo do conteúdo contido na página número 4
2.2.3.9 DisassemblingInstructions ................................ 2–21 2.2.3.10 DisplayingRemoteExportedEntries .................... 2–21 2.2.3.11 DisplayingtheFileTable .................................. 2–21 2.2.3.12 DisplayingtheudbandtcbTables........................ 2–22 2.2.3.13 PerformingCommandsonLists .......................... 2–22 2.2.3.14 DisplayingthelockstatsStructures ...................... 2–24 2.2.3.15 DisplayinglockinfoStructures ............................ 2–25 2.2.3.16 Disp
Resumo do conteúdo contido na página número 5
3.2.7 CheckingArgumentsPassedtoanExtension ............... 3–7 3.2.8 CheckingtheFieldsinaStructure............................ 3–7 3.2.9 SettingthekdbxContext ....................................... 3–8 3.2.10 PassingCommandstothedbxDebugger..................... 3–9 3.2.11 DereferencingaPointer ......................................... 3–9 3.2.12 DisplayingtheErrorMessagesStoredinFields ............ 3–10 3.2.13 ConvertingaLongAddresstoaStringAddress ............ 3–10 3.2.14 FreeingMemory .......
Resumo do conteúdo contido na página número 6
A Output from the crashdc Command Index Examples 3–1 TemplateExtensionUsingLists.................................... 3–23 3–2 ExtensionThatUsesLinkedLists:callout.c ..................... 3–24 3–3 TemplateExtensionsUsingArrays ................................ 3–27 3–4 ExtensionThatUsesArrays:file.c................................. 3–28 3–5 ExtensionThatUsesGlobalSymbols:sum.c..................... 3–34 Figures 2–1 UsingaGatewaySystemDuringRemoteDebugging........... 2–38 Tables 2–1 ThedbxAddressMod
Resumo do conteúdo contido na página número 7
About This Manual Thismanualprovidesinformationonthetoolsusedtodebugakerneland analyzeacrashdumpfileoftheTru64™UNIX(formerlyDIGITALUNIX) operatingsystem. Italsoexplainshowtowriteextensionstothekernel debuggingtools. Youcanuseextensionstodisplaycustomizedinformation fromkerneldatastructuresoracrashdumpfile. Audience Thismanualisintendedforsystemprogrammerswhowriteprogramsthat usekerneldatastructuresandarebuiltintothekernel. Itisalsointended forsystemadministratorswhoareresponsibleformanagingtheop
Resumo do conteúdo contido na página número 8
Organization Thismanualconsistsoffourchaptersandoneappendix: Chapter1 Introduces the concepts of kernel debugging and crash dump analysis. Describes the tools used to debug kernels and Chapter2 analyze crash dump files. Chapter3 Describeshowtowritea kdbxdebuggerextension. This chapterassumesyouhavepurchasedandinstalledaTru64 UNIXSourceKitandsohaveaccesstosourcefiles. Chapter4 Providesbackgroundinformationusefulforandexamples of analyzing crashdump files. AppendixA Containsexampleoutputfromthe cr
Resumo do conteúdo contido na página número 9
G Manuals for general users S Manualsforsystemandnetworkadministrators P Manuals for programmers R Manualsforreferencepage users Somemanualsinthedocumentationhelpmeettheneedsofseveral audiences. Forexample,theinformationinsomesystemmanualsisalso usedbyprogrammers. Keepthisinmindwhensearchingforinformation onspecifictopics. TheDocumentationOverviewprovidesinformationonallofthemanualsin theTru64UNIXdocumentationset. Reader’s Comments Compaqwelcomesanycommentsandsuggestionsyouhaveonthisand otherTru
Resumo do conteúdo contido na página número 10
% $ ApercentsignrepresentstheCshellsystemprompt. Adollarsignrepresentsthesystempromptforthe Bourne,Korn,andPOSIXshells. # Anumbersignrepresentsthesuperuserprompt. % cat Boldfacetypeininteractiveexamplesindicates typeduserinput. file Italic(slanted)typeindicatesvariablevalues, placeholders,andfunctionargumentnames. [|] {|} Insyntaxdefinitions,bracketsindicateitemsthat areoptionalandbracesindicateitemsthatare required. Verticalbarsseparatingitemsinside bracketsorbracesindicatethatyouchooseoneitem
Resumo do conteúdo contido na página número 11
1 Introduction to Kernel Debugging Kerneldebuggingisatasknormallyperformedbysystemsengineerswriting kernelprograms. Akernelprogramisonethatisbuiltaspartofthekernel andthatreferenceskerneldatastructures. Systemadministratorsmight alsodebugthekernelinthefollowingsituations: • Aprocessishungorstopsrunningunexpectedly • Theneedarisestoexamine,andpossiblymodify,kernelparameters • Thesystemitselfhangs,panics,orcrashes Thismanualdescribeshowtodebugkernelprogramsandthekernel.Italso includesinformationab
Resumo do conteúdo contido na página número 12
textfilethatdescribesthehardwareandsoftwarethatwillbepresenton therunningsystem. Usingthisinformation,thebootstraplinkerlinksthe modulesthatareneededtosupportthishardwareandsoftware.Thelinker buildsthekerneldirectlyintomemory. Youcannotdirectlydebugabootstrap-linkedkernelbecauseyoumustsupply thenameofanimagetothekerneldebuggingtools.Withouttheimage,the toolshavenoaccesstosymbolnames,variablenames,andsoon.Therefore, thefirststepinanykerneldebuggingeffortistodeterminewhetheryour kernelwaslinkedatb
Resumo do conteúdo contido na página número 13
1.2 Debugging Kernel Programs Kernelprogramscanbedifficulttodebugbecauseyounormallycannot controlkernelexecution. Tomakedebuggingkernelprogramsmore convenient,thesystemprovidesthe kdebugdebugger. The kdebug debuggeriscodethatresidesinsidethekernelandallowsyoutousethedbx debuggertocontrolexecutionofarunningkernelinthesamemanneras youcontrolexecutionofauserspaceprogram. Todebugakernelprogram inthismanner,followthesesteps: 1. Buildyourkernelprogramintothekernelonatestsystem. 2. Setupthe kdebugdebug
Resumo do conteúdo contido na página número 14
# dbx -k /vmunix /dev/mem Thiscommandinvokes dbxwiththekerneldebuggingflag, −k,which mapskerneladdressestomakekerneldebuggingeasier.The/vmunixand /dev/memparameterscausethedebuggertooperateontherunningkernel. Onceinthedbxenvironment,youusedbxcommandstodisplayprocessIDs andtraceexecutionofprocesses.Youcanperformthesametasksusingthe kdbxdebugger. Thefollowingexampleshowsthedbxcommandyouuseto displayprocessIDs: (dbx) kps PID COMM 00000 kernel idle 00001 init 00014 kloadsrv 00016 update . . . Ifyouw
Resumo do conteúdo contido na página número 15
1.4 Analyzing a Crash Dump File Ifyoursystemcrashes,youcanoftenfindthecauseofthecrashbyusing dbxorkdbxtodebugoranalyzeacrashdumpfile. Theoperatingsystemcancrashbecauseoneofthefollowingoccurs: • Hardwareexception • Softwarepanic • Hungsystem Whenasystemhangs,itisoftennecessarytoforcethesystemtocreate dumpsthatyoucananalyzetodeterminewhythesystemhung. The SystemAdministrationmanualdescribestheprocedureforforcinga crashdumpofahungsystem. • Resourceexhaustion Thesystemcrashesorhangsbecauseitcannotco
Resumo do conteúdo contido na página número 16
Atsystemreboottime,thecopyofcorememorysavedintheswappartitions iscopiedintoafile,calledacrashdumpfile. Youcananalyzethecrash dumpfiletodeterminewhatcausedthecrash.Bydefault,thecrashdumpis apartial(ratherthanfull)dumpandisincompressedform. Forcomplete informationaboutmanagingcrashdumpsandcrashdumpfiles,including howtochangedefaultsettings,seetheSystemAdministrationmanual.For examplesofanalyzingcrashdumpfiles,seeChapter4. 1–6 Introduction to Kernel Debugging
Resumo do conteúdo contido na página número 17
2 Kernel Debugging Utilities TheTru64UNIXsystemprovidesseveraltoolsyoucanusetodebugthe kernelandkernelprograms.TheLadebugdebugger(availableasanoption) isalsocapableofdebuggingthekernel. Thischapterdescribesthreedebuggersandautilityforanalyzingcrash dumps: • Thedbxdebugger,whichisdescribedforkerneldebugginginSection2.1. (Forgeneraldbxuserinformation,seetheProgrammer’sGuide.) Youcanusethedbxdebuggertodisplaythevaluesofkernelvariables andkernelstructures. However,youmustunderstandthestructures andb
Resumo do conteúdo contido na página número 18
______________________ Note _______________________ StartingwithTru64UNIXVersion5.0,allthepreviously mentionedtoolscanbeusedwithcompressed(vmzcore.n)and uncompressed(vmcore.n)crashdumpfiles. Olderversionsof thesetoolscanreadonly vmcore.nfiles. Ifyouareusingan olderversionofatool,usetheexpand_dumputilitytoproduce a vmcore.nfilefroma vmzcore.nfile. Formoreinformation aboutcompressedanduncompressedcrashdumpfiles,see expand_dump(8)andtheSystemAdministrationmanual. 2.1 The dbx Debugger The dbxdebugge
Resumo do conteúdo contido na página número 19
• Thesystemcorememoryimage Thesefilesmaybefilesfromarunningsystem,suchas /vmunixand /dev/mem,ordumpfiles,suchasvmunix.nandvmzcore.n(compressed) orvmcore.n(uncompressed). Bydefault,crashdumpfilesarecreatedin the/var/adm/crashdirectory(seetheSystemAdministrationmanual). ______________________ Note _______________________ Youmightneedtobethesuperuser(rootlogin)toexaminethe runningsystemorcrashdumpfilesproducedby savecore. Whetheryouneedtobethesuperuserdependsonthedirectory andfileprotectionsforthef
Resumo do conteúdo contido na página número 20
wanttoaddasymboltabletoyourcurrentdebuggingsessionratherthan endthesessionandstartanewone. Toaddasymboltabletoyourcurrent debuggingsession,followthesesteps: 1. Gotoawindowotherthantheoneinwhichthedebuggerisrunning, orputthedebuggerinthebackground,andrebuildthemodulesfor whichyouneedasymboltable. 2. Oncethemodulesbuildcorrectly,usetheostripcommandtostripa symboltableoutoftheresultingexecutablefile. Forexample,ifyour executablefileisnamed kernel_program,issueacommandsuchas thefollowingone: % /usr/