Keil Logo

µVISION DEBUGGER: DETECTING NULL POINTER ASSIGNMENTS


Information in this article applies to:

  • µVision Version 1 and Later

QUESTION

How do I check my program for assignments to NULL pointers?

ANSWER

It is easy to use the µVision Debugger to check for NULL pointer assignments. The steps to take to detect NULL pointer assignments (and make them less likely to cause problems) are:

  1. Use the linker options to relocate the beginning of your data areas so they don't begin at offset 0. Since a NULL pointer accesses this memory area, starting your program's variables and data at a different address reduces the chance that a NULL pointer assignment changes anything of importance.
  2. In the debugger, set a memory access breakpoint at the beginning of the data area (at address 0x0000). When your program READS or WRITES to this location, the debugger halts execution on the line that accessed the NULL address.

The following command:

BS READWRITE BYTE(X:0x0000)

sets a READ or WRITE access breakpoint on the byte at XDATA memory location 0x0000. When anything reads from or writes to that location, the debugger halts the program.

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Saturday, July 9, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.