Null pointer in a header file

If the compiler-generated object is shown in the log entry, the offset in the null pointer detection log entry might not match the listing.

If you need more information, you can debug your application:
  1. Set the Stop at null pointers and addresses breakpoint to stop running your program at the location where the null pointer detection event occurs.
  2. View the module, object, and function in the log file to see where the event occurs. The Debugger source line field shows the line where the event occurs.
  3. Start of changeIn the Debug view, examine the stack and variables to determine the cause of the event.End of change

The code in the following example comes from the compiler generated listing. The code might not be the same for other compilers.

Example

The following log entry indicates that a null pointer is detected in a memcpy function call:
A null pointer or null address was detected.
Module: QDBW
Object: CompilerGenerated
Function: memcpy
Debugger source line: 508
Offset: 0xC2
ECB address: 0x12203000
Instruction address: 0x9F187162
ECB TOD: DBF23137D3259D45
ECB creation time: 12 Aug 2022, 18:27:56
To figure out how a null string was passed to the memcpy function, you debug your application and set the Stop at null pointers and addresses breakpoint. The debugger stops the application at the memcpy function at line 508.
507 inline void * memcpy (void *__x, const void *__y, size_t __z)
508        { return __memcpy(__x, __y, __z); }
In this case, the problem is not with the memcpy function. From the stack, you can see that the memcpy function is called by the resetName method, which is called by the zeroPointerHeader function.
Execution Pt. :   : 0x000000009ED3A166	
memcpy : CompilerGenerated.o 
ZeroAddressDriverClass::resetName : CompilerGenerated.o 
zeroPointerHeader: qdbw.o -O0 -gdwarf 
zeroAddressDetectionCases : qdbw.o -O0 -gdwarf 
QDB0 : qdb0.o -O0 -g3 
The problem is not with the resetName method because this method only calls the memcpy function.
89    void resetName(char * temp)
90    {
91      char name[5];
92      memset(name,0,5);
93      memcpy(name,temp,4);
94    }; 
The problem is that the input to the resetName method is null.
389 void zeroPointerHeader()
390 {
391   ZeroAddressDriverClass zeroAddressTest;
392   zeroAddressTest.setName(NULL);
393   zeroAddressTest.resetName(NULL);
394   zeroAddressTest.print();