10.4 Debuggers Flashcards
What type of errors do debuggers / compilers catch
- Compiler: compile time errors
- Debugger: runtime error
What are compiler warnings (what are they used for)
- Help to spot potentially problematic code (not something which is syntactically wrong which would be an error)
What are debug symbols (and how do they relate to the compiler and debugger)
- Compiler adds information to file to help debuggers identify the correponsing source instructions
- Common format is DWARF (for ELF binary format)
What are debuggers
- Trace and modify the program (to add breakpoints etc.)
- Needs to have access via kernel.
What are some possible commands in the GDB (GNU debugger)
How does the kernel support debuggers
- Debugger by nature accesses code outside its own protection boundry
- Kernel has library calls (such as ptrace) for debuggers
- Primarily software interrupts
What is the flow diagram for a creating a breakpoint in a running piece of code (debugger)
Note: Code is modified / line is replaced for a breakpoint
How do debuggers make use of software breakpoints
- Software interrupts are primary form of breaking
How can debuggers make use of hardware breakpoints
For example: Intel trap flag for single step mode. Otherwise step mode can be done via software interrupts
How can debuggers unwind the stack to perform a stack trace
- Recursively follow the return address upwards