MethodsforDebuggingDLLs
IfyouhavethesourceforboththeDLLandthecallingprogram,opentheprojectforthecallingexecutablefileanddebugtheDLLfromthere.IfyouloadaDLLdynamically,youmustspecifyitintheAdditionalDLLscategoryoftheDebugtabintheProjectSettingsdialogbox.
IfyouhavethesourcefortheDLLonly,opentheprojectthatbuildstheDLL.UsetheDebugtabintheProjectSettingsdialogboxtospecifytheexecutablefilethatcallstheDLL.
YoucanalsodebugaDLLwithoutaproject.Forexample,maybeyoujustpickedupaDLLandsourcecodebutyoudon'thaveanassociatedprojectorworkspace.YoucanusetheOpencommandontheFilemenutoselectthe.DLLfileyouwanttodebug.Thedebuginformationshouldbeineitherthe.DLLortherelated.PDBfile.AfterVisualC++opensthefile,ontheBuildmenuclickStartDebugandGotobegindebugging.
TodebugaDLLusingtheprojectfortheexecutablefile
1.FromtheProjectmenu,clickSettings.
TheProjectSettingsdialogboxappears.
2.ChoosetheDebugtab.
3.IntheCategorydrop-downlistbox,selectGeneral.
4.IntheProgramArgumentstextbox,typeanycommand-lineargumentsrequiredbytheexecutablefile.
5.IntheCategorydrop-downlistbox,selectAdditionalDLLs.
6.IntheLocalNamecolumn,typethenamesofDLLstodebug.
Ifyouaredebuggingremotely,theRemoteNamecolumnappears.Inthiscolumn,typethecompletepathfortheremotemoduletomaptothelocalmodulename.
7.InthePreloadcolumn,selectthecheckboxifyouwanttoloadthemodulebeforedebuggingbegins.
8.ClickOKtostoretheinformationinyourproject.
9.FromtheBuildmenu,clickStartDebugandGotostartthedebugger.
YoucansetbreakpointsintheDLLorthecallingprogram.YoucanopenasourcefilefortheDLLandsetbreakpointsinthatfile,eventhoughitisnotapartoftheexecutablefile'sproject.
TodebugaDLLusingtheprojectfortheDLL
1.FromtheProjectmenu,clickSettings.
TheProjectSettingsdialogboxappears.
2.ChoosetheDebugtab.
3.IntheCategorydrop-downlistbox,selectGeneral.
4.IntheExecutableForDebugSessiontextbox,typethenameoftheexecutablefilethatcallstheDLL.
5.IntheCategorylistbox,selectAdditionalDLLs.
6.IntheLocalModuleNamecolumn,typethenameoftheDLLsyouwanttodebug.
7.ClickOKtostoretheinformationinyourproject.
8.SetbreakpointsasrequiredinyourDLLsourcefilesoronfunctionsymbolsintheDLL.
9.FromtheBuildmenu,clickStartDebugandGotostartthedebugger.
TodebugaDLLcreatedwithanexternalproject
1.FromtheProjectmenu,clickSettings.
TheProjectSettingsdialogboxappears.
2.ChoosetheDebugtab.
3.IntheCategorydrop-downlistbox,selectGeneral.
4.IntheExecutableForDebugSessiontextbox,typethenameoftheDLLthatyourexternalmakefilebuilds.
5.ClickOKtostoretheinformationinyourproject.
6.BuildadebugversionoftheDLLwithsymbolicdebugginginformation,ifyoudon'talreadyhaveone.
7.FollowoneofthetwoproceduresimmediatelyprecedingthisonetodebugtheDLL.
|