SEARCH
TOOLBOX
LANGUAGES
modified on 17 June 2010 at 17:34 ••• 5,238 views

Using OpenOCD/3

From Manuals

Jump to: navigation, search

Contents

Debugging using Insight GUI

Insight – The GDB GUI

Insight is a graphical user interface to GDB written in Tcl/Tk. The main advantage of using the Insight GUI is that multiple debugging windows are displayed simultaneously. You can have a console window to type commands, a source window with the source code being executed, a watch window with the current contents of variables (including structures, linked lists, etc.), a stack window with the program's call stack, and so on. All your display windows are updated automatically as you step through your program.

Insight can be used with popular GNU ARM toolchains like devkitARM, Sourcery G++ Lite, WinARM and YAGARTO. Since it is not included with the toolchain distribution, you may need to install it separately. It is important to verify that the version of Insight in use supports the version of GDB in the toolchain.

Introduction to Insight Functions

The Insight console window allows access to the same GDB commands discussed in the previous chapter. Rules and procedures are the same, but Insight acts as a graphical interface to GDB to simplify its operation. Insight can be invoked from the command line, usually from the directory containing the application binary to be debugged. The devkitARM project includes build of Insight compatible with their toolchain. It can be invoked with ’arm-eabi-insight project_name.out’. Figure 3-1 shows a sample debugging session of blinky.out. After Insight is loaded, a source window will be displayed similar to the one shown in Figure 3-2.

C:\Projects\ARM\blinky\gcc> arm-eabi-insight blinky.out

Figure 3-1: Invoking Insight from the command line

Insight source window
Figure 3-2: Insight source window

Insight has several windows useful for debugging, including:

  • Console window
  • Source window
  • Register window
  • Memory window
  • Locals window
  • Watch window
  • Stack window
  • Thread/process window
  • Function browser window
  • Debug window (for developers)

Insight can connect to a remote target via OpenOCD by selecting ‘File’, ‘Target’ in the menu and specifying the remote target parameters as shown in Figure 3-3. The localhost:3333 in the example connects to the OpenOCD daemon running in port 3333 of the local machine. Once you have specified your target settings, you can click the Run button so Insight loads the application to your device. Another alternative is to enter the command’target remote localhost:3333’ in the command window as shown in Figure 3-4. If you specified your target using the console window, you will need to manually load your program to your device typing load in the command line.

Target Settings
Figure 3-3: Target Settings window
Console Window
Figure 3-4: Console Window

To jump to the start of the application or to a specific location, you just need to invoke the jump command (j line or j *address) as in GDB using the Console Window.

The GDB commands available from Insight are the same as with the command line example in the previous chapter. When placing breakpoints and watching variables you can do it using two methods: setting them manually using the console window as in GDB, or using Insight graphical interface. To set breakpoints in Insight graphical interface just click on left side of the line number where you want to stop the program. To add a variable to the watch window, right click on the variable and select add variable to watch. Figure 3-5 shows how to set breakpoints and watching variables. Conditional breakpoints are set as in GDB, using the console windows and entering the command: cond n [expr].


Setting Breakpoints
Figure 3-5: Setting breakpoints and watching variables

The following list describes the use of the debugger buttons:

Run Run – Start the debugging process

Into Step – Step into function calls

Next Next – Step over function calls

Finish Finish – Step out of function calls

Continue Continue – Continue the debugging process

Using Insight from the CodeBlocks IDE

Insight can be invoked from the CodeBlocks IDE using the proper settings. The IDE acts as a launcher for Insight so all procedures discussed in the previous section also apply here.

To set Insight as your debugger within Codeblocks, the procedure is very similar as the one used for GDB. On the ‘Compiler and debugger’ settings window, look for Global compiler settings and click on Toolchain executables. When using the devkitARM toolchain your Debugger should be set to arm-eabi-insight.exe. Figure 3-6 shows an example of the proper configuration of toolchain executables.

Setting Insight in Codeblocks
Figure 3-6: Setting the Debugger to Insight on Codeblocks

More information about Insight is available online from this reference:

Insight Home Page

http://sourceware.org/insight/