DOC PREVIEW
CMU CS 15410 - Debugging

This preview shows page 1-2-3-4 out of 12 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

15-410, F’04- 1 -DebuggingSep. 17, 2004Dave EckhardtDave EckhardtL08a_Debug15-410“Experience is what you get......when you don't get what you want.”15-410, F’04- 2 -What is “Debugging”?Debugging is resolving a clash between storiesDebugging is resolving a clash between storiesÿYour hopeful story of achievementÿThe world's sad tale of woeThe stories look alike!The stories look alike!ÿAt the beginning, they both start with main()...ÿKey step: finding the divergenceStories are fractalStories are fractalÿYou can zoom in on them and get more detail each timeÿThe divergence is typically a tiny detailYou will need to zoom in quite a lot15-410, F’04- 3 -Move Beyond “Plot Summaries”“When I install my keyboard handler it crashes”“When I install my keyboard handler it crashes”Insufficient detailThis is a “plot summary”, not a tale of woeDon't ask us to look at your code yet!Deepen your level of detailDeepen your level of detailWhat was your story of hope, in detail?What parts of your story already happened?15-410, F’04- 4 -Telling Your Story“When I install my keyboard handler...”“When I install my keyboard handler...”What do you really hope?Hardware notices keyboard eventHardware posts interruptCPU recognizes interrupt as keyboard interruptCPU responds to (vs. ignores) keyboard interruptCPU stores trap frameCPU vectors through your IDT entryYour wrapper is runWrapper calls C codeC code does ...15-410, F’04- 5 -Pinpointing Depends on the Story“...it crashes”“...it crashes”Ok, that's generally what programs doOr, at least, that's when we start to pay attention to them...The critical questionThe critical questionHow far did your story progress before the crash?Pinpointing the problemPinpointing the problemHow can you measure which steps worked ok?“Keypress ⇒ crash” tells you quite a bit!15-410, F’04- 6 -Matching Phenomena to the Story“Keypress “Keypress ⇒⇒ crash” tells you quite a bit crash” tells you quite a bit√ Hardware notices keyboard event√ Hardware posts interrupt√ CPU recognizes interrupt as keyboard interrupt√ CPU responds to (vs. ignores) keyboard interrupt? CPU stores trap frame? CPU vectors through your IDT entry? Your wrapper is run? Wrapper calls C code? C code does ...What now?What now?15-410, F’04- 7 -MeasuringHow can you How can you measuremeasure the other steps? the other steps?? CPU stores trap frame? CPU vectors through your IDT entry? Your wrapper is run? Wrapper calls C code? C code does ...15-410, F’04- 8 -Measurement Techniques“Obvious”“Obvious”printf()single-step the programMoving beyond the obviousMoving beyond the obviousKnow your debuggerbreakpoints, watchpointsThose pesky registers%esp, %eip – these should always “make sense”»You should always know what would be “sensible”!%CS, %DS, %SS – not all that many legal values, right?%EFLAGS, %CR0 – “when the going gets tough...”15-410, F’04- 9 -Measurement TechniquesWriting codeWriting codeBreakage of a complex data structure is, well complexProbably need code to check invariantsDoing it by hand is fun at most once15-410, F’04- 10 -Asking for Help“Plot summary” is not enough“Plot summary” is not enoughWe probaby have no idea what's wrongReally!Please see “triple fault” web pageYou should always have a measurement planYou should always have a measurement planWhat is the next thing to measure?How would I measure it?You may reach the end of your ropeYou may reach the end of your ropeSome things are genuinely tricky to debugThings in this class may occasionally qualifyThis is a good learning experience15-410, F’04- 11 -Asking for HelpWhen are you ready to ask for help?When are you ready to ask for help?You have a long, detailed story – this is critical!!!Based on lecture, handout, Intel docs“Story” often needs one or two picturesParts of the story are clearly happeningYou have straightforward evidence, you are confidentYou have a measurement problemToo many things to measure?No idea how to measure one complicated thing?Measurement results “make no sense”?15-410, F’04- 12 -SummaryDebugging is about reconciling two storiesDebugging is about reconciling two stories“Plot summaries” aren't stories (you must zoom in)“If you don't know where you are going, you will wind up somewhere else.” — Yogi Berra Measure multiple things, use multiple mechanismsMeasure multiple things, use multiple mechanismsYou should “always” have a next measurement targetYou should “always” have a next measurement targetWhen you see us, bring a long storyWhen you see us, bring a long story...which you will naturally be an expert on the first part ofTry to know why each register has the value it


View Full Document

CMU CS 15410 - Debugging

Download Debugging
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Debugging and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Debugging 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?