From: walter@cithe303.cithep.caltech.edu (Chris Walter)
Subject: Problems debugging g++ code on RS6000 with gdb4.7
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sun, 10 Jan 1993 06:37:21 GMT

Hello,

I've tried this question in comp.unix.aix and gnu.g++.help and have gotten
no responses, I really hope someone here can help me.

First off I am running AIX3.2 on an RS6000.
I am using gcc 2.3.2/libg++ 2.3
I am using gdb 4.7

I am having problems debugging c++ programs with gdb4.7.
gdb seems to work OK on small C programs compiled with gcc but I am
having problems debugging C++ code compiled(-g of course) with g++.

I should mention that my sys-op says the RS6000 assembly patch(for gcc)  has
been applied.  Here is an example of what happens when I try to load a
executable:
------------------------------------------------------------------------
cithe502:wfd > gdb 
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.7, Copyright 1992 Free Software Foundation, Inc.
(gdb) file monte
Reading symbols from monte...GDB Error: `.bf' not found.
GDB Error: `.bf' not found.
done.
(gdb)
------------------------------------------------------------------------

And here is the same thing for what is a simpler program:

------------------------------------------------------------------------
cithe502:flux > gdb
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.7, Copyright 1992 Free Software Foundation, Inc.
(gdb) file flux
Reading symbols from flux...GDB Error: `.bf' not found.
GDB Error: `.bf' not found.

Catastrophe in realloc: invalid storage ptr
IOT trap (core dumped)
cithe502:flux > 
------------------------------------------------------------------------

In addition, the first program, which it allows me to load, starts in the
middle of the routine if I tell it to "break main".  It sets the
breakpoint 17 lines down into routine.

Here is the source code for the second very simple program:

************************************************************************

#include <iostream.h>
#include <iomanip.h>
#include <math.h>

const double E_BREAK = 2.0e6;
const double K1 =      2.7e4;
const double K2 =      4.3e6;
const double GAMMA1 =  2.65;
const double GAMMA2 =  3.00;


/* This program produces a muon flux */

main ()

{

  double dN_dE;         /* number/m^2*s*sr*Gev */
  double flux;
  double energy;        /* in GeV */
  double gamma;
  double K;

  for (energy=1e5; energy<1e9; energy = energy*pow(10.0,1.0/10.0))
    {
      if (energy <= E_BREAK) {
	dN_dE = K1*(1.0/(1-GAMMA1))*pow(E_BREAK,1.0-GAMMA1); 
	dN_dE = dN_dE + K1*(1.0/(GAMMA1-1))*pow(energy,1.0-GAMMA1);
	dN_dE = dN_dE + K2*(1.0/(GAMMA2-1))*pow(E_BREAK,1.0-GAMMA2);
      }
      else {	
	dN_dE = K2*(1.0/(GAMMA2-1))*pow(energy,1.0-GAMMA2);
      }

      flux  = dN_dE*72.0*12.0*PI*60.0*60.0*24.0*356.0 ;

      cout.setf(ios::scientific); 
      cout << setprecision(3) << energy << " " << flux << endl;
    }
}

************************************************************************

Also I'm not sure if this is relevant but I get the following warning
message when I compile the above code -g:

cithe303:flux > g++ -lm -g -oflux flux.cc
/usr/local/lib/g++-include/iomanip.h: In function `class smanip<int> setbase (int)':
In file included from flux.cc:2:
/usr/local/lib/g++-include/iomanip.h:141: warning: dbx info for template class methods not yet supported
cithe303:flux > 

************************************************************************
Any suggestions would be most appreciated!

-Chris Walter
walter@cithe501.cithep.caltech.edu



Newsgroups: gnu.gdb.bug