GHS MULTI Debugger

In this lab, you will practice using Green Hills MUTLI to debug projects. As you do the lab, complete this question sheet.

  1. Run MULTI with mprojmgr.

  2. Use File > New Top Project... to make a new project.

For all of the example projects, make sure to read the messages in the console!

Basic debugging

  1. The default location is probably fine. Select Next and make sure Stand-alone is selected, then go Next. Select ARM for the processor family. Next, expand Generic-ARM and select ARM Cortex-A5, then Finish making the project.

  2. Add the Basic Debugging demo project, then Finish creating the project.

  3. You can read 'linked_list.txt' for an explanation of the project.

  4. Build the project by clicking the Wrench/Hammer icon or pressing F7.

  5. Debug the project by clicking the red Bug icon or pressing F5.

  6. The debugging window will open. In the window, the Cmd tab near the bottom will display output and instructions. Walk through the steps of the demo, answering the questions below. If the debugger asks you to connect to a target, select the ARM simulator that matches the previously choosen processor type.

  7. Complete the debugging tutorial by following the instructions in the console.

  8. After finishing the tutorial, close the debugger window and return to the project manager.

Program traces

  1. Right click on the root node in the project and Modify Project > Add Item... and add the PathAnalyzer demo.

  2. You should now have two programs in your project. Click on the path analyzer one and build, debug it, and complete the tutorial.

  3. What are your thoughts on the runtime of the second quicksort?

Running sort.c

  1. Now, create your own program. Again, right click on the root project node and add an item. This time, add Program. This will create a program with no source files inside it.

  2. Add source files by right click the new program and Modify Project > Add Item..., then select Source File. Press Next and find the sort.c that came with your gdb_example project.

  3. Build and debug your new program.

  4. In the debugger, set a breakpoint at the last line of main (return 0;). Set the breakpoint by clicking the green circle to the left of the line.

  5. Double click the A variable to open it in Data Explorer and verify that the array has been sorted.

  6. View the program trace by clicking TimeMachine > PathAnaylizer...

  7. If you don't see a trace in the new window, go to File > Retrieve Trace.

  8. At the beginning and the end, you should see a large region of time spent printing the array. In the middle you should see the actual calls to sort the array.

  9. In the FastFind input box, type partial to highliht all calls that contain that name. Zoom to the sort region by clicking and dragging so that the region between the prints is selected.

  10. How long does the sort take relative to the prints?

  11. From this small example, could you estimate the time complexity of sort.c?

More

If you want, you practice with the other demo projects. Some of them have some pretty interesting and advanced techniques.