Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #15304

Re: Single Step Debugging, why or why not?

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups comp.lang.forth
Subject Re: Single Step Debugging, why or why not?
Date 2012-08-31 08:54 +0000
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID <2012Aug31.105444@mips.complang.tuwien.ac.at> (permalink)
References <ab2c43cf-2e71-479a-8fd9-d6f385ff515d@googlegroups.com>

Show all headers | View raw


Jason Damisch <jasondamisch@yahoo.com> writes:
>I thought that I had my brain wrapped around the issue of single stepping a=
>nd why it may be discouraged in Forth.  But, then recently my brain went 't=
>hump' and straightened itself out.  So, I wanted to ask people, and hopeful=
>ly I will receive some erudite explanations as to the advantages and disadv=
>antages of single stepping.  Examples cases would be appreciated. =20

Disadvantage: You can waste a lot of time for stepping through the
program and checking at many steps whether the state is still as
intended.

Advantages: None

When there is a bug, it invariably shows itself after the buggy code
has been executed.  The state of the program is wrong afterwards and
correct before.  Stepping through the program before the buggy code is
a waste of time.  But since you don't know where the bug ist, you
waste a lot of time this way.  And at every step you examine the
state.  Very time-consuming.

I don't find the interactive variant of single-stepping (that others
suggest) useful in most cases, either.  However, if you have test
cases for each word and each word is simple enough, then there may be
no need for more sophisticated debugging.  But I consider that only
effective if most of the test cases are developped for testing, not
for debugging.

Running backwards from the point where the bug showed itself, with
backwards watchpoints and maybe backwards breakpoints and stepping,
would allow to find the buggy code relatively fast.

If we don't have that, tracing (known as "printf() debugging" to C
programmers) allows quite effective debugging: You put tracers
(printing words that show the state) in strategic places and run the
program.  When the bug shows up, you can look at the output and scan
backwards until you find a correct state; then the bug is between this
tracer and the next.  If needed, you can insert additional tracers
between these points and repeat.  Stepping debugging is a kind of
linear search process, this refinement approach is logarithmic like
binary search.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2012: http://www.euroforth.org/ef12/

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Single Step Debugging,  why or why not? Jason Damisch <jasondamisch@yahoo.com> - 2012-08-30 11:27 -0700
  Re: Single Step Debugging,  why or why not? "Elizabeth D. Rather" <erather@forth.com> - 2012-08-30 08:42 -1000
  Single Step Debugging,  why or why not? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-30 14:37 -0700
    Re: Single Step Debugging,  why or why not? "Elizabeth D. Rather" <erather@forth.com> - 2012-08-30 14:26 -1000
      Re: Single Step Debugging, why or why not? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-31 02:25 -0700
        Re: Single Step Debugging, why or why not? "Elizabeth D. Rather" <erather@forth.com> - 2012-08-31 08:18 -1000
  Re: Single Step Debugging,  why or why not? Paul Rubin <no.email@nospam.invalid> - 2012-08-30 18:48 -0700
    Re: Single Step Debugging, why or why not? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-31 02:12 -0700
  Re: Single Step Debugging,  why or why not? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-08-31 08:54 +0000
    Re: Single Step Debugging,  why or why not? Paul Rubin <no.email@nospam.invalid> - 2012-08-31 02:46 -0700
      Re: Single Step Debugging,  why or why not? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-08-31 05:56 -0500
        Re: Single Step Debugging,  why or why not? Paul Rubin <no.email@nospam.invalid> - 2012-08-31 09:10 -0700
          Re: Single Step Debugging,  why or why not? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-08-31 11:33 -0500
            Re: Single Step Debugging, why or why not? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-31 12:51 -0700
              Re: Single Step Debugging, why or why not? Coos Haak <chforth@hccnet.nl> - 2012-08-31 23:23 +0200
              Re: Single Step Debugging, why or why not? Paul Rubin <no.email@nospam.invalid> - 2012-08-31 15:42 -0700
                Re: Single Step Debugging, why or why not? Bernd Paysan <bernd.paysan@gmx.de> - 2012-09-01 01:52 +0200
                Re: Single Step Debugging, why or why not? Paul Rubin <no.email@nospam.invalid> - 2012-09-01 17:41 -0700
          Re: Single Step Debugging,  why or why not? Gerry Jackson <gerry@jackson9000.fsnet.co.uk> - 2012-08-31 17:54 +0100
          Re: Single Step Debugging,  why or why not? "Elizabeth D. Rather" <erather@forth.com> - 2012-08-31 08:22 -1000
          Re: Single Step Debugging,  why or why not? "Ed" <invalid@nospam.com> - 2012-09-03 22:15 +1000

csiph-web