This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 10/10] Add --enable-ubsan
> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>
> Date: Mon, 1 Oct 2018 22:44:20 -0600
>
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -103,6 +103,14 @@ CSKY GNU/LINUX csky*-*-linux
> ** The gdb.Progspace type has a new 'objfiles' method, which returns the list
> of objfiles associated to that program space.
>
> +* Configure changes
> +
> +--enable-ubsan
> +
> + Enable or disable the undefined behavior sanitizer. Release
> + versions of gdb disable this by default, but development versions
"GDB", capitalized, I guess?
> --- a/gdb/README
> +++ b/gdb/README
> @@ -538,6 +538,13 @@ more obscure GDB `configure' options are not listed here.
> the compiler, which will fail the compilation if the compiler
> outputs any warning messages.
>
> +`--enable-ubsan'
> + Enable the GCC undefined behavior sanitizer. By default this is
> + disabled in GDB releases, but enabled when building from git.
> + The undefined behavior sanitizer checks for C++ undefined
> + behavior. It has a performance cost, so if you are looking at
> + GDB's performance, you should disable it.
Does this require some minimal version of g++? If so, I think we
should mention that. And what about testing for this support at
configure time?
> +
> +# ac_fn_cxx_try_link LINENO
> +# -------------------------
> +# Try to link conftest.$ac_ext, and return whether this succeeded.
> +ac_fn_cxx_try_link ()
> +{
> + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
> + rm -f conftest.$ac_objext conftest$ac_exeext
> + if { { ac_try="$ac_link"
> +case "(($ac_try" in
> + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
> + *) ac_try_echo=$ac_try;;
> +esac
> +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
> +$as_echo "$ac_try_echo"; } >&5
> + (eval "$ac_link") 2>conftest.err
> + ac_status=$?
> + if test -s conftest.err; then
> + grep -v '^ *+' conftest.err >conftest.er1
> + cat conftest.er1 >&5
> + mv -f conftest.er1 conftest.err
> + fi
> + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
> + test $ac_status = 0; } && {
> + test -z "$ac_cxx_werror_flag" ||
> + test ! -s conftest.err
> + } && test -s conftest$ac_exeext && {
> + test "$cross_compiling" = yes ||
> + test -x conftest$ac_exeext
> + }; then :
> + ac_retval=0
> +else
> + $as_echo "$as_me: failed program was:" >&5
> +sed 's/^/| /' conftest.$ac_ext >&5
> +
> + ac_retval=1
> +fi
> + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
> + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
> + # interfere with the next link command; also delete a directory that is
> + # left behind by Apple's compiler. We do this before executing the actions.
> + rm -rf conftest.dSYM conftest_ipa8_conftest.oo
> + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
> + as_fn_set_status $ac_retval
> +
> +} # ac_fn_cxx_try_link
> cat >config.log <<_ACEOF
> This file contains any messages produced by compilers while
> running configure, to aid debugging if configure makes a mistake.
Is this hunk related to the issue at hand?
The documentation parts are approved, with the above nits fixed.
Thanks.