HW6 - C++ Debugging

Supplement to the hw6 main assignment.

Three possibilities come to mind.

Method 0

No bugs, no debugging.

Method 1

If that doesn't work, Visual Studio provides a pretty nice debugger that you can use to debug your code, even though (a) it runs "inside" the SMOK application, and (b) you don't have access to the SMOK source. Assuming you have completed the Task 0 setup:

  1. Start SMOK and verify that it has loaded your code by right-click, Add Component, and then looking for your package (smokCachePackage) listed after the built-in component types.
  2. In Visual Studio, select the Debug menu, then Processes... Scroll down the list until you find the SMOK process. Highlight it by single-clicking. Hit the Attach button, then OK, then the Close button. (If the OK button is greyed out, check Native in the list that is presented.)
  3. You can set breakpoints in your code by clicking in the grey area just to the left of the line you want to break on. (You remove them by clicking there again.) The debug menu lets you do things like Step, as does the debug toolbar. There are windows that show variable values and the call stack when you reach a breakpoint.

Method 2

printf statements in your code will print to the trace window that comes up when running SMOKTrace.exe. (They don't appear anywhere when you run SMOK.exe.) Of course, there is a lot of other trace information printed, so finding your output can be cumbersome.