CS452 - Real-Time Programming - Fall 2010
Lecture 11 - Debugging
Pubilic Service Announcements
- Send/Receive/Reply
- performance
- no caches, no optimization
Why is debugging hard?
- Bottlenecks
- Critical races
- Non-determinism
Terminal
What's good
- printf
- provdes information as the program runs
What's bad
RedBoot
What's good
- very robust
- available even after the program has crashed
What's bad
- no support for kernel data structures
Busy-wait IO
Good for early-stage debugging
- You are only trying to get things happening in the right sequence
- You don't care if it is slower or faster
Bad when the real-world comes into the computation
- You can no longer control the sequence of execution because you can't
slow down the real world.
Stack Trace
In single-threaded programs this is often the most useful tool.
- Anything that terminates execution abnormally prints the set of active
stack frames
- Minimal version
- name of calling function
- line number of call
- Extreme version
- values of arguments
- values of local variables
What is the equivalent of a stack trace in a multi-tasking environment?
- How would you implement it?
- How would you make it readable?
Breakpoint
What does it do?
- snapshot of the system
- restart system immediately afterwards
How do you get it started?
- function call
- system call
- interrupt
- reset exception
- another exception
Breakpoint is a special case of a particular sort of tool that is very
common.
- condition occurs => information is made available
- breakpoint provides the information interactively (`interactively' =
`on the time scale of the user')
- it can stop the system completely. How?
- but it has limited ability to stop the real world
Getting information closer to real-time.
Gossip
Circular buffer somewhere
- You write into it as things happen
How do you read it?
- Write it in English
- Write it in code
What are the advantages and disadvantages of each?
Use Bits
Fast Interrupts
Return to: