This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/5859: gdb fails to break in C++ MPI code
- From: cummings at cacr dot caltech dot edu
- To: gcc-gnats at gcc dot gnu dot org
- Date: 7 Mar 2002 03:03:48 -0000
- Subject: libstdc++/5859: gdb fails to break in C++ MPI code
- Reply-to: cummings at cacr dot caltech dot edu
>Number: 5859
>Category: libstdc++
>Synopsis: gdb fails to break in C++ MPI code
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 06 19:06:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Julian Cummings
>Release: 3.0
>Organization:
>Environment:
i686 running Linux 2.4.9-ac9
>Description:
The gdb debugger fails to break on the symbol MPI_Init
in a trivial MPI code written in C++. The code uses the
mpich package from Argonne National Laboratory and is
compiled using mpiCC, a script that invokes the g++ compiler
and links with libmpich.a. The code is executed using
"mpirun" and the -gdb flag, which causes gdb to set a
breakpoint at MPI_Init and run the program.
The problem is triggered by any C++ MPI code that utilizes
C++ streams, for example, to write something to std::cout.
In this case, the code will run through all of main() and
stop inside the global object destructor phase. With no
usage of C++ streams, the code halts at MPI_Init as it
should. Also, a comparable MPI code written in C functions
properly with gdb.
I am reporting this as a gcc bug because it does not happen
with gcc 2.96. It seems that something has changed with
respect to the C++ standard library and streams that makes
debugging of MPI codes with gdb no longer possible.
>How-To-Repeat:
You will need to have a recent version of mpich
installed (http://www.mcs.anl.gov/mpi/mpich). I am using
mpich-1.2.1. With this installed, build my example code
with the command "mpiCC -g -o cctest main.cc". Then run it
on a single processor, for example, with the command
"mpirun -np 1 ./cctest". Now try to run it under the gdb
debugger by adding the flag -gdb to the mpirun command.
You should see that the code does not break at MPI_Init
as expected.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="main.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="main.cc"
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