Use more portable 'nm' command instead of the BFD library to collect symbol information for instrumentation with the GNU, Intel, and PathScale
This commit was SVN r22737.
Этот коммит содержится в:
родитель
3f56f9e688
Коммит
157942809c
@ -2,7 +2,7 @@
|
||||
- updated version of internal OTF to 1.6.5openmpi
|
||||
(see extlib/otf/ChangeLog)
|
||||
- added support for tracing functions in shared libraries instrumented
|
||||
by the GNU, Intel, Pathscale, ot PGI 9 compiler
|
||||
by the GNU, Intel, PathScale, or PGI 9 compiler
|
||||
- added support for PAPI-C counters which belong to different components
|
||||
- added environment variable VT_METRICS_SEP to specify a string which
|
||||
separate the counter names in VT_METRICS
|
||||
@ -15,6 +15,9 @@
|
||||
- added configure tests to detect Bull MPICH2
|
||||
- use Open MPI provided Fortran wrapper library 'libmpi_f77'
|
||||
- added functions 'MPI_Group_range_<incl|excl>' to Fortran MPI wrappers
|
||||
- use more portable 'nm' command instead of the BFD library to collect
|
||||
symbol information for instrumentation with the GNU, Intel, PathScale,
|
||||
and PGI 9 compiler
|
||||
- fixed detection of unique node id on MacOS platforms
|
||||
- fixed support for LAM/MPI
|
||||
- fixed build error: do not add objects from the static version of the
|
||||
@ -87,7 +90,7 @@
|
||||
- do not install 'vtCC' and the corresponding config file, if the file
|
||||
system is case insensitive (e.g. HFS+ on MacOS X)
|
||||
- added configure option '--with[out]-bfd' to control usage of BFD
|
||||
library to get symbol information for GNU, Intel, and Pathscale
|
||||
library to get symbol information for GNU, Intel, and PathScale
|
||||
compiler instrumentation
|
||||
- preselect availability of MPI type converter functions
|
||||
(e.g. MPI_Comm_f2c), if '--with-openmpi' was given
|
||||
@ -236,7 +239,7 @@
|
||||
|
||||
5.5
|
||||
- updated version of internal OTF to 1.4 (see extlib/otf/ChangeLog)
|
||||
- added support for automatic instrumentation by using Pathscale
|
||||
- added support for automatic instrumentation by using PathScale
|
||||
compiler (version 3.1 or higher required)
|
||||
- added support for recording function and message statistics
|
||||
- extended user API for enable/disable tracing
|
||||
|
@ -1,4 +1,3 @@
|
||||
m4_include(config/m4/acinclude.bfd.m4)
|
||||
m4_include(config/m4/acinclude.clapack.m4)
|
||||
m4_include(config/m4/acinclude.compinst.m4)
|
||||
m4_include(config/m4/acinclude.compwrap.m4)
|
||||
@ -11,19 +10,18 @@ m4_include(config/m4/acinclude.dl.m4)
|
||||
m4_include(config/m4/acinclude.dyninst.m4)
|
||||
m4_include(config/m4/acinclude.etimesync.m4)
|
||||
m4_include(config/m4/acinclude.getcpu.m4)
|
||||
m4_include(config/m4/acinclude.gnudmgl.m4)
|
||||
m4_include(config/m4/acinclude.iowrap.m4)
|
||||
m4_include(config/m4/acinclude.java.m4)
|
||||
m4_include(config/m4/acinclude.jvmti.m4)
|
||||
m4_include(config/m4/acinclude.libc.m4)
|
||||
m4_include(config/m4/acinclude.libcwrap.m4)
|
||||
m4_include(config/m4/acinclude.liberty.m4)
|
||||
m4_include(config/m4/acinclude.libwrap.m4)
|
||||
m4_include(config/m4/acinclude.ltmpdir.m4)
|
||||
m4_include(config/m4/acinclude.math.m4)
|
||||
m4_include(config/m4/acinclude.memhooks.m4)
|
||||
m4_include(config/m4/acinclude.metrics.m4)
|
||||
m4_include(config/m4/acinclude.mpi.m4)
|
||||
m4_include(config/m4/acinclude.nm.m4)
|
||||
m4_include(config/m4/acinclude.omp.m4)
|
||||
m4_include(config/m4/acinclude.otf.m4)
|
||||
m4_include(config/m4/acinclude.papi.m4)
|
||||
|
@ -1,75 +0,0 @@
|
||||
AC_DEFUN([ACVT_BFD],
|
||||
[
|
||||
bfd_error="no"
|
||||
check_bfd="yes"
|
||||
force_bfd="no"
|
||||
have_bfd="no"
|
||||
|
||||
BFDDIR=
|
||||
BFDINCDIR=
|
||||
BFDLIBDIR=
|
||||
BFDLIB=
|
||||
|
||||
AC_ARG_WITH(bfd,
|
||||
AC_HELP_STRING([--with-bfd], [use BFD to get symbol information of an executable instrumented with GNU, Intel, PGI9, or Pathscale compiler, default: yes]),
|
||||
[AS_IF([test x"$withval" = "xyes"], [force_bfd="yes"], [check_bfd="no"])])
|
||||
|
||||
AC_ARG_WITH(bfd-dir,
|
||||
AC_HELP_STRING([--with-bfd-dir=BFDDIR], [give the path for BFD, default: /usr]),
|
||||
[BFDDIR="$withval/"])
|
||||
|
||||
AC_ARG_WITH(bfd-inc-dir,
|
||||
AC_HELP_STRING([--with-bfd-inc-dir=BFDINCDIR],
|
||||
[give the path for BFD-include files, default: BFDDIR/include]),
|
||||
[BFDINCDIR="-I$withval/"],
|
||||
[AS_IF([test x"$BFDDIR" != x], [BFDINCDIR="-I$BFDDIR"include/])])
|
||||
|
||||
AC_ARG_WITH(bfd-lib-dir,
|
||||
AC_HELP_STRING([--with-bfd-lib-dir=BFDLIBDIR],
|
||||
[give the path for BFD-libraries, default: BFDDIR/lib]),
|
||||
[BFDLIBDIR="-L$withval/"],
|
||||
[AS_IF([test x"$BFDDIR" != x], [BFDLIBDIR="-L$BFDDIR"lib/])])
|
||||
|
||||
AC_ARG_WITH(bfd-lib,
|
||||
AC_HELP_STRING([--with-bfd-lib=BFDLIB], [use given bfd lib, default: -lbfd]),
|
||||
[BFDLIB="$withval"])
|
||||
|
||||
AS_IF([test x"$check_bfd" = "xyes"],
|
||||
[
|
||||
sav_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $BFDINCDIR"
|
||||
AC_CHECK_HEADER([bfd.h], [],
|
||||
[
|
||||
AC_MSG_NOTICE([error: no bfd.h found; check path for BFD package first...])
|
||||
bfd_error="yes"
|
||||
])
|
||||
CPPFLAGS=$sav_CPPFLAGS
|
||||
|
||||
AS_IF([test x"$BFDLIB" = x -a "$bfd_error" = "no"],
|
||||
[
|
||||
sav_LIBS=$LIBS
|
||||
LIBS="$LIBS $BFDLIBDIR -lbfd"
|
||||
AC_MSG_CHECKING([whether linking with -lbfd works])
|
||||
AC_TRY_LINK([],[],
|
||||
[AC_MSG_RESULT([yes]); BFDLIB=-lbfd],[AC_MSG_RESULT([no])])
|
||||
LIBS=$sav_LIBS
|
||||
])
|
||||
|
||||
AS_IF([test x"$BFDLIB" = x -a "$bfd_error" = "no"],
|
||||
[
|
||||
AC_MSG_NOTICE([error: no libbfd found; check path for BFD package first...])
|
||||
bfd_error="yes"
|
||||
])
|
||||
|
||||
AS_IF([test "$bfd_error" = "no"],
|
||||
[
|
||||
have_bfd="yes"
|
||||
AC_DEFINE([HAVE_BFD], [1], [Define to 1 if you have the BFD.])
|
||||
])
|
||||
])
|
||||
|
||||
AC_SUBST(BFDINCDIR)
|
||||
AC_SUBST(BFDLIBDIR)
|
||||
AC_SUBST(BFDLIB)
|
||||
])
|
||||
|
@ -191,18 +191,8 @@ AC_DEFUN([ACVT_COMPINST],
|
||||
[
|
||||
AS_IF([test x"$compinst_type" = "xgnu" -o x"$compinst_type" = "xpgi9"],
|
||||
[
|
||||
ACVT_BFD
|
||||
AS_IF([test x"$bfd_error" = "xyes"],
|
||||
[
|
||||
AS_IF([test x"$force_bfd" = "xyes"], [exit 1])
|
||||
AC_MSG_WARN([no usable BFD found; using nm-output file for addr./symbol mapping])
|
||||
],
|
||||
[
|
||||
AS_IF([test x"$have_bfd" = "xyes"],
|
||||
[ACVT_GNUDMGL])
|
||||
])
|
||||
|
||||
AS_IF([test x"$dl_error" = x], [ACVT_DL])
|
||||
ACVT_NM
|
||||
ACVT_DL
|
||||
])
|
||||
])
|
||||
|
||||
|
@ -306,22 +306,11 @@ AC_DEFUN([ACVT_CONF_SUMMARY],
|
||||
echo ""
|
||||
echo " Build compiler instrumentation support: $answer"
|
||||
|
||||
AS_IF([test x"$compinst_type" = "xgnu" -o x"$compinst_type" = "xpgi9"],
|
||||
AS_IF([test x"$compinst_type" = "xgnu"],
|
||||
[
|
||||
AS_IF([test x"$have_bfd" = "xyes"],
|
||||
[answer="yes"], [answer="no"])
|
||||
echo " Use BFD to get symbol information: $answer"
|
||||
|
||||
AS_IF([test x"$have_gnudmgl" = "xyes"],
|
||||
[answer="yes"], [answer="no"])
|
||||
echo " Name demangling of C++ symbols: $answer"
|
||||
|
||||
AS_IF([test x"$compinst_type" != "xpgi9"],
|
||||
[
|
||||
echo ""
|
||||
echo " * The instrumentation type 'gnu' also"
|
||||
echo " works for Intel and Pathscale compilers."
|
||||
])
|
||||
echo ""
|
||||
echo " * The instrumentation type 'gnu' also"
|
||||
echo " works for Intel and Pathscale compilers."
|
||||
])
|
||||
|
||||
AS_IF([test x"$have_dyninst" = "xyes"],
|
||||
|
@ -42,14 +42,11 @@ AC_DEFUN([ACVT_DYNINST],
|
||||
[AS_IF([test x"$DYNIDIR" != x], [DYNILIBDIR="-L$DYNIDIR"lib/])])
|
||||
|
||||
AC_ARG_WITH(dyninst-lib,
|
||||
AC_HELP_STRING([--with-dyninst-lib=DYNILIB], [use given Dyninst lib, default: -ldyninstAPI -liberty]),
|
||||
AC_HELP_STRING([--with-dyninst-lib=DYNILIB], [use given Dyninst lib, default: -ldyninstAPI]),
|
||||
[DYNILIB="$withval"])
|
||||
|
||||
AS_IF([test "$check_dyninst" = "yes"],
|
||||
[
|
||||
AS_IF([test x"$liberty_error" = x], [ACVT_LIBERTY])
|
||||
AS_IF([test x"$have_liberty" = "xno"], [dyninst_error="yes"])
|
||||
|
||||
AC_LANG([C++])
|
||||
|
||||
AS_IF([test x"$dyninst_error" = "xno"],
|
||||
@ -67,10 +64,10 @@ AC_DEFUN([ACVT_DYNINST],
|
||||
AS_IF([test x"$DYNILIB" = x -a x"$dyninst_error" = "xno"],
|
||||
[
|
||||
sav_LIBS=$LIBS
|
||||
LIBS="$LIBS $DYNILIBDIR -ldyninstAPI $LIBERTYLIBDIR $LIBERTYLIB"
|
||||
AC_MSG_CHECKING([whether linking with -ldyninstAPI $LIBERTYLIB works])
|
||||
LIBS="$LIBS $DYNILIBDIR -ldyninstAPI"
|
||||
AC_MSG_CHECKING([whether linking with -ldyninstAPI works])
|
||||
AC_TRY_LINK([],[],
|
||||
[AC_MSG_RESULT([yes]); DYNILIB="-ldyninstAPI $LIBERTYLIBDIR $LIBERTYLIB"],
|
||||
[AC_MSG_RESULT([yes]); DYNILIB="-ldyninstAPI"],
|
||||
[AC_MSG_RESULT([no])])
|
||||
LIBS=$sav_LIBS
|
||||
])
|
||||
|
@ -1,32 +0,0 @@
|
||||
AC_DEFUN([ACVT_GNUDMGL],
|
||||
[
|
||||
gnudmgl_error="no"
|
||||
have_gnudmgl="no"
|
||||
|
||||
ACVT_LIBERTY
|
||||
AS_IF([test x"$LIBERTYLIB" = x], [gnudmgl_error="yes"])
|
||||
|
||||
AS_IF([test x"$gnudmgl_error" = "xno"],
|
||||
[
|
||||
sav_LIBS=$LIBS
|
||||
LIBS="$LIBS $LIBERTYLIBDIR $LIBERTYLIB"
|
||||
AC_CHECK_FUNC([cplus_demangle], [], [gnudmgl_error="yes"])
|
||||
LIBS=$sav_LIBS
|
||||
])
|
||||
|
||||
AS_IF([test x"$gnudmgl_error" = "xno"],
|
||||
[
|
||||
sav_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $LIBERTYINCDIR"
|
||||
AC_CHECK_HEADERS([demangle.h])
|
||||
CPPFLAGS=$sav_CPPFLAGS
|
||||
])
|
||||
|
||||
AS_IF([test x"$gnudmgl_error" = "xno"],
|
||||
[
|
||||
have_gnudmgl="yes"
|
||||
AC_DEFINE([HAVE_GNU_DEMANGLE],
|
||||
[1], [Define to 1 if you can use GNU demangling of C++ names.])
|
||||
])
|
||||
])
|
||||
|
@ -1,63 +0,0 @@
|
||||
AC_DEFUN([ACVT_LIBERTY],
|
||||
[
|
||||
liberty_error="no"
|
||||
have_liberty="no"
|
||||
|
||||
LIBERTYDIR=
|
||||
LIBERTYINCDIR=
|
||||
LIBERTYLIBDIR=
|
||||
LIBERTYLIB=
|
||||
|
||||
AC_ARG_WITH(liberty-dir,
|
||||
AC_HELP_STRING([--with-liberty-dir=LIBERTYDIR], [give the path for LIBERTY, default: /usr]),
|
||||
[LIBERTYDIR="$withval/"])
|
||||
|
||||
AC_ARG_WITH(liberty-inc-dir,
|
||||
AC_HELP_STRING([--with-liberty-inc-dir=LIBERTYINCDIR],
|
||||
[give the path for LIBERTY-include files, default: LIBERTYDIR/include]),
|
||||
[LIBERTYINCDIR="-I$withval/"],
|
||||
[AS_IF([test x"$LIBERTYDIR" != x], [LIBERTYINCDIR="-I$LIBERTYDIR"include/])])
|
||||
|
||||
AC_ARG_WITH(liberty-lib-dir,
|
||||
AC_HELP_STRING([--with-liberty-lib-dir=LIBERTYLIBDIR],
|
||||
[give the path for LIBERTY-libraries, default: LIBERTYDIR/lib]),
|
||||
[LIBERTYLIBDIR="-L$withval/"],
|
||||
[AS_IF([test x"$LIBERTYDIR" != x], [LIBERTYLIBDIR="-L$LIBERTYDIR"lib/])])
|
||||
|
||||
AC_ARG_WITH(liberty-lib,
|
||||
AC_HELP_STRING([--with-liberty-lib=LIBERTYLIB], [use given liberty lib, default: -liberty]),
|
||||
[LIBERTYLIB="$withval"])
|
||||
|
||||
sav_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$CPPFLAGS $LIBERTYINCDIR"
|
||||
AC_CHECK_HEADER([libiberty.h], [],
|
||||
[
|
||||
AC_MSG_NOTICE([error: no libiberty.h found; check path for LIBERTY package first...])
|
||||
liberty_error="yes"
|
||||
])
|
||||
CPPFLAGS=$sav_CPPFLAGS
|
||||
|
||||
AS_IF([test x"$LIBERTYLIB" = x -a x"$liberty_error" = "xno"],
|
||||
[
|
||||
sav_LIBS=$LIBS
|
||||
LIBS="$LIBS $LIBERTYLIBDIR -liberty"
|
||||
AC_MSG_CHECKING([whether linking with -liberty works])
|
||||
AC_TRY_LINK([],[],
|
||||
[AC_MSG_RESULT([yes]); LIBERTYLIB=-liberty],[AC_MSG_RESULT([no])])
|
||||
LIBS=$sav_LIBS
|
||||
])
|
||||
|
||||
AS_IF([test x"$LIBERTYLIB" = x -a x"$liberty_error" = "xno"],
|
||||
[
|
||||
AC_MSG_NOTICE([error: no libiberty found; check path for LIBERTY package first...])
|
||||
liberty_error="yes"
|
||||
])
|
||||
|
||||
AS_IF([test x"$LIBERTYLIB" != x -a x"$liberty_error" = "xno"],
|
||||
[have_liberty="yes"])
|
||||
|
||||
AC_SUBST(LIBERTYINCDIR)
|
||||
AC_SUBST(LIBERTYLIBDIR)
|
||||
AC_SUBST(LIBERTYLIB)
|
||||
])
|
||||
|
49
ompi/contrib/vt/vt/config/m4/acinclude.nm.m4
Обычный файл
49
ompi/contrib/vt/vt/config/m4/acinclude.nm.m4
Обычный файл
@ -0,0 +1,49 @@
|
||||
AC_DEFUN([ACVT_NM],
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_REQUIRE([AC_PROG_NM])
|
||||
|
||||
AS_IF([test x"$NM" != x -a x"$lt_cv_nm_interface" = "xBSD nm"],
|
||||
[
|
||||
default_nm="$NM"
|
||||
|
||||
AC_TRY_COMPILE([], [],
|
||||
[
|
||||
opts_to_check="--demangle"
|
||||
for opt in $opts_to_check
|
||||
do
|
||||
AC_MSG_CHECKING([if $NM demangle option $opt works])
|
||||
eval "$NM $opt conftest.$ac_objext" >/dev/null 2>&1
|
||||
AS_IF([test "$?" = "0"],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
default_nm="$default_nm $opt"
|
||||
break
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
done
|
||||
|
||||
opts_to_check="--line-numbers"
|
||||
for opt in $opts_to_check
|
||||
do
|
||||
AC_MSG_CHECKING([if $NM line numbers option $opt works])
|
||||
eval "$NM $opt conftest.$ac_objext" >/dev/null 2>&1
|
||||
AS_IF([test "$?" = "0"],
|
||||
[
|
||||
AC_MSG_RESULT([yes])
|
||||
default_nm="$default_nm $opt"
|
||||
break
|
||||
],
|
||||
[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
done
|
||||
])
|
||||
|
||||
AC_DEFINE_UNQUOTED([DEFAULT_NM], ["$default_nm"],
|
||||
[Command to list symbols from object files.])
|
||||
])
|
||||
])
|
||||
|
@ -8,9 +8,6 @@ AC_CONFIG_MACRO_DIR(config/m4)
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
# If Automake supports silent rules, enable them.
|
||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||
|
||||
# Check whether we are inside Open MPI package
|
||||
inside_openmpi="no"
|
||||
AC_ARG_WITH(openmpi-inside, [],
|
||||
@ -174,7 +171,6 @@ AM_CONDITIONAL(AMBUILDCOMPINST_PHAT, test x"$compinst_type" = "xsun")
|
||||
AM_CONDITIONAL(AMBUILDCOMPINST_XL, test x"$compinst_type" = "xxl")
|
||||
AM_CONDITIONAL(AMBUILDCOMPINST_FTRACE, test x"$compinst_type" = "xnec")
|
||||
AM_CONDITIONAL(AMBUILDCOMPINST_OPENUH, test x"$compinst_type" = "xopenuh")
|
||||
AM_CONDITIONAL(AMHAVEBFD, test x"$have_bfd" = "xyes")
|
||||
|
||||
# Check for binary instrumentation by Dyninst
|
||||
ACVT_CONF_TITLE([Binary instrumentation by Dyninst])
|
||||
@ -184,7 +180,6 @@ AS_IF([test x"$force_dynattlib" = "xyes" -a x"$dynattlib_error" = "xyes"], [exit
|
||||
AS_IF([test x"$enable_config_titles" = "xyes" -a x"$check_dyninst" = "xno"],
|
||||
[AC_MSG_NOTICE([disabled via command line switch])])
|
||||
AM_CONDITIONAL(AMHAVEDYNINST, test x"$have_dyninst" = "xyes")
|
||||
AM_CONDITIONAL(AMHAVELIBERTY, test x"$have_liberty" = "xyes")
|
||||
AM_CONDITIONAL(AMBUILDDYNATTLIB, test x"$build_dynattlib" = "xyes")
|
||||
|
||||
# Check for MPI support
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Двоичные данные
ompi/contrib/vt/vt/doc/UserManual.pdf
Двоичные данные
ompi/contrib/vt/vt/doc/UserManual.pdf
Двоичный файл не отображается.
@ -5,7 +5,7 @@ compiler_flags_env=VT_CXXFLAGS
|
||||
compiler=@VT_WRAPPER_CXX@
|
||||
compiler_flags=@PTHREAD_CFLAGS@ @VT_WRAPPER_EXTRA_CXXFLAGS@
|
||||
linker_flags=@VT_WRAPPER_EXTRA_LDFLAGS@
|
||||
libs=@OTFLIBDIR@ @OTFLIB@ @BFDLIBDIR@ @BFDLIB@ @LIBERTYLIBDIR@ @LIBERTYLIB@ @PAPILIBDIR@ @PAPILIB@ @CPCLIBDIR@ @CPCLIB@ @DLLIBDIR@ @DLLIB@ @MATHLIB@ @VT_WRAPPER_EXTRA_LIBS@
|
||||
libs=@OTFLIBDIR@ @OTFLIB@ @PAPILIBDIR@ @PAPILIB@ @CPCLIBDIR@ @CPCLIB@ @DLLIBDIR@ @DLLIB@ @MATHLIB@ @VT_WRAPPER_EXTRA_LIBS@
|
||||
includedir=${includedir}
|
||||
libdir=${libdir}
|
||||
vtlib=@VT_WRAPPER_VTLIB@
|
||||
|
@ -5,7 +5,7 @@ compiler_flags_env=VT_CFLAGS
|
||||
compiler=@VT_WRAPPER_CC@
|
||||
compiler_flags=@PTHREAD_CFLAGS@ @VT_WRAPPER_EXTRA_CFLAGS@
|
||||
linker_flags=@VT_WRAPPER_EXTRA_LDFLAGS@
|
||||
libs=@OTFLIBDIR@ @OTFLIB@ @BFDLIBDIR@ @BFDLIB@ @LIBERTYLIBDIR@ @LIBERTYLIB@ @PAPILIBDIR@ @PAPILIB@ @CPCLIBDIR@ @CPCLIB@ @DLLIBDIR@ @DLLIB@ @MATHLIB@ @VT_WRAPPER_EXTRA_LIBS@
|
||||
libs=@OTFLIBDIR@ @OTFLIB@ @PAPILIBDIR@ @PAPILIB@ @CPCLIBDIR@ @CPCLIB@ @DLLIBDIR@ @DLLIB@ @MATHLIB@ @VT_WRAPPER_EXTRA_LIBS@
|
||||
includedir=${includedir}
|
||||
libdir=${libdir}
|
||||
vtlib=@VT_WRAPPER_VTLIB@
|
||||
|
@ -5,7 +5,7 @@ compiler_flags_env=VT_FFLAGS
|
||||
compiler=@VT_WRAPPER_F77@
|
||||
compiler_flags=@VT_WRAPPER_EXTRA_FFLAGS@
|
||||
linker_flags=@VT_WRAPPER_EXTRA_LDFLAGS@
|
||||
libs=@OTFLIBDIR@ @OTFLIB@ @BFDLIBDIR@ @BFDLIB@ @LIBERTYLIBDIR@ @LIBERTYLIB@ @PAPILIBDIR@ @PAPILIB@ @CPCLIBDIR@ @CPCLIB@ @DLLIBDIR@ @DLLIB@ @MATHLIB@ @VT_WRAPPER_EXTRA_LIBS@
|
||||
libs=@OTFLIBDIR@ @OTFLIB@ @PAPILIBDIR@ @PAPILIB@ @CPCLIBDIR@ @CPCLIB@ @DLLIBDIR@ @DLLIB@ @MATHLIB@ @VT_WRAPPER_EXTRA_LIBS@
|
||||
includedir=${includedir}
|
||||
libdir=${libdir}
|
||||
vtlib=@VT_WRAPPER_VTLIB@
|
||||
|
@ -5,7 +5,7 @@ compiler_flags_env=VT_FCFLAGS
|
||||
compiler=@VT_WRAPPER_FC@
|
||||
compiler_flags=@VT_WRAPPER_EXTRA_FCFLAGS@
|
||||
linker_flags=@VT_WRAPPER_EXTRA_LDFLAGS@
|
||||
libs=@OTFLIBDIR@ @OTFLIB@ @BFDLIBDIR@ @BFDLIB@ @LIBERTYLIBDIR@ @LIBERTYLIB@ @PAPILIBDIR@ @PAPILIB@ @CPCLIBDIR@ @CPCLIB@ @DLLIBDIR@ @DLLIB@ @MATHLIB@ @VT_WRAPPER_EXTRA_LIBS@
|
||||
libs=@OTFLIBDIR@ @OTFLIB@ @PAPILIBDIR@ @PAPILIB@ @CPCLIBDIR@ @CPCLIB@ @DLLIBDIR@ @DLLIB@ @MATHLIB@ @VT_WRAPPER_EXTRA_LIBS@
|
||||
includedir=${includedir}
|
||||
libdir=${libdir}
|
||||
vtlib=@VT_WRAPPER_VTLIB@
|
||||
|
@ -220,30 +220,6 @@ else
|
||||
DYNINSTSOURCES =
|
||||
endif
|
||||
|
||||
if AMHAVEBFD
|
||||
BFDCFLAGS = $(BFDINCDIR)
|
||||
# On some platforms only a static version of the BFD library is available
|
||||
# which might be built without PIC, so do not add its objects to the shared
|
||||
# VT libraries.
|
||||
#BFDLIBRARY = $(BFDLIBDIR) $(BFDLIB)
|
||||
BFDLIBRARY =
|
||||
else
|
||||
BFDCFLAGS =
|
||||
BFDLIBRARY =
|
||||
endif
|
||||
|
||||
if AMHAVELIBERTY
|
||||
LIBERTYCFLAGS = $(LIBERTYINCDIR)
|
||||
# On some platforms only a static version of the liberty library is available
|
||||
# which might be built without PIC, so do not add its objects to the shared
|
||||
# VT libraries.
|
||||
#LIBERTYLIBRARY = $(LIBERTYLIBDIR) $(LIBERTYLIB)
|
||||
LIBERTYLIBRARY =
|
||||
else
|
||||
LIBERTYCFLAGS =
|
||||
LIBERTYLIBRARY =
|
||||
endif
|
||||
|
||||
if AMHAVEDL
|
||||
DLCFLAGS = $(DLINCDIR)
|
||||
DLLIBRARY = $(DLLIBDIR) $(DLLIB)
|
||||
@ -373,24 +349,24 @@ VT_FMPI_SOURCES = \
|
||||
$(FMPI2CONSTSOURCES)
|
||||
|
||||
CC = $(MPICC)
|
||||
AM_CFLAGS = $(OTFCFLAGS) $(BFDCFLAGS) $(LIBERTYCFLAGS) $(DLCFLAGS) $(LIBWRAPCFLAGS) $(LIBCWRAPCFLAGS) $(IOWRAPCFLAGS) $(MEMHOOKCFLAGS) $(GETCPUCFLAGS) $(RUSAGECFLAGS) $(METRCFLAGS)
|
||||
AM_CFLAGS = $(OTFCFLAGS) $(DLCFLAGS) $(LIBWRAPCFLAGS) $(LIBCWRAPCFLAGS) $(IOWRAPCFLAGS) $(MEMHOOKCFLAGS) $(GETCPUCFLAGS) $(RUSAGECFLAGS) $(METRCFLAGS)
|
||||
|
||||
libvt_la_LIBADD = $(top_builddir)/util/libutil.la $(OTFLIBRARY) $(BFDLIBRARY) $(LIBERTYLIBRARY) $(METRLIBRARY) $(DLLIBRARY) $(MATHLIBRARY)
|
||||
libvt_la_LIBADD = $(top_builddir)/util/libutil.la $(OTFLIBRARY) $(METRLIBRARY) $(DLLIBRARY) $(MATHLIBRARY)
|
||||
libvt_la_DEPENDENCIES = $(top_builddir)/util/libutil.la $(OTFDEPENDENCIES)
|
||||
libvt_la_SOURCES = $(VT_COMMON_SOURCES) $(VT_SEQ_SOURCES)
|
||||
|
||||
libvt_mpi_la_CFLAGS = -DVT_MPI $(AM_CFLAGS) $(MPICFLAGS) $(MPIINCDIR) $(ETIMESYNCCFLAGS) $(UNIMCICFLAGS)
|
||||
libvt_mpi_la_LIBADD = $(top_builddir)/util/libutil.la $(OTFLIBRARY) $(BFDLIBRARY) $(LIBERTYLIBRARY) $(METRLIBRARY) $(DLLIBRARY) $(MATHLIBRARY)
|
||||
libvt_mpi_la_LIBADD = $(top_builddir)/util/libutil.la $(OTFLIBRARY) $(METRLIBRARY) $(DLLIBRARY) $(MATHLIBRARY)
|
||||
libvt_mpi_la_DEPENDENCIES = $(top_builddir)/util/libutil.la $(OTFDEPENDENCIES)
|
||||
libvt_mpi_la_SOURCES = $(VT_COMMON_SOURCES) $(VT_MPI_SOURCES)
|
||||
|
||||
libvt_mt_la_CFLAGS = -DVT_MT $(AM_CFLAGS) $(PTHREADCFLAGS) $(OMPCFLAGS) $(THRDCFLAGS)
|
||||
libvt_mt_la_LIBADD = $(top_builddir)/util/libutil.la $(OTFLIBRARY) $(BFDLIBRARY) $(LIBERTYLIBRARY) $(METRLIBRARY) $(DLLIBRARY) $(MATHLIBRARY)
|
||||
libvt_mt_la_LIBADD = $(top_builddir)/util/libutil.la $(OTFLIBRARY) $(METRLIBRARY) $(DLLIBRARY) $(MATHLIBRARY)
|
||||
libvt_mt_la_DEPENDENCIES = $(top_builddir)/util/libutil.la $(OTFDEPENDENCIES)
|
||||
libvt_mt_la_SOURCES = $(VT_COMMON_SOURCES) $(VT_MT_SOURCES)
|
||||
|
||||
libvt_hyb_la_CFLAGS = -DVT_HYB $(AM_CFLAGS) $(MPICFLAGS) $(MPIINCDIR) $(PTHREADCFLAGS) $(OMPCFLAGS) $(THRDCFLAGS) $(ETIMESYNCCFLAGS) $(UNIMCICFLAGS)
|
||||
libvt_hyb_la_LIBADD = $(top_builddir)/util/libutil.la $(OTFLIBRARY) $(BFDLIBRARY) $(LIBERTYLIBRARY) $(METRLIBRARY) $(DLLIBRARY) $(MATHLIBRARY)
|
||||
libvt_hyb_la_LIBADD = $(top_builddir)/util/libutil.la $(OTFLIBRARY) $(METRLIBRARY) $(DLLIBRARY) $(MATHLIBRARY)
|
||||
libvt_hyb_la_DEPENDENCIES = $(top_builddir)/util/libutil.la $(OTFDEPENDENCIES)
|
||||
libvt_hyb_la_SOURCES = $(VT_COMMON_SOURCES) $(VT_HYB_SOURCES)
|
||||
|
||||
|
@ -22,29 +22,13 @@
|
||||
#include "vt_comp.h"
|
||||
#include "vt_env.h"
|
||||
#include "vt_error.h"
|
||||
#include "vt_inttypes.h"
|
||||
#include "vt_iowrap.h"
|
||||
#include "vt_memhook.h"
|
||||
#include "vt_pform.h"
|
||||
#include "vt_trc.h"
|
||||
#include "vt_thrd.h"
|
||||
|
||||
#if defined(HAVE_BFD) && HAVE_BFD
|
||||
# include "bfd.h"
|
||||
# if defined(HAVE_GNU_DEMANGLE) && HAVE_GNU_DEMANGLE
|
||||
# if defined(HAVE_DEMANGLE_H) && HAVE_DEMANGLE_H
|
||||
# include "demangle.h"
|
||||
# else /* HAVE_DEMANGLE_H */
|
||||
extern char* cplus_demangle (const char* mangled, int options);
|
||||
# define DMGL_NO_OPTS 0
|
||||
# define DMGL_PARAMS (1 << 0)
|
||||
# define DMGL_ANSI (1 << 1)
|
||||
# define DMGL_JAVA (1 << 2)
|
||||
# define DMGL_VERBOSE (1 << 3)
|
||||
# define DMGL_TYPES (1 << 4)
|
||||
# endif /* HAVE_DEMANGLE_H */
|
||||
# endif /* HAVE_GNU_DEMANGLE */
|
||||
#endif /* HAVE_BFD */
|
||||
|
||||
#if (defined(HAVE_DL) && HAVE_DL) && (defined(HAVE_DECL_RTLD_DEFAULT) && HAVE_DECL_RTLD_DEFAULT)
|
||||
# include <dlfcn.h>
|
||||
# define GET_ADDR_OF_UNDEF_FUNC(func) \
|
||||
@ -59,6 +43,9 @@
|
||||
# define DEREF_IA64_FUNC_PTR(ptr) (ptr)
|
||||
#endif /* __ia64__ */
|
||||
|
||||
#define NM_LINE_BLK_LEN 1024
|
||||
#define NM_LINE_MAX_LEN 16384
|
||||
|
||||
static int gnu_init = 1; /* is initialization needed? */
|
||||
|
||||
/*
|
||||
@ -115,204 +102,195 @@ static HashNode* hash_get(long h) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(HAVE_BFD) && HAVE_BFD
|
||||
|
||||
/*
|
||||
* Get symbol table by using BFD
|
||||
* Get symbol table by 'nm'
|
||||
*/
|
||||
|
||||
static void get_symtab_bfd(void) {
|
||||
bfd* BfdImage = 0;
|
||||
int nr_all_syms;
|
||||
int i;
|
||||
size_t size;
|
||||
char* exe_env;
|
||||
asymbol** syms;
|
||||
int do_getsrc = vt_env_gnu_getsrc();
|
||||
#if defined(HAVE_GNU_DEMANGLE) && HAVE_GNU_DEMANGLE
|
||||
int do_demangle = vt_env_gnu_demangle();
|
||||
#endif /* HAVE_GNU_DEMANGLE */
|
||||
|
||||
/* initialize BFD */
|
||||
bfd_init();
|
||||
|
||||
/* get executable path from environment var. VT_APPPATH */
|
||||
exe_env = vt_env_apppath();
|
||||
if ( ! exe_env )
|
||||
{
|
||||
vt_error_msg("Could not determine path of executable.\n"
|
||||
"There are two possible ways to solve this problem:\n"
|
||||
"Set either the environment variable VT_APPPATH to the path "
|
||||
"of the executable or set VT_GNU_NMFILE to a symbol list "
|
||||
"file, created with 'nm'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* get executable image */
|
||||
BfdImage = bfd_openr(exe_env, 0 );
|
||||
if ( ! BfdImage )
|
||||
vt_error_msg("BFD: bfd_openr(): failed\n"
|
||||
"Could not get executable image from %s.\n"
|
||||
"A possible solution to the problem is to set the "
|
||||
"environment variable VT_GNU_NMFILE to a symbol list file, "
|
||||
"created with 'nm'.", exe_env);
|
||||
}
|
||||
|
||||
/* check image format */
|
||||
if ( ! bfd_check_format(BfdImage, bfd_object) ) {
|
||||
vt_error_msg("BFD: bfd_check_format(): failed");
|
||||
}
|
||||
|
||||
/* return if file has no symbols at all */
|
||||
if ( ! ( bfd_get_file_flags(BfdImage) & HAS_SYMS ) )
|
||||
vt_error_msg("BFD: bfd_get_file_flags(): failed");
|
||||
|
||||
/* get the upper bound number of symbols */
|
||||
size = bfd_get_symtab_upper_bound(BfdImage);
|
||||
|
||||
/* HAS_SYMS can be set even with no symbols in the file! */
|
||||
if ( size < 1 )
|
||||
vt_error_msg("BFD: bfd_get_symtab_upper_bound(): < 1");
|
||||
|
||||
/* read canonicalized symbols */
|
||||
syms = (asymbol**)malloc(size);
|
||||
nr_all_syms = bfd_canonicalize_symtab(BfdImage, syms);
|
||||
if ( nr_all_syms < 1 )
|
||||
vt_error_msg("BFD: bfd_canonicalize_symtab(): < 1");
|
||||
|
||||
for (i=0; i<nr_all_syms; ++i) {
|
||||
char* dem_name = NULL;
|
||||
long addr;
|
||||
const char* filename;
|
||||
const char* funcname;
|
||||
unsigned int lno;
|
||||
|
||||
/* ignore symbols that are not a function */
|
||||
if ( !(syms[i]->flags & BSF_FUNCTION) ) continue;
|
||||
|
||||
/* ignore system functions */
|
||||
if ( syms[i]->name[0] == '.' ||
|
||||
strncmp(syms[i]->name, "bfd_", 4) == 0 ||
|
||||
strstr(syms[i]->name, "@@") != NULL ) continue;
|
||||
|
||||
/* get filename and linenumber from debug info */
|
||||
/* needs -g */
|
||||
filename = NULL;
|
||||
lno = VT_NO_LNO;
|
||||
if ( do_getsrc ) {
|
||||
bfd_find_nearest_line(BfdImage, bfd_get_section(syms[i]), syms,
|
||||
syms[i]->value, &filename, &funcname, &lno);
|
||||
}
|
||||
|
||||
/* calculate function address */
|
||||
addr = syms[i]->section->vma+syms[i]->value;
|
||||
|
||||
/* try to get address of undefined function, if necessary */
|
||||
if ( addr == 0 )
|
||||
addr = (long)GET_ADDR_OF_UNDEF_FUNC(syms[i]->name);
|
||||
|
||||
/* ignore function, if its address could not be determined */
|
||||
if ( addr == 0 )
|
||||
continue;
|
||||
|
||||
/* use demangled name if possible */
|
||||
#if defined(HAVE_GNU_DEMANGLE) && HAVE_GNU_DEMANGLE
|
||||
if ( do_demangle ) {
|
||||
dem_name = cplus_demangle(syms[i]->name,
|
||||
DMGL_PARAMS | DMGL_ANSI |
|
||||
DMGL_VERBOSE | DMGL_TYPES);
|
||||
}
|
||||
#endif /* HAVE_GNU_DEMANGLE */
|
||||
|
||||
if( dem_name ) {
|
||||
hash_put(addr, dem_name, filename, lno);
|
||||
} else {
|
||||
char* n = strdup(syms[i]->name);
|
||||
hash_put(addr, n, filename, lno);
|
||||
}
|
||||
}
|
||||
|
||||
free(syms);
|
||||
bfd_close(BfdImage);
|
||||
return;
|
||||
}
|
||||
#endif /* HAVE_BFD */
|
||||
|
||||
/*
|
||||
* Get symbol table by parsing nm-file
|
||||
*/
|
||||
|
||||
static void get_symtab_nm(const char* nmfilename)
|
||||
static void get_symtab(void)
|
||||
{
|
||||
FILE* nmfile;
|
||||
char line[1024];
|
||||
int do_getsrc = vt_env_gnu_getsrc();
|
||||
char* nm_cmd = NULL;
|
||||
char* nm_filename;
|
||||
FILE* nm_stream;
|
||||
|
||||
/* open nm-file */
|
||||
if( !(nmfile = fopen(nmfilename, "r")) )
|
||||
vt_error_msg("Could not open symbol list file %s", nmfilename);
|
||||
char* line;
|
||||
size_t line_size;
|
||||
uint32_t lineno = 0;
|
||||
|
||||
uint8_t parse_error = 0;
|
||||
|
||||
VT_SUSPEND_IO_TRACING();
|
||||
|
||||
/* open nm-file, if given */
|
||||
nm_filename = vt_env_gnu_nmfile();
|
||||
if ( nm_filename != NULL && strlen(nm_filename) > 0 )
|
||||
{
|
||||
vt_cntl_msg(2, "Collecting symbols from file %s", nm_filename);
|
||||
|
||||
/* open nm-file */
|
||||
if ( (nm_stream = fopen(nm_filename, "r")) == NULL )
|
||||
vt_error_msg("Could not open symbol list file %s", nm_filename);
|
||||
}
|
||||
/* otherwise, try to get symbol table automatically */
|
||||
else
|
||||
{
|
||||
char* apppath;
|
||||
char* nm;
|
||||
size_t nm_cmd_len;
|
||||
|
||||
vt_cntl_msg(2, "Collecting symbols by 'nm'");
|
||||
|
||||
/* get executable path specified by VT_APPPATH */
|
||||
apppath = vt_env_apppath();
|
||||
if ( apppath == NULL || strlen(apppath) == 0 )
|
||||
{
|
||||
vt_error_msg("Could not determine path of executable.\n"
|
||||
"Please set the environment variable VT_APPPATH to the path "
|
||||
"of your executable or set VT_GNU_NMFILE to a symbol list "
|
||||
"file created with 'nm'.");
|
||||
}
|
||||
|
||||
/* get nm command specified by VT_GNU_NM */
|
||||
nm = vt_env_gnu_nm();
|
||||
if ( nm == NULL )
|
||||
{
|
||||
vt_error_msg("VampirTrace was configured without an 'nm' command.\n"
|
||||
"Please set the environment variable VT_GNU_NM to the 'nm' "
|
||||
"command including command line switches which lists "
|
||||
"symbol/addresses of an object file in BSD-style or set "
|
||||
"VT_GNU_NMFILE to a pre-created symbol list file." );
|
||||
}
|
||||
|
||||
/* allocate memory for nm command */
|
||||
nm_cmd_len = strlen(nm) + 1 + strlen(apppath) + 1;
|
||||
nm_cmd = (char*)malloc(nm_cmd_len * sizeof(char));
|
||||
if ( nm_cmd == NULL )
|
||||
vt_error();
|
||||
|
||||
/* compose nm command */
|
||||
snprintf(nm_cmd, nm_cmd_len, "%s %s", nm, apppath);
|
||||
|
||||
/* execute nm command */
|
||||
vt_cntl_msg(2, "Executing %s", nm_cmd);
|
||||
nm_stream = popen(nm_cmd, "r");
|
||||
/* error handling after pclose below */
|
||||
|
||||
nm_filename = NULL;
|
||||
}
|
||||
|
||||
/* allocate memory for lines */
|
||||
line = (char*)malloc(NM_LINE_BLK_LEN * sizeof(char));
|
||||
if ( line == NULL )
|
||||
vt_error();
|
||||
line_size = NM_LINE_BLK_LEN;
|
||||
|
||||
/* read lines */
|
||||
while( fgets( line, sizeof(line)-1, nmfile ) )
|
||||
|
||||
while( nm_stream != NULL && fgets(line, line_size, nm_stream) )
|
||||
{
|
||||
char* col;
|
||||
char delim[2] = " ";
|
||||
int nc = 0;
|
||||
int nc = 1;
|
||||
|
||||
long addr = 0;
|
||||
long addr = -1;
|
||||
char* filename = NULL;
|
||||
char* funcname = NULL;
|
||||
unsigned int lno = VT_NO_LNO;
|
||||
|
||||
if( strlen(line) == 0 )
|
||||
continue;
|
||||
lineno++;
|
||||
|
||||
if( line[strlen(line)-1] == '\n' )
|
||||
/* trigger a parse error, if line is empty */
|
||||
if ( strlen(line) == 0 )
|
||||
{
|
||||
parse_error = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* if line seems to be incomplete, enlarge line buffer and read the
|
||||
remaining line */
|
||||
while( !parse_error && line[strlen(line)-1] != '\n' )
|
||||
{
|
||||
char tmp[NM_LINE_BLK_LEN];
|
||||
|
||||
/* read the remaining line; if it fails (EOF) the line seems to
|
||||
be complete after all */
|
||||
if ( !fgets(tmp, sizeof(tmp), nm_stream) )
|
||||
break;
|
||||
|
||||
/* trigger a parse error, if line is to long (>NM_LINE_MAX_LEN) */
|
||||
if ( line_size + NM_LINE_BLK_LEN > NM_LINE_MAX_LEN )
|
||||
{
|
||||
parse_error = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* enlarge line buffer */
|
||||
line = (char*)realloc(line, (line_size + NM_LINE_BLK_LEN) * sizeof(char));
|
||||
if ( line == NULL )
|
||||
vt_error();
|
||||
line_size += NM_LINE_BLK_LEN;
|
||||
|
||||
/* complete line */
|
||||
strcat(line, tmp);
|
||||
}
|
||||
if ( parse_error )
|
||||
break;
|
||||
|
||||
/* chop new-line character from line */
|
||||
if ( line[strlen(line)-1] == '\n' )
|
||||
line[strlen(line)-1] = '\0';
|
||||
|
||||
/* split line to columns */
|
||||
col = strtok(line, delim);
|
||||
do
|
||||
{
|
||||
if( nc == 0 ) /* column 1 (address) */
|
||||
if ( nc == 1 ) /* column 1 (address) */
|
||||
{
|
||||
/* undefined symbol?
|
||||
try to get its address by dlsym() if we've a symbol name (nc==2) */
|
||||
if( col[0] == 'U' )
|
||||
/* if there is no address in the first column the symbol could be
|
||||
undefined; try get its address later (nc==3) */
|
||||
if ( strlen(col) == 1 )
|
||||
{
|
||||
nc++;
|
||||
nc = 3;
|
||||
strcpy(delim, "\t");
|
||||
continue;
|
||||
}
|
||||
/* otherwise, try to convert address string */
|
||||
else
|
||||
{
|
||||
addr = strtol(col, NULL, 16);
|
||||
if( addr == 0 )
|
||||
/* check boundaries of address */
|
||||
if ( addr == LONG_MIN || addr == LONG_MAX )
|
||||
{
|
||||
parse_error = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( nc == 1 ) /* column 2 (type) */
|
||||
else if ( nc == 2 ) /* column 2 (type) */
|
||||
{
|
||||
/* type must have a length of 1 */
|
||||
if ( strlen(col) != 1 )
|
||||
{
|
||||
parse_error = 1;
|
||||
break;
|
||||
}
|
||||
strcpy(delim, "\t");
|
||||
}
|
||||
else if( nc == 2 ) /* column 3 (symbol) */
|
||||
else if ( nc == 3 ) /* column 3 (symbol) */
|
||||
{
|
||||
funcname = col;
|
||||
strcpy(delim, ":");
|
||||
|
||||
/* try to get address of undefined function, if necessary */
|
||||
if( addr == 0 )
|
||||
if ( addr == -1 )
|
||||
addr = (long)GET_ADDR_OF_UNDEF_FUNC(funcname);
|
||||
|
||||
/* ignore function, if its address could not be determined */
|
||||
if( addr == 0 )
|
||||
if ( addr == 0 )
|
||||
break;
|
||||
}
|
||||
else if( nc == 3 ) /* column 4 (filename) */
|
||||
else if( nc == 4 ) /* column 4 (filename) */
|
||||
{
|
||||
if( do_getsrc )
|
||||
filename = col;
|
||||
else
|
||||
break;
|
||||
filename = col;
|
||||
}
|
||||
else /* column 5 (line) */
|
||||
{
|
||||
@ -325,42 +303,64 @@ static void get_symtab_nm(const char* nmfilename)
|
||||
col = strtok(0, delim);
|
||||
} while( col );
|
||||
|
||||
/* add symbol to hash table */
|
||||
if( nc >= 3 && addr > 0 )
|
||||
/* stop reading file, if an parse error occurred */
|
||||
if ( parse_error )
|
||||
{
|
||||
break;
|
||||
}
|
||||
/* at least three columns must be read (nc>=3) */
|
||||
else if ( nc < 3 )
|
||||
{
|
||||
parse_error = 1;
|
||||
break;
|
||||
}
|
||||
/* add symbol to hash table, if we have its address */
|
||||
else if ( addr > 0 )
|
||||
{
|
||||
char* n = strdup(funcname);
|
||||
hash_put(addr, n, filename, lno);
|
||||
}
|
||||
}
|
||||
|
||||
/* close nm-file */
|
||||
fclose(nmfile);
|
||||
}
|
||||
/* close file/pipe stream */
|
||||
|
||||
/*
|
||||
* Get symbol table either by using BFD or by parsing nm-file
|
||||
*/
|
||||
static void get_symtab(void)
|
||||
{
|
||||
char* nmfilename = vt_env_gnu_nmfile();
|
||||
|
||||
VT_SUSPEND_IO_TRACING();
|
||||
|
||||
/* read nm-output file, if given? */
|
||||
if( nmfilename )
|
||||
if ( nm_filename != NULL )
|
||||
{
|
||||
get_symtab_nm( nmfilename );
|
||||
fclose(nm_stream);
|
||||
|
||||
if ( parse_error )
|
||||
{
|
||||
vt_error_msg("%s:%u: could not be parsed.\n"
|
||||
"Please check the content of %s for BSD-style.",
|
||||
nm_filename, lineno, nm_filename);
|
||||
}
|
||||
}
|
||||
/* read application's executable by using BFD */
|
||||
else
|
||||
{
|
||||
#if defined(HAVE_BFD) && HAVE_BFD
|
||||
get_symtab_bfd();
|
||||
#else /* HAVE_BFD */
|
||||
vt_error_msg("No symbol list file given. Please set the environment variable VT_GNU_NMFILE to the path of your symbol list file, created with 'nm'.");
|
||||
#endif /* HAVE_BFD */
|
||||
if ( nm_stream == NULL || pclose(nm_stream) != 0 )
|
||||
{
|
||||
vt_error_msg("Failed to execute %s\n"
|
||||
"Please set the environment variable VT_GNU_NM to the 'nm' "
|
||||
"command including command line switches which lists "
|
||||
"symbol/addresses of an object file in BSD-style or set "
|
||||
"VT_GNU_NMFILE to a pre-created symbol list file.",
|
||||
nm_cmd);
|
||||
}
|
||||
else if ( parse_error )
|
||||
{
|
||||
vt_error_msg("Could not parse 'nm' output created with %s.\n"
|
||||
"Please set the environment variable VT_GNU_NM to the 'nm' "
|
||||
"command including command line switches which lists "
|
||||
"symbol/addresses of an object file in BSD-style or set "
|
||||
"VT_GNU_NMFILE to a pre-created symbol list file.",
|
||||
nm_cmd);
|
||||
}
|
||||
|
||||
free(nm_cmd);
|
||||
}
|
||||
|
||||
free(line);
|
||||
|
||||
VT_RESUME_IO_TRACING();
|
||||
}
|
||||
|
||||
|
@ -215,6 +215,30 @@ char* vt_env_dyn_shlibs()
|
||||
return dyn_shlibs;
|
||||
}
|
||||
|
||||
char* vt_env_gnu_nm()
|
||||
{
|
||||
static int read = 1;
|
||||
static char* gnu_nm = NULL;
|
||||
char* tmp;
|
||||
|
||||
if (read)
|
||||
{
|
||||
read = 0;
|
||||
tmp = getenv("VT_GNU_NM");
|
||||
if (tmp != NULL && strlen(tmp) > 0)
|
||||
{
|
||||
gnu_nm = replace_vars(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DEFAULT_NM
|
||||
gnu_nm = DEFAULT_NM;
|
||||
#endif /* DEFAULT_NM */
|
||||
}
|
||||
}
|
||||
|
||||
return gnu_nm;
|
||||
}
|
||||
char* vt_env_gnu_nmfile()
|
||||
{
|
||||
static int read = 1;
|
||||
@ -227,52 +251,12 @@ char* vt_env_gnu_nmfile()
|
||||
tmp = getenv("VT_GNU_NMFILE");
|
||||
if (tmp != NULL && strlen(tmp) > 0)
|
||||
{
|
||||
gnu_nmfile = replace_vars(tmp);
|
||||
gnu_nmfile = replace_vars(tmp);
|
||||
}
|
||||
}
|
||||
return gnu_nmfile;
|
||||
}
|
||||
|
||||
int vt_env_gnu_demangle()
|
||||
{
|
||||
static int gnu_demangle = -1;
|
||||
char* tmp;
|
||||
|
||||
if (gnu_demangle == -1)
|
||||
{
|
||||
tmp = getenv("VT_GNU_DEMANGLE");
|
||||
if (tmp != NULL && strlen(tmp) > 0)
|
||||
{
|
||||
gnu_demangle = parse_bool(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gnu_demangle = 0;
|
||||
}
|
||||
}
|
||||
return gnu_demangle;
|
||||
}
|
||||
|
||||
int vt_env_gnu_getsrc()
|
||||
{
|
||||
static int gnu_getsrc = -1;
|
||||
char* tmp;
|
||||
|
||||
if (gnu_getsrc == -1)
|
||||
{
|
||||
tmp = getenv("VT_GNU_GETSRC");
|
||||
if (tmp != NULL && strlen(tmp) > 0)
|
||||
{
|
||||
gnu_getsrc = parse_bool(tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
gnu_getsrc = 1;
|
||||
}
|
||||
}
|
||||
return gnu_getsrc;
|
||||
}
|
||||
|
||||
char* vt_env_gdir()
|
||||
{
|
||||
static char* gdir = NULL;
|
||||
|
@ -24,9 +24,8 @@
|
||||
EXTERN char* vt_env_apppath(void);
|
||||
EXTERN char* vt_env_dyn_blacklist(void);
|
||||
EXTERN char* vt_env_dyn_shlibs(void);
|
||||
EXTERN char* vt_env_gnu_nm(void);
|
||||
EXTERN char* vt_env_gnu_nmfile(void);
|
||||
EXTERN int vt_env_gnu_demangle(void);
|
||||
EXTERN int vt_env_gnu_getsrc(void);
|
||||
EXTERN char* vt_env_gdir(void);
|
||||
EXTERN char* vt_env_ldir(void);
|
||||
EXTERN int vt_env_gdir_check(void);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user