Lecture 4 - Debugging & Development Tools Flashcards
Memory stores data, but what else?
Program code and instructions.
Is it possible to have a pointer to a function, if so what is it callled.
yes , function pointer
What is the type of a function pointer?
return_type (*)(argument_types)
When could having a function pointer be useful?
Having different print functions for node of a binary search tree.
Are function names automatically converted to pointers?
YES
What is a syntactical bug?
A grammar bug, it is something picked up by the compiler e.g. mispelling a keyword
What is a semantic bug?
Error in our logic , not flagged by the compiler, but the code doesn’t do what we want it to do .
What is a debugger?
A controlled enviroment in which we can run our program and investigate it’s execution.
What is static analysis?
When we reason about a program’s behaviour without running it.
What is dynamic analysis?
Adding instructions to program in order to be able to detect bugs at runtime.
What are the 2 most popular debuggers for C?
lldb and gdb
How to we need to compile a C program in order to be able to debug it?
With a g flag, this adds debug information to the binary exectuable
After compiling with a g flag do we simply run the program normally to debug ?
No, we start the debugger and load the program executable
EG.
gdb –argc ./program arg1 arg2
lldb – ./program arg1 arg2
How to exit a debugger?
type quit
How to set a breakpoint in the debugger?
b followed by the line number