NULL Pointer Assignment Errors

Hey there,


We are working under QNX 4.25 using Watcom 10.6 compiler in text mode.
In almost every case we get a “NULL Pointer Assignment” error on exit
from these programs. I have read the manuals on this matter. There is
a write up in the QNX Debug Manual. It talks about how to debug this
error. The problem is the debug stuff is written for Video. Anyone got
any ideas about how to debug this???


Thanks for your assistance.


Larry Sams

Somewhere in your code something that is effectivly similar to:
some_kinf_of * ptr = 0;
*ptr = some_data;

I think Watcom actually NULLs out the fiurst 32 bytes. When your program
exits it then scans those 32 bytes. If they are not NULL, then you get this
error.

So, in you code, periodicly check the first 32 bytes. When they look
Non-NULL then you know that the problem has just happened.

The real problem here is that whatever you intended to happen did not
actually happen. SO this Null Pointer Assignment message is actually
helping to catch your otherwise unnoticed bug.


Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net

“Larry Sams” <lsams@imaginei.com> wrote in message
news:3BE066A1.475073EB@imaginei.com

Hey there,


We are working under QNX 4.25 using Watcom 10.6 compiler in text mode.
In almost every case we get a “NULL Pointer Assignment” error on exit
from these programs. I have read the manuals on this matter. There is
a write up in the QNX Debug Manual. It talks about how to debug this
error. The problem is the debug stuff is written for Video. Anyone got
any ideas about how to debug this???


Thanks for your assistance.


Larry Sams

Set up a break on write on address 0. Your program will run a lot slower but
it will catch the offending code.


Larry Sams wrote:

Hey there,

We are working under QNX 4.25 using Watcom 10.6 compiler in text mode.
In almost every case we get a “NULL Pointer Assignment” error on exit
from these programs. I have read the manuals on this matter. There is
a write up in the QNX Debug Manual. It talks about how to debug this
error. The problem is the debug stuff is written for Video. Anyone got
any ideas about how to debug this???

Thanks for your assistance.

Larry Sams

How do I set a breakpoint on address 0???

Thanks,

Larry


Dave Allamby wrote:

Set up a break on write on address 0. Your program will run a lot slower but
it will catch the offending code.

Larry Sams wrote:

Hey there,

We are working under QNX 4.25 using Watcom 10.6 compiler in text mode.
In almost every case we get a “NULL Pointer Assignment” error on exit
from these programs. I have read the manuals on this matter. There is
a write up in the QNX Debug Manual. It talks about how to debug this
error. The problem is the debug stuff is written for Video. Anyone got
any ideas about how to debug this???

Thanks for your assistance.

Larry Sams

Larry,

First run your program under the debugger and when the program has ended and you
have received the NULL assignment message, inspect ds:0 (start of data)
using Data, Memory at … and 0 The first 32 bytes should be 1. Figure out
which one has changed (you can’t assume that it is the first byte). When you have
the location reload your program and do Data, Memory At… 0. Using your
mouse, right click while the cursor is over the offending location. One of the
items is break on write. Select that and then start your program. It will run
quite slow but you should find the problem provided it is not time sensitive.

Dave


Larry Sams wrote:

How do I set a breakpoint on address 0???

Thanks,

Larry

Dave Allamby wrote:

Set up a break on write on address 0. Your program will run a lot slower but
it will catch the offending code.

Larry Sams wrote:

Hey there,

We are working under QNX 4.25 using Watcom 10.6 compiler in text mode.
In almost every case we get a “NULL Pointer Assignment” error on exit
from these programs. I have read the manuals on this matter. There is
a write up in the QNX Debug Manual. It talks about how to debug this
error. The problem is the debug stuff is written for Video. Anyone got
any ideas about how to debug this???

Thanks for your assistance.

Larry Sams