Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

4    Running Palm OS Debugger

Palm OS® Debugger Guide

Palm OS® Developer Suite

This chapter describes each of the Palm OS Debugger windows and discusses how to use them. It covers the following topics:

Palm OS Debugger Overview ^TOP^

You can use Palm OS Debugger to:

  • View information about applications and their source files.
  • Set breakpoints.
  • Display a list of registers and their values.
  • View information about variables.
  • View information about memory address locations and their contents.
  • View processes that Palm OS Debugger knows about.
  • View the stack trace.
  • Evaluate C expressions.
  • View standard input and output operations (such as debug messages) in an STDIO console.
  • Interact with your debugging session in a command line environment.

You can open an instance any of the Palm OS Debugger tabs in its own separate window. To do this, select Windows in the Palm OS Debugger menu bar, and then select a view from the list of views.

Getting Started ^TOP^


NOTE: While you are following the steps described here, whenever Palm OS Debugger displays a dialog asking "Do you want to save modified preferences?" you should click Yes.

Modifying Preferences ^TOP^

To modify Palm OS Debugger preferences, follow the instructions in Chapter 3, "Setting Palm OS Debugger Preferences,".

Using the Palm OS Debugger Windows ^TOP^

This section explains how to use each of the Palm OS Debugger windows (also called tabs).

Source View ^TOP^

The source view shows you your application source file in the specified mode: either C/C++, Assembly, or mixed. In the source view, you can read your source code and graphically view any breakpoints in your code.

The source view pane is the bottom pane of every view described below, and the user interface of the source view is maintained across every view.

Note that, by default, the source view shows the current location in the source based on the program counter. But the content and current location can be changed in several ways:

  • When you select a breakpoint in the breakpoint window, the source view shows the breakpoint you just selected.
  • When you select an item from the call stack, the source view shows the item you just selected.
  • When you select a file in the files view, the source view shows you the selected file.
  • When the program counter is within an area of memory where you have no symbolic information available, the source view shows an assembly view of the code.

If you change the file view, you can get back to the current program counter location by using the Goto PC command. (To view the menu, right-click in the source view window.)

Figure 4.1  Source View

Source View User Interface

This pane is available within all views in the debugger. When you open Palm OS Debugger, the pane displays the contents of the file selected in the Files View. When you are debugging, the pane shows the current program counter location in the source or assembly. It is always the lowest pane, but you can resize the pane.

The lower pane in the source view is known as the source view pane. It is a resizable pane that displays the contents of the selected source file; if no source file is selected in the files view, then this pane is empty. In this pane, you can use the following functions:

  • View your source code.
  • Use Find, Find Next, and Find Previous to perform searches.
  • Select and Copy text to the clipboard.
  • Set and clear breakpoints.
  • Move to the next code line where you can place a breakpoint, or back up to the next prior code line where you can place a breakpoint.

Setting Breakpoints in the Source View

The source view uses gray squares in the left margin to indicate where you can set a breakpoint. You can only set breakpoints on code lines that have a gray square in the left margin.


TIP: If your breakpoint boxes are not lining up or if they appear to be on incorrect lines such as comment lines, check that your source file and symbolic file are both up-to-date.
  • To set a breakpoint, click the gray square.
    • If the symbolic file containing the new breakpoint has not yet been loaded, then a white dot appears indicating that the breakpoint is set but unresolved. In the breakpoints view, the status for this breakpoint is listed as "Unresolved."
    • If the symbolic file has already been loaded, then a red dot appears indicating that the breakpoint is both set and enabled. In the breakpoints view, the status for this breakpoint is listed as "Enabled."
  • To run the code up to a breakpoint, Shift-click a gray square that shows a red dot.
  • To run to a given source line without setting a permanent breakpoint, Shift-click that source line's gray box to set a "one time" breakpoint. This function is handy for getting out of long loops without having to set a breakpoint, run to the breakpoint, and then clear the breakpoint.
  • To disable a breakpoint, Ctrl-click a gray square that shows a red dot. The red dot changes to a white dot, indicating that the breakpoint is set but disabled. In the breakpoints view, the status for this breakpoint is listed as "Disabled."
  • To clear a breakpoint, click a gray square that shows a white or a red dot. The dot disappears, indicating that the breakpoint has been cleared.

Note that each line of C source corresponds to a range of possibly discontinguous addresses. When you set a breakpoint in C source mode, the breakpoint is set at the beginning of the range of addresses.

In mixed mode or assembly mode, you can set one or more breakpoints within the range of addresses that correspond to one single line in C source. When you view these breakpoints in C source mode, the graphical representation of the breakpoint dots may be changed to indicate multiple breakpoints for a single line in the C source:

  • For a breakpoint within the range for a source line but not at the beginning of the range, the dot is shown in the upper left-hand corner of the gray square.
  • For multiple breakpoints corresponding to a single source line, the breakpoints are shown as two smaller, overlapping dots.

TIP: When the source view is the active view, you can use the mouse scroll wheel to step through your code while debugging. Click in the source view to make sure it is the active view.

- Use Ctrl+Mwheel_Down to step over
- Use Ctrl+Shift+Mwheel_Down to step into
- Use Ctrl+Mwheel_Up to step out

Source View Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the source view:

Source

Select Source to view the original source code for the current file.

Mixed for File

Select Mixed for File to view the original source mixed with the assembly version for the entire address range corresponding to the current source file being displayed.

Note that when you select this option, Palm OS Debugger may take some time to update to the source view for a large source file.

Mixed for Function

Select Mixed for Function to view the original source mixed with the assembly version for the current function. The original source is shown for other functions.

Mixed for Source Line

Select Mixed for Source Line to view the original source mixed with the assembly version for the current source line only. The original source is shown for all other lines.

Disassembly

Select Disassembly to view the disassembly version of the current file.

Note that when you select this option, Palm OS Debugger may take some time to update to the source view for a large source file.

Return to Current PC

Returns you to the location specified by the current program counter data.

Disassemble

Opens a dialog box asking you for the address of the code to disassemble. This function disassembles a raw address range starting from the value you specified in the dialog box. Palm OS Debugger initializes the starting address to the current address range for the file being disassembled.

You specify the disassemble range as a standard ANSI C string in one of the following ways:

  • Using a low address and a high address. For example, if you specify the string "0x8000-0x9000", Palm OS Debugger disassembles the address range 0x00008000 to 0x00009000.
  • Using a starting address and a size. For example, if you specify the string "0x8000+0x1000", Palm OS Debugger disassembles the address range 0x00008000 to 0x00009000.
  • Using a starting address. If you don't specify a size for the disassemble range, then Palm OS Debugger uses the most recently specified size, or uses the default size of 256 bytes if you have never specified a size.

When you click Enter, Palm OS Debugger disassembles the entire file up to the upper bound of the disassembler.

Set Disassembler

Changes the disassembler that is being used to disassemble the current source range when in mixed or disassembly view modes. Palm OS Debugger attempts to identify the correct disassembler, but you can set it manually when Palm OS Debugger is unable to determine the correct disassembler.

This function allows you to choose between the disassembler plug-ins you have installed. Palm OS Debugger ships with 68K, ARM, and Thumb disassemblers.

Set Breakpoint at Address

Sets a breakpoint at an absolute address. This function displays a dialog asking you for the address at which to set the breakpoint. Palm OS Debugger attempts to resolve this address to a source file and line number.

If Palm OS Debugger is able to resolve the address, it stores the breakpoint as a source file and line number breakpoint. If Palm OS Debugger is not able to resolve the address, then the breakpoint is stored as an absolute addressed breakpoint.

Set Breakpoint at Function

Sets a breakpoint at a function. You can either use a dialog to enter the name of the function, or select a function name from a list.

If you use the dialog, you can enter the name of the function in one of two ways:

  • As a simple function name. Palm OS Debugger searches the symbolic files sequentially until it finds a matching function name.
  • As a symbolic file and function name combination. For example, if you enter symfilename.ext(funcName), then Palm OS Debugger sets a breakpoint at the function funcName in the symbolic file symfilename.ext. The symbolic file extension is optional; you can alternatively enter the example above as symfilename(funcName).

If Palm OS Debugger is unable to find the specified function, then it displays an error message.

If you use the function name list, you simply select the function from the list. By default, the function name list is in source file order (the order in which the functions appear in the source file). To sort the function name list in alphabetical order, hold down the shift key before displaying the pop-up menu.

Set Breakpoint at Cursor

Sets a breakpoint in the source view pane at the current cursor location. (This menu item is available when the selection caret is on a source line that has a breakpoint gray box on it.)

Run to Cursor

Sets a temporary breakpoint in the source view pane at the current cursor location, and runs to the cursor location. The breakpoint is cleared at the next stop of program execution.

Set PC at Cursor

Sets the program counter to the current cursor location in the source view pane.

Goto PC

Takes you to the location in source that corresponds with the current contents of the program counter.

Goto Function

Displays a list of function names in the program. Select a function name to move the cursor location in the source view pane to the beginning of that function.

By default, the function name list is in source file order (the order in which the functions appear in the source file). To sort the function name list in alphabetical order, hold down the shift key before displaying the pop-up menu.

Show Line Numbers

For source and mixed modes, displays line numbers in the margin to the left of breakpoint boxes.

Lookup Address

Opens a dialog box asking you for an address that you are looking up. If the address you enter is within the address range for a source file, then that source file is displayed.

Files View ^TOP^

The Files view is the first tab in the user interface, and it is displayed in the upper pane of the user interface. The Files view shows all currently loaded symbolic files.

Expand a symbolic file to display a list of source files that have debugging information. Use the address range information for each symbolic and source file to manually identify which symbolic file and source file an arbitrary address corresponds to.

Figure 4.2  Files View

Files View User Interface

The files view pane is a resizable pane that displays the filenames, paths, low PC value, and high PC value for the application in a table format. By clicking on one of the column headings, you can sort the table by that value.

When the files view is initially displayed, each symbolic file is collapsed. To expand the contents of a symbolic file, click on the plus sign next to the symbolic file's filename. The contents are the names of the files that have debugging information.

When you click on a filename, the source code for that file is displayed in the Source View.

When you double-click on a filename, Palm OS Debugger tries to open the file in a new window. If Palm OS Debugger cannot find the file, then Palm OS Debugger displays a dialog box so you can locate the source file in another directory.

Files View Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the files view:

Open File in New Window

If you have a specific file selected, this option becomes available in the context menu. This option lets you display the file in a separate window.

Remove Symbolic File

To remove a symbolic file from the current debug project, select the symbolic file's filename and then select Remove Symbolic File from the pop-up menu. If you set any breakpoints in the symbolic file, Palm OS Debugger removes the breakpoints before removing the symbolic file from the project.

Change Path

Opens a dialog box so you can find the source file in a different directory. If the path of your source file is out of date with the symbolic file, modify the path to your source file by selecting the filename, and then selecting Change Path from the pop-up menu. Use this option when a file is located in a different directory but still has the same name and extension.

Change Filename

Opens a dialog box so you can select a different source file. If the path and filename of your source file is out of date with the symbolic file, modify the path and filename to your source file by selecting the filename, and then selecting Change Filename from the pop-up menu. Use this option when the file has a different name or extension, and is not just located in a different directory.

Revert to Original Path

Sets the path information back to the path information that is stored in the symbolic file. If you have changed the filename using Change Filename, but selected an incorrect source file, you can restore the original name by selecting the filename and then selecting Revert to Original Path from the pop-up menu.

Show All Files

By default, the Files view only shows files that contain code. To view other files in the files view, check the Show All Files menu. This allows you to see other files which are listed in the symbolic file, such as header files.

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Breakpoints View ^TOP^

This view shows the list of breakpoints set in the application you are debugging.


NOTE: You set breakpoints in the source view. For details, see "Setting Breakpoints in the Source View".

Figure 4.3  Breakpoints View

Breakpoints View User Interface

The breakpoints view displays the following information, displayed in a table format. By clicking on any column heading, you can sort the table by that value in either ascending order or descending order. Column headings are:

  • Status – The current status of the breakpoint. The status is one of the following:
    • Unresolved: The breakpoint is set, but the symbolic file containing the breakpoint has not yet been loaded. In the source view, the status for this type of breakpoint is shown with a white dot.
    • Enabled: The breakpoint is set and the symbolic file containing the breakpoint has been loaded. The breakpoint reflects an actual address. In the source view, the status for this type of breakpoint is shown with a red dot.
    • Disabled: The breakpoint address is resolved, but the breakpoint is not active. In the source view, the status for this type of breakpoint is shown with a white dot.
    • Unknown: If you try to set a breakpoint while a debug process is running, Palm OS Debugger may temporarily set the status in the breakpoints view to Unknown.
  • Function – The function in which the breakpoint can be found.
  • Line – The line in the source file.
  • Filename – The filename of the source file.
  • Path – The path to the source file.
  • Symbolic File – The associated symbol file.
  • Condition – If this is a conditional breakpoint, the condition is displayed here.
Conditional Breakpoints

To add a conditional breakpoint:

  • Select the desired line in the breakpoints view. The selected line is highlighted.
  • Double-click the section of the highlighted line that runs through the Condition column (under the heading "Condition" in the table).
  • Palm OS Debugger opens a text box where you add a condition.

When Palm OS Debugger hits your conditional breakpoint, a dialog box opens.

Use Palm OS Debugger's C expression parser to write conditions. For detailed information, see "Expressions View".

Breakpoints View Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the breakpoints view:

Enable Breakpoint

Enables a previously disabled breakpoint at a specific address.

Disable Breakpoint

Disables a breakpoint at a specific address.

Clear Breakpoint

Clears a breakpoint at a specific address.

Enable All Breakpoints

Palm OS Debugger attempts to enable all disabled and unresolved breakpoints. Any unresolved breakpoints that Palm OS Debugger can not set remain unresolved; any disabled breakpoints that Palm OS Debugger can not enable become unresolved.

Disable All Breakpoints

Disables all currently set breakpoints.

Clear All Breakpoints

Clears all currently set breakpoints.

Set Breakpoint at Address

Sets a breakpoint at an absolute address. This function displays a dialog asking you for the address at which to set the breakpoint. Palm OS Debugger attempts to resolve this address to a source file and line number.

If Palm OS Debugger is able to resolve the address, it stores the breakpoint as a source file and line number breakpoint. If Palm OS Debugger is not able to resolve the address, then the breakpoint is stored as an absolute addressed breakpoint.

Set Breakpoint at Function

Sets a breakpoint at a function. This function displays a dialog asking you for the name of the function at which to set the breakpoint. You can enter the name of the function in one of two ways:

  • As a simple function name. Palm OS Debugger searches the symbolic files sequentially until it finds a matching function name.
  • As a symbolic file and function name combination. For example, if you enter symfilename.ext(funcName), then Palm OS Debugger sets a breakpoint at the function funcName in the symbolic file symfilename.ext. The symbolic file extension is optional; you can alternatively enter the example above as symfilename(funcName).

If Palm OS Debugger is unable to find the specified function, then it displays an error message.

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Registers View ^TOP^

This view displays the list of registers and their values. It has bitwise text mnemonics for registers such as the CPSR and SPSR, to mimic the ARM debugger.

Registers View User Interface

You can sort the view by the name and by the value, in both ascending or descending order.

To set the contents of a register, you can double-click on the value of a register, and type in a new value. This value gets reflected immediately in the debugging session.

In general, Palm OS Debugger interprets the value according to the semantics of the ANSI C standard function strtol (or strtod for floating point numbers).

  • If the value starts with a number (1 through 9) or with a hyphen ("-"), then Palm OS Debugger interprets the value as a decimal number.
  • If the value starts with "0x" characters, then Palm OS Debugger interprets the value as a hexadecimal number.
  • If the value starts with "0" followed by the numbers 1 through 7, then Palm OS Debugger interprets the value as an octal number.
  • If the value contains a decimal point ("."), then Palm OS Debugger interprets the value as one of the IEEE 754 (floating point number) formats, depending on the size of the register.
  • If the value starts with "0b" characters followed by zeroes or ones, then Palm OS Debugger interprets the value as a binary number.

You can enter any valid numerical string; you do not need to use quotation marks. If the string cannot be parsed according to the above rules, Palm OS Debugger interprets it based on the format of the previous value.

For example, say that a register's value is "0x11223344" and you change its value to "be": Palm OS Debugger attempts to parse the value based on the rules described above. But since none of the rules fit, Palm OS Debugger then parses the string in hexadecimal format because it was originally in hexadecimal format.

If Palm OS Debugger is unable to determine the correct format of the string, then the register's value remains unchanged. If you specify an out-of-range string, the value also remains unchanged.

Registers View Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the register view:


NOTE: If an individual register is selected, then options selected in the context menu apply only to that register. If a group of registers is selected, then options selected in the context menu apply to all registers in that group.
Format Types

You can display registers in the following formats:

  • ASCII Integer
  • Binary
  • Boolean
  • Char
  • Decimal (Signed)
  • Decimal (Unsigned)
  • Fixed 50/50 (Signed)
  • Fixed 50/50 (Unsigned)
  • Fixed 75/25 (Signed)
  • Fixed 75/25 (Unsigned)
  • Float
  • Hex
  • Hex Byte Stream
  • Hex with Decimal (Signed)
  • Hex with Decimal (Unsigned)
  • String (C)
  • String (Pascal)
Format Changes Are Global

Select this setting to permanently apply changes to a register for the duration of the debug session. If you create any new register views, they have the same format.

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Variables View ^TOP^

This view displays information about variables: the variables' names, the values of the variables, the types of the variables, the scope of the variables, and the variables' locations. If a variable is out of scope, then Palm OS Debugger displays the string "ERROR" for that variable.

Variables View User Interface

You can sort the table of data in ascending or descending order by clicking on any of the column titles. To change the value of a variable, double-click on the value of a variable and type in a new value. The new value gets reflected immediately in the debugging session.

  • If the value starts with a number (1 through 9) or with a hyphen ("-"), then Palm OS Debugger interprets the value as a decimal number.
  • If the value starts with "0x" characters, then Palm OS Debugger interprets the value as a hexadecimal number.
  • If the value starts with "0" followed by the numbers 1 through 7, then Palm OS Debugger interprets the value as an octal number.
  • If the value contains a decimal point ("."), then Palm OS Debugger interprets the value as an IEEE floating point number.
  • If the value starts with "0b" characters followed by zeroes or ones, then Palm OS Debugger interprets the value as a binary number.

You can enter any valid numerical string; you do not need to use quotation marks. If the string cannot be parsed according to the above rules, Palm OS Debugger interprets it based on the format of the previous value.

For example, say that a variables's value is "0x11223344" and you change its value to "be": Palm OS Debugger attempts to parse the value based on the rules described above. But since none of the rules fit, Palm OS Debugger then parses the string in hexadecimal format because it was originally in hexadecimal format.

If Palm OS Debugger is unable to determine the correct format of the string, then the variables's value remains unchanged. If you specify an out-of-range string, the value also remains unchanged.

Variables View Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the variables view:

Show File Globals

When this command is checked, the file global variables are shown.

Format Types

You can display variables in various formats, similar to the way you can display registers in various formats (see "Format Types"). Additionally, you can show enumerated types as their enumerated strings.

Format Elements As

When you select an array name, you can use the Format Elements As command. This command displays all elements of an array in the same format. You can display the arrays of characters as strings.

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Global Variables View ^TOP^

This view displays the global variable name, the value of the variables, the type of variable, the variable location.

Global Variables User Interface

You can sort the view by clicking on any of the titles to sort in ascending or descending order. Additionally, you can double click on the value of a variable and type in a new value. The new value gets reflected immediately in the debugging session.

You can edit either the value or location of global variables in the same way that you can edit variables (see Variables View).

Global Variables Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the global variables view:

Show All Globals

When this command is checked, all global variables are shown.

Format Types

You can display variables in various formats, similar to the way you can display registers in various formats (see "Format Types"). Additionally, you can show enumerated types as their enumerated strings.

Format Elements As

When you select an array name, you can use the Format Elements As command. This command displays all elements of an array in the same format. You can display the arrays of characters as strings.

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Memory View ^TOP^

This view displays memory address locations and their contents (memory dumps). You can display memory either using the built-in memory display function or using any memory disassembler plug-in.

You specify the absolute start memory address as a standard ANSI C string representing a hexadecimal number (for example, "0x8000").

Memory View User Interface

  • You can sort the view by clicking on any of the titles to sort in ascending or descending order, where applicable.
  • By double-clicking on a specific address, range of data, or displayed character string, you can type in a new value and press Enter to save the changed value.

Memory View Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the memory view:

Format

Sets the data type format to be used for the displayed data.

Bytes per Column

Sets the number of bytes of data to be displayed in each column.

Bytes per Row

Sets the number of bytes of data to be displayed in each row.

Uppercase Numbers

Select this setting to show hexadecimal numbers with uppercase letters. For example, with this setting, the number 0xabcdef would be displayed as 0xABCDEF.

Show Base Prefix

Select this setting to display the base prefix for the number being displayed. This setting shows the "0x" prefix in front of hexadecimal numbers and the "0b" prefix in front of binary numbers. For example, the hexadecimal number 1122aabb displays as 0x1122aabb if this option is selected, but displays as 1122aabb if this option is not selected.

68K Disassembler

Displays the 68K Disassembler's various modes. Selecting one disassembles the selected address.

ARM Disassembler

Displays the ARM Disassembler's various modes. Selecting one disassembles the selected address.

Number Disassembler

Displays the various modes that the Number disassembler has.

Thumb Disassembler

Displays the various modes that the Thumb disassembler has. Selecting one disassembles the selected address.

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Processes View ^TOP^

This view displays processes that Palm OS Debugger knows about. For example, Palm OS Debugger notifies you when a thread faults or has an uncaught exception. To view the faulted thread, double-click on the thread in the Processes view. The thread name is displayed next to the thread ID (in Palm OS Cobalt, this is the four-character code for the thread). Double-clicking on a thread tree item entry shows the thread's context in the Source view window and updates all views.

Processes View User Interface

You can sort the view by clicking on any of the titles to sort in ascending or descending order. You can sort by Name or Value.

Processes View Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the processes view:

Remove All Added Columns

Removes all added columns.

Copy

Copies selected text in the current window into the operating system clipboard.

Copy All

Copies all text in the current window into the operating system clipboard.

Stack Trace View ^TOP^

This view displays the stack, allowing you to see the previous calls.

Stack Trace View User Interface

You cannot sort the stack trace view.

Stack Trace View Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the stack trace view:

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Expressions View ^TOP^

This displays a text window where you can type a C expression and have it evaluated. You can type in an expression and Palm OS Debugger evaluates it and displays the result. The expression can contain simple variables (no array members and no struct, union, or class members), registers, memory dereferences, and constants.

The expression parser supports the following operators with full C operator precedence (topmost is highest precedence).

Table 4.1 Operators Supported by the C Expression Parser

Expression

How It Is Read

()

left to right

! ~ ++ --

right to left

* / %

left to right

+ -

left to right

<< >>

left to right

< <= > >=

left to right

== !=

left to right

&

left to right

^

left to right

|

left to right

&&

left to right

||

left to right

?:

right to left

= += -= *= /= %= &= ^= |= <<= >>=

right to left

All operations are supported for SInt32, UInt32, SInt64, UInt64, and 4-byte floats. Constant numbers can be in expressions and are entered as they would be in a C program. Integers are SInt32 by default. Integers can be unsigned by following them with a U or UL (for example, 3u). 64-bit integers can be used in expressions by typing a hex number that is too large for a 32-bit value (for example, 0x000000001). Floats can be entered in any format and are assumed to be 4-byte floats by default.

Expressions can currently access debug variables by typing the variable name in the expression The expression parser can use simple variables and does not support members of structs, unions or classes. Registers can be accessed as @<reg_name> (for example, @R0).

The register name is case sensitive. The register name must match the exact name that is found in the register views for it to evaluate correctly. In addition, the register must be valid at the time of the expression being evaluated; the parser cannot read registers prior to connecting.

The expression parser also has built-in expression variables that can be defined and are global to all of Palm OS Debugger. These variables are defined as C-tokens pre-pended with a $ character (for example, $x); note the similarity to Perl variables.

Table 4.2 Sample Expressions

Expression

What It Does

2 << 20

Simple constant expression

x == 3

Find out if the debug variable x equals 0x00000003

myFloat == 2.0

Find out if myFloat is 2.0 (0x40000000)

$foo = 1024

Set expression glob var to 1024

$bar = ++$foo

Set $bar to ++ of $foo

$foo

print the value of $foo

@R0

get the value of the register R0

(@CPSR & 0x1FUL) == 0x10UL

Find out if we are in user mode

(@CPSR & (1 << 5))

Find out if we are in Thumb mode

Expressions Console User Interface

You can sort the view by clicking on any of the titles to sort in ascending or descending order. You can sort by Expression, Result, Hex, or Type.

Expressions Context Menu

You can use the following function from the pop-up menu (displayed with the right mouse button) in the expressions view:

New Expression

Provides an input area (in the Expression column) where you can type an expression. The expression parser evaluates the expression and displays the result in the Result column.

Delete Expression

Deletes the selected expression.

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Profiler View ^TOP^

This view is not used for application development.

STDIO Console ^TOP^

The STDIO Console is a read-only text window where your application can conduct standard input and output operations. The STDIO Console is typically used for output of debug messages.

To write your program so that it uses the STDIO Console, use the AdnDebugMessage() and AdnDebugEnableSet() functions described in Chapter 6, "AdnDebug Manager."

The STDIO Console window is colored grey to indicate that the window is read-only. If an input operation such as scanf is necessary, the window temporarily turns white to indicate input is necessary to continue execution.

STDIO Console User Interface

In this pane, you can use the following functions:

  • Find and Find Next
  • Find Previous
  • Select and Copy text to the clipboard

STDIO Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the STDIO view:

Copy

Copies the text from a tree item, and all its available children, to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Copy All

Copies the text for all visible tree items to the operating system clipboard. Each tree item is formatted to a separate line with the column text tab-separated.

Select All

Selects all of the text in the current window.

Clear

Clears the current console.

Echo Input

Select this setting to indicate that the input typed should appear in the console as text.

Sync on EOL

Select this setting to force the console buffer to flush itself when it detects an end-of-line character. This setting allows you to see console information more quickly.

Debug Console ^TOP^

The debug console is a command line interface, allowing you to interact with your debugging session in a command line environment.

Debug Console User Interface

The user interface of the debug console is a command line interface. The percentage sign, %, is the command line prompt.

Debug Console Commands

Command Arguments
Alias [ <NewAlias> <actualCommand> ]
This allows you to make a new alias of an actual command. Typing this command without any parameters displays all currently assigned aliases.
Bpclear [ <address> <functionname> <symbolname> <symfile(functionname)> ]
Clears a breakpoint at an address, function, or symbol.
Bpset [ <address> <functionname> <symbolname> <symfile(functionname)> ]
Sets a breakpoint at an address, function, or a symbol.
Clear Clears the console contents.
Find [ <function name> <symbol name> symfile(function name)> <symfile(symbol name)>]
Finds a function or symbol address and size from symbolics.
Help [<command name>]
Displays help for all commands or for a specific command.
Lookup <absolute address>
Lets you look up an address in symbolics and see to which symbolic file, source file and source line, function, and scope the address pertains.
Mem [<absolute address> [numbytes=32]]
Displays memory at an absolute address.
Prot Sends commands to the debugger protocol.
To find out what protocol interface commands are supported, use this command:
prot help
Prot nub Sends commands to the debugger protocol nub.
To find out what protocol nub commands are supported, use this command:
prot nub help
Rename <old command name> <new command name>
Renames a command.
Setsym <sym file name>
Sets the current symbolic file for 'sym' commands
sym <varies based on symbolic plug-in interface>
Sends a command down to the current symbolic file's symbolic plug-in interface

Debug Console Context Menu

You can use the following functions from the pop-up menu (displayed with the right mouse button) in the debug console view:

Copy

Copies selected text in the current window into the operating system clipboard.

Paste

Pastes the contents of the operating system clipboard into the current window.

Select All

Selects all of the text in the current window.

Clear

Clears the current console

Echo Input

Select this setting to indicate that the input typed should appear in the console as text.

Sync on EOL

Select this setting to force the console buffer to flush itself when it detects an end-of-line character. This setting allows you to see console information more quickly.