|
|
|
Using AimAdt With Debuggers
This page describes some of the ways to use AimAdt with various C/C++ and
Java debuggers. In particular, we discuss ways that you can use to display data
"on the fly," i.e. invoke the Aim Viewer at those times when you have not
pre-embedded AimAdt calls into your code, because you do not know in advance
what, if any, data you will want to view. The descriptions below are as simple as possible. We have not addressed issues such as variable scope, the use of non-static AimViewer methods in Java calls, and the like. Still, they should be enough to get you started.
Microsoft Visual Studio .NET 2003 Microsoft .NET can be used when interfacing AimAdt with your C/C++ application code. The best way to display data on the fly is to use the "Edit And Continue" capability. To do this, you should first:
You can then start the debugger. When you reach the point in your code at which you want to display some in-memory array data, simply type into the code a call to one of the "aimAdd<type>Array interface methods, and invoke Edit And Continue using the "Apply Code Changes" button on the "Debug" pull-down menu. Correct any errors if necessary. Then set the execution pointer to the line of new code you just added if it is not already there, and use "Step Over" to execute that code. The AimViewer should start up with the data displayed in the grid window.
Eclipse has a debugger capability called "Execute" that is perhaps the easiest way to display data in the Aim Viewer while debugging your code. The Execute command will attempt to execute a line of code that you have selected with the mouse or other means. This of course implies that the line of code must exist. To use the Execute command, apply Breakpoint or Step commands to get to the point in your code where you want to display the array data. Next, enter into your code a call to a static AimViewer method such as: AimViewer.showRaster (theRasterObject, arrayTitle, waitFlag); Then select the text of the code and invoke the "Execute" command from the popup menu (right mouse click) or the "Run" pull-down menu. Assuming there is no error in the code, the AimViewer will start and display your data in the grid window. When done, you can just delete the line of code, or you can leave it in the code but comment it out so that you can use it again later without having to re-enter it. The Execute command does not care whether the code is located inside a comment; just don't include the comment symbol when you select the code text. If you plan to use the Execute command, you may want to place an "import com.hgs.aimadt.*;" statement into your code. This is not absolutely necessary, but adding it allows you to invoke the AimViewer methods without having to enter the full package name.
Sun NetBeans is best used with its' variation of "Edit And Continue" called "Fix And Continue". While not as convenient as the Microsoft .NET capability, it is nonetheless useful, as long as you are aware of its behavior. Most important is that once invoked, the Fix process will pop the call stack, the consequences of which we discuss in a moment. To use the Fix capability, apply Breakpoint or Step commands to get to the point in your code where you want to display the array data. Enter an AimViewer call to the appropriate static "show" routine, which depends on the type of your data object. For example: AimViewer.showRaster (theRasterObject, arrayTitle, waitFlag); Next, click the "Fix" button on either the toolbar or the "Run" pull-down menu. The code will be re-compiled, and the call stack will be popped so that the execution pointer is placed at the point of the call to the method you just modified. You then rerun the method (using Step Into, Step Over, or whatever), and when executed the Aim Viewer will start up and display your data. All static method calls that you put into your code will display their data in the same Aim Viewer window. As with Eclipse, you may want to place an "import com.hgs.aimadt.*;" statement into your code. Because Fix pops the call stack, you cannot use the capability from a "main" method of your application, presumably because there isn't a call to pop. Instead, put your array processing code into sub-methods, so that when the Fix process pops the stack, you will be placed at the point at which the array processing sub-method was originally called. |
|