How to display a range of arrays using the pointer in the IAR IDE Watch viewport?

In the IAR Embedded Workbench, I have a pointer pointing to a buffer in memory. When viewing a pointer, I see the contents of the word that it points to. How can I show in the Watch view a list of the buffer range, starting with the pointer, for a specific length of elements?

For example, enter the expression:

myPtr[0..2] 

will display information equivalent to three expressions:

 myPtr[0] myPtr[1] myPtr[2] 
+5
source share
2 answers

From the Iar Embedded Workbench (9.20) help tab:

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

 myArray;3 

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

 myPtr;3 

Optionally add a comma and another integer that indicates which ones to start with. For example, to display items 10-14, write:

 myArray;5,10 

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

 myPtr;5,10 
+1
source

An alternative would be to view it in memory. Choose View → Memory and enter a pointer value (prefixed with 0x). You can view and edit the range of data. It may not be as clean as the traditional debugger variable viewer, but it does the job.

+3
source

Source: https://habr.com/ru/post/1203250/


All Articles