Docsity

Debugging: A Story of Clashing Narratives, Slides of Software Engineering

Partial preview of the text

Download Debugging: A Story of Clashing Narratives and more Slides Software Engineering in PDF only on Docsity!

15-410, F'

Debugging

Sep. 14, 2011

Dave Eckhardt

Dave Eckhardt

L07a_Debug

“Experience is what you get...

...when you don't get what you want.”

15-410, F'

What is “Debugging”?

Debugging is resolving a clash between stories

Debugging is resolving a clash between stories

Your hopeful story of achievement

The world's sad tale of woe

The stories look alike!

The stories look alike!

At the beginning, they both start with main()...

Key step: finding the divergence

Stories are fractal

Stories 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 lot

15-410, F'

Telling Your Story

When I install my keyboard handler...”

When I install my keyboard handler...”

What do you really hope?

15-410, F'

Telling Your Story

When I install my keyboard handler...”

When I install my keyboard handler...”

What do you really hope?

Hardware notices key press/release

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'

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'

Measuring

How can you

How can you measure

measure 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'

Measurement Techniques

Writing code

Writing code

Breakage of a complex data structure is, well complex

Probably need code to check invariants

Doing it by hand is fun at most once

15-410, F'

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 page

You should always have a measurement plan

You 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 rope

You 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 experience

15-410, F'

Summary

Debugging is about reconciling two stories

Debugging 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 mechanisms

Measure multiple things, use multiple mechanisms

You should “always” have a next measurement target

You should “always” have a next measurement target

When you see us, bring a long story

When 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 does