Re: Saving breakpoints




<asperamanca@xxxxxxxxx> wrote in message
news:a3aa4d98-e0df-4bf9-9222-6e17e74fe840@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Sep 26, 3:32 pm, "MikeD" <nob...@xxxxxxxxxxx> wrote:
However, if you need to preserve "breakpoints", I recommend you
add Debug.Assert statements into your code. You can also use
the Stop statement to enter into break mode, but you must be
very (VERY) careful to remove them because Stop statements will
terminate your compiled program, whereas Debug.Assert statements
don't even get compiled (with one exception, consult
VB's Help for more info).

--
Mike
Microsoft MVP Visual Basic

Thanks for your reply, Mike!
Unfortunately, adding a Debug.Assert is not an option. Since
I am whitebox-testing the code, it must not change during
the course of the test. Plus, my self-written add-in that
guides me to the code lines I need to test is line-number
based, I would cause myself some extra grief if I added
code lines.

The strange thing: I once considered to add a breakpoint
save/restore into my own add-in. Back then, I couldn't
find any interface to access breakpoint data of the IDE.

I once worked in a shop with similar constraints.

There are two ways to provide conditional preserved breakpoints. You will
likely use both schemes.

Scheme 1:
' A module scope constant that is set during testing in the IDE
Const NDebug As Boolean = False ' Note reversed logic
' Debug Assert statements will be cleaned from compiled code
Debug.Assert (NDebug)

White-box testing takes a degree of assistance from the initial programmer
as code should be written with testing in mind. The programmer has
(hopefully <g>) already done a certain amount of testing before the code is
released so logical 'stopping points' have already been identified and
Assert statements can be used. In this case just leave the Debug.Assert
statements in the code. They can remain labeled without any impact on
released code.

Also consider you can easily add a number of obvious test-patterns by
perhaps using several "DebugModes"...
Const DebugNewCustomer As Boolean = True
Const DebugTax = False
....
This will take care of the majority of stopping-points that will be using on
a regular testing schedule.

Now is also a good time to investigate using the Debug.Assert statement for
its intented purpose, and that is to "Assert" that something is true at this
point or holler loudly if it isn't. Making such statements manditory within
critical code sections is a best practice.

Scheme 2:
' A compile time constant which is also set during testing
' and specifically turned off for production builds
#Const DebugMode = True
#If DebugMode Then
' Debug print args/statements will be in compiled code with this
' switch on, but removed if off.
Debug.Print "This is a breakpoint"
' not compiled in released code
Debug.Assert (True)
#End If

Simply re-write your Addin to ignore lines between #If...#End If statements.
(You could just as easily just ignore "Debug. ..." statements.)

Line numbering should always be done with 'room' between statements. That's
why Addins that provide line-numbers increment them by 10. Nine extra lines
between labels should be room enough for inserting temporary code. Or by
using scheme two above can remain permanently in your code.

Once you start using line-numbering beyond a simple quick debugging device
then those labels become as much a part of the code as the code statements
themselves. Line Numbers have no ordinal or cardinal value. They are simply
labels.

If you want a simple way to inert #If...#End If statements or manage
line-numbering take a look at MZTools
(http://www.mztools.com/v3/download.aspx).

hth
-ralph






.



Relevant Pages

  • Re: Problems with Gambit
    ... do the work of choosing a good Scheme or Common Lisp): ... Adaptative filtering is used to recognize signal patterns. ... I picked a few programs for recognizing EMG signals, ... All these functions were compiled, yet compile time was a small part ...
    (comp.lang.scheme)
  • Re: How do you do this?
    ... Python can execute statements ... language while Scheme is designed to be compiled. ... lexical bindings are always resolvable at compile time. ...
    (comp.lang.scheme)
  • Re: Can one compile khello.cc ?
    ... >upgrade KDE on it. ... >QCString const&, bool, bool)' ... : undefined reference to `QObject::connect(QObject const*, char const*, ... compile to an object file only however, let's test using -c for 'compile ...
    (freebsd-questions)
  • Re: List<> of struct with property. Cannot change value of property. why?
    ... I was under the impression that we were discussing the "const" keyword as it applies to function declarations. ... Second, in the above example, the second line of code doesn't compile. ... In other words, any difference between the two lines of code you posted are caused *not* by the use of the "const" keyword, but rather by the differences in the way the compiler deals with a pointer versus an array. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Overloading the "=" operator for Complex numbers
    ... >> Forgetting const, put the const in and it will compile. ... You might not see a reason, other people don't see the reason, its somewhat ... > float re; ... I pointed out a way to make your program compile, ...
    (comp.lang.cpp)