Home > Archive > VC Language > January 2006 > the process of debugging
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
the process of debugging
|
|
| marco 2 2006-01-25, 7:23 pm |
| Hi everyone!
can some of you give me a structured global description
of how to undertake the process of debugging
(among others with JIT deb.)???
also especially for resolving NULL pointers and
acces violations (on adress 0x00000)???
Thanxxx,
Marc K.
| |
| marco 2 2006-01-25, 7:23 pm |
| in addition to former question:
i don't want to use any pageheap,
except p-heap facilities that are standardly
integrated into JIT/vstudio-debugger.
M.
"marco 2" <rebel-6-out@planet.nl> schreef in bericht
news:43d7d90d$0$12847$ba620dc5@text.nova.planet.nl...
> Hi everyone!
>
> can some of you give me a structured global description
> of how to undertake the process of debugging
> (among others with JIT deb.)???
> also especially for resolving NULL pointers and
> acces violations (on adress 0x00000)???
>
> Thanxxx,
> Marc K.
>
>
| |
| marco 2 2006-01-25, 7:23 pm |
| i just want a structured description of
debugging in general in steps.
M.
"marco 2" <rebel-6-out@planet.nl> schreef in bericht
news:43d7dab7$0$12850$ba620dc5@text.nova.planet.nl...
> in addition to former question:
> i don't want to use any pageheap,
> except p-heap facilities that are standardly
> integrated into JIT/vstudio-debugger.
>
> M.
>
> "marco 2" <rebel-6-out@planet.nl> schreef in bericht
> news:43d7d90d$0$12847$ba620dc5@text.nova.planet.nl...
>
>
| |
| William DePalo [MVP VC++] 2006-01-25, 7:23 pm |
| "marco 2" <rebel-6-out@planet.nl> wrote in message
news:43d7d90d$0$12847$ba620dc5@text.nova.planet.nl...
> can some of you give me a structured global description
> of how to undertake the process of debugging
> (among others with JIT deb.)???
> also especially for resolving NULL pointers and
> acces violations (on adress 0x00000)???
Do you compile and link with debug information? If so, at the time of the
access violation do you get a message box asking if you'd like to debug?
If you answer: yes and yes, then the IDE should take you to the offending
line, no?
Regards,
Will
| |
| Bruno van Dooren 2006-01-25, 7:23 pm |
| there are a number of things, but the following things are generally
usefull:
sprinkle assert statements in your code whenever you expect pointers to have
a certain value, or whenever values always have to be within limits.
remove code from your program until you find the problem.
use the Trace and Debug classes to trace the execution of your code.
but if you really want a good explanation of debugging with visual studio
..NET, read
'Debugging applications for microsoft .NET and microsoft Windows'
by John Robbins.
it's a very good book.
kind regards,
Bruno.
"marco 2" <rebel-6-out@planet.nl> wrote in message
news:43d7deaa$0$12836$ba620dc5@text.nova.planet.nl...
>i just want a structured description of
> debugging in general in steps.
>
> M.
>
> "marco 2" <rebel-6-out@planet.nl> schreef in bericht
> news:43d7dab7$0$12850$ba620dc5@text.nova.planet.nl...
>
>
| |
| marco 2 2006-01-25, 7:23 pm |
| yes it does,
thanxx,
m.
"William DePalo [MVP VC++]" <willd.no.spam@mvps.org> schreef in bericht
news:%230krG4eIGHA.2036@TK2MSFTNGP14.phx.gbl...
> "marco 2" <rebel-6-out@planet.nl> wrote in message
> news:43d7d90d$0$12847$ba620dc5@text.nova.planet.nl...
>
> Do you compile and link with debug information? If so, at the time of the
> access violation do you get a message box asking if you'd like to debug?
>
> If you answer: yes and yes, then the IDE should take you to the offending
> line, no?
>
> Regards,
> Will
>
>
| |
| marco 2 2006-01-25, 7:23 pm |
| hi Bruno!
please help me on this!
1. how do i actually include an asssert?
do i have to #include "assert.h"?
2. how (for god's sake) do i use the Trace and Debug
classes???
M.
"Bruno van Dooren" <bruno_nos_pam_van_dooren@hotmail.com> schreef in bericht
news:%23xmoC8eIGHA.2900@TK2MSFTNGP14.phx.gbl...
> there are a number of things, but the following things are generally
> usefull:
> sprinkle assert statements in your code whenever you expect pointers to
> have a certain value, or whenever values always have to be within limits.
> remove code from your program until you find the problem.
> use the Trace and Debug classes to trace the execution of your code.
>
> but if you really want a good explanation of debugging with visual studio
> .NET, read
> 'Debugging applications for microsoft .NET and microsoft Windows'
> by John Robbins.
>
> it's a very good book.
>
> kind regards,
> Bruno.
>
>
>
> "marco 2" <rebel-6-out@planet.nl> wrote in message
> news:43d7deaa$0$12836$ba620dc5@text.nova.planet.nl...
>
>
| |
| William DePalo [MVP VC++] 2006-01-25, 7:23 pm |
| "marco 2" <rebel-6-out@planet.nl> wrote in message
news:43d7eb62$0$12846$ba620dc5@text.nova.planet.nl...
> yes it does,
If that's so, then the debugger should take to to the source line where the
error is.
Regards,
Will
| |
| marco 2 2006-01-25, 7:23 pm |
| hi Bruno!
please help me on this!
1. how do i actually include an asssert?
do i have to #include "assert.h"?
2. how (for god's sake) do i use the Trace and Debug
classes???
M.
"marco 2" <rebel-6-out@planet.nl> schreef in bericht
news:43d7eb62$0$12846$ba620dc5@text.nova.planet.nl...
> yes it does,
>
> thanxx,
> m.
>
> "William DePalo [MVP VC++]" <willd.no.spam@mvps.org> schreef in bericht
> news:%230krG4eIGHA.2036@TK2MSFTNGP14.phx.gbl...
>
>
| |
| marco 2 2006-01-25, 7:23 pm |
| yes, but i already had come so far.
my question was, what to do when i'm actually inside
JIT.
i have many many years of experience with motorola
assembly. i have been a games programmer/designer
for 20 years. but i'm not yet very familiar with
some aspects of windows programming.
and in the past i never needed to use the debugger.
even when i wrote a 13.000 line engine, with >pure<
68000 assembly. i also know pentium assembly.
but things like for instance Trace and Debug Classes
are very new to me, and i don't yet
understand everything about visual studio 2005.
M
"William DePalo [MVP VC++]" <willd.no.spam@mvps.org> schreef in bericht
news:%23pRYJzfIGHA.1188@TK2MSFTNGP14.phx.gbl...
> "marco 2" <rebel-6-out@planet.nl> wrote in message
> news:43d7eb62$0$12846$ba620dc5@text.nova.planet.nl...
>
> If that's so, then the debugger should take to to the source line where
> the error is.
>
> Regards,
> Will
>
>
| |
| William DePalo [MVP VC++] 2006-01-25, 7:23 pm |
| "marco 2" <rebel-6-out@planet.nl> wrote in message
news:43d808ac$0$12838$ba620dc5@text.nova.planet.nl...
> my question was, what to do when i'm actually inside
> JIT.
Clicking the button on the notification dialog should launch the debugger.
Once there, you should be at the line in the source that caused the problem.
If the error occurs in a line for which you don't have source (in a library,
in the o/s ...) then you can choose to view the callstack which hopefully
shows how you got there. But if the stack is trashed that can fail.
In addition you can hover over a variable name in the source to get a tool
tip that shows its value. Alternatively, you can type the name of a variable
in the watch window to see its value.
You can set breakpoints, run your program to the line at the cursor, view
memory etc.
There are plenty of web resources at msdn.microsoft.com and other sites that
goi into greater detail on the use of the debugger. Google finds them all.
Regards,
Will
| |
| Bruno van Dooren 2006-01-26, 4:03 am |
| Hi Marco,
> 1. how do i actually include an asssert?
> do i have to #include "assert.h"?
yes.
> 2. how (for god's sake) do i use the Trace and Debug
> classes???
install MSDN if you haven't already done so. the Trace and Debug classes can
be used lik for example Trace::WriteLine(...)
of course these are .NET classes, so your program has to use .NET.
if you have added a trace listener to your program, your tracing data can be
written to disk or the screen without having to do much yourself.
with the trace class you can set per message the tracing level. that way you
can set the trace level at runtime to determine how much data is going to be
logged.
If you can spare the money i really advise you to buy that book i mentioned.
its over 500 pages on debugging with VS .NET. it's really the best text on
debugging i have ever seen.
kind regards,
Bruno.
>
> M.
>
> "Bruno van Dooren" <bruno_nos_pam_van_dooren@hotmail.com> schreef in bericht
> news:%23xmoC8eIGHA.2900@TK2MSFTNGP14.phx.gbl...
>
>
>
| |
| marco 2 2006-01-26, 7:08 pm |
| question:
1. if i don't use MC++ (managed code) but compile in vs2005,
will my program need the .net framework to run on
another pc?
2. i'm developing a 3d game. can i provide the latest version of the .net
framework
with my game, when distributing, like the way it's
done with directX?
M
"William DePalo [MVP VC++]" <willd.no.spam@mvps.org> schreef in bericht
news:uDVXA8gIGHA.1836@TK2MSFTNGP11.phx.gbl...
> "marco 2" <rebel-6-out@planet.nl> wrote in message
> news:43d808ac$0$12838$ba620dc5@text.nova.planet.nl...
>
> Clicking the button on the notification dialog should launch the debugger.
> Once there, you should be at the line in the source that caused the
> problem.
>
> If the error occurs in a line for which you don't have source (in a
> library, in the o/s ...) then you can choose to view the callstack which
> hopefully shows how you got there. But if the stack is trashed that can
> fail.
>
> In addition you can hover over a variable name in the source to get a tool
> tip that shows its value. Alternatively, you can type the name of a
> variable in the watch window to see its value.
>
> You can set breakpoints, run your program to the line at the cursor, view
> memory etc.
>
> There are plenty of web resources at msdn.microsoft.com and other sites
> that goi into greater detail on the use of the debugger. Google finds them
> all.
>
> Regards,
> Will
>
>
| |
| William DePalo [MVP VC++] 2006-01-26, 7:08 pm |
| "marco 2" <rebel-6-out@planet.nl> wrote in message
news:43d92485$0$12831$ba620dc5@text.nova.planet.nl...
> 1. if i don't use MC++ (managed code) but compile in vs2005,
> will my program need the .net framework to run on
> another pc?
No, it will not.
Depending on how you link it may need the runtime library from VS2005 but
you can build native, Win32 applications - either console or windowed -
which have no dependency on the framework.
> 2. i'm developing a 3d game. can i provide the latest version of the .net
> framework with my game, when distributing, like the way it's
> done with directX?
Sorry, but I don't know anything about 3D graphics. If no one responds here
you may want to post again in another group.
Regards,
Will
| |
| marco 2 2006-01-26, 7:08 pm |
| two new questions:
1 what means a >red< value in the autos window?
what does the word <autos> mean?
2 what does <add watch> do (in autos and other locations)?
M
"William DePalo [MVP VC++]" <willd.no.spam@mvps.org> schreef in bericht
news:OLFzJXtIGHA.3408@TK2MSFTNGP12.phx.gbl...
> "marco 2" <rebel-6-out@planet.nl> wrote in message
> news:43d92485$0$12831$ba620dc5@text.nova.planet.nl...
>
> No, it will not.
>
> Depending on how you link it may need the runtime library from VS2005 but
> you can build native, Win32 applications - either console or windowed -
> which have no dependency on the framework.
>
>
> Sorry, but I don't know anything about 3D graphics. If no one responds
> here you may want to post again in another group.
>
> Regards,
> Will
>
>
| |
| William DePalo [MVP VC++] 2006-01-26, 7:08 pm |
| "marco 2" <rebel-6-out@planet.nl> wrote in message
news:43d96c70$0$12837$ba620dc5@text.nova.planet.nl...
> 1 what means a >red< value in the autos window?
It means that the value of a variable has changed.
> what does the word <autos> mean?
Auto is short for automatic. It refers to stack-based variables whose memory
is managed automatically by the compiler. In effect the compiler inserts
instructions in the code to reserve stack space for them on entry to a
function and to reclaim the space on exit without explicit instructions on
the part of the programmer as is the case for heap-based allocations.
Regards,
Will
| |
| marco 2 2006-01-27, 7:05 pm |
| Hi
what is "add watch"?
M
"William DePalo [MVP VC++]" <willd.no.spam@mvps.org> schreef in bericht
news:egs$EytIGHA.524@TK2MSFTNGP09.phx.gbl...
> "marco 2" <rebel-6-out@planet.nl> wrote in message
> news:43d96c70$0$12837$ba620dc5@text.nova.planet.nl...
>
> It means that the value of a variable has changed.
>
>
> Auto is short for automatic. It refers to stack-based variables whose
> memory is managed automatically by the compiler. In effect the compiler
> inserts instructions in the code to reserve stack space for them on entry
> to a function and to reclaim the space on exit without explicit
> instructions on the part of the programmer as is the case for heap-based
> allocations.
>
> Regards,
> Will
>
>
| |
| William DePalo [MVP VC++] 2006-01-27, 7:05 pm |
| "marco 2" <rebel-6-out@planet.nl> wrote in message
news:43da4fb4$1$12843$ba620dc5@text.nova.planet.nl...
> what is "add watch"?
It adds what is sometimes called a "watch point". :-)
The debugger watches for changes in a variable. When it changes the debugger
stops executing your program immediately after the change and reports the
change.
One of the prime usages of the facility is to detect a buffer overrun or
some otherwise unintended update of a variable.
Regards,
Will
| |
| marco 2 2006-01-27, 7:05 pm |
| what is the vstudio/c++ runtime?
is it a file, or a set of files?
should or can i include it with my 3d-game,
when i have it distributed???
M
"William DePalo [MVP VC++]" <willd.no.spam@mvps.org> schreef in bericht
news:escd9h3IGHA.648@TK2MSFTNGP14.phx.gbl...
> "marco 2" <rebel-6-out@planet.nl> wrote in message
> news:43da4fb4$1$12843$ba620dc5@text.nova.planet.nl...
>
> It adds what is sometimes called a "watch point". :-)
>
> The debugger watches for changes in a variable. When it changes the
> debugger stops executing your program immediately after the change and
> reports the change.
>
> One of the prime usages of the facility is to detect a buffer overrun or
> some otherwise unintended update of a variable.
>
> Regards,
> Will
>
>
| |
|
|
| Ben Voigt 2006-01-30, 7:07 pm |
|
"marco 2" <rebel-6-out@planet.nl> wrote in message
news:43d96c70$0$12837$ba620dc5@text.nova.planet.nl...
> two new questions:
>
> 1 what means a >red< value in the autos window?
> what does the word <autos> mean?
These are useful for single-stepping:
Autos is a window that automatically displays variables in the last line
executed, and the line about to execute. If a value changes, it turns red.
>
> 2 what does <add watch> do (in autos and other locations)?
Sometimes you want to keep an eye on global variables, parameters, or maybe
the result of a computation. Add watch lets you add pretty much any C/C++
expression into the watch window, and show you the result.
>
> M
>
> "William DePalo [MVP VC++]" <willd.no.spam@mvps.org> schreef in bericht
> news:OLFzJXtIGHA.3408@TK2MSFTNGP12.phx.gbl...
>
>
|
|
|
|
|