LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie: Debugging external code

Hello,

in our project we are using a CIN for certain Algorithms. The annoying thing
there is, that we are not able to debug the code(?). And every SegFault
crashes LabView completely.

Q:
Is there a way to debug the code provided in an lsb?
Is it possible to debug a DLL with VC++? If so, how can I achieve this?
Are there any other debugging techniques not covered above?

Thank you in advance

Olli
0 Kudos
Message 1 of 3
(2,917 Views)
I do that regularly, however I create the CIN resource trough the command line. If you create it with the Visual C IDE you will have to make sure you enable the debugging features in the Compile and Link tab of the project settings. This would be mainly:
Compile (C/C++): Optimization: Disable (debug) (/Od)
Linking: Generate debug info (/debug)

In addition you may want to define following makro in your source file:

#ifdef _DEBUG
#define DebugBreaking() {__asm int 3}
#else
#define DebugBreaking()
#endif

and add the DebugBreaking(); call whereever in your source code where you want to break into the debugger. The standard Win32 API DebugBreak() never was able to find my source code to do source code debugging in VC.

Also VC may not be setup automa
tically to catch exceptions and you only get a General Protection fault dialog or a Dr. Watson dialog. There are some registry settings you can make to get VC to be your system debugger and there should be information about how to set that up in your VC documentation or alternatingly on msdn.microsoft.com.

Rolf K
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 3
(2,917 Views)
To add to Rolf...

Look in the "Using External Code in LabVIEW" manual for creating a debugable CIN that allows you to step through the code. The directions are not extensive but they are all that is avaliable. You can find the manual by opening LabVIEW >> help >> search the LabVIEW bookshelf.
0 Kudos
Message 3 of 3
(2,917 Views)