Lab 10: More Debugging

## A. Intro

Today, we will go over how to use some of the more powerful debugger functionalities. Your job will be to debug two buggy codes using only the debugger.

## B. Debugging

#### A Review of Debugging Tools

If you're still not familiar with debuggers, please take the time to review their documentation. You have a variety of options to choose from, but the two most popular debuggers are listed below.

In IntelliJ, in addition to traditional breakpoints you can also have conditional breakpoints. Understanding how to use them will be useful for this lab.

#### Exercise: A Debugging Mystery

An important skill to learn is how to exhaustively debug. When done properly, debugging should allow you to rapidly narrow down where a bug might be located, even when you are debugging code you don't fully understand.

Your company, Flik Enterprises, has released a fine software library called Flik.java that is able to determine whether two Integers are the same or not.

You receive an email from someone named "Horrible Steve" who describes a problem they're having with your library:

"Dear Flik Enterprises,

Your library is very bad. See the attached code. It should print out 500 but actually it's printing out 128.

(attachment: HorribleSteve.java)"

Using you choice of debugger, figure out whether the bug is in Horrible Steve's code or in Flik enterprise's library.

Once you find the bug, fix it. You might find conditional breakpoints useful for this exercise.

#### Exercise: Buggy Project1

We have some buggy project1 code. When you run the MachineTest.java file, you see that the tests in the file fail. Now using a debugger, figure out why the tests fail. You will need to fix the error from testConvertChar() to be able to debug the second error. Write your findings about the bugs in the code in answer.txt.