Skip to content

Superbase NG IDE Quick Start Manual

In the first part, we built our first basic program in SIMPOL and learned how to use the IDE to do various tasks, including basic debugging. In this part, we will learn how to debug into the source code of one of the supplied libraries.

Debugging Revisited

Debugging a program is an important aspect of the development process. Since so many parts of Superbase NG are delivered as libraries, it is important to be able to assess what happens to your program when it goes into one of those libraries, especially if you think that there is a flaw in the library itself. Another important aspect is to learn how the libraries are written, and see how they work. This can be a useful tool for learning about the programming language. Using the Superbase NG IDE you can debug into any library for which the source code (as a project) is available.

Adding Library Source Code

We are going to be using the project learn01, so we should open this. First close whatever your current project is (File>Close Project). Now open learn01.smp (File>Open Project)

To add source code from another project to the current one, in the project tree view right-click the root node and select “Import Modules From Project”

Project context menu

In the resulting window find: C:\SIMPOL\projects\libs\sbldatelib

Open project window

And then open the SBLDateLib.smj

This will add the library project into the current project as a module. Projects loaded in this way cannot be modified, the source code is read-only. Once it has been added, the IDE will retrieve the function and type information, and add it to the tree

Project after importing a module for debugging

Now that the project code has been imported, we can now open the source file in the editor. First expand the entry for SBLDatetLib and then double click on SBLDateLib.sma.

To debug inside the call to the library function we will place a break point at the beginning of the function where indicated below. This is done by clicking on the line and pressing F9 (or Debug>Insert/Remove Breakpoint).

Setting a break point in a library function

To enter debugging press F4. Then press F5 to run through the program. Program execution should halt with the line containing the break point highlighted, as shown below:

Code execution halted at the break point

At this point, we can start single-stepping through the code (using F11), examine the variables, and evaluate what is happening to the code. In the beginning of the function most of the variables will be equal to .nul, since they have been declared but nothing has yet been assigned to them.

If you are debugging code that is working with a multi-threaded system, such as that provided by the SIMPOL Application Framework, then you may need to switch to the correct thread before any debugging commands will work or the variables are shown in the list. To do this select Debug → Thread Manager and in the window select the correct thread, then click on the Set Focus button.  
Thread Manager dialog window

Further into the function, as shown in the following image, the variables can be seen to the right in the watch window and the call stack is shown in the window below that.

Debugging showing the variables and call stack

By double-clicking on a function further down the call stack, the point in the code that called the next function further up the call stack can be displayed, and the state of the variables in that function can be shown.

Debugging showing the variables at a different call stack position

Removing Library Source Code

Once the debugging exercise with the library source code is complete, it is beneficial to remove the project from the tree, since each time debugging is entered, the IDE must analyze the source code from the library project as well as the development project, which slows down development. To remove the project, right-click on the module node in the project tree, and select the menu item Remove Module from the pop-up menu.

Removing the imported source code module


In this chapter we have learned how to:

  • Import a library project to allow debugging into its source code
  • Use the Thread Manager to select the correct thread
  • Remove a library project module once it is no longer required

Now its time to open up some of the sample projects and try them out. Have fun!

Pages: 1 2 3 4