LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

general protection fault

 

I am new to NI CVI environment and running a C code in CVI 2012 that reads data from PXI DAQs using a registered event callback.

Running the application, I get the following error in the middle of the run:

 

FATAL RUN-TIME ERROR: Unknown source position, thread id 0x0000152C: The program has caused a 'General Protection' fault at 0x6D9E0C6B.

 

The address is within the nicaiu.dll module, as reported on the modules window. Once this happens all of the modules are showing "Not Loaded" except for my own .exe application. 

Any idea, what could be causing this? Could this be related to any possible memory corruption? Any settings in th CVI?

Could it be related to the modules being unloaded before my app? If so, what could cause the modules to get unloaded?

 

Thank you

 

0 Kudos
Message 1 of 3
(4,168 Views)

HI mjr1357

 

General Protection faults are ususally memory related issues within programs. General protection faults can  be caused by trying to access null pointers or invalid blocks of memory. Are you able to reproduce the crash at the same point within your code upon every run? That would likely point to a null pointer, non initialized connection, or trying to operate on an unloaded module.

 

Another tool available is to use the Resource Tracking option, which you can use by setting your debugging level to Extended (Options->Build Options menu), and then select resource tracking (Window->Resource Tracking menu) and run your program. You can find more information about resource tracking on the manual page at http://zone.ni.com/reference/en-XX/help/370051V-01/cvi/usermanual/prjwindowrestracking/

 

The big thing will be trying to figure out the exact conditions that reproduce the issue. I would try to see if you can pinpoint the exact point of failure. That will give the best starting point for debugging this issue.

 

Regards,

James W.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(4,151 Views)

Hi,

Thanks for your reply. I could solve the problem. Since the error was stating "Unknown source position", it pointed me towards

the possibility of a corruption in a callback. In fact, I am using  DAQmxRegisterEveryNSamplesEvent to register a callback.

That function was getting called a few times (with errors related to reading overwritten samples), so it was not initially clear that this

function pointer might be corrupt. However, when I double checked, I realized that the calling convention for the callback function

is not explicitly specified to CVICALLBACK (the code is trnasformed from an older DAQmx on Linux). Adding the calling convention immediately got rid of this general protection fault problem.

 

MJR

0 Kudos
Message 3 of 3
(4,141 Views)