LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Debugger takes control of an already running program

Is there any way to make the CVI debugger take control of an already-executing debug build?

 

Other frameworks can do this - is the JIT debugger in CVI 2010 able to do this?

 

Thanks

0 Kudos
Message 1 of 6
(3,455 Views)

Now that I look into it, it looks like that is exactly what the JIT debugger is for  ... not sure if it has to be a debug build to attach to but seems like maybe it would have to be - or at least have a matching symbol table/meta data for the executable - not sure how the debugger is implemented.

 

Suspect that this works only on executables built with CVI 2010 - so that if I tried to attach to my CVI 2009 built application with CVI 2010 IDE, it wouldn't do the trick?

0 Kudos
Message 2 of 6
(3,454 Views)

CVI will allow you to attach to any running process. But you're correct. In order to really be able to debug it, it must include some debuggable code built with CVI 2010. Note that the .exe itself doesn't have to be a debuggable CVI exe... you might only be interested in debugging some individual DLL, for example. But this DLL must be built from a debug configuration in CVI 2010.

 

By the way, the JIT debugger itself is really only needed to do post-mortem debugging -- to attach to your program after it has already crashed.

 

Luis

Message 3 of 6
(3,444 Views)

Thanks Luis for the reply.

 

Well, maybe I'm still confused - can I use the JIT debugger to grab control of a running application?

 

I have an app in a spin lock somewhere (i.e. still running) and I want to attach to it and the stop the execution and see where it is.

 

Not sure what post-mortmem debug means if the app is not running ("crashed") then there's nothing to attach to it would seem to me.  Or by "crash" maybe you mean there's a debug popup (e.g. library error) ?

 

Thanks.

0 Kudos
Message 4 of 6
(3,431 Views)

I think the confusion is just an issue of terminology. The CVI debugger can attach to any running application from the Run>>Attach to Process... menu item (though there are the limitations that Luis mentioned, when the binary is not built with debugging).

 

When a process on Windows crashes, it does not necessarily exit immediately. If there is a program registered with the system as a JIT debugger, Windows will launch that program and allow it to attach to the newly crashed process. This is what Luis meant by "post-mortem debugging".

 

Mert A.

National Instruments

Message 5 of 6
(3,418 Views)

Thanks both of you for the response.

 

OK got it - JIT can grab any running CVI 2010 debug build, as well as register as the debugger with the OS when it's willing to schedule it due to a crash (as with an exception that a C application can't catch).  I think I tried once before to get the OS to use CVI as the debugger on a crash and it wouldn't do it (well, until now with CVI 2010).

 

This is a good improvement - enought for me to switch over to CVI 2010.

 

With fast multi core micros we can get away with running debug builds most all of the time for many applications, so this will help us with deployed apps that get into trouble.

0 Kudos
Message 6 of 6
(3,409 Views)