Re: [PATCH v3] gdb/riscv: Add record support for rv64gc instructions

Guinevere Larsen
2024-12-13T18:11:55Z

Sorry about the delay reviewing, this escaped my notice when it first
came to the list.

On 12/3/24 3:30 PM, Timur wrote:
> This commit adds record full support for rv64gc instrcution.
>
> It includes changes to the following files:
> - gdb/riscv-linux-tdep.c, gdb/riscv-linux-tdep.h: adds facilities to record
> syscalls.
> - gdb/riscv-tdep.c, gdb/riscv-tdep.h: adds facilities to record execution of
> rv64gc instructions.
> - gdb/configure.tgt: adds new files for compilation.
> - gdb/testsuite/lib/gdb.exp: enables testing of full record mode for RISC-V
> targets.
> - gdb/syscalls/riscv-canonicalize-syscall-gen.py: a script to generate function
> that canonicalizes RISC-V syscall. This script can simply support for syscalls
> on rv32 system. To use this script you need to pass a path to a file with
One small nit, but I would word it as "This script can simplify support
for syscalls on rv32 and rv64 systems". The current wording sounds to me
like the script is only for rv32, which I know isn't the case.
> syscalls description from riscv-glibc (example is in the help message). The
> script produces a mapping from syscall names to gdb_syscall enum.
> - gdb/riscv-canonicalize-syscall.c: the file generated by the previous script.
The GDB style for commit message is more free form text, instead of a
changelog. However, this change is simple enough that I think this
should be fine.
>
> Timur Golubovich timurgol007@gmail.com
>
> Hi!
>
>>>> + switch (syscall)
>>>> + {
>>>> + case 0: // #define __NR_io_setup 0
>>>>
>>>> All comments should be in the form /* */, rather than //
>>>>
>>>> I would also prefer if this followed what other architectures do,
>>>> defining an enum to relate syscall numbers in a RISCV system to their
>>>> names, and then this function returning the gdb_sys enum numbers,
>>>> however I don't expect to be working on RISCV in the near future, so
>>>> feel free to ignore this comment if the other RISCV maintainers are ok
>>>> with this style. This would make it so no #define comment is necessary
>>> Decided to make a script generating function that canonicalizes RISC-V syscall.
>>> This solution will simplify adding record support for rv32 system. I also left
>>> place for corner cases in generating script as they always may exist. Also
>>> removed this #define comment from generating script.
>> I see. This makes sense.
>>
>> I would like to see this explanation on the commit message, so that it
>> is recorded why Risc-V works different to all other arches.
> Could you please double-check the commit message? I tried to make it more
> detailed. Do you think I need to provide additional information?
>
>>>> +
>>>> + if (m_length == 2)
>>>> + return record_insn_len2 (ival, regcache, gdbarch);
>>>> +
>>>> + /* 6 bytes or more. If the instruction is longer than 8 bytes, we don't
>>>> +have full instruction bits in ival. At least, such long instructions
>>>> +are not defined yet, so just ignore it. */
>>>> Again, the indentation here is incorrect. Lines should start in the same column as the number 6.
>>> Addressed
>>>
>>> Best wishes,
>>> Timur Golubovich
>>>
>>> Timur Golubovich timurgol007@gmail.com
>> As I mentioned in the first review, please add some commit message
>> explaining a bit of what your patch is doing. I would recommend
>> explaining the inspiration for how riscv-tdep handles the recording (I
>> guess aarch64) and why you changed it; plus explaining the idea behind
>> the python script.c
> Added this information to the commit message.
>
>>> /* The following value is derived from __NR_rt_sigreturn in
>>> <include/uapi/asm-generic/unistd.h> from the Linux source tree. */
>>> @@ -173,6 +178,250 @@ riscv_linux_syscall_next_pc (const frame_info_ptr &frame)
>>> return pc + 4 /* Length of the ECALL insn. */;
>>> }
>>>
>>> +/* RISC-V process record-replay constructs: syscall, signal etc. */
>>> +
>>> +static linux_record_tdep riscv_linux_record_tdep;
>>> +
>>> +/* Record all registers but PC register for process-record. */
>>> +
>>> +using regnum_type = int;
>>> +
>>> +static bool
>>> +save_registers (struct regcache *regcache, regnum_type fir, regnum_type last)
>> Please fully type the variable names (fir -> first). Even if this makes
>> you need to use multiple lines for the function, I think this makes the
>> function easier to understand in the future.
>>
>> Sorry about not mentioning this before, I missed it in my first pass.
> Addressed
>
>>> + if (syscall_gdb == gdb_sys_sigreturn || syscall_gdb == gdb_sys_rt_sigreturn)
>>> + {
>>> + if (!riscv_all_but_pc_registers_record (regcache))
>>> + return -1;
>>> + return 0;
>>> + }
>>> +
>>> + auto ret = record_linux_system_call (syscall_gdb, regcache,
>>> + &riscv_linux_record_tdep);
>>> + if (ret != 0)
>>> + return ret;
>>> +
>>> + /* Record the return value of the system call. */
>>> + if (record_full_arch_list_add_reg (regcache, RISCV_A0_REGNUM))
>>> + return -1;
>>> +
>>> + return 0;
>>> +}
>>> +
>>> +/* Initialize the riscv64_linux_record_tdep. */
>>> +/* These values are the size of the type that will be used in a system
>>> + call. They are obtained from Linux Kernel source. */
>>> +static void
>>> +riscv64_linux_record_tdep_init (
>>> + struct gdbarch *gdbarch, struct linux_record_tdep &riscv_linux_record_tdep)
>> Oops, also missed this one on the first pass.
>>
>> The preferred way to do multi-line arguments is:
>>
>> static void
>> riscv64_linux_record_tdep_init (struct gdbarch *gdbarch,
>> struct
>> linux_record_tdep &riscv_linux_record_tdep)
>> {
>>
>> (with the "struct" keywords being aligned)
> Addressed
>
>>> + {
>>> + gdb_assert (regcache);
>>> +
>>> + if (!try_read (regcache, reg, addr))
>>> + {
>>> + return set_error ();
>>> + }
>>> + return true;
>>> + }
>>> +
>>> + bool
>>> + save_reg (regnum_type regnum) noexcept
>>> + {
>>> + try
>>> + {
>>> + m_regs.emplace_back (regnum);
>> Similar to my thoughts on Loongarch, I don't think this approach is the
>> best.
>>
>> In short, recording is already considered very slow. The strategy this
>> patch uses is to first collect all the data to be recorded (which
>> demands dynamic allocations to std::vector), and then call
>> record_full_arch_list_add_reg or record_full_arch_list_add_mem, which
>> will do their own dynamic allocations. This seems wasteful to me.
>>
>> I believe it would be better if, instead, the save_reg and save_mem
>> methods would directly call the correct record_full_arch_list_add
>> function, so that only one allocation is needed per unit of data that
>> needs recording.
>>
>> Since aarch64 already uses the strategy in this patch I won't block
>> merging based on this feedback, if you're set on this idea, but I think
>> direct calls would be better.
> I think that this overhead is negligeble, since the number of allocation
> because most instructions affect only 1 register. Moreover, I feel that the
> suggested approach simplifies error handling, since I can decouple decoding
> procedure from the actual error detection. If you don't mind, I would suggest
> to leave it as it is.
>
>>> + if (is_ebreak_insn (ival))
>>> + {
>>> + m_record_type = record_type::EBREAK;
>>> + return true;
>>> + }
>>> +
>>> + if (try_save_pc (ival) || try_save_pc_rd (ival) || try_save_pc_fprd (ival)
>>> + || try_save_pc_rd_csr (ival) || try_save_pc_mem (ival, regcache)
>>> + || try_save_pc_rd_mem (ival, regcache)
>>> + || try_save_pc_rs2_rd_mem (ival, regcache))
>>> + {
>>> + return !has_error ();
>>> + }
>> Minor nit, but I noticed around here that this (and some lines later,
>> maybe some before) don't need the braces.
> Addressed
>
>>> + if (!try_read (regcache, RISCV_A7_REGNUM, reg_val))
>>> + {
>>> + return -1;
>>> + }
>>> + return tdep->riscv_syscall_record (regcache, reg_val);
>>> + }
>>> +
>>> + case riscv_recorded_insn::record_type::EBREAK:
>>> + break;
>>> +
>>> + default:
>>> + return -1;
>>> + }
>>> + return 0;
>>> +}
>>> +
>>> +int
>>> +riscv_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
>>> + CORE_ADDR addr)
>>> +{
>>> + gdb_assert (gdbarch && regcache);
>> null pointer checks should be explicit, ie, gdb_assert (gdbarch !=
>> nullptr && regcache != nullptr)
> Addressed.
>
> Best wishes,
> Timur Golubovich
>
> ---
> gdb/config.lt | 1484 ++++++++++++++++++++++++++
> gdb/riscv-canonicalize-syscall-gen.c | 338 ++++++
> gdb/riscv-linux-tdep.c | 22 +-
> gdb/riscv-tdep.c | 141 +--
> 4 files changed, 1888 insertions(+), 97 deletions(-)
> create mode 100755 gdb/config.lt
> create mode 100644 gdb/riscv-canonicalize-syscall-gen.c
Are you sure you sent the correct diff? A couple files are missing
(riscv-linux-tdep.h, configure.tgt, gdb.exp and
riscv-canonicalize-syscall.c), and there's no mention of config.lt in
the commit message.

--
Cheers,
Guinevere Larsen
She/Her/Hers

>
> diff --git a/gdb/config.lt b/gdb/config.lt
> new file mode 100755
> index 00000000000..96851a9bfaf
> --- /dev/null
> +++ b/gdb/config.lt
> @@ -0,0 +1,1484 @@
> +#! /bin/bash
> +# Generated by configure.
> +# Run this file to recreate a libtool stub with the current configuration.
> +SHELL=${CONFIG_SHELL-/bin/bash}
> +export SHELL
> +## -------------------- ##
> +## M4sh Initialization. ##
> +## -------------------- ##
> +
> +# Be more Bourne compatible
> +DUALCASE=1; export DUALCASE # for MKS sh
> +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
> + emulate sh
> + NULLCMD=:
> + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
> + # is contrary to our usage. Disable this feature.
> + alias -g '${1+"$@"}'='"$@"'
> + setopt NO_GLOB_SUBST
> +else
> + case `(set -o) 2>/dev/null` in #(
> + *posix*) :
> + set -o posix ;; #(
> + *) :
> + ;;
> +esac
> +fi
> +
> +
> +as_nl='
> +'
> +export as_nl
> +# Printing a long string crashes Solaris 7 /usr/bin/printf.
> +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
> +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
> +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
> +# Prefer a ksh shell builtin over an external printf program on Solaris,
> +# but without wasting forks for bash or zsh.
> +if test -z "$BASH_VERSION$ZSH_VERSION" \
> + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
> + as_echo='print -r --'
> + as_echo_n='print -rn --'
> +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
> + as_echo='printf %s\n'
> + as_echo_n='printf %s'
> +else
> + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
> + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
> + as_echo_n='/usr/ucb/echo -n'
> + else
> + as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
> + as_echo_n_body='eval
> + arg=$1;
> + case $arg in #(
> + *"$as_nl"*)
> + expr "X$arg" : "X\\(.*\\)$as_nl";
> + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
> + esac;
> + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
> + '
> + export as_echo_n_body
> + as_echo_n='sh -c $as_echo_n_body as_echo'
> + fi
> + export as_echo_body
> + as_echo='sh -c $as_echo_body as_echo'
> +fi
> +
> +# The user is always right.
> +if test "${PATH_SEPARATOR+set}" != set; then
> + PATH_SEPARATOR=:
> + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
> + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
> + PATH_SEPARATOR=';'
> + }
> +fi
> +
> +
> +# IFS
> +# We need space, tab and new line, in precisely that order. Quoting is
> +# there to prevent editors from complaining about space-tab.
> +# (If _AS_PATH_WALK were called with IFS unset, it would disable word
> +# splitting by setting IFS to empty value.)
> +IFS=" "" $as_nl"
> +
> +# Find who we are. Look in the path if we contain no directory separator.
> +as_myself=
> +case $0 in #((
> + *[\\/]* ) as_myself=$0 ;;
> + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
> +for as_dir in $PATH
> +do
> + IFS=$as_save_IFS
> + test -z "$as_dir" && as_dir=.
> + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
> + done
> +IFS=$as_save_IFS
> +
> + ;;
> +esac
> +# We did not find ourselves, most probably we were run as `sh COMMAND'
> +# in which case we are not to be found in the path.
> +if test "x$as_myself" = x; then
> + as_myself=$0
> +fi
> +if test ! -f "$as_myself"; then
> + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
> + exit 1
> +fi
> +
> +# Unset variables that we do not need and which cause bugs (e.g. in
> +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
> +# suppresses any "Segmentation fault" message there. '((' could
> +# trigger a bug in pdksh 5.2.14.
> +for as_var in BASH_ENV ENV MAIL MAILPATH
> +do eval test x\${$as_var+set} = xset \
> + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
> +done
> +PS1='$ '
> +PS2='> '
> +PS4='+ '
> +
> +# NLS nuisances.
> +LC_ALL=C
> +export LC_ALL
> +LANGUAGE=C
> +export LANGUAGE
> +
> +# CDPATH.
> +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
> +
> +
> +# as_fn_error STATUS ERROR [LINENO LOG_FD]
> +# ----------------------------------------
> +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
> +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
> +# script with STATUS, using 1 if that was 0.
> +as_fn_error ()
> +{
> + as_status=$1; test $as_status -eq 0 && as_status=1
> + if test "$4"; then
> + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
> + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
> + fi
> + $as_echo "$as_me: error: $2" >&2
> + as_fn_exit $as_status
> +} # as_fn_error
> +
> +
> +# as_fn_set_status STATUS
> +# -----------------------
> +# Set $? to STATUS, without forking.
> +as_fn_set_status ()
> +{
> + return $1
> +} # as_fn_set_status
> +
> +# as_fn_exit STATUS
> +# -----------------
> +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
> +as_fn_exit ()
> +{
> + set +e
> + as_fn_set_status $1
> + exit $1
> +} # as_fn_exit
> +
> +# as_fn_unset VAR
> +# ---------------
> +# Portably unset VAR.
> +as_fn_unset ()
> +{
> + { eval $1=; unset $1;}
> +}
> +as_unset=as_fn_unset
> +# as_fn_append VAR VALUE
> +# ----------------------
> +# Append the text in VALUE to the end of the definition contained in VAR. Take
> +# advantage of any shell optimizations that allow amortized linear growth over
> +# repeated appends, instead of the typical quadratic growth present in naive
> +# implementations.
> +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
> + eval 'as_fn_append ()
> + {
> + eval $1+=\$2
> + }'
> +else
> + as_fn_append ()
> + {
> + eval $1=\$$1\$2
> + }
> +fi # as_fn_append
> +
> +# as_fn_arith ARG...
> +# ------------------
> +# Perform arithmetic evaluation on the ARGs, and store the result in the
> +# global $as_val. Take advantage of shells that can avoid forks. The arguments
> +# must be portable across $(()) and expr.
> +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
> + eval 'as_fn_arith ()
> + {
> + as_val=$(( $* ))
> + }'
> +else
> + as_fn_arith ()
> + {
> + as_val=`expr "$@" || test $? -eq 1`
> + }
> +fi # as_fn_arith
> +
> +
> +if expr a : '\(a\)' >/dev/null 2>&1 &&
> + test "X`expr 00001 : '.*\(...\)'`" = X001; then
> + as_expr=expr
> +else
> + as_expr=false
> +fi
> +
> +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
> + as_basename=basename
> +else
> + as_basename=false
> +fi
> +
> +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
> + as_dirname=dirname
> +else
> + as_dirname=false
> +fi
> +
> +as_me=`$as_basename -- "$0" ||
> +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
> + X"$0" : 'X\(//\)$' \| \
> + X"$0" : 'X\(/\)' \| . 2>/dev/null ||
> +$as_echo X/"$0" |
> + sed '/^.*\/\([^/][^/]*\)\/*$/{
> + s//\1/
> + q
> + }
> + /^X\/\(\/\/\)$/{
> + s//\1/
> + q
> + }
> + /^X\/\(\/\).*/{
> + s//\1/
> + q
> + }
> + s/.*/./; q'`
> +
> +# Avoid depending upon Character Ranges.
> +as_cr_letters='abcdefghijklmnopqrstuvwxyz'
> +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
> +as_cr_Letters=$as_cr_letters$as_cr_LETTERS
> +as_cr_digits='0123456789'
> +as_cr_alnum=$as_cr_Letters$as_cr_digits
> +
> +ECHO_C= ECHO_N= ECHO_T=
> +case `echo -n x` in #(((((
> +-n*)
> + case `echo 'xy\c'` in
> + *c*) ECHO_T=' ';; # ECHO_T is single tab character.
> + xy) ECHO_C='\c';;
> + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
> + ECHO_T=' ';;
> + esac;;
> +*)
> + ECHO_N='-n';;
> +esac
> +
> +rm -f conf$$ conf$$.exe conf$$.file
> +if test -d conf$$.dir; then
> + rm -f conf$$.dir/conf$$.file
> +else
> + rm -f conf$$.dir
> + mkdir conf$$.dir 2>/dev/null
> +fi
> +if (echo >conf$$.file) 2>/dev/null; then
> + if ln -s conf$$.file conf$$ 2>/dev/null; then
> + as_ln_s='ln -s'
> + # ... but there are two gotchas:
> + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
> + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
> + # In both cases, we have to default to `cp -pR'.
> + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
> + as_ln_s='cp -pR'
> + elif ln conf$$.file conf$$ 2>/dev/null; then
> + as_ln_s=ln
> + else
> + as_ln_s='cp -pR'
> + fi
> +else
> + as_ln_s='cp -pR'
> +fi
> +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
> +rmdir conf$$.dir 2>/dev/null
> +
> +
> +# as_fn_mkdir_p
> +# -------------
> +# Create "$as_dir" as a directory, including parents if necessary.
> +as_fn_mkdir_p ()
> +{
> +
> + case $as_dir in #(
> + -*) as_dir=./$as_dir;;
> + esac
> + test -d "$as_dir" || eval $as_mkdir_p || {
> + as_dirs=
> + while :; do
> + case $as_dir in #(
> + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
> + *) as_qdir=$as_dir;;
> + esac
> + as_dirs="'$as_qdir' $as_dirs"
> + as_dir=`$as_dirname -- "$as_dir" ||
> +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
> + X"$as_dir" : 'X\(//\)[^/]' \| \
> + X"$as_dir" : 'X\(//\)$' \| \
> + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
> +$as_echo X"$as_dir" |
> + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
> + s//\1/
> + q
> + }
> + /^X\(\/\/\)[^/].*/{
> + s//\1/
> + q
> + }
> + /^X\(\/\/\)$/{
> + s//\1/
> + q
> + }
> + /^X\(\/\).*/{
> + s//\1/
> + q
> + }
> + s/.*/./; q'`
> + test -d "$as_dir" && break
> + done
> + test -z "$as_dirs" || eval "mkdir $as_dirs"
> + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
> +
> +
> +} # as_fn_mkdir_p
> +if mkdir -p . 2>/dev/null; then
> + as_mkdir_p='mkdir -p "$as_dir"'
> +else
> + test -d ./-p && rmdir ./-p
> + as_mkdir_p=false
> +fi
> +
> +
> +# as_fn_executable_p FILE
> +# -----------------------
> +# Test if FILE is an executable regular file.
> +as_fn_executable_p ()
> +{
> + test -f "$1" && test -x "$1"
> +} # as_fn_executable_p
> +as_test_x='test -x'
> +as_executable_p=as_fn_executable_p
> +
> +# Sed expression to map a string onto a valid CPP name.
> +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
> +
> +# Sed expression to map a string onto a valid variable name.
> +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
> +
> +
> +exec 6>&1
> +## --------------------------------- ##
> +## Main body of "$CONFIG_LT" script. ##
> +## --------------------------------- ##
> +lt_cl_silent=false
> +exec 5>>config.log
> +{
> + echo
> + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
> +## Running $as_me. ##
> +_ASBOX
> +} >&5
> +
> +lt_cl_help="\
> +\`$as_me' creates a local libtool stub from the current configuration,
> +for use in further configure time tests before the real libtool is
> +generated.
> +
> +Usage: $0 [OPTIONS]
> +
> + -h, --help print this help, then exit
> + -V, --version print version number, then exit
> + -q, --quiet do not print progress messages
> + -d, --debug don't remove temporary files
> +
> +Report bugs to <bug-libtool@gnu.org>."
> +
> +lt_cl_version="\
> +config.lt
> +configured by $0, generated by GNU Autoconf 2.69.
> +
> +Copyright (C) 2009 Free Software Foundation, Inc.
> +This config.lt script is free software; the Free Software Foundation
> +gives unlimited permision to copy, distribute and modify it."
> +
> +while test $# != 0
> +do
> + case $1 in
> + --version | --v* | -V )
> + echo "$lt_cl_version"; exit 0 ;;
> + --help | --h* | -h )
> + echo "$lt_cl_help"; exit 0 ;;
> + --debug | --d* | -d )
> + debug=: ;;
> + --quiet | --q* | --silent | --s* | -q )
> + lt_cl_silent=: ;;
> +
> + -*) as_fn_error $? "unrecognized option: $1
> +Try \`$0 --help' for more information." "$LINENO" 5 ;;
> +
> + *) as_fn_error $? "unrecognized argument: $1
> +Try \`$0 --help' for more information." "$LINENO" 5 ;;
> + esac
> + shift
> +done
> +
> +if $lt_cl_silent; then
> + exec 6>/dev/null
> +fi
> +
> +
> +# The HP-UX ksh and POSIX shell print the target directory to stdout
> +# if CDPATH is set.
> +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
> +
> +sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
> +double_quote_subst='s/\(["`\\]\)/\\\1/g'
> +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
> +macro_version='2.2.7a'
> +macro_revision='1.3134'
> +enable_shared='yes'
> +enable_static='yes'
> +pic_mode='default'
> +enable_fast_install='needless'
> +SHELL='/bin/bash'
> +ECHO='printf %s\n'
> +host_alias='x86_64-pc-linux-gnu'
> +host='x86_64-pc-linux-gnu'
> +host_os='linux-gnu'
> +build_alias='x86_64-pc-linux-gnu'
> +build='x86_64-pc-linux-gnu'
> +build_os='linux-gnu'
> +SED='/usr/bin/sed'
> +Xsed='/usr/bin/sed -e 1s/^X//'
> +GREP='/usr/bin/grep'
> +EGREP='/usr/bin/grep -E'
> +FGREP='/usr/bin/grep -F'
> +LD='ld -m elf_x86_64'
> +NM='/usr/bin/nm -B'
> +LN_S='ln -s'
> +max_cmd_len='1572864'
> +ac_objext='o'
> +exeext=''
> +lt_unset='unset'
> +lt_SP2NL='tr \040 \012'
> +lt_NL2SP='tr \015\012 \040\040'
> +reload_flag=' -r'
> +reload_cmds='$LD$reload_flag -o $output$reload_objs'
> +OBJDUMP='objdump'
> +deplibs_check_method='pass_all'
> +file_magic_cmd='$MAGIC_CMD'
> +AR='ar --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so'
> +AR_FLAGS='rc'
> +STRIP='strip'
> +RANLIB='ranlib --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so --plugin /usr/lib/gcc/x86_64-linux-gnu/11/liblto_plugin.so'
> +old_postinstall_cmds='chmod 644 $oldlib~$RANLIB $oldlib'
> +old_postuninstall_cmds=''
> +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs~$RANLIB $oldlib'
> +lock_old_archive_extraction='no'
> +CC='gcc'
> +CFLAGS='-g -O2 '
> +compiler='g++'
> +GCC='yes'
> +lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'''
> +lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^T .* \(.*\)$/extern int \1();/p'\'' -e '\''s/^[ABCDGIRSTW]* .* \(.*\)$/extern char \1;/p'\'''
> +lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/ {"\2", (void *) \&\2},/p'\'''
> +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (void *) 0},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \(lib[^ ]*\)$/ {"\2", (void *) \&\2},/p'\'' -e '\''s/^[ABCDGIRSTW]* \([^ ]*\) \([^ ]*\)$/ {"lib\2", (void *) \&\2},/p'\'''
> +objdir='.libs'
> +MAGIC_CMD='file'
> +lt_prog_compiler_no_builtin_flag=' -fno-builtin'
> +lt_prog_compiler_wl='-Wl,'
> +lt_prog_compiler_pic=' -fPIC -DPIC'
> +lt_prog_compiler_static='-static'
> +lt_cv_prog_compiler_c_o='yes'
> +need_locks='no'
> +DSYMUTIL='dsymutil'
> +NMEDIT=''
> +LIPO='lipo'
> +OTOOL='otool'
> +OTOOL64=''
> +libext='a'
> +shrext_cmds='.so'
> +extract_expsyms_cmds=''
> +archive_cmds_need_lc='no'
> +enable_shared_with_static_runtimes='no'
> +export_dynamic_flag_spec='${wl}--export-dynamic'
> +whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
> +compiler_needs_object='no'
> +old_archive_from_new_cmds=''
> +old_archive_from_expsyms_cmds=''
> +archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
> +archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
> + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
> + echo "local: *; };" >> $output_objdir/$libname.ver~
> + $CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
> +module_cmds=''
> +module_expsym_cmds=''
> +with_gnu_ld='yes'
> +allow_undefined_flag=''
> +no_undefined_flag=''
> +hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
> +hardcode_libdir_flag_spec_ld=''
> +hardcode_libdir_separator=''
> +hardcode_direct='no'
> +hardcode_direct_absolute='no'
> +hardcode_minus_L='no'
> +hardcode_shlibpath_var='unsupported'
> +hardcode_automatic='no'
> +inherit_rpath='no'
> +link_all_deplibs='unknown'
> +fix_srcfile_path=''
> +always_export_symbols='no'
> +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
> +exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
> +include_expsyms=''
> +prelink_cmds=''
> +file_list_spec=''
> +variables_saved_for_relink='PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH'
> +need_lib_prefix='no'
> +need_version='no'
> +version_type='linux'
> +runpath_var='LD_RUN_PATH'
> +shlibpath_var='LD_LIBRARY_PATH'
> +shlibpath_overrides_runpath='yes'
> +libname_spec='lib$name'
> +library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
> +soname_spec='${libname}${release}${shared_ext}$major'
> +install_override_mode=''
> +postinstall_cmds=''
> +postuninstall_cmds=''
> +finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
> +finish_eval=''
> +hardcode_into_libs='yes'
> +sys_lib_search_path_spec='/usr/lib/gcc/x86_64-linux-gnu/11 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib '
> +sys_lib_dlsearch_path_spec='/lib /usr/lib /usr/lib/x86_64-linux-gnu/libfakeroot /usr/local/lib /usr/local/lib/x86_64-linux-gnu /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /lib32 /usr/lib32 '
> +hardcode_action='immediate'
> +enable_dlopen='unknown'
> +enable_dlopen_self='unknown'
> +enable_dlopen_self_static='unknown'
> +old_striplib='strip --strip-debug'
> +striplib='strip --strip-unneeded'
> +compiler_lib_search_dirs=''
> +predep_objects=''
> +postdep_objects=''
> +predeps=''
> +postdeps=''
> +compiler_lib_search_path=''
> +LD_CXX='ld -m elf_x86_64'
> +reload_flag_CXX=' -r'
> +reload_cmds_CXX='$LD$reload_flag -o $output$reload_objs'
> +old_archive_cmds_CXX='$AR $AR_FLAGS $oldlib$oldobjs~$RANLIB $oldlib'
> +compiler_CXX='g++'
> +GCC_CXX='yes'
> +lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
> +lt_prog_compiler_wl_CXX='-Wl,'
> +lt_prog_compiler_pic_CXX=' -fPIC -DPIC'
> +lt_prog_compiler_static_CXX='-static'
> +lt_cv_prog_compiler_c_o_CXX='yes'
> +archive_cmds_need_lc_CXX='no'
> +enable_shared_with_static_runtimes_CXX='no'
> +export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
> +whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
> +compiler_needs_object_CXX='no'
> +old_archive_from_new_cmds_CXX=''
> +old_archive_from_expsyms_cmds_CXX=''
> +archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
> +archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
> +module_cmds_CXX=''
> +module_expsym_cmds_CXX=''
> +with_gnu_ld_CXX='yes'
> +allow_undefined_flag_CXX=''
> +no_undefined_flag_CXX=''
> +hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
> +hardcode_libdir_flag_spec_ld_CXX=''
> +hardcode_libdir_separator_CXX=''
> +hardcode_direct_CXX='no'
> +hardcode_direct_absolute_CXX='no'
> +hardcode_minus_L_CXX='no'
> +hardcode_shlibpath_var_CXX='unsupported'
> +hardcode_automatic_CXX='no'
> +inherit_rpath_CXX='no'
> +link_all_deplibs_CXX='unknown'
> +fix_srcfile_path_CXX=''
> +always_export_symbols_CXX='no'
> +export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
> +exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
> +include_expsyms_CXX=''
> +prelink_cmds_CXX=''
> +file_list_spec_CXX=''
> +hardcode_action_CXX='immediate'
> +compiler_lib_search_dirs_CXX='/usr/lib/gcc/x86_64-linux-gnu/11 /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /usr/lib/gcc/x86_64-linux-gnu/11/../../..'
> +predep_objects_CXX='/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/11/crtbeginS.o'
> +postdep_objects_CXX='/usr/lib/gcc/x86_64-linux-gnu/11/crtendS.o /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/crtn.o'
> +predeps_CXX=''
> +postdeps_CXX='-lstdc++ -lm -lgcc_s -lc -lgcc_s'
> +compiler_lib_search_path_CXX='-L/usr/lib/gcc/x86_64-linux-gnu/11 -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/11/../../..'
> +
> +LTCC='gcc'
> +LTCFLAGS='-g -O2 '
> +compiler='gcc'
> +
> +# A function that is used when there is no print builtin or printf.
> +func_fallback_echo ()
> +{
> + eval 'cat <<_LTECHO_EOF
> +$1
> +_LTECHO_EOF'
> +}
> +
> +# Quote evaled strings.
> +for var in SHELL ECHO SED GREP EGREP FGREP LD NM LN_S lt_SP2NL lt_NL2SP reload_flag OBJDUMP deplibs_check_method file_magic_cmd AR AR_FLAGS STRIP RANLIB CC CFLAGS compiler lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl lt_cv_sys_global_symbol_to_c_name_address lt_cv_sys_global_symbol_to_c_name_address_lib_prefix lt_prog_compiler_no_builtin_flag lt_prog_compiler_wl lt_prog_compiler_pic lt_prog_compiler_static lt_cv_prog_compiler_c_o need_locks DSYMUTIL NMEDIT LIPO OTOOL OTOOL64 shrext_cmds export_dynamic_flag_spec whole_archive_flag_spec compiler_needs_object with_gnu_ld allow_undefined_flag no_undefined_flag hardcode_libdir_flag_spec hardcode_libdir_flag_spec_ld hardcode_libdir_separator fix_srcfile_path exclude_expsyms include_expsyms file_list_spec variables_saved_for_relink libname_spec library_names_spec soname_spec install_override_mode finish_eval old_striplib striplib compiler_lib_search_dirs predep_objects postdep_objects predeps postdeps compiler_lib_search_path LD_CXX reload_flag_CXX compiler_CXX lt_prog_compiler_no_builtin_flag_CXX lt_prog_compiler_wl_CXX lt_prog_compiler_pic_CXX lt_prog_compiler_static_CXX lt_cv_prog_compiler_c_o_CXX export_dynamic_flag_spec_CXX whole_archive_flag_spec_CXX compiler_needs_object_CXX with_gnu_ld_CXX allow_undefined_flag_CXX no_undefined_flag_CXX hardcode_libdir_flag_spec_CXX hardcode_libdir_flag_spec_ld_CXX hardcode_libdir_separator_CXX fix_srcfile_path_CXX exclude_expsyms_CXX include_expsyms_CXX file_list_spec_CXX compiler_lib_search_dirs_CXX predep_objects_CXX postdep_objects_CXX predeps_CXX postdeps_CXX compiler_lib_search_path_CXX; do
> + case `eval \\$ECHO \\""\\$$var"\\"` in
> + *[\\\`\"\$]*)
> + eval "lt_$var=\\\"\`\$ECHO \"\$$var\" | \$SED \"\$sed_quote_subst\"\`\\\""
> + ;;
> + *)
> + eval "lt_$var=\\\"\$$var\\\""
> + ;;
> + esac
> +done
> +
> +# Double-quote double-evaled strings.
> +for var in reload_cmds old_postinstall_cmds old_postuninstall_cmds old_archive_cmds extract_expsyms_cmds old_archive_from_new_cmds old_archive_from_expsyms_cmds archive_cmds archive_expsym_cmds module_cmds module_expsym_cmds export_symbols_cmds prelink_cmds postinstall_cmds postuninstall_cmds finish_cmds sys_lib_search_path_spec sys_lib_dlsearch_path_spec reload_cmds_CXX old_archive_cmds_CXX old_archive_from_new_cmds_CXX old_archive_from_expsyms_cmds_CXX archive_cmds_CXX archive_expsym_cmds_CXX module_cmds_CXX module_expsym_cmds_CXX export_symbols_cmds_CXX prelink_cmds_CXX; do
> + case `eval \\$ECHO \\""\\$$var"\\"` in
> + *[\\\`\"\$]*)
> + eval "lt_$var=\\\"\`\$ECHO \"\$$var\" | \$SED -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
> + ;;
> + *)
> + eval "lt_$var=\\\"\$$var\\\""
> + ;;
> + esac
> +done
> +
> +ac_aux_dir='..'
> +xsi_shell='yes'
> +lt_shell_append='yes'
> +
> +# See if we are running on zsh, and set the options which allow our
> +# commands through without removal of \ escapes INIT.
> +if test -n "${ZSH_VERSION+set}" ; then
> + setopt NO_GLOB_SUBST
> +fi
> +
> +
> + PACKAGE=''
> + VERSION=''
> + TIMESTAMP=''
> + RM='rm -f'
> + ofile='libtool'
> +
> +
> +
> +
> +
> +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $ofile" >&5
> +$as_echo "$as_me: creating $ofile" >&6;}
> +
> +
> + # See if we are running on zsh, and set the options which allow our
> + # commands through without removal of \ escapes.
> + if test -n "${ZSH_VERSION+set}" ; then
> + setopt NO_GLOB_SUBST
> + fi
> +
> + cfgfile="${ofile}T"
> + trap "$RM \"$cfgfile\"; exit 1" 1 2 15
> + $RM "$cfgfile"
> +
> + cat <<_LT_EOF >> "$cfgfile"
> +#! $SHELL
> +
> +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
> +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
> +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
> +# NOTE: Changes made to this file will be lost: look at ltmain.sh.
> +#
> +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
> +# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
> +# Written by Gordon Matzigkeit, 1996
> +#
> +# This file is part of GNU Libtool.
> +#
> +# GNU Libtool is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# As a special exception to the GNU General Public License,
> +# if you distribute this file as part of a program or library that
> +# is built using GNU Libtool, you may include this file under the
> +# same distribution terms that you use for the rest of that program.
> +#
> +# GNU Libtool is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with GNU Libtool; see the file COPYING. If not, a copy
> +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
> +# obtained by writing to the Free Software Foundation, Inc.,
> +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> +
> +
> +# The names of the tagged configurations supported by this script.
> +available_tags="CXX "
> +
> +# ### BEGIN LIBTOOL CONFIG
> +
> +# Which release of libtool.m4 was used?
> +macro_version=$macro_version
> +macro_revision=$macro_revision
> +
> +# Whether or not to build shared libraries.
> +build_libtool_libs=$enable_shared
> +
> +# Whether or not to build static libraries.
> +build_old_libs=$enable_static
> +
> +# What type of objects to build.
> +pic_mode=$pic_mode
> +
> +# Whether or not to optimize for fast installation.
> +fast_install=$enable_fast_install
> +
> +# Shell to use when invoking shell scripts.
> +SHELL=$lt_SHELL
> +
> +# An echo program that protects backslashes.
> +ECHO=$lt_ECHO
> +
> +# The host system.
> +host_alias=$host_alias
> +host=$host
> +host_os=$host_os
> +
> +# The build system.
> +build_alias=$build_alias
> +build=$build
> +build_os=$build_os
> +
> +# A sed program that does not truncate output.
> +SED=$lt_SED
> +
> +# Sed that helps us avoid accidentally triggering echo(1) options like -n.
> +Xsed="\$SED -e 1s/^X//"
> +
> +# A grep program that handles long lines.
> +GREP=$lt_GREP
> +
> +# An ERE matcher.
> +EGREP=$lt_EGREP
> +
> +# A literal string matcher.
> +FGREP=$lt_FGREP
> +
> +# A BSD- or MS-compatible name lister.
> +NM=$lt_NM
> +
> +# Whether we need soft or hard links.
> +LN_S=$lt_LN_S
> +
> +# What is the maximum length of a command?
> +max_cmd_len=$max_cmd_len
> +
> +# Object file suffix (normally "o").
> +objext=$ac_objext
> +
> +# Executable file suffix (normally "").
> +exeext=$exeext
> +
> +# whether the shell understands "unset".
> +lt_unset=$lt_unset
> +
> +# turn spaces into newlines.
> +SP2NL=$lt_lt_SP2NL
> +
> +# turn newlines into spaces.
> +NL2SP=$lt_lt_NL2SP
> +
> +# An object symbol dumper.
> +OBJDUMP=$lt_OBJDUMP
> +
> +# Method to check whether dependent libraries are shared objects.
> +deplibs_check_method=$lt_deplibs_check_method
> +
> +# Command to use when deplibs_check_method == "file_magic".
> +file_magic_cmd=$lt_file_magic_cmd
> +
> +# The archiver.
> +AR=$lt_AR
> +AR_FLAGS=$lt_AR_FLAGS
> +
> +# A symbol stripping program.
> +STRIP=$lt_STRIP
> +
> +# Commands used to install an old-style archive.
> +RANLIB=$lt_RANLIB
> +old_postinstall_cmds=$lt_old_postinstall_cmds
> +old_postuninstall_cmds=$lt_old_postuninstall_cmds
> +
> +# Whether to use a lock for old archive extraction.
> +lock_old_archive_extraction=$lock_old_archive_extraction
> +
> +# A C compiler.
> +LTCC=$lt_CC
> +
> +# LTCC compiler flags.
> +LTCFLAGS=$lt_CFLAGS
> +
> +# Take the output of nm and produce a listing of raw symbols and C names.
> +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
> +
> +# Transform the output of nm in a proper C declaration.
> +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
> +
> +# Transform the output of nm in a C name address pair.
> +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
> +
> +# Transform the output of nm in a C name address pair when lib prefix is needed.
> +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
> +
> +# The name of the directory that contains temporary libtool files.
> +objdir=$objdir
> +
> +# Used to examine libraries when file_magic_cmd begins with "file".
> +MAGIC_CMD=$MAGIC_CMD
> +
> +# Must we lock files when doing compilation?
> +need_locks=$lt_need_locks
> +
> +# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
> +DSYMUTIL=$lt_DSYMUTIL
> +
> +# Tool to change global to local symbols on Mac OS X.
> +NMEDIT=$lt_NMEDIT
> +
> +# Tool to manipulate fat objects and archives on Mac OS X.
> +LIPO=$lt_LIPO
> +
> +# ldd/readelf like tool for Mach-O binaries on Mac OS X.
> +OTOOL=$lt_OTOOL
> +
> +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
> +OTOOL64=$lt_OTOOL64
> +
> +# Old archive suffix (normally "a").
> +libext=$libext
> +
> +# Shared library suffix (normally ".so").
> +shrext_cmds=$lt_shrext_cmds
> +
> +# The commands to extract the exported symbol list from a shared archive.
> +extract_expsyms_cmds=$lt_extract_expsyms_cmds
> +
> +# Variables whose values should be saved in libtool wrapper scripts and
> +# restored at link time.
> +variables_saved_for_relink=$lt_variables_saved_for_relink
> +
> +# Do we need the "lib" prefix for modules?
> +need_lib_prefix=$need_lib_prefix
> +
> +# Do we need a version for libraries?
> +need_version=$need_version
> +
> +# Library versioning type.
> +version_type=$version_type
> +
> +# Shared library runtime path variable.
> +runpath_var=$runpath_var
> +
> +# Shared library path variable.
> +shlibpath_var=$shlibpath_var
> +
> +# Is shlibpath searched before the hard-coded library search path?
> +shlibpath_overrides_runpath=$shlibpath_overrides_runpath
> +
> +# Format of library name prefix.
> +libname_spec=$lt_libname_spec
> +
> +# List of archive names. First name is the real one, the rest are links.
> +# The last name is the one that the linker finds with -lNAME
> +library_names_spec=$lt_library_names_spec
> +
> +# The coded name of the library, if different from the real name.
> +soname_spec=$lt_soname_spec
> +
> +# Permission mode override for installation of shared libraries.
> +install_override_mode=$lt_install_override_mode
> +
> +# Command to use after installation of a shared archive.
> +postinstall_cmds=$lt_postinstall_cmds
> +
> +# Command to use after uninstallation of a shared archive.
> +postuninstall_cmds=$lt_postuninstall_cmds
> +
> +# Commands used to finish a libtool library installation in a directory.
> +finish_cmds=$lt_finish_cmds
> +
> +# As "finish_cmds", except a single script fragment to be evaled but
> +# not shown.
> +finish_eval=$lt_finish_eval
> +
> +# Whether we should hardcode library paths into libraries.
> +hardcode_into_libs=$hardcode_into_libs
> +
> +# Compile-time system search path for libraries.
> +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
> +
> +# Run-time system search path for libraries.
> +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
> +
> +# Whether dlopen is supported.
> +dlopen_support=$enable_dlopen
> +
> +# Whether dlopen of programs is supported.
> +dlopen_self=$enable_dlopen_self
> +
> +# Whether dlopen of statically linked programs is supported.
> +dlopen_self_static=$enable_dlopen_self_static
> +
> +# Commands to strip libraries.
> +old_striplib=$lt_old_striplib
> +striplib=$lt_striplib
> +
> +
> +# The linker used to build libraries.
> +LD=$lt_LD
> +
> +# How to create reloadable object files.
> +reload_flag=$lt_reload_flag
> +reload_cmds=$lt_reload_cmds
> +
> +# Commands used to build an old-style archive.
> +old_archive_cmds=$lt_old_archive_cmds
> +
> +# A language specific compiler.
> +CC=$lt_compiler
> +
> +# Is the compiler the GNU compiler?
> +with_gcc=$GCC
> +
> +# Compiler flag to turn off builtin functions.
> +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
> +
> +# How to pass a linker flag through the compiler.
> +wl=$lt_lt_prog_compiler_wl
> +
> +# Additional compiler flags for building library objects.
> +pic_flag=$lt_lt_prog_compiler_pic
> +
> +# Compiler flag to prevent dynamic linking.
> +link_static_flag=$lt_lt_prog_compiler_static
> +
> +# Does compiler simultaneously support -c and -o options?
> +compiler_c_o=$lt_lt_cv_prog_compiler_c_o
> +
> +# Whether or not to add -lc for building shared libraries.
> +build_libtool_need_lc=$archive_cmds_need_lc
> +
> +# Whether or not to disallow shared libs when runtime libs are static.
> +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
> +
> +# Compiler flag to allow reflexive dlopens.
> +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
> +
> +# Compiler flag to generate shared objects directly from archives.
> +whole_archive_flag_spec=$lt_whole_archive_flag_spec
> +
> +# Whether the compiler copes with passing no objects directly.
> +compiler_needs_object=$lt_compiler_needs_object
> +
> +# Create an old-style archive from a shared archive.
> +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
> +
> +# Create a temporary old-style archive to link instead of a shared archive.
> +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
> +
> +# Commands used to build a shared archive.
> +archive_cmds=$lt_archive_cmds
> +archive_expsym_cmds=$lt_archive_expsym_cmds
> +
> +# Commands used to build a loadable module if different from building
> +# a shared archive.
> +module_cmds=$lt_module_cmds
> +module_expsym_cmds=$lt_module_expsym_cmds
> +
> +# Whether we are building with GNU ld or not.
> +with_gnu_ld=$lt_with_gnu_ld
> +
> +# Flag that allows shared libraries with undefined symbols to be built.
> +allow_undefined_flag=$lt_allow_undefined_flag
> +
> +# Flag that enforces no undefined symbols.
> +no_undefined_flag=$lt_no_undefined_flag
> +
> +# Flag to hardcode \$libdir into a binary during linking.
> +# This must work even if \$libdir does not exist
> +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
> +
> +# If ld is used when linking, flag to hardcode \$libdir into a binary
> +# during linking. This must work even if \$libdir does not exist.
> +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
> +
> +# Whether we need a single "-rpath" flag with a separated argument.
> +hardcode_libdir_separator=$lt_hardcode_libdir_separator
> +
> +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
> +# DIR into the resulting binary.
> +hardcode_direct=$hardcode_direct
> +
> +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
> +# DIR into the resulting binary and the resulting library dependency is
> +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
> +# library is relocated.
> +hardcode_direct_absolute=$hardcode_direct_absolute
> +
> +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
> +# into the resulting binary.
> +hardcode_minus_L=$hardcode_minus_L
> +
> +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
> +# into the resulting binary.
> +hardcode_shlibpath_var=$hardcode_shlibpath_var
> +
> +# Set to "yes" if building a shared library automatically hardcodes DIR
> +# into the library and all subsequent libraries and executables linked
> +# against it.
> +hardcode_automatic=$hardcode_automatic
> +
> +# Set to yes if linker adds runtime paths of dependent libraries
> +# to runtime path list.
> +inherit_rpath=$inherit_rpath
> +
> +# Whether libtool must link a program against all its dependency libraries.
> +link_all_deplibs=$link_all_deplibs
> +
> +# Fix the shell variable \$srcfile for the compiler.
> +fix_srcfile_path=$lt_fix_srcfile_path
> +
> +# Set to "yes" if exported symbols are required.
> +always_export_symbols=$always_export_symbols
> +
> +# The commands to list exported symbols.
> +export_symbols_cmds=$lt_export_symbols_cmds
> +
> +# Symbols that should not be listed in the preloaded symbols.
> +exclude_expsyms=$lt_exclude_expsyms
> +
> +# Symbols that must always be exported.
> +include_expsyms=$lt_include_expsyms
> +
> +# Commands necessary for linking programs (against libraries) with templates.
> +prelink_cmds=$lt_prelink_cmds
> +
> +# Specify filename containing input files.
> +file_list_spec=$lt_file_list_spec
> +
> +# How to hardcode a shared library path into an executable.
> +hardcode_action=$hardcode_action
> +
> +# The directories searched by this compiler when creating a shared library.
> +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
> +
> +# Dependencies to place before and after the objects being linked to
> +# create a shared library.
> +predep_objects=$lt_predep_objects
> +postdep_objects=$lt_postdep_objects
> +predeps=$lt_predeps
> +postdeps=$lt_postdeps
> +
> +# The library search path used internally by the compiler when linking
> +# a shared library.
> +compiler_lib_search_path=$lt_compiler_lib_search_path
> +
> +# ### END LIBTOOL CONFIG
> +
> +_LT_EOF
> +
> + case $host_os in
> + aix3*)
> + cat <<\_LT_EOF >> "$cfgfile"
> +# AIX sometimes has problems with the GCC collect2 program. For some
> +# reason, if we set the COLLECT_NAMES environment variable, the problems
> +# vanish in a puff of smoke.
> +if test "X${COLLECT_NAMES+set}" != Xset; then
> + COLLECT_NAMES=
> + export COLLECT_NAMES
> +fi
> +_LT_EOF
> + ;;
> + esac
> +
> +
> +ltmain="$ac_aux_dir/ltmain.sh"
> +
> +
> + # We use sed instead of cat because bash on DJGPP gets confused if
> + # if finds mixed CR/LF and LF-only lines. Since sed operates in
> + # text mode, it properly converts lines to CR/LF. This bash problem
> + # is reportedly fixed, but why not run on old versions too?
> + sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
> + || (rm -f "$cfgfile"; exit 1)
> +
> + case $xsi_shell in
> + yes)
> + cat << \_LT_EOF >> "$cfgfile"
> +
> +# func_dirname file append nondir_replacement
> +# Compute the dirname of FILE. If nonempty, add APPEND to the result,
> +# otherwise set result to NONDIR_REPLACEMENT.
> +func_dirname ()
> +{
> + case ${1} in
> + */*) func_dirname_result="${1%/*}${2}" ;;
> + * ) func_dirname_result="${3}" ;;
> + esac
> +}
> +
> +# func_basename file
> +func_basename ()
> +{
> + func_basename_result="${1##*/}"
> +}
> +
> +# func_dirname_and_basename file append nondir_replacement
> +# perform func_basename and func_dirname in a single function
> +# call:
> +# dirname: Compute the dirname of FILE. If nonempty,
> +# add APPEND to the result, otherwise set result
> +# to NONDIR_REPLACEMENT.
> +# value returned in "$func_dirname_result"
> +# basename: Compute filename of FILE.
> +# value retuned in "$func_basename_result"
> +# Implementation must be kept synchronized with func_dirname
> +# and func_basename. For efficiency, we do not delegate to
> +# those functions but instead duplicate the functionality here.
> +func_dirname_and_basename ()
> +{
> + case ${1} in
> + */*) func_dirname_result="${1%/*}${2}" ;;
> + * ) func_dirname_result="${3}" ;;
> + esac
> + func_basename_result="${1##*/}"
> +}
> +
> +# func_stripname prefix suffix name
> +# strip PREFIX and SUFFIX off of NAME.
> +# PREFIX and SUFFIX must not contain globbing or regex special
> +# characters, hashes, percent signs, but SUFFIX may contain a leading
> +# dot (in which case that matches only a dot).
> +func_stripname ()
> +{
> + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
> + # positional parameters, so assign one to ordinary parameter first.
> + func_stripname_result=${3}
> + func_stripname_result=${func_stripname_result#"${1}"}
> + func_stripname_result=${func_stripname_result%"${2}"}
> +}
> +
> +# func_opt_split
> +func_opt_split ()
> +{
> + func_opt_split_opt=${1%%=*}
> + func_opt_split_arg=${1#*=}
> +}
> +
> +# func_lo2o object
> +func_lo2o ()
> +{
> + case ${1} in
> + *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
> + *) func_lo2o_result=${1} ;;
> + esac
> +}
> +
> +# func_xform libobj-or-source
> +func_xform ()
> +{
> + func_xform_result=${1%.*}.lo
> +}
> +
> +# func_arith arithmetic-term...
> +func_arith ()
> +{
> + func_arith_result=$(( $* ))
> +}
> +
> +# func_len string
> +# STRING may not start with a hyphen.
> +func_len ()
> +{
> + func_len_result=${#1}
> +}
> +
> +_LT_EOF
> + ;;
> + *) # Bourne compatible functions.
> + cat << \_LT_EOF >> "$cfgfile"
> +
> +# func_dirname file append nondir_replacement
> +# Compute the dirname of FILE. If nonempty, add APPEND to the result,
> +# otherwise set result to NONDIR_REPLACEMENT.
> +func_dirname ()
> +{
> + # Extract subdirectory from the argument.
> + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
> + if test "X$func_dirname_result" = "X${1}"; then
> + func_dirname_result="${3}"
> + else
> + func_dirname_result="$func_dirname_result${2}"
> + fi
> +}
> +
> +# func_basename file
> +func_basename ()
> +{
> + func_basename_result=`$ECHO "${1}" | $SED "$basename"`
> +}
> +
> +
> +# func_stripname prefix suffix name
> +# strip PREFIX and SUFFIX off of NAME.
> +# PREFIX and SUFFIX must not contain globbing or regex special
> +# characters, hashes, percent signs, but SUFFIX may contain a leading
> +# dot (in which case that matches only a dot).
> +# func_strip_suffix prefix name
> +func_stripname ()
> +{
> + case ${2} in
> + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
> + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
> + esac
> +}
> +
> +# sed scripts:
> +my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
> +my_sed_long_arg='1s/^-[^=]*=//'
> +
> +# func_opt_split
> +func_opt_split ()
> +{
> + func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"`
> + func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"`
> +}
> +
> +# func_lo2o object
> +func_lo2o ()
> +{
> + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
> +}
> +
> +# func_xform libobj-or-source
> +func_xform ()
> +{
> + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
> +}
> +
> +# func_arith arithmetic-term...
> +func_arith ()
> +{
> + func_arith_result=`expr "$@"`
> +}
> +
> +# func_len string
> +# STRING may not start with a hyphen.
> +func_len ()
> +{
> + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
> +}
> +
> +_LT_EOF
> +esac
> +
> +case $lt_shell_append in
> + yes)
> + cat << \_LT_EOF >> "$cfgfile"
> +
> +# func_append var value
> +# Append VALUE to the end of shell variable VAR.
> +func_append ()
> +{
> + eval "$1+=\$2"
> +}
> +_LT_EOF
> + ;;
> + *)
> + cat << \_LT_EOF >> "$cfgfile"
> +
> +# func_append var value
> +# Append VALUE to the end of shell variable VAR.
> +func_append ()
> +{
> + eval "$1=\$$1\$2"
> +}
> +
> +_LT_EOF
> + ;;
> + esac
> +
> +
> + sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
> + || (rm -f "$cfgfile"; exit 1)
> +
> + mv -f "$cfgfile" "$ofile" ||
> + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
> + chmod +x "$ofile"
> +
> +
> + cat <<_LT_EOF >> "$ofile"
> +
> +# ### BEGIN LIBTOOL TAG CONFIG: CXX
> +
> +# The linker used to build libraries.
> +LD=$lt_LD_CXX
> +
> +# How to create reloadable object files.
> +reload_flag=$lt_reload_flag_CXX
> +reload_cmds=$lt_reload_cmds_CXX
> +
> +# Commands used to build an old-style archive.
> +old_archive_cmds=$lt_old_archive_cmds_CXX
> +
> +# A language specific compiler.
> +CC=$lt_compiler_CXX
> +
> +# Is the compiler the GNU compiler?
> +with_gcc=$GCC_CXX
> +
> +# Compiler flag to turn off builtin functions.
> +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
> +
> +# How to pass a linker flag through the compiler.
> +wl=$lt_lt_prog_compiler_wl_CXX
> +
> +# Additional compiler flags for building library objects.
> +pic_flag=$lt_lt_prog_compiler_pic_CXX
> +
> +# Compiler flag to prevent dynamic linking.
> +link_static_flag=$lt_lt_prog_compiler_static_CXX
> +
> +# Does compiler simultaneously support -c and -o options?
> +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
> +
> +# Whether or not to add -lc for building shared libraries.
> +build_libtool_need_lc=$archive_cmds_need_lc_CXX
> +
> +# Whether or not to disallow shared libs when runtime libs are static.
> +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
> +
> +# Compiler flag to allow reflexive dlopens.
> +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
> +
> +# Compiler flag to generate shared objects directly from archives.
> +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
> +
> +# Whether the compiler copes with passing no objects directly.
> +compiler_needs_object=$lt_compiler_needs_object_CXX
> +
> +# Create an old-style archive from a shared archive.
> +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
> +
> +# Create a temporary old-style archive to link instead of a shared archive.
> +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
> +
> +# Commands used to build a shared archive.
> +archive_cmds=$lt_archive_cmds_CXX
> +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
> +
> +# Commands used to build a loadable module if different from building
> +# a shared archive.
> +module_cmds=$lt_module_cmds_CXX
> +module_expsym_cmds=$lt_module_expsym_cmds_CXX
> +
> +# Whether we are building with GNU ld or not.
> +with_gnu_ld=$lt_with_gnu_ld_CXX
> +
> +# Flag that allows shared libraries with undefined symbols to be built.
> +allow_undefined_flag=$lt_allow_undefined_flag_CXX
> +
> +# Flag that enforces no undefined symbols.
> +no_undefined_flag=$lt_no_undefined_flag_CXX
> +
> +# Flag to hardcode \$libdir into a binary during linking.
> +# This must work even if \$libdir does not exist
> +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
> +
> +# If ld is used when linking, flag to hardcode \$libdir into a binary
> +# during linking. This must work even if \$libdir does not exist.
> +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
> +
> +# Whether we need a single "-rpath" flag with a separated argument.
> +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
> +
> +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
> +# DIR into the resulting binary.
> +hardcode_direct=$hardcode_direct_CXX
> +
> +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
> +# DIR into the resulting binary and the resulting library dependency is
> +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
> +# library is relocated.
> +hardcode_direct_absolute=$hardcode_direct_absolute_CXX
> +
> +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
> +# into the resulting binary.
> +hardcode_minus_L=$hardcode_minus_L_CXX
> +
> +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
> +# into the resulting binary.
> +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
> +
> +# Set to "yes" if building a shared library automatically hardcodes DIR
> +# into the library and all subsequent libraries and executables linked
> +# against it.
> +hardcode_automatic=$hardcode_automatic_CXX
> +
> +# Set to yes if linker adds runtime paths of dependent libraries
> +# to runtime path list.
> +inherit_rpath=$inherit_rpath_CXX
> +
> +# Whether libtool must link a program against all its dependency libraries.
> +link_all_deplibs=$link_all_deplibs_CXX
> +
> +# Fix the shell variable \$srcfile for the compiler.
> +fix_srcfile_path=$lt_fix_srcfile_path_CXX
> +
> +# Set to "yes" if exported symbols are required.
> +always_export_symbols=$always_export_symbols_CXX
> +
> +# The commands to list exported symbols.
> +export_symbols_cmds=$lt_export_symbols_cmds_CXX
> +
> +# Symbols that should not be listed in the preloaded symbols.
> +exclude_expsyms=$lt_exclude_expsyms_CXX
> +
> +# Symbols that must always be exported.
> +include_expsyms=$lt_include_expsyms_CXX
> +
> +# Commands necessary for linking programs (against libraries) with templates.
> +prelink_cmds=$lt_prelink_cmds_CXX
> +
> +# Specify filename containing input files.
> +file_list_spec=$lt_file_list_spec_CXX
> +
> +# How to hardcode a shared library path into an executable.
> +hardcode_action=$hardcode_action_CXX
> +
> +# The directories searched by this compiler when creating a shared library.
> +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
> +
> +# Dependencies to place before and after the objects being linked to
> +# create a shared library.
> +predep_objects=$lt_predep_objects_CXX
> +postdep_objects=$lt_postdep_objects_CXX
> +predeps=$lt_predeps_CXX
> +postdeps=$lt_postdeps_CXX
> +
> +# The library search path used internally by the compiler when linking
> +# a shared library.
> +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
> +
> +# ### END LIBTOOL TAG CONFIG: CXX
> +_LT_EOF
> +
> +
> +as_fn_exit 0
> diff --git a/gdb/riscv-canonicalize-syscall-gen.c b/gdb/riscv-canonicalize-syscall-gen.c
> new file mode 100644
> index 00000000000..60d80aae0a6
> --- /dev/null
> +++ b/gdb/riscv-canonicalize-syscall-gen.c
> @@ -0,0 +1,338 @@
> +/* DO NOT EDIT: Autogenerated by riscv-canonicalize-syscall-gen.py
> +
> + Copyright (C) 2024 Free Software Foundation, Inc.
> +
> + This file is part of GDB.
> +
> + This program is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3 of the License, or
> + (at your option) any later version.
> +
> + This program is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with this program. If not, see <http://www.gnu.org/licenses/>. */
> +
> +#include "defs.h"
> +#include "riscv-linux-tdep.h"
> +
> +enum gdb_syscall
> +riscv64_canonicalize_syscall (int syscall)
> +{
> + switch (syscall)
> + {
> + case 0: return gdb_sys_io_setup;
> + case 1: return gdb_sys_io_destroy;
> + case 2: return gdb_sys_io_submit;
> + case 3: return gdb_sys_io_cancel;
> + case 4: return gdb_sys_io_getevents;
> + case 5: return gdb_sys_setxattr;
> + case 6: return gdb_sys_lsetxattr;
> + case 7: return gdb_sys_fsetxattr;
> + case 8: return gdb_sys_getxattr;
> + case 9: return gdb_sys_lgetxattr;
> + case 10: return gdb_sys_fgetxattr;
> + case 11: return gdb_sys_listxattr;
> + case 12: return gdb_sys_llistxattr;
> + case 13: return gdb_sys_flistxattr;
> + case 14: return gdb_sys_removexattr;
> + case 15: return gdb_sys_lremovexattr;
> + case 16: return gdb_sys_fremovexattr;
> + case 17: return gdb_sys_getcwd;
> + case 18: return gdb_sys_lookup_dcookie;
> + case 19: return gdb_sys_eventfd2;
> + case 20: return gdb_sys_epoll_create1;
> + case 21: return gdb_sys_epoll_ctl;
> + case 22: return gdb_sys_epoll_pwait;
> + case 23: return gdb_sys_dup;
> + case 24: return gdb_sys_dup3;
> + case 25: return gdb_sys_fcntl;
> + case 26: return gdb_sys_inotify_init1;
> + case 27: return gdb_sys_inotify_add_watch;
> + case 28: return gdb_sys_inotify_rm_watch;
> + case 29: return gdb_sys_ioctl;
> + case 30: return gdb_sys_ioprio_set;
> + case 31: return gdb_sys_ioprio_get;
> + case 32: return gdb_sys_flock;
> + case 33: return gdb_sys_mknodat;
> + case 34: return gdb_sys_mkdirat;
> + case 35: return gdb_sys_unlinkat;
> + case 36: return gdb_sys_symlinkat;
> + case 37: return gdb_sys_linkat;
> + /* case 39: return gdb_sys_umount2; */
> + case 40: return gdb_sys_mount;
> + case 41: return gdb_sys_pivot_root;
> + case 42: return gdb_sys_nfsservctl;
> + case 43: return gdb_sys_statfs;
> + case 44: return gdb_sys_fstatfs;
> + case 45: return gdb_sys_truncate;
> + case 46: return gdb_sys_ftruncate;
> + case 47: return gdb_sys_fallocate;
> + case 48: return gdb_sys_faccessat;
> + case 49: return gdb_sys_chdir;
> + case 50: return gdb_sys_fchdir;
> + case 51: return gdb_sys_chroot;
> + case 52: return gdb_sys_fchmod;
> + case 53: return gdb_sys_fchmodat;
> + case 54: return gdb_sys_fchownat;
> + case 55: return gdb_sys_fchown;
> + case 56: return gdb_sys_openat;
> + case 57: return gdb_sys_close;
> + case 58: return gdb_sys_vhangup;
> + case 59: return gdb_sys_pipe2;
> + case 60: return gdb_sys_quotactl;
> + case 61: return gdb_sys_getdents64;
> + case 62: return gdb_sys_lseek;
> + case 63: return gdb_sys_read;
> + case 64: return gdb_sys_write;
> + case 65: return gdb_sys_readv;
> + case 66: return gdb_sys_writev;
> + case 67: return gdb_sys_pread64;
> + case 68: return gdb_sys_pwrite64;
> + /* case 69: return gdb_sys_preadv; */
> + /* case 70: return gdb_sys_pwritev; */
> + case 71: return gdb_sys_sendfile;
> + case 72: return gdb_sys_pselect6;
> + case 73: return gdb_sys_ppoll;
> + /* case 74: return gdb_sys_signalfd4; */
> + case 75: return gdb_sys_vmsplice;
> + case 76: return gdb_sys_splice;
> + case 77: return gdb_sys_tee;
> + case 78: return gdb_sys_readlinkat;
> + case 79: return gdb_sys_newfstatat;
> + case 80: return gdb_sys_fstat;
> + case 81: return gdb_sys_sync;
> + case 82: return gdb_sys_fsync;
> + case 83: return gdb_sys_fdatasync;
> + case 84: return gdb_sys_sync_file_range;
> + /* case 85: return gdb_sys_timerfd_create; */
> + /* case 86: return gdb_sys_timerfd_settime; */
> + /* case 87: return gdb_sys_timerfd_gettime; */
> + /* case 88: return gdb_sys_utimensat; */
> + case 89: return gdb_sys_acct;
> + case 90: return gdb_sys_capget;
> + case 91: return gdb_sys_capset;
> + case 92: return gdb_sys_personality;
> + case 93: return gdb_sys_exit;
> + case 94: return gdb_sys_exit_group;
> + case 95: return gdb_sys_waitid;
> + case 96: return gdb_sys_set_tid_address;
> + case 97: return gdb_sys_unshare;
> + case 98: return gdb_sys_futex;
> + case 99: return gdb_sys_set_robust_list;
> + case 100: return gdb_sys_get_robust_list;
> + case 101: return gdb_sys_nanosleep;
> + case 102: return gdb_sys_getitimer;
> + case 103: return gdb_sys_setitimer;
> + case 104: return gdb_sys_kexec_load;
> + case 105: return gdb_sys_init_module;
> + case 106: return gdb_sys_delete_module;
> + case 107: return gdb_sys_timer_create;
> + case 108: return gdb_sys_timer_gettime;
> + case 109: return gdb_sys_timer_getoverrun;
> + case 110: return gdb_sys_timer_settime;
> + case 111: return gdb_sys_timer_delete;
> + case 112: return gdb_sys_clock_settime;
> + case 113: return gdb_sys_clock_gettime;
> + case 114: return gdb_sys_clock_getres;
> + case 115: return gdb_sys_clock_nanosleep;
> + case 116: return gdb_sys_syslog;
> + case 117: return gdb_sys_ptrace;
> + case 118: return gdb_sys_sched_setparam;
> + case 119: return gdb_sys_sched_setscheduler;
> + case 120: return gdb_sys_sched_getscheduler;
> + case 121: return gdb_sys_sched_getparam;
> + case 122: return gdb_sys_sched_setaffinity;
> + case 123: return gdb_sys_sched_getaffinity;
> + case 124: return gdb_sys_sched_yield;
> + case 125: return gdb_sys_sched_get_priority_max;
> + case 126: return gdb_sys_sched_get_priority_min;
> + case 127: return gdb_sys_sched_rr_get_interval;
> + case 128: return gdb_sys_restart_syscall;
> + case 129: return gdb_sys_kill;
> + case 130: return gdb_sys_tkill;
> + case 131: return gdb_sys_tgkill;
> + case 132: return gdb_sys_sigaltstack;
> + case 133: return gdb_sys_rt_sigsuspend;
> + case 134: return gdb_sys_rt_sigaction;
> + case 135: return gdb_sys_rt_sigprocmask;
> + case 136: return gdb_sys_rt_sigpending;
> + case 137: return gdb_sys_rt_sigtimedwait;
> + case 138: return gdb_sys_rt_sigqueueinfo;
> + case 139: return gdb_sys_rt_sigreturn;
> + case 140: return gdb_sys_setpriority;
> + case 141: return gdb_sys_getpriority;
> + case 142: return gdb_sys_reboot;
> + case 143: return gdb_sys_setregid;
> + case 144: return gdb_sys_setgid;
> + case 145: return gdb_sys_setreuid;
> + case 146: return gdb_sys_setuid;
> + case 147: return gdb_sys_setresuid;
> + case 148: return gdb_sys_getresuid;
> + case 149: return gdb_sys_setresgid;
> + case 150: return gdb_sys_getresgid;
> + case 151: return gdb_sys_setfsuid;
> + case 152: return gdb_sys_setfsgid;
> + case 153: return gdb_sys_times;
> + case 154: return gdb_sys_setpgid;
> + case 155: return gdb_sys_getpgid;
> + case 156: return gdb_sys_getsid;
> + case 157: return gdb_sys_setsid;
> + case 158: return gdb_sys_getgroups;
> + case 159: return gdb_sys_setgroups;
> + case 160: return gdb_sys_uname;
> + case 161: return gdb_sys_sethostname;
> + case 162: return gdb_sys_setdomainname;
> + case 163: return gdb_sys_getrlimit;
> + case 164: return gdb_sys_setrlimit;
> + case 165: return gdb_sys_getrusage;
> + case 166: return gdb_sys_umask;
> + case 167: return gdb_sys_prctl;
> + case 168: return gdb_sys_getcpu;
> + case 169: return gdb_sys_gettimeofday;
> + case 170: return gdb_sys_settimeofday;
> + case 171: return gdb_sys_adjtimex;
> + case 172: return gdb_sys_getpid;
> + case 173: return gdb_sys_getppid;
> + case 174: return gdb_sys_getuid;
> + case 175: return gdb_sys_geteuid;
> + case 176: return gdb_sys_getgid;
> + case 177: return gdb_sys_getegid;
> + case 178: return gdb_sys_gettid;
> + case 179: return gdb_sys_sysinfo;
> + case 180: return gdb_sys_mq_open;
> + case 181: return gdb_sys_mq_unlink;
> + case 182: return gdb_sys_mq_timedsend;
> + case 183: return gdb_sys_mq_timedreceive;
> + case 184: return gdb_sys_mq_notify;
> + case 185: return gdb_sys_mq_getsetattr;
> + case 186: return gdb_sys_msgget;
> + case 187: return gdb_sys_msgctl;
> + case 188: return gdb_sys_msgrcv;
> + case 189: return gdb_sys_msgsnd;
> + case 190: return gdb_sys_semget;
> + case 191: return gdb_sys_semctl;
> + case 192: return gdb_sys_semtimedop;
> + case 193: return gdb_sys_semop;
> + case 194: return gdb_sys_shmget;
> + case 195: return gdb_sys_shmctl;
> + case 196: return gdb_sys_shmat;
> + case 197: return gdb_sys_shmdt;
> + case 198: return gdb_sys_socket;
> + case 199: return gdb_sys_socketpair;
> + case 200: return gdb_sys_bind;
> + case 201: return gdb_sys_listen;
> + case 202: return gdb_sys_accept;
> + case 203: return gdb_sys_connect;
> + case 204: return gdb_sys_getsockname;
> + case 205: return gdb_sys_getpeername;
> + case 206: return gdb_sys_sendto;
> + case 207: return gdb_sys_recvfrom;
> + case 208: return gdb_sys_setsockopt;
> + case 209: return gdb_sys_getsockopt;
> + case 210: return gdb_sys_shutdown;
> + case 211: return gdb_sys_sendmsg;
> + case 212: return gdb_sys_recvmsg;
> + case 213: return gdb_sys_readahead;
> + case 214: return gdb_sys_brk;
> + case 215: return gdb_sys_munmap;
> + case 216: return gdb_sys_mremap;
> + case 217: return gdb_sys_add_key;
> + case 218: return gdb_sys_request_key;
> + case 219: return gdb_sys_keyctl;
> + case 220: return gdb_sys_clone;
> + case 221: return gdb_sys_execve;
> + case 222: return gdb_old_mmap;
> + case 223: return gdb_sys_fadvise64;
> + case 224: return gdb_sys_swapon;
> + case 225: return gdb_sys_swapoff;
> + case 226: return gdb_sys_mprotect;
> + case 227: return gdb_sys_msync;
> + case 228: return gdb_sys_mlock;
> + case 229: return gdb_sys_munlock;
> + case 230: return gdb_sys_mlockall;
> + case 231: return gdb_sys_munlockall;
> + case 232: return gdb_sys_mincore;
> + case 233: return gdb_sys_madvise;
> + case 234: return gdb_sys_remap_file_pages;
> + case 235: return gdb_sys_mbind;
> + case 236: return gdb_sys_get_mempolicy;
> + case 237: return gdb_sys_set_mempolicy;
> + case 238: return gdb_sys_migrate_pages;
> + case 239: return gdb_sys_move_pages;
> + /* case 240: return gdb_sys_rt_tgsigqueueinfo; */
> + /* case 241: return gdb_sys_perf_event_open; */
> + /* case 242: return gdb_sys_accept4; */
> + /* case 243: return gdb_sys_recvmmsg; */
> + /* case 258: return gdb_sys_riscv_hwprobe; */
> + /* case 259: return gdb_sys_riscv_flush_icache; */
> + case 260: return gdb_sys_wait4;
> + /* case 261: return gdb_sys_prlimit64; */
> + /* case 262: return gdb_sys_fanotify_init; */
> + /* case 263: return gdb_sys_fanotify_mark; */
> + /* case 264: return gdb_sys_name_to_handle_at; */
> + /* case 265: return gdb_sys_open_by_handle_at; */
> + /* case 266: return gdb_sys_clock_adjtime; */
> + /* case 267: return gdb_sys_syncfs; */
> + /* case 268: return gdb_sys_setns; */
> + /* case 269: return gdb_sys_sendmmsg; */
> + /* case 270: return gdb_sys_process_vm_readv; */
> + /* case 271: return gdb_sys_process_vm_writev; */
> + /* case 272: return gdb_sys_kcmp; */
> + /* case 273: return gdb_sys_finit_module; */
> + /* case 274: return gdb_sys_sched_setattr; */
> + /* case 275: return gdb_sys_sched_getattr; */
> + /* case 276: return gdb_sys_renameat2; */
> + /* case 277: return gdb_sys_seccomp; */
> + case 278: return gdb_sys_getrandom;
> + /* case 279: return gdb_sys_memfd_create; */
> + /* case 280: return gdb_sys_bpf; */
> + /* case 281: return gdb_sys_execveat; */
> + /* case 282: return gdb_sys_userfaultfd; */
> + /* case 283: return gdb_sys_membarrier; */
> + /* case 284: return gdb_sys_mlock2; */
> + /* case 285: return gdb_sys_copy_file_range; */
> + /* case 286: return gdb_sys_preadv2; */
> + /* case 287: return gdb_sys_pwritev2; */
> + /* case 288: return gdb_sys_pkey_mprotect; */
> + /* case 289: return gdb_sys_pkey_alloc; */
> + /* case 290: return gdb_sys_pkey_free; */
> + case 291: return gdb_sys_statx;
> + /* case 292: return gdb_sys_io_pgetevents; */
> + /* case 293: return gdb_sys_rseq; */
> + /* case 294: return gdb_sys_kexec_file_load; */
> + /* case 424: return gdb_sys_pidfd_send_signal; */
> + /* case 425: return gdb_sys_io_uring_setup; */
> + /* case 426: return gdb_sys_io_uring_enter; */
> + /* case 427: return gdb_sys_io_uring_register; */
> + /* case 428: return gdb_sys_open_tree; */
> + /* case 429: return gdb_sys_move_mount; */
> + /* case 430: return gdb_sys_fsopen; */
> + /* case 431: return gdb_sys_fsconfig; */
> + /* case 432: return gdb_sys_fsmount; */
> + /* case 433: return gdb_sys_fspick; */
> + /* case 434: return gdb_sys_pidfd_open; */
> + /* case 435: return gdb_sys_clone3; */
> + /* case 436: return gdb_sys_close_range; */
> + /* case 437: return gdb_sys_openat2; */
> + /* case 438: return gdb_sys_pidfd_getfd; */
> + /* case 439: return gdb_sys_faccessat2; */
> + /* case 440: return gdb_sys_process_madvise; */
> + /* case 441: return gdb_sys_epoll_pwait2; */
> + /* case 442: return gdb_sys_mount_setattr; */
> + /* case 443: return gdb_sys_quotactl_fd; */
> + /* case 444: return gdb_sys_landlock_create_ruleset; */
> + /* case 445: return gdb_sys_landlock_add_rule; */
> + /* case 446: return gdb_sys_landlock_restrict_self; */
> + /* case 447: return gdb_sys_memfd_secret; */
> + /* case 448: return gdb_sys_process_mrelease; */
> + /* case 449: return gdb_sys_futex_waitv; */
> + /* case 450: return gdb_sys_set_mempolicy_home_node; */
> + default:
> + return gdb_sys_no_syscall;
> + }
> +}
> diff --git a/gdb/riscv-linux-tdep.c b/gdb/riscv-linux-tdep.c
> index 12cab06f276..ebaed9b4508 100644
> --- a/gdb/riscv-linux-tdep.c
> +++ b/gdb/riscv-linux-tdep.c
> @@ -187,9 +187,11 @@ static linux_record_tdep riscv_linux_record_tdep;
> using regnum_type = int;
>
> static bool
> -save_registers (struct regcache *regcache, regnum_type fir, regnum_type last)
> +save_registers (struct regcache *regcache, regnum_type first, regnum_type last)
> {
> - for (regnum_type i = fir; i != last; ++i)
> + gdb_assert (regcache != nullptr);
> +
> + for (regnum_type i = first; i != last; ++i)
> if (record_full_arch_list_add_reg (regcache, i))
> return false;
> return true;
> @@ -198,6 +200,8 @@ save_registers (struct regcache *regcache, regnum_type fir, regnum_type last)
> static bool
> riscv_all_but_pc_registers_record (struct regcache *regcache)
> {
> + gdb_assert (regcache != nullptr);
> +
> auto &&gdbarch = regcache->arch ();
> auto &&tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
> auto &&features = tdep->isa_features;
> @@ -219,12 +223,12 @@ static int
> riscv_linux_syscall_record (struct regcache *regcache,
> unsigned long svc_number)
> {
> + gdb_assert (regcache != nullptr);
> +
> auto syscall_gdb = riscv64_canonicalize_syscall (svc_number);
>
> if (record_debug > 1)
> - {
> - gdb_printf (gdb_stdlog, "Made syscall %s.\n", plongest (svc_number));
> - }
> + gdb_printf (gdb_stdlog, "Made syscall %s.\n", plongest (svc_number));
>
> if (syscall_gdb == gdb_sys_no_syscall)
> {
> @@ -258,9 +262,11 @@ riscv_linux_syscall_record (struct regcache *regcache,
> /* These values are the size of the type that will be used in a system
> call. They are obtained from Linux Kernel source. */
> static void
> -riscv64_linux_record_tdep_init (
> - struct gdbarch *gdbarch, struct linux_record_tdep &riscv_linux_record_tdep)
> +riscv64_linux_record_tdep_init (struct gdbarch *gdbarch,
> + struct linux_record_tdep &riscv_linux_record_tdep)
> {
> + gdb_assert (gdbarch != nullptr);
> +
> /* Initialize the riscv_linux_record_tdep. */
> /* These values are the size of the type that will be used in a system
> call. They are obtained from Linux Kernel source. */
> @@ -427,7 +433,7 @@ riscv64_linux_record_tdep_init (
> static void
> riscv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> {
> - riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
> + auto tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
>
> linux_init_abi (info, gdbarch, 0);
>
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index c6c7b7a63fd..37ec30fff91 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -4843,7 +4843,7 @@ this option can be used."),
> static bool
> try_read (struct regcache *regcache, int regnum, ULONGEST &addr)
> {
> - gdb_assert (regcache);
> + gdb_assert (regcache != nullptr);
>
> if (regcache->raw_read<ULONGEST> (regnum, &addr)
> != register_status::REG_VALID)
> @@ -4964,12 +4964,10 @@ class riscv_recorded_insn final
> read_reg (struct regcache *regcache, regnum_type reg,
> ULONGEST &addr) noexcept
> {
> - gdb_assert (regcache);
> + gdb_assert (regcache != nullptr);
>
> if (!try_read (regcache, reg, addr))
> - {
> - return set_error ();
> - }
> + return set_error ();
> return true;
> }
>
> @@ -5143,14 +5141,14 @@ class riscv_recorded_insn final
> bool
> try_save_pc_mem (ULONGEST ival, struct regcache *regcache) noexcept
> {
> - gdb_assert (regcache);
> + gdb_assert (regcache != nullptr);
>
> - mem_addr addr = 0;
> + auto addr = mem_addr{};
> auto len = need_save_pc_mem (ival);
> if (len <= 0)
> return false;
>
> - mem_len offset = EXTRACT_STYPE_IMM (ival);
> + auto offset = mem_len{EXTRACT_STYPE_IMM (ival)};
> return !read_reg (regcache, decode_rs1 (ival), addr)
> || !save_mem (addr + offset, len) || set_ordinary_record_type ();
> }
> @@ -5178,10 +5176,10 @@ class riscv_recorded_insn final
> bool
> try_save_pc_rd_mem (ULONGEST ival, struct regcache *regcache) noexcept
> {
> - gdb_assert (regcache);
> + gdb_assert (regcache != nullptr);
>
> auto len = need_save_pc_rd_mem (ival);
> - mem_addr addr = 0;
> + auto addr = mem_addr{};
> if (len <= 0)
> return false;
>
> @@ -5205,9 +5203,9 @@ class riscv_recorded_insn final
> bool
> try_save_pc_rs2_rd_mem (ULONGEST ival, struct regcache *regcache) noexcept
> {
> - gdb_assert (regcache);
> + gdb_assert (regcache != nullptr);
>
> - mem_addr addr = 0;
> + auto addr = mem_addr{};
> auto len = need_save_pc_rs2_rd_mem (ival);
> if (len <= 0)
> return false;
> @@ -5222,7 +5220,7 @@ class riscv_recorded_insn final
> bool
> record_insn_len4 (ULONGEST ival, struct regcache *regcache) noexcept
> {
> - gdb_assert (regcache);
> + gdb_assert (regcache != nullptr);
>
> if (is_ecall_insn (ival))
> {
> @@ -5240,9 +5238,7 @@ class riscv_recorded_insn final
> || try_save_pc_rd_csr (ival) || try_save_pc_mem (ival, regcache)
> || try_save_pc_rd_mem (ival, regcache)
> || try_save_pc_rs2_rd_mem (ival, regcache))
> - {
> - return !has_error ();
> - }
> + return !has_error ();
>
> warning (_ ("Currently this instruction with len 4(%lx) is unsupported"),
> ival);
> @@ -5255,10 +5251,10 @@ class riscv_recorded_insn final
> record_insn_len2 (ULONGEST ival, struct regcache *regcache,
> struct gdbarch *gdbarch) noexcept
> {
> - gdb_assert (regcache);
> - gdb_assert (gdbarch);
> + gdb_assert (regcache != nullptr);
> + gdb_assert (gdbarch != nullptr);
>
> - mem_addr addr = 0;
> + auto addr = mem_addr{};
> auto xlen = riscv_isa_xlen (gdbarch);
>
> /* The order here is very important, because
> @@ -5266,100 +5262,70 @@ class riscv_recorded_insn final
>
> if (is_c_addi4spn_insn (ival) || is_c_lw_insn (ival)
> || (xlen == 8 && is_c_ld_insn (ival)))
> - {
> - return !save_reg (decode_crs2_short (ival))
> - || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs2_short (ival))
> + || set_ordinary_record_type ();
>
> if (is_c_fld_insn (ival) || (xlen == 4 && is_c_flw_insn (ival)))
> - {
> - return !save_reg (RISCV_FIRST_FP_REGNUM + decode_crs2_short (ival))
> - || set_ordinary_record_type ();
> - }
> + return !save_reg (RISCV_FIRST_FP_REGNUM + decode_crs2_short (ival))
> + || set_ordinary_record_type ();
>
> if (is_c_fsd_insn (ival) || (xlen == 8 && is_c_sd_insn (ival)))
> {
> - int offset = EXTRACT_CLTYPE_LD_IMM (ival);
> + auto offset = int{EXTRACT_CLTYPE_LD_IMM (ival)};
> return !read_reg (regcache, decode_crs1_short (ival), addr)
> || !save_mem (addr + offset, 8) || set_ordinary_record_type ();
> }
>
> if ((xlen == 4 && is_c_fsw_insn (ival)) || is_c_sw_insn (ival))
> {
> - int offset = EXTRACT_CLTYPE_LW_IMM (ival);
> + auto offset = int{EXTRACT_CLTYPE_LW_IMM (ival)};
> return !read_reg (regcache, decode_crs1_short (ival), addr)
> || !save_mem (addr + offset, 4) || set_ordinary_record_type ();
> }
>
> if (is_c_nop_insn (ival))
> - {
> - return set_ordinary_record_type ();
> - }
> + return set_ordinary_record_type ();
>
> if (is_c_addi_insn (ival))
> - {
> - return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
>
> if (xlen == 4 && is_c_jal_insn (ival))
> - {
> - return !save_reg (RISCV_RA_REGNUM) || set_ordinary_record_type ();
> - }
> + return !save_reg (RISCV_RA_REGNUM) || set_ordinary_record_type ();
>
> if ((xlen == 8 && is_c_addiw_insn (ival)) || is_c_li_insn (ival))
> - {
> - return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
>
> if (is_c_addi16sp_insn (ival))
> - {
> - return !save_reg (RISCV_SP_REGNUM) || set_ordinary_record_type ();
> - }
> + return !save_reg (RISCV_SP_REGNUM) || set_ordinary_record_type ();
>
> if (is_c_lui_insn (ival))
> - {
> - return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
>
> if (is_c_srli_insn (ival) || is_c_srai_insn (ival) || is_c_andi_insn (ival)
> || is_c_sub_insn (ival) || is_c_xor_insn (ival) || is_c_or_insn (ival)
> || is_c_and_insn (ival) || (xlen == 8 && is_c_subw_insn (ival))
> || (xlen == 8 && is_c_addw_insn (ival)))
> - {
> - return !save_reg (decode_crs1_short (ival))
> - || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs1_short (ival))
> + || set_ordinary_record_type ();
>
> if (is_c_j_insn (ival) || is_c_beqz_insn (ival) || is_c_bnez_insn (ival))
> - {
> - return set_ordinary_record_type ();
> - }
> + return set_ordinary_record_type ();
>
> if (is_c_slli_insn (ival))
> - {
> - return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
>
> if (is_c_fldsp_insn (ival) || (xlen == 4 && is_c_flwsp_insn (ival)))
> - {
> - return !save_reg (RISCV_FIRST_FP_REGNUM + decode_crs1 (ival))
> - || set_ordinary_record_type ();
> - }
> + return !save_reg (RISCV_FIRST_FP_REGNUM + decode_crs1 (ival))
> + || set_ordinary_record_type ();
>
> if (is_c_lwsp_insn (ival) || (xlen == 8 && is_c_ldsp_insn (ival)))
> - {
> - return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
>
> if (is_c_jr_insn (ival))
> - {
> - return set_ordinary_record_type ();
> - }
> + return set_ordinary_record_type ();
>
> if (is_c_mv_insn (ival))
> - {
> - return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
>
> if (is_c_ebreak_insn (ival))
> {
> @@ -5368,25 +5334,21 @@ class riscv_recorded_insn final
> }
>
> if (is_c_jalr_insn (ival))
> - {
> - return !save_reg (RISCV_RA_REGNUM) || set_ordinary_record_type ();
> - }
> + return !save_reg (RISCV_RA_REGNUM) || set_ordinary_record_type ();
>
> if (is_c_add_insn (ival))
> - {
> - return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
> - }
> + return !save_reg (decode_crs1 (ival)) || set_ordinary_record_type ();
>
> if (is_c_fsdsp_insn (ival) || (xlen == 8 && is_c_sdsp_insn (ival)))
> {
> - int offset = EXTRACT_CSSTYPE_SDSP_IMM (ival);
> + auto offset = int{EXTRACT_CSSTYPE_SDSP_IMM (ival)};
> return !read_reg (regcache, RISCV_SP_REGNUM, addr)
> || !save_mem (addr + offset, 8) || set_ordinary_record_type ();
> }
>
> if (is_c_swsp_insn (ival) || (xlen == 4 && is_c_fswsp_insn (ival)))
> {
> - int offset = EXTRACT_CSSTYPE_SWSP_IMM (ival);
> + auto offset = int{EXTRACT_CSSTYPE_SWSP_IMM (ival)};
> return !read_reg (regcache, RISCV_SP_REGNUM, addr)
> || !save_mem (addr + offset, 4) || set_ordinary_record_type ();
> }
> @@ -5403,7 +5365,10 @@ class riscv_recorded_insn final
> bool
> record (gdbarch *gdbarch, struct regcache *regcache, CORE_ADDR addr) noexcept
> {
> - int m_length = 0;
> + gdb_assert (gdbarch != nullptr);
> + gdb_assert (regcache != nullptr);
> +
> + auto m_length = int{};
> auto ival = riscv_insn::fetch_instruction (gdbarch, addr, &m_length);
> if (!save_reg (RISCV_PC_REGNUM))
> return false;
> @@ -5458,9 +5423,10 @@ static int
> riscv_make_record_process (struct gdbarch *gdbarch, struct regcache *regcache,
> const riscv_recorded_insn &insn)
> {
> - gdb_assert (gdbarch && regcache);
> + gdb_assert (gdbarch != nullptr);
> + gdb_assert (regcache != nullptr);
>
> - riscv_gdbarch_tdep *tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
> + auto tdep = gdbarch_tdep<riscv_gdbarch_tdep> (gdbarch);
> auto regs_begin = insn.regs_begin ();
> auto regs_end = insn.regs_end ();
> if (std::any_of (regs_begin, regs_end, [&regcache] (auto &&reg_it) {
> @@ -5487,11 +5453,9 @@ riscv_make_record_process (struct gdbarch *gdbarch, struct regcache *regcache,
> warning (_ ("Syscall record is not supported"));
> return -1;
> }
> - ULONGEST reg_val = 0;
> + auto reg_val = ULONGEST{};
> if (!try_read (regcache, RISCV_A7_REGNUM, reg_val))
> - {
> - return -1;
> - }
> + return -1;
> return tdep->riscv_syscall_record (regcache, reg_val);
> }
>
> @@ -5508,7 +5472,8 @@ int
> riscv_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
> CORE_ADDR addr)
> {
> - gdb_assert (gdbarch && regcache);
> + gdb_assert (gdbarch != nullptr);
> + gdb_assert (regcache != nullptr);
>
> riscv_recorded_insn insn;
> if (!insn.record (gdbarch, regcache, addr))
> @@ -5520,9 +5485,7 @@ riscv_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
> auto ret_val = riscv_make_record_process (gdbarch, regcache, insn);
>
> if (record_full_arch_list_add_end ())
> - {
> - return -1;
> - }
> + return -1;
>
> return ret_val;
> }
> --
> 2.34.1
>