This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb/435: gdb fails to break in MPI code that uses C++ streams


The following reply was made to PR gdb/435; it has been noted by GNATS.

From: Daniel Jacobowitz <drow@mvista.com>
To: cummings@cacr.caltech.edu
Cc: gdb-gnats@sources.redhat.com
Subject: Re: gdb/435: gdb fails to break in MPI code that uses C++ streams
Date: Wed, 20 Mar 2002 18:29:47 -0500

 On Tue, Mar 19, 2002 at 07:43:43PM -0000, cummings@cacr.caltech.edu wrote:
 > The gdb debugger fails to break in MPI code written in C++
 > that uses standard C++ streams to do I/O.  I am using mpich
 > version 1.2.3 for MPI support.  After compiling my simple
 > MPI code with g++, I run it with mpirun and give the -gdb
 > option.  This tells the mpirun script to launch gdb on my
 > executable and break on the call to MPI_Init().  However,
 > the debugger does not break at MPI_Init() as expected.
 > Instead it runs the code through to the completion of main()
 > and then stops during the execution of some global object
 > destructors from the the STL.  This makes it impossible to
 > debug MPI codes written in C++ with gdb.
 
 Transcript, please?
 
 > I have made the following observations regarding this bug.
 > It only occurs when using C++ streams in your code; for 
 > example, using std::cout to send output to stdout.  If I
 > remove the use of <iostream> and std::cout from my example
 > code, gdb stops at MPI_Init() as expected.  This problem
 > only occurs with the newer version 3.x of gcc, not with 
 > previous versions of the compiler such as 2.95.2.  Finally,
 > this problem does not occur with MPI code written in C, 
 > only C++ code that uses streams.
 > >How-To-Repeat:
 > First, you must have a recent version of the mpich library
 > installed for MPI support.  I am using mpich 1.2.3 from
 > Argonne National Laboratory.  Compile the simple program
 > main.cc with "mpiCC -g" which will compile for debugging 
 > and link with the MPI library.  Then run with "mpirun -gdb"
 > to automatically launch gdb on the code and break on
 > MPI_Init().  You will see that gdb does not stop at the
 > call to MPI_Init() as it should.  If you comment out the 
 > use of <iostream> and std::cout in my example code and 
 > recompile it, then running with mpirun -gdb works correctly.
 
 Is it likely that there are sufficient changes between 1.2.1 and 1.2.3
 to influence this?  I can not reproduce it:
 
 drow@nevyn:~/mpi% mpirun -gdb ./a.out
 GNU gdb 5.1.1
 Copyright 2002 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you are
 welcome to change it and/or 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.
 This GDB was configured as "i386-linux"...
 Breakpoint 1 at 0x804e2f6
 
 Breakpoint 1, 0x0804e2f6 in PMPI_Init ()
 (gdb) info breakpoints
 Num Type           Disp Enb Address    What
 1   breakpoint     keep y   0x0804e2f6 <PMPI_Init+6>
         breakpoint already hit 1 time
 
 -- 
 Daniel Jacobowitz                           Carnegie Mellon University
 MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]