Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion config/orte_setup_debugger_flags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dnl Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
dnl University of Stuttgart. All rights reserved.
dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2009 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2006-2009 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
dnl reserved.
Expand All @@ -24,6 +24,28 @@ dnl
dnl $HEADER$
dnl

dnl Check to see if specific CFLAGS work
dnl $1: compiler flags to check
dnl $2: Action if the flags work
dnl $3: Action if the flags do not work
AC_DEFUN([_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS],[
OPAL_VAR_SCOPE_PUSH([ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save])

ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save=$CFLAGS
AC_MSG_CHECKING([if $1 compiler flag works])
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[int i = 3;])],
[ORTE_SETUP_DEBUGGER_FLAGS_HAPPY=yes],
[ORTE_SETUP_DEBUGGER_FLAGS_HAPPY=no])
AC_MSG_RESULT([$ORTE_SETUP_DEBUGGER_FLAGS_HAPPY])
CFLAGS=$ORTE_SETUP_DEBUGGER_FLAGS_CFLAGS_save

OPAL_VAR_SCOPE_POP

AS_IF([test $ORTE_SETUP_DEBUGGER_FLAGS_HAPPY = yes],
[$2], [$3])
])

AC_DEFUN([ORTE_SETUP_DEBUGGER_FLAGS],[
#
# Do a final process of the CFLAGS to make a WITHOUT_OPTFLAGS
Expand Down Expand Up @@ -53,4 +75,22 @@ AC_DEFUN([ORTE_SETUP_DEBUGGER_FLAGS],[

AC_SUBST(CFLAGS_WITHOUT_OPTFLAGS)
AC_SUBST(DEBUGGER_CFLAGS)

# Check for compiler specific flag to add in unwind information.
# This is needed when attaching using MPIR to unwind back to the
# user's main function. Certain optimisations can prevent GDB from
# producing a stack when explicit unwind information is unavailable.
# This is implied by -g, but we want to save space and don't need
# full debug symbols.
_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS([-fasynchronous-unwind-tables],
[MPIR_UNWIND_CFLAGS="-fasynchronous-unwind-tables"],
[_ORTE_SETUP_DEBUGGER_FLAGS_TRY_CFLAGS([-Meh_frame -Mframe],
[MPIR_UNWIND_CFLAGS="-Meh_frame -Mframe"],
[MPIR_UNWIND_CFLAGS=-g])
])

AC_MSG_CHECKING([for final compiler unwind flags])
AC_MSG_RESULT([$MPIR_UNWIND_CFLAGS])

AC_SUBST(MPIR_UNWIND_CFLAGS)
])
11 changes: 10 additions & 1 deletion ompi/runtime/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ headers += \
lib@OMPI_LIBMPI_NAME@_la_SOURCES += \
runtime/ompi_mpi_abort.c \
runtime/ompi_mpi_dynamics.c \
runtime/ompi_mpi_init.c \
runtime/ompi_mpi_finalize.c \
runtime/ompi_mpi_params.c \
runtime/ompi_mpi_preconnect.c \
runtime/ompi_cr.c \
runtime/ompi_info_support.c

# The MPIR portion of the library must be built with flags to
# enable stepping out of MPI_INIT into main.
# Use an intermediate library to isolate the debug object.
noinst_LTLIBRARIES += libompi_mpir.la
libompi_mpir_la_SOURCES = \
runtime/ompi_mpi_init.c
libompi_mpir_la_CFLAGS = $(MPIR_UNWIND_CFLAGS)

lib@OMPI_LIBMPI_NAME@_la_LIBADD += libompi_mpir.la
4 changes: 4 additions & 0 deletions orte/mca/ess/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

AM_CPPFLAGS = $(LTDLINCL)

# Add unwind flags because files in this tree are
# involved in startup.
AM_CFLAGS = $(MPIR_UNWIND_CFLAGS)

# main library setup
noinst_LTLIBRARIES = libmca_ess.la
libmca_ess_la_SOURCES =
Expand Down
6 changes: 6 additions & 0 deletions orte/mca/ess/pmi/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
# $HEADER$
#

# Add MPIR unwind flags because files in this tree are
# involved in startup. This is not needed in the other
# subdirs in orte/mca/ess because the other components are
# solely used by daemons and thus are not accessible by the debugger.
AM_CFLAGS = $(MPIR_UNWIND_CFLAGS)

AM_CPPFLAGS = $(ess_pmi_CPPFLAGS)

sources = \
Expand Down
10 changes: 9 additions & 1 deletion orte/runtime/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ headers += \

lib@ORTE_LIB_PREFIX@open_rte_la_SOURCES += \
runtime/orte_finalize.c \
runtime/orte_init.c \
runtime/orte_locks.c \
runtime/orte_globals.c \
runtime/orte_quit.c \
Expand All @@ -52,3 +51,12 @@ lib@ORTE_LIB_PREFIX@open_rte_la_SOURCES += \
runtime/orte_cr.c \
runtime/orte_data_server.c \
runtime/orte_info_support.c

# The MPIR portion of the library must be built with flags to
# enable stepping out of MPI_INIT into main.
# Use an intermediate library to isolate the debug object.
noinst_LTLIBRARIES += libruntime_mpir.la
libruntime_mpir_la_SOURCES = \
runtime/orte_init.c
libruntime_mpir_la_CFLAGS = $(MPIR_UNWIND_CFLAGS)
lib@ORTE_LIB_PREFIX@open_rte_la_LIBADD += libruntime_mpir.la