[Gdal-dev] Debugging in Visual C++ with nmake build

Brent Fraser bfraser at geoanalytic.com
Wed Aug 10 16:54:37 EDT 2005


Hmm. I'm not sure how I figured that our either!  Oh yeah, I had to debug
C++ ActiveX dlls called from a VB app.

I thought there must be a better way to solve your problem, so I tried
setting the exe in a project:

- make sure the gdaltindex.exe is compiled for Debug via nmake
- Invoke the VC++ 6 IDE, and create a new console app project (it doesn't
matter where or what it is named)
- Select Project -> Settings, then select the Debug tab
- Select the ">" button on the end of the "Executable for debug session" and
select browse
- Browse to your gdaltindex.exe, click Ok to dismiss Project Settings dialog
- Select Build -> Start Debug -> step Into

It should stop at the first executable line and show your source code.  And
no DebugBreak required.

Brent


----- Original Message ----- 
From: "Dan Greve" <grevedan at hotmail.com>
To: <bfraser at geoanalytic.com>
Cc: <gdal-dev at lists.maptools.org>
Sent: Wednesday, August 10, 2005 2:25 PM
Subject: Re: [Gdal-dev] Debugging in Visual C++ with nmake build


> Brent,
>
> Interesting technique.  Not sure how you figured that one out.  I added
the
> line, and rebuilt but the executable, gdaltindex.exe, does not popup a
> dialog, nor is there any output. Am I missing something?
>
> -- dan
>
> >From: bfraser at geoanalytic.com
> >To: "Dan Greve" <grevedan at hotmail.com>
> >CC: gdal-dev at lists.maptools.org
> >Subject: Re: [Gdal-dev] Debugging in Visual C++ with nmake build
> >Date: Tue, 9 Aug 2005 19:11:24 -0600 (Mountain Daylight Time)
> >
> >Dan,
> >
> >   A trick I've used is to insert a
> >      DebugBreak();
> >statement in the C main I want to debug and compile gdal for debug using
> >nmake -f makefile.vc.  When you run the app, a dialog will popup asking
if
> >you want to abort the application (or No to debug it).  If you answer No,
> >the VC++ IDE will be invoked, showing the assembler code.  Click the
> >"Single Step" icon twice in the IDE to advance to the source code, and
> >dismiss the assembler window.  You can then step thru the source.
> >
> >Oh yeah, to be able to compile with the DebugBreak(); you need to do
> >#include <windows.h>
> >
> >Sounds kinda complicated, but it's not too bad once you try it.  It's
also
> >a handy way of debugging a CGI app like Mapserver...
> >
> >Brent Fraser
> >
> >
> >
> > > Is this even possible?  I'm getting tired of maintaining a separate
gdal
> > > project to make the makefile.vc for the entire gdal tree.  Any visual
> >c++
> > > experts? I'm using 6.0
> > >
> > > -- dan greve
> > > -- melbourne fl
> >
> >
>
>




More information about the Gdal-dev mailing list