131 Week 10 - Debugging Flashcards

1
Q

Compilation time bugs

A

Bugs that occur during compilation of the program.
e.g., syntax error, variable used before definition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Run time bugs

A

Bugs that occur while the program is running. Program is syntactically correct but does work as expected.
e.g., logic error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Divide and conquer debugging

A

Gradually remove/add code to create the smallest source file that contains the bug.
Either remove code until the bug stops and examine last removed lines.
Or start with smallest running program and add code until the program breaks and examine last added lines.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Debugging using logging

A

Insert logging statements (e.g., printf) to see values of variables at different points during runtime.
Has flaws as it can take many log statements or logging statements could even change program behaviour such as timings or the stack - called heisenbug errors.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Micro:bit logging debugging

A

You can use a serial/UART interface to output logging statements to your computers terminal by connecting your micro:bit and using uBit.serial.printf to output logging statements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Debugger

A

Software that provides tools to assist with debugging such as:
- stepping
- breakpoints
- investigating machine state
- investigating crashes
Debuggers are generally language dependent but some can support multiple languages.
Some debuggers require hardware support.
Can be GUI or command line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

GDB

A

Open-source command line debugger designed for the C language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Using GDB

A

Compile using gcc -g fileName.c -o executableName
-g tells compiler to generate debugging symbols
Use break lineNumber to set a breakpoint e.g., break 5
Use run to start running the program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Big endian

A

Most significant byte is stored first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Little endian

A

Least significant byte stored first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How is a Micro:bit debugged

A

Use DAPLink to debug a running Micro:bit
On-chip debugger (OCB) allows remote debugging.
Can integrate with VS Code to use a powerful debugging environment.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly