|
|
How can I detect null references in my program? |
| On OpenServer, there are two kernel global variables of interest in
/etc/conf/pack.d/kernel/space.c that may be set.
If notice_null_refs is non-zero, a kernel message will be generated when a program attempts to reference the page with a virtual address of zero. If signal_null_refs is non-zero, the kernel will detect zero page references and deliver a signal to the process, killing it and likely leaving a core dump for analysis. TLS594, available at ftp://ftp.sco.com/TLS allows finer control of these actions.
| |
| On UnixWare 7, the 'nullptr' command can enable, disable, or trap null pointer
references on a per-uid basis. On UW7 before 7.1.0, many system utilities
(vi, more, pg) become unstable if nullptr disable is ineffect.
robertlipe@usa.net | |
| With UW7.1, the MALLOC_CHECKS environment variable can be set to cause
page zero to be unreadable. See malloc(3C). This works on a per-process
basis. Note that since page zero must first be read to turn off access,
when "nullptr disable" has been set, this MALLOC_CHECKS setting will cause
a process to die when it first gets into malloc() code.
dfp@sco.com | |
| Beginning with UnixWare 7.1.3 see also memtool(1) for
dealing with null pointers and related memory bug checks.
jls@sco.com | |
| [Append to This Answer] |
| Previous: |
|
| Next: |
|
| ||||||||