Expression Evaluation
Studio 12, SPARC Solaris 9
There is an article in the IDE Help titled "Evaluating an Expression" and says:
To evaluate an expression:
1. Start a debugging session.
2. Choose Run > Evaluate Expression (Ctrl-F9) from the main window.
3. Type the expression in the Expression drop-down and click Evaluate. The result is shown in the Results window.
I can't find this menu item nor ctrl-F9 works. Do I have to configure something or is this feature not implemented?
What other possibilities are there for avaluating an expression?
[579 byte] By [
mriba] at [2007-11-27 6:42:35]

# 1
I can't find neither the article with such title nor Evaluate menu item either.
Here's what I'd do in order to evaluate an expression:
- start debugging session,
- open "Watches" tab and choose "New Watch" from pop-up menu (right-click somewhere in this tab),
- type your expression and hit OK button,
or
- open Dbx Console and issue
print <expression>
# 2
Thanks for the reply.
In most cases where I need to evaluate an expression is when I have a pointer to an array of structs.
The watches are not very flexible. The index range I can give is pretty small (depends on the size of the structure) and I have to delete and add a new watch each time.
Is there a better way to work with (allocated) arrays than with watches?
mriba at 2007-7-12 18:12:44 >

# 3
If I understand you right, you need smth like this:
watch arr[10..40]
where arr is array of structures, right?
If range of indices and/or size of structure is too large, you can supply -L parameter to watch (or print, or display) commands. It looks like this option is not accessible from the GUI, but you can type watch command directly in the dbx console. For example, this worked for me:
(dbx) watch -L array[20..50]
Note that this will slow down the debugger so use with caution.
I didn't understand why you have to re-create new watch each time. Is it because watched expression is re-parsed every time the app stops on an event of interest? In this case, you can use 'display' command (again, no GUI support, you need to type it in and then the expression appears in Watches tab).