LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CINs debugging external code?

Hello!!

I'm starting to work with CIN and I've got a problem.

I have some programs which I would like to follow step by step. I have read in the manual: "Using External Code" pages 3-18..What i should do. But i think that i have done something wrong because it doesn´t work as I expected.

1. I have added to my code the CINLoad with the assemby command and the DbgPrintf command.
2. I´ve changed the project settings typing in executable for debug session my labview executable. e.g: cross

But after all this, when I load the program it shows an unknown software exception, the error occurring at the instruction "_asm int 3" inside the cinLoad command and i can do anything else.

I know the basic code of the program i´m using is
right because i´m testing it with an NI´s example which is provided with Labview.

I would be pleased if anyone could send me an example code with a debuger configuration?

Thank you.

Silvia.
0 Kudos
Message 1 of 3
(2,779 Views)
ok first of all, don't call "_asm int 3" from CINLoad. Put the following code at the top of your CINRun

#ifdef _DEBUG
char msg[256];
sprintf(msg, "Attach to process %d and press yes to debug.", GetCurrentProcessId());
if(MessageBox(NULL, msg, "Debug", MB_YESNO|MB_ICONQUESTION|MB_SETFOREGROUND)==IDYES)
_asm int 3;
#endif // _DEBUG

You might have to include stdio.h,windows.h for this. Compile, attach lsb file to VI and run the VI. It should pop up dialog box telling you process# you want to attach to.

Note down the process number, launch VC, goto "Debug>>Start Debug>>Attach to Process" and choose LV process number. VC should bring up your .c file. Now click yes to the dialog box to dismiss it.

Now you can step through your CIN code. enjoy and
good luck!!

ARafiq
Message 2 of 3
(2,779 Views)
It works perfectly.

Thank you, very much!!!
0 Kudos
Message 3 of 3
(2,779 Views)