User`s manual

Dynamic C Users Manual digi.com 99
6.3.6 Memory Dump
The Dump window was improved in Dynamic C 8.01 in several ways. For example, multiple dump win-
dows can be active simultaneously, flyover hints make it easier to see the correct address, and three differ-
ent types of dumps are allowed. Read the section titled, “Dump at Address,” for more information on these
and the other improvements made in version 8.01. In Dynamic C 9, dump windows were improved again.
One improvement is that values that have changed are shown highlighted in reverse video or in customiz-
able colors. Another improvement is that the value entered in the Memory Dump Setup dialog is the first
address shown in the dump window. E.g., if you type in a logical address such as 74ec (all addresses are in
hexadecimal), that will be the first address shown. Earlier versions of Dynamic C took a zero-based
approach, meaning that the first address would be 74e0.
Pros Dump windows allow access to any memory location, beginning at any address.
There are alignment options; the data can be viewed as bytes, words or double-
words using a right-click menu.
Cons The Dump window does not contain symbolic information, which makes some
information harder to decipher. There is the potential for increased debugging
overhead if you open multiple dump windows and make them large.
Uses Use a dump window when you suspect memory is being corrupted. Or to watch
string or numerical data manipulation proceed. String manipulation can easily
cause memory corruption if you are not careful.
Example Consider the following code:
char my_array[10];
for (i=0; i<=10; i++){
my_array[i] = 0xff;
}
If you do not have run-time checking of array indices enabled, this code will cor-
rupt whatever is immediately following my_array in memory.
There is no run-time checking for string manipulation, so if you wrote something
like the following in your application, memory would be corrupted when the null
terminator for the string “1234” was written.
void foo () {
int x;
char str[4];
x = 0xffff;
strcpy(str,”1234”);
}
Watching changes in a dump window will make the mistake more obvious in
both of these situations, though in the former, turning on run-time checking for
array indices in the Compiler tab of the Project Options dialog is easier.