LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

To find out where exactly the error happened in Release Mode / Debug Mode when GENERAL PROTECTION ERROR happens

Hi
While running the application in Release mode, I am getting GENERAL PROTECTION ERROR.
I am getting the address where the error happened.
Since I have selected the option "Build --> Target Settings --> Generate Map File", my map file gets generated.
So using the address I can reach the particular function where the error has happened.
 
MY QUERY FOLLOWS:
In Visual Studio, we can set the option to know in which line of thhe particular function the error happened by setting the option "Project--> Settings --> C/C++ --> Debug info:" with "Line Numbers only" and adding the commands /MAPINFO:LINES /MAPINFO:EXPORTS in "Project --> Settings -->Link -->Project  Options:"
In LabWindows, is there any options to know in which line the error happened in that particular function.
Where we can set the "Debug Info" and "Link" options.
 
Joesam
0 Kudos
Message 1 of 4
(3,059 Views)
You do not have this option in CVI.
 
Since you already know which function the error is happening in, my suggestion is to sprinkle some trace messages throughout that function and see how far you get. This should only take you a couple of minutes. The easiest way is to use the MessagePopup function, but if the display of a panel interferes with the timing in your program, and if that is a problem, then you can use fprintf. Just make sure to follow each fprintf with an fflush, to make sure every message is written out to the file, before the program crashes)
 
Luis
NI
0 Kudos
Message 2 of 4
(3,056 Views)

I dont know in which function the error is happening. What I have mentioned is that, if we select the option to generate the map file, we will be able to know the particular function. Also the error is not generating all the times. The problem is happening at my clients place and we have installed our application in their system. They dont have any source code there. Also its not necessary that the problem will happen when we are there in clients place. If the error is happening during development time and we know the function where the error is happening, ofcourse we can trace it using fprintf or MessagePopup functions. In this situation I want to generate a map file in their system so that I can trace the error when ever it happens. As I have mentioned in my query, I am intersted in knowing whether there is any option to generate the line number in map file similar to Visual Studio.

Joesam

0 Kudos
Message 3 of 4
(3,024 Views)
Joesam,
 
I assumed you knew what function the GPF ocurred because I thought you had already generated the map file and compared the address reported by the GPF eith the addresses in the map file. My bad.
 
By the way, you do not need to generate the map file in their system. You can generate it in your system, as long as you do it when building from the same exact source code that you did when you built the binary that you sent to your client.
 
Of course, even if you learn which function the crash is in, that is usually not sufficient. As you know, you would then need to investigate which assumptions that your code is making are not valid, and it how it came to be in that state. That would be true even if you knew the exact line. Usually the map file is just one of several steps needed to debug these thorny, hard-to-reproduce problems.
 
There are two possibilities to debug this further. If you have CVI 7.1, and there is no network firewall between your site and your client's, you can use the remote debugging feature to debug your client's machine from your own. If this is not possible, you would need the cooperation of your client and send him or her versions of your binary with fprintfs, so that you could iteratively find out where and why the crash is happening.
 
Luis 
0 Kudos
Message 4 of 4
(3,015 Views)