LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

will CVI honor a breakpoint in a program scheduled by another process?

I have a CVI program that is scheduled by another process with a CreateProcess Win32 SDK function call.  It is scheduling a debug build of the application.  I have the CVI IDE running with the application loaded and active, and a breakpoint set in the source code.  Is there anyway for the CVI IDE to honor such a breakpoint, so that when the CreateProcess call is executed, the CVI IDE honors the breakpoint?

 

If I run the application directly from CVI, it's not the same scenario - I need to debug the interaction between the scheduling process and the application.  This isn't quite like debugging a dll that's being invoked by a process.

 

Thanks,

 

Menchar.

0 Kudos
Message 1 of 7
(3,965 Views)

it does not seem CVI will honor a breakpoint if it is not launching the application itself. there is no way to attach to a running process (feature request for a future version ?), no way of overwriting the command line, even the Breackpoint() function does not break if the debugger is not running.

 

the only way i can think of right now is to deliberatly crash the software at startup to bring up the debug dialog, then launch the debugger and continue execution. but generally, when the debug dialog appears it is already too late and the execution cannot be resumed.

0 Kudos
Message 2 of 7
(3,942 Views)

Hello,

 

Unfortunately, I believe that dummy_decoy is correct when indicating that there is no way for this breakpoint

to be utilized outside of an execution that stems from the CVI environment.  However, one alternative approach

for debugging would be to temporarily place some form of output prior to the line of code you intend to break

on.  This output could detail the present state of certain variables of interest to you as well as potentially

halt execution by waiting for user input (depending on the nature of your application) in order to give you a

chance to examine the state of the system by some other means in the OS.  I hope these suggestions are helpful

to your end goal!

0 Kudos
Message 3 of 7
(3,923 Views)

I would have thought there would be a way to do this, it's not an uncommon scenario in Windows.

Hand crafted code to dump variables? - I already bought a debugger (CVI), I don't want to write one.

Other debuggers can accomplish this very thing - capturing a task after it's been started.

 

0 Kudos
Message 4 of 7
(3,921 Views)

Menchar,

 

I definitely understand your frustration with the effort that you might actually have to put forward to accomplish this task.  In line with dummy_decoy's comments, I would be glad to submit this idea as a product feature suggestion for consideration in subsequent versions of LabWindows/CVI.  I agree that it would be a very helpful tool for the debugger, which is actually one element of the much larger environment that is LabWindows/CVI, but a very important element of application development nonetheless.  Please feel free to respond with any additional questions or suggestions that you might have!

0 Kudos
Message 5 of 7
(3,916 Views)

here, i have it ! in the build options of your software, make sure "Detect uninitialized variables at runtime" is checked. then in your code, declare 2 dummy variables, do not assign them a value, and assign one to the other, like this:

 

int main()

{

    int dummy1, dummy2;

 

    dummy1 = dummy2;

}

 

this will trigger an uninitialized variable non-fatal error, which allows you to jump into the debugger. then you can resume execution safely and debug your software. a bit complicated, but it should be a good placeholder until this feature is added to CVI.

Message 6 of 7
(3,892 Views)

Didn't recall that you could launch CVI from the non-fatal error popup ... but if so, then, yes, this is a solution.

 

I'll give it a try.

 

Menchar

0 Kudos
Message 7 of 7
(3,863 Views)