[vtkusers] How to debug a vtk class (single step in code)?

Per R. Andresen pra at trivision.dk
Thu Oct 7 03:08:27 EDT 2004


Dear Julien

Thanks for your reply. Unfortunately, I've already tried it. Both running
the exe-file as the active project and "letting" the DLL run the exe-file.
I've also placed a breakpoint at vtk<Class>->Update() in the main function
and tried to step into the class. The debugger correctly stops at the
breakpoint, but I'm not able to "step into" the class. This happens after
the class has been initialized with "SetNumberOfIterations" etc. (which
should ensure that the DLL is loaded). 

None of it seems to work :( (I think it has something to do with the way the
class is allocated and called through the object factory).

/Per

-----Original Message-----
From: Julien Alizier (free.fr) [mailto:julien.alizier at free.fr] 
Sent: 7. oktober 2004 08:19
To: Per R. Andresen; vtkusers at vtk.org
Subject: Re: [vtkusers] How to debug a vtk class (single step in code)?

Hi Per,

There are 2 ways in VC++ to debug shared libs :
1) The simpler (1 DLL) : Set your new dll as "Active Project". Set your
breakpoints wherever you want in your active project source files. When you
debug, specify the excutable you wish to run. The BP are then still active.
2) To step into multiple DLL : Set breakpoints where you want in your code.
Then set a breakpoint in the main executable or at the beginning of the
active project. Take care of setting it in a way that it insure that all DLL
are loaded at that point. When you'll run it in Debug, some breakpoints will
be disabled but not that one. So it will stop at that point. Press CTRL-B to
show the breakpoints dialog box. Check all checkboxes to re-enable your
disabled breakpoints. Run/Continue -> That's it!

Why : VC++ cannot set BP on a DLL that is not loaded. When this DLL is the
active project, VC++ will wait for it to be loaded before enabling BP.
Otherwise you'll have to wait for the DLL to be loaded and then set BP.

HTH

-- Julien


----- Original Message ----- 
From: Per R. Andresen
To: vtkusers at vtk.org
Sent: Thursday, October 07, 2004 1:27 AM
Subject: [vtkusers] How to debug a vtk class (single step in code)?


Dear VTK users,
I've wrote a VTK class and would like to single step (debug) the Execute()
function in debug-mode. It's possible to set breakpoints, but the
breakpoints change to "question marks" (meaning "A breakpoint cannot be set
because the code at this location is not loaded") when running the program.

I'm running on Win XP using MS Visual Studio 2003 .net and compiled VTK
(4.4) with shared libs. It should be possible to single step in DLL's
according to the Visual Studio manual but apparently not VTK classes. Is
this due to the VTK object factory? If so, how does one debug VTK classes
(hopefully not with print statementsJ)?

Thanks in advance,
Per



_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers







More information about the vtkusers mailing list