Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display an array range via a pointer in the IAR IDE Watch window?

In the IAR Embedded Workbench I have a pointer pointing to a buffer in memory. When watching the pointer, I can see the contents of the word it points to. How can I tell the Watch view to list a range of the buffer, from the pointer onwards, for some specified length of elements?

For example, enter the expression:

myPtr[0..2]

will display information equivalent to the three expressions:

myPtr[0]
myPtr[1]
myPtr[2]
like image 941
ysap Avatar asked Sep 23 '14 19:09

ysap


2 Answers

From the Iar Embedded Workbench (9.20) help:

In windows where you can edit the Expression field and in the Quick Watch window, you can specify the number of elements to be displayed in the field by adding a semicolon followed by an integer. For example, to display only the three first elements of an array named myArray, or three elements in sequence starting with the element pointed to by a pointer, write:

myArray;3

To display three elements pointed to by myPtr, myPtr+1, and myPtr+2, write:

myPtr;3

Optionally, add a comma and another integer that specifies which element to start with. For example, to display elements 10–14, write:

myArray;5,10

To display myPtr+10, myPtr+11, myPtr+12, myPtr+13, and myPtr+14, write:

myPtr;5,10
like image 72
spoorcc Avatar answered Nov 15 '22 19:11

spoorcc


An alternative would be to view it in memory. Select View -> Memory and enter the pointer value (with 0x prefix). You can view and edit the range of data. Maybe not as "clean" as a traditional debugger variable viewer but it does the job.

like image 34
cutofmyjib Avatar answered Nov 15 '22 19:11

cutofmyjib