public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@linaro.org>
To: Zied Guermazi <zied.guermazi@trande.de>,
	gdb-patches@sourceware.org, markus.t.metzger@intel.com
Subject: Re: [PATCH v6 1/7] configure gdb build system for supporting btrace on arm processors
Date: Wed, 30 Jun 2021 09:17:09 -0300	[thread overview]
Message-ID: <448c6382-69e5-db36-20c4-242e669ccee7@linaro.org> (raw)
In-Reply-To: <20210531213307.275079-2-zied.guermazi@trande.de>

On 5/31/21 6:33 PM, Zied Guermazi wrote:
> This patch adds the possibility to build GDB with support for branch tracing
> using ARM CoreSight traces.
> New flag is --with-arm-cs
> 
> gdb/ChangeLog
> 
> 	* Makefile.in LIBOPENCSD_C_API: Regenerated.
> 	* config.in LIBOPENCSD_C_API: Regenerated.
> 	* configure: Regenerated.
> 	* configure.nat: add nat/linux-btrace.o to the build
> 	for aarch64 and arm
> 	* top.c (print_gdb_configuration): add --with-arm-cs
> 	or --without-arm-cs according to the configuration.
> 
> gdbserver/ChangeLog
> 	* gdbserver/configure: Regenerated.
> 	* gdbserver/config.in: Regenerated.
> 
> gdbsupport/ChangeLog
> 
> 	* gdbsupport/common.m4: check --with-arm-cs configuration
> 	flag, perf_event and opencsd_c_api to set compilation flags.
> 	* gdbsupport/config.in: Regenerated.
> 	* gdbsupport/Makefile.in: Regenerated.
> 	* gdbsupport/configure: Regenerated.
> ---
>   gdb/Makefile.in        |   5 +-
>   gdb/config.in          |   3 +
>   gdb/configure          | 549 +++++++++++++++++++++++++++++++++++++++++
>   gdb/configure.nat      |   4 +-
>   gdb/top.c              |  10 +-
>   gdbserver/config.in    |   3 +
>   gdbserver/configure    | 545 ++++++++++++++++++++++++++++++++++++++++
>   gdbsupport/Makefile.in |   3 +
>   gdbsupport/common.m4   |  39 +++
>   gdbsupport/config.in   |   3 +
>   gdbsupport/configure   | 545 ++++++++++++++++++++++++++++++++++++++++
>   11 files changed, 1705 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/Makefile.in b/gdb/Makefile.in
> index bb6c5dfa784..04680a22e5c 100644
> --- a/gdb/Makefile.in
> +++ b/gdb/Makefile.in
> @@ -203,6 +203,9 @@ LIBXXHASH = @LIBXXHASH@
>   # Where is libipt?  This will be empty if libipt was not available.
>   LIBIPT = @LIBIPT@
>   
> +#where is libopencsd? this will be empty if libopencsd was not available
> +LIBOPENCSD_C_API = @LIBOPENCSD_C_API@
> +
>   # Where is libgmp?
>   LIBGMP = @LIBGMP@
>   
> @@ -636,7 +639,7 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(LIBCTF) $(BFD) $(ZLIB) \
>           $(LIBSUPPORT) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \
>   	$(XM_CLIBS) $(GDBTKLIBS) \
>   	@LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \
> -	$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \
> +	$(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) $(LIBOPENCSD_C_API) \
>   	$(WIN32LIBS) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) $(LIBICONV) \
>   	$(LIBMPFR) $(LIBGMP) $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \
>   	$(DEBUGINFOD_LIBS)
> diff --git a/gdb/config.in b/gdb/config.in
> index 99c924f9ba0..0373689a3ce 100644
> --- a/gdb/config.in
> +++ b/gdb/config.in
> @@ -246,6 +246,9 @@
>   /* Define if you have the mpfr library. */
>   #undef HAVE_LIBMPFR
>   
> +/* Define if you have the opencsd_c_api library. */
> +#undef HAVE_LIBOPENCSD_C_API
> +
>   /* Define to 1 if you have the <libunwind-ia64.h> header file. */
>   #undef HAVE_LIBUNWIND_IA64_H
>   
> diff --git a/gdb/configure b/gdb/configure
> index cdc112e10dc..26b075a7c61 100755
> --- a/gdb/configure
> +++ b/gdb/configure
> @@ -705,6 +705,9 @@ SYSTEM_GDBINIT
>   TARGET_SYSTEM_ROOT
>   CONFIG_LDFLAGS
>   RDYNAMIC
> +LTLIBOPENCSD_C_API
> +LIBOPENCSD_C_API
> +HAVE_LIBOPENCSD_C_API
>   LTLIBIPT
>   LIBIPT
>   HAVE_LIBIPT
> @@ -911,6 +914,9 @@ enable_source_highlight
>   with_intel_pt
>   with_libipt_prefix
>   with_libipt_type
> +with_arm_cs
> +with_libopencsd_c_api_prefix
> +with_libopencsd_c_api_type
>   with_sysroot
>   with_system_gdbinit
>   with_system_gdbinit_dir
> @@ -1660,6 +1666,15 @@ Optional Packages:
>     --with-libipt-prefix[=DIR]  search for libipt in DIR/include and DIR/lib
>     --without-libipt-prefix     don't search for libipt in includedir and libdir
>     --with-libipt-type=TYPE     type of library to search for (auto/static/shared)
> +  --with-arm-cs           include ARM CoreSight Processor Trace support
> +                          (auto/yes/no)
> +  --with-libopencsd_c_api-prefix[=DIR]  search for libopencsd_c_api in DIR/include and DIR/lib
> +  --without-libopencsd_c_api-prefix     don't search for libopencsd_c_api in includedir and libdir
> +  --with-libopencsd_c_api-type=TYPE     type of library to search for (auto/static/shared)
> +  --without-included-regex
> +                          don't use included regex; this is the default on
> +                          systems with version 2 of the GNU C library (use
> +                          with caution on other system)
>     --with-sysroot[=DIR]    search for usr/lib et al within DIR
>     --with-system-gdbinit=PATH
>                             automatically load a system-wide gdbinit file
> @@ -15238,6 +15253,540 @@ fi
>       fi
>     fi
>   
> +  # ARM CoreSight trace       #
> +
> +
> +# Check whether --with-arm_cs was given.
> +if test "${with_arm_cs+set}" = set; then :
> +  withval=$with_arm_cs;
> +else
> +  with_arm_cs=auto
> +fi
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use ARM CoreSight Processor Trace " >&5
> +$as_echo_n "checking whether to use ARM CoreSight Processor Trace ... " >&6; }
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_arm_cs" >&5
> +$as_echo "$with_arm_cs" >&6; }
> +
> +  if test "${with_arm_cs}" = no; then
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ARM CoreSight Processor Trace support disabled; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: ARM CoreSight Processor Trace support disabled; CoreSight Tracing will be unavailable." >&2;}
> +    HAVE_LIBOPENCSD=no
> +  else
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +  #include <linux/perf_event.h>
> +  #ifndef PERF_ATTR_SIZE_VER5
> +  # error
> +  #endif
> +
> +_ACEOF
> +if ac_fn_c_try_cpp "$LINENO"; then :
> +  perf_event=yes
> +else
> +  perf_event=no
> +fi
> +rm -f conftest.err conftest.i conftest.$ac_ext
> +    if test "$perf_event" != yes; then
> +      if test "$with_arm_cs" = yes; then
> +        as_fn_error $? "linux/perf_event.h missing or too old" "$LINENO" 5
> +      else
> +        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/perf_event.h missing or too old; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: linux/perf_event.h missing or too old; CoreSight Tracing will be unavailable." >&2;}
> +      fi
> +    fi
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libopencsd_c_api-prefix was given.
> +if test "${with_libopencsd_c_api_prefix+set}" = set; then :
> +  withval=$with_libopencsd_c_api_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +
> +# Check whether --with-libopencsd_c_api-type was given.
> +if test "${with_libopencsd_c_api_type+set}" = set; then :
> +  withval=$with_libopencsd_c_api_type;  with_libopencsd_c_api_type=$withval
> +else
> +   with_libopencsd_c_api_type=auto
> +fi
> +
> +  lib_type=`eval echo \$with_libopencsd_c_api_type`
> +
> +      LIBOPENCSD_C_API=
> +  LTLIBOPENCSD_C_API=
> +  INCOPENCSD_C_API=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='opencsd_c_api '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            elif test x$lib_type != xshared; then
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  elif test x$lib_type != xshared; then
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_a"
> +              else
> +                                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCOPENCSD_C_API="${INCOPENCSD_C_API}${INCOPENCSD_C_API:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$dep"
> +                    LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            if test "x$lib_type" = "xauto" || test "x$lib_type" = "xshared"; then
> +              LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l$name"
> +              LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-l$name"
> +            else
> +              LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l:lib$name.$libext"
> +              LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-l:lib$name.$libext"
> +            fi
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCOPENCSD_C_API; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libopencsd_c_api" >&5
> +$as_echo_n "checking for libopencsd_c_api... " >&6; }
> +if ${ac_cv_libopencsd_c_api+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBOPENCSD_C_API"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "opencsd/c_api/opencsd_c_api.h"
> +int
> +main ()
> +{
> +ocsd_get_version();
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libopencsd_c_api=yes
> +else
> +  ac_cv_libopencsd_c_api=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libopencsd_c_api" >&5
> +$as_echo "$ac_cv_libopencsd_c_api" >&6; }
> +  if test "$ac_cv_libopencsd_c_api" = yes; then
> +    HAVE_LIBOPENCSD_C_API=yes
> +
> +$as_echo "#define HAVE_LIBOPENCSD_C_API 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libopencsd_c_api" >&5
> +$as_echo_n "checking how to link with libopencsd_c_api... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBOPENCSD_C_API" >&5
> +$as_echo "$LIBOPENCSD_C_API" >&6; }
> +  else
> +    HAVE_LIBOPENCSD_C_API=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBOPENCSD_C_API=
> +    LTLIBOPENCSD_C_API=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBOPENCSD_C_API" != yes; then
> +      if test "$with_arm_cs" = yes; then
> +        as_fn_error $? "libopencsd_c_api is missing or unusable" "$LINENO" 5
> +      else
> +        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libopencsd_c_api is missing or unusable; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: libopencsd_c_api is missing or unusable; CoreSight Tracing will be unavailable." >&2;}
> +      fi
> +    else
> +      LIBS="$LIBS $LIBOPENCSD_C_API"
> +    fi
> +  fi
> +
> +
>   
>   $as_echo "#define _STRUCTURED_PROC 1" >>confdefs.h
>   
> diff --git a/gdb/configure.nat b/gdb/configure.nat
> index e34cccffd98..135041bd031 100644
> --- a/gdb/configure.nat
> +++ b/gdb/configure.nat
> @@ -235,7 +235,7 @@ case ${gdb_host} in
>   		#  Host: AArch64 based machine running GNU/Linux
>   		NATDEPFILES="${NATDEPFILES} aarch64-linux-nat.o \
>   		aarch32-linux-nat.o nat/aarch64-linux-hw-point.o \
> -		nat/aarch64-linux.o \
> +		nat/aarch64-linux.o nat/linux-btrace.o \
>   		nat/aarch64-sve-linux-ptrace.o \
>   		nat/aarch64-mte-linux-ptrace.o"
>   		;;
> @@ -246,7 +246,7 @@ case ${gdb_host} in
>   	    arm)
>   		# Host: ARM based machine running GNU/Linux
>   		NATDEPFILES="${NATDEPFILES} arm-linux-nat.o \
> -		aarch32-linux-nat.o"
> +		aarch32-linux-nat.o nat/linux-btrace.o"
>   		;;
>   	    i386)
>   		# Host: Intel 386 running GNU/Linux.
> diff --git a/gdb/top.c b/gdb/top.c
> index 6e0f43d2fd9..53f04ee29af 100644
> --- a/gdb/top.c
> +++ b/gdb/top.c
> @@ -1538,7 +1538,15 @@ This GDB was configured as follows:\n\
>   	     --without-intel-pt\n\
>   "));
>   #endif
> -
> +#if HAVE_LIBOPENCSD_C_API
> +    fprintf_filtered (stream, _("\
> +             --with-arm-cs\n\
> +"));
> +#else
> +    fprintf_filtered (stream, _("\
> +             --without-arm-cs\n\
> +"));
> +#endif
>   #if HAVE_LIBMPFR
>     fprintf_filtered (stream, _("\
>   	     --with-mpfr\n\
> diff --git a/gdbserver/config.in b/gdbserver/config.in
> index 611bfd7aa76..fbcdf896ef7 100644
> --- a/gdbserver/config.in
> +++ b/gdbserver/config.in
> @@ -139,6 +139,9 @@
>   /* Define if you have the ipt library. */
>   #undef HAVE_LIBIPT
>   
> +/* Define if you have the opencsd_c_api library. */
> +#undef HAVE_LIBOPENCSD_C_API
> +
>   /* Define if the target supports branch tracing. */
>   #undef HAVE_LINUX_BTRACE
>   
> diff --git a/gdbserver/configure b/gdbserver/configure
> index aab72c0b8c5..e8265116c8c 100755
> --- a/gdbserver/configure
> +++ b/gdbserver/configure
> @@ -656,6 +656,9 @@ am__leading_dot
>   host_noncanonical
>   target_noncanonical
>   WIN32APILIBS
> +LTLIBOPENCSD_C_API
> +LIBOPENCSD_C_API
> +HAVE_LIBOPENCSD_C_API
>   LTLIBIPT
>   LIBIPT
>   HAVE_LIBIPT
> @@ -751,6 +754,9 @@ with_gnu_ld
>   enable_rpath
>   with_libipt_prefix
>   with_libipt_type
> +with_arm_cs
> +with_libopencsd_c_api_prefix
> +with_libopencsd_c_api_type
>   enable_unit_tests
>   with_ust
>   with_ust_include
> @@ -1415,6 +1421,11 @@ Optional Packages:
>     --with-libipt-prefix[=DIR]  search for libipt in DIR/include and DIR/lib
>     --without-libipt-prefix     don't search for libipt in includedir and libdir
>     --with-libipt-type=TYPE     type of library to search for (auto/static/shared)
> +  --with-arm-cs           include ARM CoreSight Processor Trace support
> +                          (auto/yes/no)
> +  --with-libopencsd_c_api-prefix[=DIR]  search for libopencsd_c_api in DIR/include and DIR/lib
> +  --without-libopencsd_c_api-prefix     don't search for libopencsd_c_api in includedir and libdir
> +  --with-libopencsd_c_api-type=TYPE     type of library to search for (auto/static/shared)
>     --with-ust=PATH       Specify prefix directory for the installed UST package
>                             Equivalent to --with-ust-include=PATH/include
>                             plus --with-ust-lib=PATH/lib
> @@ -8549,6 +8560,540 @@ fi
>       fi
>     fi
>   
> +  # ARM CoreSight trace       #
> +
> +
> +# Check whether --with-arm_cs was given.
> +if test "${with_arm_cs+set}" = set; then :
> +  withval=$with_arm_cs;
> +else
> +  with_arm_cs=auto
> +fi
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use ARM CoreSight Processor Trace " >&5
> +$as_echo_n "checking whether to use ARM CoreSight Processor Trace ... " >&6; }
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_arm_cs" >&5
> +$as_echo "$with_arm_cs" >&6; }
> +
> +  if test "${with_arm_cs}" = no; then
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ARM CoreSight Processor Trace support disabled; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: ARM CoreSight Processor Trace support disabled; CoreSight Tracing will be unavailable." >&2;}
> +    HAVE_LIBOPENCSD=no
> +  else
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +  #include <linux/perf_event.h>
> +  #ifndef PERF_ATTR_SIZE_VER5
> +  # error
> +  #endif
> +
> +_ACEOF
> +if ac_fn_c_try_cpp "$LINENO"; then :
> +  perf_event=yes
> +else
> +  perf_event=no
> +fi
> +rm -f conftest.err conftest.i conftest.$ac_ext
> +    if test "$perf_event" != yes; then
> +      if test "$with_arm_cs" = yes; then
> +        as_fn_error $? "linux/perf_event.h missing or too old" "$LINENO" 5
> +      else
> +        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/perf_event.h missing or too old; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: linux/perf_event.h missing or too old; CoreSight Tracing will be unavailable." >&2;}
> +      fi
> +    fi
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libopencsd_c_api-prefix was given.
> +if test "${with_libopencsd_c_api_prefix+set}" = set; then :
> +  withval=$with_libopencsd_c_api_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +
> +# Check whether --with-libopencsd_c_api-type was given.
> +if test "${with_libopencsd_c_api_type+set}" = set; then :
> +  withval=$with_libopencsd_c_api_type;  with_libopencsd_c_api_type=$withval
> +else
> +   with_libopencsd_c_api_type=auto
> +fi
> +
> +  lib_type=`eval echo \$with_libopencsd_c_api_type`
> +
> +      LIBOPENCSD_C_API=
> +  LTLIBOPENCSD_C_API=
> +  INCOPENCSD_C_API=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='opencsd_c_api '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            elif test x$lib_type != xshared; then
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  elif test x$lib_type != xshared; then
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_a"
> +              else
> +                                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCOPENCSD_C_API="${INCOPENCSD_C_API}${INCOPENCSD_C_API:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$dep"
> +                    LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            if test "x$lib_type" = "xauto" || test "x$lib_type" = "xshared"; then
> +              LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l$name"
> +              LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-l$name"
> +            else
> +              LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l:lib$name.$libext"
> +              LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-l:lib$name.$libext"
> +            fi
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCOPENCSD_C_API; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libopencsd_c_api" >&5
> +$as_echo_n "checking for libopencsd_c_api... " >&6; }
> +if ${ac_cv_libopencsd_c_api+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBOPENCSD_C_API"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "opencsd/c_api/opencsd_c_api.h"
> +int
> +main ()
> +{
> +ocsd_get_version();
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libopencsd_c_api=yes
> +else
> +  ac_cv_libopencsd_c_api=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libopencsd_c_api" >&5
> +$as_echo "$ac_cv_libopencsd_c_api" >&6; }
> +  if test "$ac_cv_libopencsd_c_api" = yes; then
> +    HAVE_LIBOPENCSD_C_API=yes
> +
> +$as_echo "#define HAVE_LIBOPENCSD_C_API 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libopencsd_c_api" >&5
> +$as_echo_n "checking how to link with libopencsd_c_api... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBOPENCSD_C_API" >&5
> +$as_echo "$LIBOPENCSD_C_API" >&6; }
> +  else
> +    HAVE_LIBOPENCSD_C_API=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBOPENCSD_C_API=
> +    LTLIBOPENCSD_C_API=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBOPENCSD_C_API" != yes; then
> +      if test "$with_arm_cs" = yes; then
> +        as_fn_error $? "libopencsd_c_api is missing or unusable" "$LINENO" 5
> +      else
> +        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libopencsd_c_api is missing or unusable; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: libopencsd_c_api is missing or unusable; CoreSight Tracing will be unavailable." >&2;}
> +      fi
> +    else
> +      LIBS="$LIBS $LIBOPENCSD_C_API"
> +    fi
> +  fi
> +
> +
>   
>   $as_echo "#define _STRUCTURED_PROC 1" >>confdefs.h
>   
> diff --git a/gdbsupport/Makefile.in b/gdbsupport/Makefile.in
> index d7f2d4914b0..cdb7ba2f0ac 100644
> --- a/gdbsupport/Makefile.in
> +++ b/gdbsupport/Makefile.in
> @@ -250,6 +250,7 @@ GMSGFMT = @GMSGFMT@
>   GREP = @GREP@
>   HAVE_CXX11 = @HAVE_CXX11@
>   HAVE_LIBIPT = @HAVE_LIBIPT@
> +HAVE_LIBOPENCSD_C_API = @HAVE_LIBOPENCSD_C_API@
>   INCINTL = @INCINTL@
>   INSTALL = @INSTALL@
>   INSTALL_DATA = @INSTALL_DATA@
> @@ -263,9 +264,11 @@ LIBINTL = @LIBINTL@
>   LIBINTL_DEP = @LIBINTL_DEP@
>   LIBIPT = @LIBIPT@
>   LIBOBJS = @LIBOBJS@
> +LIBOPENCSD_C_API = @LIBOPENCSD_C_API@
>   LIBS = @LIBS@
>   LTLIBIPT = @LTLIBIPT@
>   LTLIBOBJS = @LTLIBOBJS@
> +LTLIBOPENCSD_C_API = @LTLIBOPENCSD_C_API@
>   MAINT = @MAINT@
>   MAKEINFO = @MAKEINFO@
>   MKDIR_P = @MKDIR_P@
> diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4
> index 2e709dbbdbb..856fb9bc31b 100644
> --- a/gdbsupport/common.m4
> +++ b/gdbsupport/common.m4
> @@ -163,6 +163,45 @@ AC_DEFUN([GDB_AC_COMMON], [
>       fi
>     fi
>   
> +  # ARM CoreSight trace       #
> +
> +  AC_ARG_WITH(arm_cs,
> +    AS_HELP_STRING([--with-arm-cs], [include ARM CoreSight Processor Trace support (auto/yes/no)]),
> +    [], [with_arm_cs=auto])
> +  AC_MSG_CHECKING([whether to use ARM CoreSight Processor Trace ])
> +  AC_MSG_RESULT([$with_arm_cs])
> +
> +  if test "${with_arm_cs}" = no; then
> +    AC_MSG_WARN([ARM CoreSight Processor Trace support disabled; CoreSight Tracing will be unavailable.])
> +    HAVE_LIBOPENCSD=no
> +  else
> +    AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
> +  #include <linux/perf_event.h>
> +  #ifndef PERF_ATTR_SIZE_VER5
> +  # error
> +  #endif
> +    ]])], [perf_event=yes], [perf_event=no])
> +    if test "$perf_event" != yes; then
> +      if test "$with_arm_cs" = yes; then
> +        AC_MSG_ERROR([linux/perf_event.h missing or too old])
> +      else
> +        AC_MSG_WARN([linux/perf_event.h missing or too old; CoreSight Tracing will be unavailable.])
> +      fi
> +    fi
> +
> +    AC_LIB_HAVE_LINKFLAGS([opencsd_c_api], [], [#include "opencsd/c_api/opencsd_c_api.h"], [ocsd_get_version();])
> +    if test "$HAVE_LIBOPENCSD_C_API" != yes; then
> +      if test "$with_arm_cs" = yes; then
> +        AC_MSG_ERROR([libopencsd_c_api is missing or unusable])
> +      else
> +        AC_MSG_WARN([libopencsd_c_api is missing or unusable; CoreSight Tracing will be unavailable.])
> +      fi
> +    else
> +      LIBS="$LIBS $LIBOPENCSD_C_API"
> +    fi
> +  fi
> +
> +
>     BFD_SYS_PROCFS_H
>     if test "$ac_cv_header_sys_procfs_h" = yes; then
>       BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
> diff --git a/gdbsupport/config.in b/gdbsupport/config.in
> index c44a2a1e5de..2259ada7fdb 100644
> --- a/gdbsupport/config.in
> +++ b/gdbsupport/config.in
> @@ -117,6 +117,9 @@
>   /* Define if you have the ipt library. */
>   #undef HAVE_LIBIPT
>   
> +/* Define if you have the opencsd_c_api library. */
> +#undef HAVE_LIBOPENCSD_C_API
> +
>   /* Define to 1 if you have the <linux/elf.h> header file. */
>   #undef HAVE_LINUX_ELF_H
>   
> diff --git a/gdbsupport/configure b/gdbsupport/configure
> index 60643c80b5a..08bc0e6a86d 100755
> --- a/gdbsupport/configure
> +++ b/gdbsupport/configure
> @@ -628,6 +628,9 @@ WERROR_CFLAGS
>   WARN_CFLAGS
>   SELFTEST_FALSE
>   SELFTEST_TRUE
> +LTLIBOPENCSD_C_API
> +LIBOPENCSD_C_API
> +HAVE_LIBOPENCSD_C_API
>   LTLIBIPT
>   LIBIPT
>   HAVE_LIBIPT
> @@ -772,6 +775,9 @@ with_gnu_ld
>   enable_rpath
>   with_libipt_prefix
>   with_libipt_type
> +with_arm_cs
> +with_libopencsd_c_api_prefix
> +with_libopencsd_c_api_type
>   enable_unit_tests
>   enable_werror
>   enable_build_warnings
> @@ -1436,6 +1442,11 @@ Optional Packages:
>     --with-libipt-prefix[=DIR]  search for libipt in DIR/include and DIR/lib
>     --without-libipt-prefix     don't search for libipt in includedir and libdir
>     --with-libipt-type=TYPE     type of library to search for (auto/static/shared)
> +  --with-arm-cs           include ARM CoreSight Processor Trace support
> +                          (auto/yes/no)
> +  --with-libopencsd_c_api-prefix[=DIR]  search for libopencsd_c_api in DIR/include and DIR/lib
> +  --without-libopencsd_c_api-prefix     don't search for libopencsd_c_api in includedir and libdir
> +  --with-libopencsd_c_api-type=TYPE     type of library to search for (auto/static/shared)
>   
>   Some influential environment variables:
>     CC          C compiler command
> @@ -9563,6 +9574,540 @@ fi
>       fi
>     fi
>   
> +  # ARM CoreSight trace       #
> +
> +
> +# Check whether --with-arm_cs was given.
> +if test "${with_arm_cs+set}" = set; then :
> +  withval=$with_arm_cs;
> +else
> +  with_arm_cs=auto
> +fi
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use ARM CoreSight Processor Trace " >&5
> +$as_echo_n "checking whether to use ARM CoreSight Processor Trace ... " >&6; }
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_arm_cs" >&5
> +$as_echo "$with_arm_cs" >&6; }
> +
> +  if test "${with_arm_cs}" = no; then
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ARM CoreSight Processor Trace support disabled; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: ARM CoreSight Processor Trace support disabled; CoreSight Tracing will be unavailable." >&2;}
> +    HAVE_LIBOPENCSD=no
> +  else
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +
> +  #include <linux/perf_event.h>
> +  #ifndef PERF_ATTR_SIZE_VER5
> +  # error
> +  #endif
> +
> +_ACEOF
> +if ac_fn_c_try_cpp "$LINENO"; then :
> +  perf_event=yes
> +else
> +  perf_event=no
> +fi
> +rm -f conftest.err conftest.i conftest.$ac_ext
> +    if test "$perf_event" != yes; then
> +      if test "$with_arm_cs" = yes; then
> +        as_fn_error $? "linux/perf_event.h missing or too old" "$LINENO" 5
> +      else
> +        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: linux/perf_event.h missing or too old; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: linux/perf_event.h missing or too old; CoreSight Tracing will be unavailable." >&2;}
> +      fi
> +    fi
> +
> +
> +
> +
> +
> +
> +
> +
> +
> +    use_additional=yes
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +    eval additional_includedir=\"$includedir\"
> +    eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +
> +# Check whether --with-libopencsd_c_api-prefix was given.
> +if test "${with_libopencsd_c_api_prefix+set}" = set; then :
> +  withval=$with_libopencsd_c_api_prefix;
> +    if test "X$withval" = "Xno"; then
> +      use_additional=no
> +    else
> +      if test "X$withval" = "X"; then
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +
> +          eval additional_includedir=\"$includedir\"
> +          eval additional_libdir=\"$libdir\"
> +
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      else
> +        additional_includedir="$withval/include"
> +        additional_libdir="$withval/lib"
> +      fi
> +    fi
> +
> +fi
> +
> +
> +# Check whether --with-libopencsd_c_api-type was given.
> +if test "${with_libopencsd_c_api_type+set}" = set; then :
> +  withval=$with_libopencsd_c_api_type;  with_libopencsd_c_api_type=$withval
> +else
> +   with_libopencsd_c_api_type=auto
> +fi
> +
> +  lib_type=`eval echo \$with_libopencsd_c_api_type`
> +
> +      LIBOPENCSD_C_API=
> +  LTLIBOPENCSD_C_API=
> +  INCOPENCSD_C_API=
> +  rpathdirs=
> +  ltrpathdirs=
> +  names_already_handled=
> +  names_next_round='opencsd_c_api '
> +  while test -n "$names_next_round"; do
> +    names_this_round="$names_next_round"
> +    names_next_round=
> +    for name in $names_this_round; do
> +      already_handled=
> +      for n in $names_already_handled; do
> +        if test "$n" = "$name"; then
> +          already_handled=yes
> +          break
> +        fi
> +      done
> +      if test -z "$already_handled"; then
> +        names_already_handled="$names_already_handled $name"
> +                        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
> +        eval value=\"\$HAVE_LIB$uppername\"
> +        if test -n "$value"; then
> +          if test "$value" = yes; then
> +            eval value=\"\$LIB$uppername\"
> +            test -z "$value" || LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$value"
> +            eval value=\"\$LTLIB$uppername\"
> +            test -z "$value" || LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }$value"
> +          else
> +                                    :
> +          fi
> +        else
> +                              found_dir=
> +          found_la=
> +          found_so=
> +          found_a=
> +          if test $use_additional = yes; then
> +            if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext" && test x$lib_type != xstatic; then
> +              found_dir="$additional_libdir"
> +              found_so="$additional_libdir/lib$name.$shlibext"
> +              if test -f "$additional_libdir/lib$name.la"; then
> +                found_la="$additional_libdir/lib$name.la"
> +              fi
> +            elif test x$lib_type != xshared; then
> +              if test -f "$additional_libdir/lib$name.$libext"; then
> +                found_dir="$additional_libdir"
> +                found_a="$additional_libdir/lib$name.$libext"
> +                if test -f "$additional_libdir/lib$name.la"; then
> +                  found_la="$additional_libdir/lib$name.la"
> +                fi
> +              fi
> +            fi
> +          fi
> +          if test "X$found_dir" = "X"; then
> +            for x in $LDFLAGS $LTLIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +              case "$x" in
> +                -L*)
> +                  dir=`echo "X$x" | sed -e 's/^X-L//'`
> +                  if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext" && test x$lib_type != xstatic; then
> +                    found_dir="$dir"
> +                    found_so="$dir/lib$name.$shlibext"
> +                    if test -f "$dir/lib$name.la"; then
> +                      found_la="$dir/lib$name.la"
> +                    fi
> +                  elif test x$lib_type != xshared; then
> +                    if test -f "$dir/lib$name.$libext"; then
> +                      found_dir="$dir"
> +                      found_a="$dir/lib$name.$libext"
> +                      if test -f "$dir/lib$name.la"; then
> +                        found_la="$dir/lib$name.la"
> +                      fi
> +                    fi
> +                  fi
> +                  ;;
> +              esac
> +              if test "X$found_dir" != "X"; then
> +                break
> +              fi
> +            done
> +          fi
> +          if test "X$found_dir" != "X"; then
> +                        LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-L$found_dir -l$name"
> +            if test "X$found_so" != "X"; then
> +                                                        if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
> +                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +              else
> +                                                                                haveit=
> +                for x in $ltrpathdirs; do
> +                  if test "X$x" = "X$found_dir"; then
> +                    haveit=yes
> +                    break
> +                  fi
> +                done
> +                if test -z "$haveit"; then
> +                  ltrpathdirs="$ltrpathdirs $found_dir"
> +                fi
> +                                if test "$hardcode_direct" = yes; then
> +                                                      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                else
> +                  if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
> +                                                            LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                                                            haveit=
> +                    for x in $rpathdirs; do
> +                      if test "X$x" = "X$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      rpathdirs="$rpathdirs $found_dir"
> +                    fi
> +                  else
> +                                                                                haveit=
> +                    for x in $LDFLAGS $LIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                      if test "X$x" = "X-L$found_dir"; then
> +                        haveit=yes
> +                        break
> +                      fi
> +                    done
> +                    if test -z "$haveit"; then
> +                      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$found_dir"
> +                    fi
> +                    if test "$hardcode_minus_L" != no; then
> +                                                                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_so"
> +                    else
> +                                                                                                                                                                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l$name"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            else
> +              if test "X$found_a" != "X"; then
> +                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$found_a"
> +              else
> +                                                LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$found_dir -l$name"
> +              fi
> +            fi
> +                        additional_includedir=
> +            case "$found_dir" in
> +              */lib | */lib/)
> +                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
> +                additional_includedir="$basedir/include"
> +                ;;
> +            esac
> +            if test "X$additional_includedir" != "X"; then
> +                                                                                                                if test "X$additional_includedir" != "X/usr/include"; then
> +                haveit=
> +                if test "X$additional_includedir" = "X/usr/local/include"; then
> +                  if test -n "$GCC"; then
> +                    case $host_os in
> +                      linux*) haveit=yes;;
> +                    esac
> +                  fi
> +                fi
> +                if test -z "$haveit"; then
> +                  for x in $CPPFLAGS $INCOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                    if test "X$x" = "X-I$additional_includedir"; then
> +                      haveit=yes
> +                      break
> +                    fi
> +                  done
> +                  if test -z "$haveit"; then
> +                    if test -d "$additional_includedir"; then
> +                                            INCOPENCSD_C_API="${INCOPENCSD_C_API}${INCOPENCSD_C_API:+ }-I$additional_includedir"
> +                    fi
> +                  fi
> +                fi
> +              fi
> +            fi
> +                        if test -n "$found_la"; then
> +                                                        save_libdir="$libdir"
> +              case "$found_la" in
> +                */* | *\\*) . "$found_la" ;;
> +                *) . "./$found_la" ;;
> +              esac
> +              libdir="$save_libdir"
> +                            for dep in $dependency_libs; do
> +                case "$dep" in
> +                  -L*)
> +                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
> +                                                                                                                                                                if test "X$additional_libdir" != "X/usr/lib"; then
> +                      haveit=
> +                      if test "X$additional_libdir" = "X/usr/local/lib"; then
> +                        if test -n "$GCC"; then
> +                          case $host_os in
> +                            linux*) haveit=yes;;
> +                          esac
> +                        fi
> +                      fi
> +                      if test -z "$haveit"; then
> +                        haveit=
> +                        for x in $LDFLAGS $LIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                        haveit=
> +                        for x in $LDFLAGS $LTLIBOPENCSD_C_API; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +                          if test "X$x" = "X-L$additional_libdir"; then
> +                            haveit=yes
> +                            break
> +                          fi
> +                        done
> +                        if test -z "$haveit"; then
> +                          if test -d "$additional_libdir"; then
> +                                                        LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-L$additional_libdir"
> +                          fi
> +                        fi
> +                      fi
> +                    fi
> +                    ;;
> +                  -R*)
> +                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
> +                    if test "$enable_rpath" != no; then
> +                                                                  haveit=
> +                      for x in $rpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        rpathdirs="$rpathdirs $dir"
> +                      fi
> +                                                                  haveit=
> +                      for x in $ltrpathdirs; do
> +                        if test "X$x" = "X$dir"; then
> +                          haveit=yes
> +                          break
> +                        fi
> +                      done
> +                      if test -z "$haveit"; then
> +                        ltrpathdirs="$ltrpathdirs $dir"
> +                      fi
> +                    fi
> +                    ;;
> +                  -l*)
> +                                        names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
> +                    ;;
> +                  *.la)
> +                                                                                names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
> +                    ;;
> +                  *)
> +                                        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$dep"
> +                    LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }$dep"
> +                    ;;
> +                esac
> +              done
> +            fi
> +          else
> +                                                            if test "x$lib_type" = "xauto" || test "x$lib_type" = "xshared"; then
> +              LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l$name"
> +              LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-l$name"
> +            else
> +              LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }-l:lib$name.$libext"
> +              LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-l:lib$name.$libext"
> +            fi
> +          fi
> +        fi
> +      fi
> +    done
> +  done
> +  if test "X$rpathdirs" != "X"; then
> +    if test -n "$hardcode_libdir_separator"; then
> +                        alldirs=
> +      for found_dir in $rpathdirs; do
> +        alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
> +      done
> +            acl_save_libdir="$libdir"
> +      libdir="$alldirs"
> +      eval flag=\"$hardcode_libdir_flag_spec\"
> +      libdir="$acl_save_libdir"
> +      LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$flag"
> +    else
> +            for found_dir in $rpathdirs; do
> +        acl_save_libdir="$libdir"
> +        libdir="$found_dir"
> +        eval flag=\"$hardcode_libdir_flag_spec\"
> +        libdir="$acl_save_libdir"
> +        LIBOPENCSD_C_API="${LIBOPENCSD_C_API}${LIBOPENCSD_C_API:+ }$flag"
> +      done
> +    fi
> +  fi
> +  if test "X$ltrpathdirs" != "X"; then
> +            for found_dir in $ltrpathdirs; do
> +      LTLIBOPENCSD_C_API="${LTLIBOPENCSD_C_API}${LTLIBOPENCSD_C_API:+ }-R$found_dir"
> +    done
> +  fi
> +
> +
> +        ac_save_CPPFLAGS="$CPPFLAGS"
> +
> +  for element in $INCOPENCSD_C_API; do
> +    haveit=
> +    for x in $CPPFLAGS; do
> +
> +  acl_save_prefix="$prefix"
> +  prefix="$acl_final_prefix"
> +  acl_save_exec_prefix="$exec_prefix"
> +  exec_prefix="$acl_final_exec_prefix"
> +  eval x=\"$x\"
> +  exec_prefix="$acl_save_exec_prefix"
> +  prefix="$acl_save_prefix"
> +
> +      if test "X$x" = "X$element"; then
> +        haveit=yes
> +        break
> +      fi
> +    done
> +    if test -z "$haveit"; then
> +      CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element"
> +    fi
> +  done
> +
> +
> +  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libopencsd_c_api" >&5
> +$as_echo_n "checking for libopencsd_c_api... " >&6; }
> +if ${ac_cv_libopencsd_c_api+:} false; then :
> +  $as_echo_n "(cached) " >&6
> +else
> +
> +    ac_save_LIBS="$LIBS"
> +    LIBS="$LIBS $LIBOPENCSD_C_API"
> +    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
> +/* end confdefs.h.  */
> +#include "opencsd/c_api/opencsd_c_api.h"
> +int
> +main ()
> +{
> +ocsd_get_version();
> +  ;
> +  return 0;
> +}
> +_ACEOF
> +if ac_fn_c_try_link "$LINENO"; then :
> +  ac_cv_libopencsd_c_api=yes
> +else
> +  ac_cv_libopencsd_c_api=no
> +fi
> +rm -f core conftest.err conftest.$ac_objext \
> +    conftest$ac_exeext conftest.$ac_ext
> +    LIBS="$ac_save_LIBS"
> +
> +fi
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_libopencsd_c_api" >&5
> +$as_echo "$ac_cv_libopencsd_c_api" >&6; }
> +  if test "$ac_cv_libopencsd_c_api" = yes; then
> +    HAVE_LIBOPENCSD_C_API=yes
> +
> +$as_echo "#define HAVE_LIBOPENCSD_C_API 1" >>confdefs.h
> +
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libopencsd_c_api" >&5
> +$as_echo_n "checking how to link with libopencsd_c_api... " >&6; }
> +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBOPENCSD_C_API" >&5
> +$as_echo "$LIBOPENCSD_C_API" >&6; }
> +  else
> +    HAVE_LIBOPENCSD_C_API=no
> +            CPPFLAGS="$ac_save_CPPFLAGS"
> +    LIBOPENCSD_C_API=
> +    LTLIBOPENCSD_C_API=
> +  fi
> +
> +
> +
> +
> +
> +
> +    if test "$HAVE_LIBOPENCSD_C_API" != yes; then
> +      if test "$with_arm_cs" = yes; then
> +        as_fn_error $? "libopencsd_c_api is missing or unusable" "$LINENO" 5
> +      else
> +        { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libopencsd_c_api is missing or unusable; CoreSight Tracing will be unavailable." >&5
> +$as_echo "$as_me: WARNING: libopencsd_c_api is missing or unusable; CoreSight Tracing will be unavailable." >&2;}
> +      fi
> +    else
> +      LIBS="$LIBS $LIBOPENCSD_C_API"
> +    fi
> +  fi
> +
> +
>   
>   $as_echo "#define _STRUCTURED_PROC 1" >>confdefs.h
>   
> 

Odd formatting aside (some deeply-indented lines), I have no further 
comments on this one.

  reply	other threads:[~2021-06-30 12:17 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 21:33 [PATCH v6 0/7] extend branch tracing to use ARM CoreSight traces Zied Guermazi
2021-05-31 21:33 ` [PATCH v6 1/7] configure gdb build system for supporting btrace on arm processors Zied Guermazi
2021-06-30 12:17   ` Luis Machado [this message]
2021-05-31 21:33 ` [PATCH v6 2/7] add btrace coresight related commands Zied Guermazi
2021-06-01 12:07   ` Eli Zaretskii
2021-06-01 15:47     ` Zied Guermazi
2021-06-30 12:26   ` Luis Machado
2021-05-31 21:33 ` [PATCH v6 3/7] start/stop btrace with coresight etm and parse etm buffer. nat independant Zied Guermazi
2021-06-22 14:59   ` Metzger, Markus T
2022-04-07 16:33     ` Zied Guermazi
2022-04-13  7:00       ` Metzger, Markus T
2022-05-10 12:58         ` Zied Guermazi
2022-05-10 13:21           ` Metzger, Markus T
2021-06-30 12:54   ` Luis Machado
2021-05-31 21:33 ` [PATCH v6 4/7] start/stop btrace with coresight etm and collect etm buffer on linux os Zied Guermazi
2021-06-23  8:00   ` Metzger, Markus T
2022-05-12 22:52     ` Zied Guermazi
2022-05-13  5:31       ` Metzger, Markus T
2022-06-12 21:02         ` Zied Guermazi
2022-06-20 12:52           ` Metzger, Markus T
2022-07-18 19:06             ` Zied Guermazi
2022-07-19  5:04               ` Metzger, Markus T
2022-07-21 22:20                 ` Zied Guermazi
2022-07-25 14:33                   ` Metzger, Markus T
2021-06-30 13:24   ` Luis Machado
2021-05-31 21:33 ` [PATCH v6 5/7] fix issue: gdb hangs in the command following a commad returning with TARGET_WAITKIND_NO_HISTORY Zied Guermazi
2021-06-23  8:08   ` Metzger, Markus T
2021-05-31 21:33 ` [PATCH v6 6/7] add support for coresight btrace via remote protocol Zied Guermazi
2021-06-01 12:08   ` Eli Zaretskii
2021-06-23 10:59   ` Metzger, Markus T
2021-05-31 21:33 ` [PATCH v6 7/7] adapt btrace testcases for arm target Zied Guermazi
2021-06-22 21:28   ` Lancelot SIX
2021-06-23 14:16   ` Metzger, Markus T
2022-05-13 11:08   ` Richard Earnshaw
2022-05-17  9:44     ` Zied Guermazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=448c6382-69e5-db36-20c4-242e669ccee7@linaro.org \
    --to=luis.machado@linaro.org \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@intel.com \
    --cc=zied.guermazi@trande.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).