🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #97

(none)

#97
From: bd
Date: Thu, 16 Apr 1992 04:54
71 lines
1921 bytes
when using the next command in a C++ program that works.  In
particular, in the code seguence 

                inFile.open( ... );
                if ( inFile )
                  {
                  ...

the gdb command "next" at the if ( inFile ) command causes
a segmentation fault.  See the script run below.

Our Machine: DEC System 5500 using a MIPS processor
and running  ULTRIX V4.2A (REV. 47) System #6
             VWS V4.2 (Rev. 272)

The program was compiled using GNU CC Version 2.0
GDB was compiled using 'cc'.
We are using GDB Version 4.5.

% cat Melville
M
 e
  v
   i
    l 
     l
      e
% cat lip.cc
#include <iostream.h>
#include <fstream.h>

main()
{
   ifstream inFile;

   inFile.open( "Melville", ios::in );
   if ( inFile )
     {
     char ch;
     while ( inFile.get(ch) ) cout.put(ch);
     }
   inFile.clear();
   inFile.close();
   return 0;
}
% g++ -g lip.cc
% a.out
M
 e
  v
   i
    l 
     l
      e
% gdb a.out
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.5, Copyright 1992 Free Software Foundation, Inc...
(gdb) break lip.cc:8
Breakpoint 1 at 0x40021c: file lip.cc, line 8.
(gdb) run
Starting program: /cs_mnt/users/bd/OOP/a.out 

Breakpoint 1, main () at lip.cc:8
8	   inFile.open( "Melville", ios::in );
(gdb) n
9	   if ( inFile )
(gdb) n
Segmentation fault
script done on Wed Apr 15 09:29:35 1992
Technical Details
Message-ID: <199204161254.AA17165@kepler.unh.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!kepler.unh.edu!bd

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!kepler.unh.edu!bd
From: bd@kepler.unh.edu
Subject: (none)
Message-ID: <199204161254.AA17165@kepler.unh.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 16 Apr 1992 04:54:30 GMT
Approved: bug-gdb@prep.ai.mit.edu
Lines: 72