[gnu.gdb.bug] Maybe bug in gdb-3.1

shin@sgtp.apple.juice (Shinichirou Sugou) (05/14/89)

Dear FSF people:

My system is Sun3/60 with OS3.4, gdb-3.1, and gcc-1.34.  'finish' command
doesn't work fine in some situation (it is ok in gdb-2.8.1).

The example program and shell logging record are appended to the last of this
letter.

Please try to set breakpoint at the function 'bar' and run program.  When
progrm stops at the head of 'bar', invoke finish.

----------beginning of example program----------------
#include	<stdio.h>

typedef enum { ok, error } e_fv;

e_fv
bar()
{
   return error;
}

void
foo()
{
   if (bar() != ok)
      (void)printf("error");
}

void
main()
{
   foo();
}
--------end of example program-------------------------

----------beginning of shell logging---------------
shin% !gcc
gcc -g tmp.c -o tmp
shin% gdb tmp
Reading symbol data from /mnt1/usr/usr1/shin/tmp/tmp...done.
(gdb) b bar
Breakpoint 1 at 0x20a4: file tmp.c, line 8.
(gdb) run
Starting program: /mnt1/usr/usr1/shin/tmp/tmp 

Bpt 1, bar () (tmp.c line 8)
8	   return error;
(gdb) finish
Run till exit from #0  bar () (tmp.c line 8)
0x20ba in foo () (tmp.c line 14)
14	   if (bar() != ok)
ptrace: I/O error.
Cannot read memory: address 0x1 out of bounds.
(gdb)
---------end of shell logging--------------

CAUTION: Reply-command supplied by your mail system may NOT generate
         my address correctly.
         Please use the following address instead.

         shin%sgtp.apple.juice%lkbreth.foretune.junet@uunet.uu.net

---
  Shinichirou Sugou   shin%sgtp.apple.juice%lkbreth.foretune.junet@uunet.uu.net