I think this is really a GDB bug.  If you find it is a bug
in some other program, please DTRT.

------- Start of forwarded message -------
From: Maggie McLoughlin <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: note from Prof Knuth
Reply-to: [EMAIL PROTECTED]
Sender: [EMAIL PROTECTED]
X-BeenThere: [EMAIL PROTECTED]
X-Mailman-Version: 2.0
Precedence: bulk
List-Help: <mailto:[EMAIL PROTECTED]?subject=help>
List-Post: <mailto:[EMAIL PROTECTED]>
List-Subscribe: <http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs>,
        <mailto:[EMAIL PROTECTED]?subject=subscribe>
List-Id: Bug reports for GNU Emacs,
        the Swiss army knife of text editors <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs>,
        <mailto:[EMAIL PROTECTED]?subject=unsubscribe>
List-Archive: <http://mail.gnu.org/pipermail/bug-gnu-emacs/>
Date: Wed, 20 Dec 2000 00:04:09 -0800 (PST)
Content-Type: text
Content-Length: 2756

Here's a small but annoying bug in GDB (or just possibly in GCC).
I have version 4.18, configured as "i386-redhat-linux".
My gcc is "egcs-2.91.66".

Three small files that illustrate the problem are appended below.
File "simple.c" was generated by "ctangle simple simple simple",
from the CWEB source file "simple.w" and the CWEB change file "simple.ch".
The #line directives in simple.c refer back to those source files.

When I invoke GDB from EMACS and say "break main" and then "run", I usually can
single step through my programs using "n" repeatedly, and the other window
shows where I am in the source files.

But in this case, GDB gets lost. When I get to the source line that
prints "The last line", the "n" instruction does not stop after that
instruction; I mean, it executes the change-file line that prints "No, this
one is actually last" without giving me a chance to single-step through
that instruction.

Of course I reduced a huge program down to this simple case, so that you
could diagnose the bug more easily. In the real program, there are
lots of instructions I never get to see when single-stepping. So I'm
hoping you can fix the bug, thereby helping me to debug incredibly
many other CWEB programs in the future, even though the bug looks rather
harmless in this simple case.

The bug appears to go away if I reduce the program even more. For example,
it is evidently necessary to jump back and forth between simple.w and
simple.ch in the place where I've changed "A bad line" to "A good line";
without that change, GDB works as it should when it gets to the other change.

Yours truly, Don Knuth

- --------- cut here for "simple.c" -----------------------
/*1:*/
#line 5 "simple.w"

#include <stdio.h> 

main()
{
printf("The first line.\n");
#line 4 "simple.ch"
printf("A good line.\n");
#line 12 "simple.w"
/*2:*/
#line 15 "simple.w"

printf("The last line.\n");

#line 9 "simple.ch"
/*:2*//*3:*/
#line 9 "simple.ch"

printf("No, this one is actually last.\n");

/*:3*/
#line 12 "simple.w"
;
}

/*:1*/
- ------------------- cut here for "simple.w" -----------------------------
\datethis

@*A curious bug. This program tweaks a bug in \.{gdb}.

@c
#include <stdio.h>

main()
{
  printf("The first line.\n");
  printf("A bad line.\n");
  @<Finish@>;
}

@ @<Finish@>=
printf("The last line.\n");

@*Index.
- -------------------- cut here for "simple.ch" ---------------------------
@x change file for restarting POLYSLAVE after a checkpoint
  printf("A bad line.\n");
@y
  printf("A good line.\n");
@z
@x
@*Index.
@y
@ @<Finish@>=
printf("No, this one is actually last.\n");

@*Index.
@z

_______________________________________________
Bug-gnu-emacs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnu-emacs
------- End of forwarded message -------

_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to