HW5 Task 3 - Setup

  1. Make sure you are running the latest versions of SMOK and Cebollita. (See the Files section of the main assignment page.)
    $ cebsim --version
    UI version: 2.5 (Build 49)
    

    Warning: You actually need V7.2.2 of SMOK.

  2. All the files you need were supplied as part of hw5.tar.gz.

  3. In a Windows explorer window, navigate to the folder containing those files. Double-click on OSComponents.sln. Visual Studio starts. Select the Build menu, then Build Solution. Stuff happens. When it's over you should see (in a pane near the bottom, with high likelihood):
    ---------------------- Done ----------------------
    
        Build: 1 succeeded, 0 failed, 0 skipped
    

    You've just compiled and linked the code for a degenerate version of an exception detecting component. You should find file ExceptionComponent.smokdll. That's the executable version of your code. (It cannot be run on its own, however, only from SMOK.)

  4. Run SMOK. Select the Edit menu, then Edit Smok Env Vars. The directory of the .smokdll file must be in one of the entries. Instructions for how to do this depend on details of your setup, of which there are too many for me to try to guess. But, in general, I think having '.' (a single period) in your path should be enough. If not, try inserting the full path to the folder. Use a semi-colon to separate this new path element from what was there already. Here's a picture that shows you the general ideas. The names you use will be different, of course.
    This setting will be remembered, so you won't have to do it again for a particular kind of machine (i.e., lab or home).

  5. Shut down SMOK and restart it. Select the View menu, then Package Information, then ExceptionComponent. (The image here is representative only.)
    Shut down SMOK.

    Note: If you attempt to build your code while running a SMOK process, you will get an error like this:

    Linking...
    LINK : fatal error LNK1168: cannot open Executables/ExceptionComponent.smokdll for writing
    
    Build log was saved at "file://c:\cse378\hw5\Debug\BuildLog.htm"
    OSComponents -  1 error(s), 0 warning(s)
    
    
    ---------------------- Done ----------------------
    
        Build: 0 succeeded, 1 failed, 0 skipped
    
    This is because Visual Studio is unable to overwrite the output executable file while it is in use.

  6. Restart Visual Studio on your project if you shut it down (see Step 3). In the Solution Explorer pane, expand ExceptionComponent, then expand Source Files. Double-click on ExceptionComponent.cpp to bring it up in the editor pane.

  7. Change the PACKAGE_AUTHOR and PACKAGE_DATE in ExceptionComponent.cpp. Re-build. Verify that the changes have taken place (Step 5).

    Don't shut down Visual Studio yet.

  8. Create an ExceptionComponent in SMOK (again, this image is only representative):
    A (purple) component is created.

  9. Go back to Visual Studio. Click to the left of a line in method ExceptionComponent::ComputeOutputs to create a breakpoint. Here's a picture of the general idea (but with somewhat different code than you have):

  10. Debug your code in the running copy of SMOK by selecting the Debug menu, then Processes... Find the SMOK process in the list and hit Attach. Make sure Native is selected, then hit OK, then Close.

  11. Go back to SMOK and type ctrl-f (step). Visual Studio asserts itself. The yellow arrow shows you that you've reached a breakpoint. The bottom left pane shows the values of variables used in that statement; the bottom right the call stack. I've annotated some of the toolbar buttons near the upper right in red.
    We reached this breakpoint because the ComputeOutput method is called at each clock up.

  12. Hit the Go button to continue.