config, btrace: check for pt_insn_event in libipt

Version 2 of libipt adds an event system to instruction flow decoders and
deprecates indicating events via flags in struct pt_insn.  Add configuration
checks to determine which version we have.

gdb/
	* configure.ac: Check for pt_insn_event, struct pt_insn.enabled,
	and struct pt_insn.resynced.
	* configure: Regenerated.
	* config.in: Regenerated.
This commit is contained in:
Markus Metzger 2016-11-21 11:46:15 +01:00
parent 5b4a1ff337
commit c56ccc05b2
4 changed files with 116 additions and 57 deletions

View File

@ -1,3 +1,10 @@
2017-05-31 Markus Metzger <markus.t.metzger@intel.com>
* configure.ac: Check for pt_insn_event, struct pt_insn.enabled,
and struct pt_insn.resynced.
* configure: Regenerated.
* config.in: Regenerated.
2017-05-30 Tim Wiederhake <tim.wiederhake@intel.com>
* btrace.c (ftrace_find_call_by_number): New function.

View File

@ -381,6 +381,9 @@
/* Define if sys/ptrace.h defines the PT_GETXMMREGS request. */
#undef HAVE_PT_GETXMMREGS
/* Define to 1 if you have the `pt_insn_event' function. */
#undef HAVE_PT_INSN_EVENT
/* Define to 1 if you have the `pwrite' function. */
#undef HAVE_PWRITE
@ -462,6 +465,12 @@
/* Define to 1 if `struct ptrace_lwpinfo' is a member of `pl_tdname'. */
#undef HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME
/* Define to 1 if `struct pt_insn' is a member of `enabled'. */
#undef HAVE_STRUCT_PT_INSN_ENABLED
/* Define to 1 if `struct pt_insn' is a member of `resynced'. */
#undef HAVE_STRUCT_PT_INSN_RESYNCED
/* Define to 1 if your system has struct reg in <machine/reg.h>. */
#undef HAVE_STRUCT_REG

150
gdb/configure vendored
View File

@ -2248,6 +2248,63 @@ $as_echo "$ac_res" >&6; }
} # ac_fn_c_check_func
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including
# INCLUDES, setting cache variable VAR accordingly.
ac_fn_c_check_member ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
$as_echo_n "checking for $2.$3... " >&6; }
if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$5
int
main ()
{
static $2 ac_aggr;
if (ac_aggr.$3)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$4=yes"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$5
int
main ()
{
static $2 ac_aggr;
if (sizeof ac_aggr.$3)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$4=yes"
else
eval "$4=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$4
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_member
# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
# -------------------------------------------
# Tests whether TYPE exists after having included INCLUDES, setting cache
@ -2346,63 +2403,6 @@ $as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_decl
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
# ----------------------------------------------------
# Tries to find if the field MEMBER exists in type AGGR, after including
# INCLUDES, setting cache variable VAR accordingly.
ac_fn_c_check_member ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
$as_echo_n "checking for $2.$3... " >&6; }
if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$5
int
main ()
{
static $2 ac_aggr;
if (ac_aggr.$3)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$4=yes"
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$5
int
main ()
{
static $2 ac_aggr;
if (sizeof ac_aggr.$3)
return 0;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
eval "$4=yes"
else
eval "$4=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
eval ac_res=\$$4
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
} # ac_fn_c_check_member
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
@ -11440,6 +11440,42 @@ $as_echo "$LIBIPT" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libipt is missing or unusable; some features may be unavailable." >&5
$as_echo "$as_me: WARNING: libipt is missing or unusable; some features may be unavailable." >&2;}
fi
else
save_LIBS=$LIBS
LIBS="$LIBS $LIBIPT"
for ac_func in pt_insn_event
do :
ac_fn_c_check_func "$LINENO" "pt_insn_event" "ac_cv_func_pt_insn_event"
if test "x$ac_cv_func_pt_insn_event" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_PT_INSN_EVENT 1
_ACEOF
fi
done
ac_fn_c_check_member "$LINENO" "struct pt_insn" "enabled" "ac_cv_member_struct_pt_insn_enabled" "#include <intel-pt.h>
"
if test "x$ac_cv_member_struct_pt_insn_enabled" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_PT_INSN_ENABLED 1
_ACEOF
fi
ac_fn_c_check_member "$LINENO" "struct pt_insn" "resynced" "ac_cv_member_struct_pt_insn_resynced" "#include <intel-pt.h>
"
if test "x$ac_cv_member_struct_pt_insn_resynced" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_PT_INSN_RESYNCED 1
_ACEOF
fi
LIBS=$save_LIBS
fi
fi

View File

@ -1272,6 +1272,13 @@ else
else
AC_MSG_WARN([libipt is missing or unusable; some features may be unavailable.])
fi
else
save_LIBS=$LIBS
LIBS="$LIBS $LIBIPT"
AC_CHECK_FUNCS(pt_insn_event)
AC_CHECK_MEMBERS([struct pt_insn.enabled, struct pt_insn.resynced], [], [],
[#include <intel-pt.h>])
LIBS=$save_LIBS
fi
fi