mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-18 12:24:38 +08:00
Fix format_pieces selftest on Windows
The format_pieces selftest currently fails on Windows hosts. The selftest doesn't handle the "%ll" -> "%I64" rewrite that the formatter may perform, but also gdbsupport was missing a configure check for PRINTF_HAS_LONG_LONG. This patch fixes both issues.
This commit is contained in:
parent
05fb05a947
commit
5dfe4bfcb9
92
gdb/configure
vendored
92
gdb/configure
vendored
@ -15282,6 +15282,52 @@ fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if the compiler and runtime support printing long longs.
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long support in printf" >&5
|
||||
$as_echo_n "checking for long long support in printf... " >&6; }
|
||||
if ${gdb_cv_printf_has_long_long+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
gdb_cv_printf_has_long_long=no
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char buf[32];
|
||||
long long l = 0;
|
||||
l = (l << 16) + 0x0123;
|
||||
l = (l << 16) + 0x4567;
|
||||
l = (l << 16) + 0x89ab;
|
||||
l = (l << 16) + 0xcdef;
|
||||
sprintf (buf, "0x%016llx", l);
|
||||
return (strcmp ("0x0123456789abcdef", buf));
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
gdb_cv_printf_has_long_long=yes
|
||||
else
|
||||
gdb_cv_printf_has_long_long=no
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_printf_has_long_long" >&5
|
||||
$as_echo "$gdb_cv_printf_has_long_long" >&6; }
|
||||
if test "$gdb_cv_printf_has_long_long" = yes; then
|
||||
|
||||
$as_echo "#define PRINTF_HAS_LONG_LONG 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
$as_echo "#define _STRUCTURED_PROC 1" >>confdefs.h
|
||||
|
||||
@ -16176,52 +16222,6 @@ if test "$gdb_cv_c_long_long" != yes; then
|
||||
as_fn_error $? "Compiler must support long long for GDB." "$LINENO" 5
|
||||
fi
|
||||
|
||||
# Check if the compiler and runtime support printing long longs.
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long support in printf" >&5
|
||||
$as_echo_n "checking for long long support in printf... " >&6; }
|
||||
if ${gdb_cv_printf_has_long_long+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
gdb_cv_printf_has_long_long=no
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char buf[32];
|
||||
long long l = 0;
|
||||
l = (l << 16) + 0x0123;
|
||||
l = (l << 16) + 0x4567;
|
||||
l = (l << 16) + 0x89ab;
|
||||
l = (l << 16) + 0xcdef;
|
||||
sprintf (buf, "0x%016llx", l);
|
||||
return (strcmp ("0x0123456789abcdef", buf));
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
gdb_cv_printf_has_long_long=yes
|
||||
else
|
||||
gdb_cv_printf_has_long_long=no
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_printf_has_long_long" >&5
|
||||
$as_echo "$gdb_cv_printf_has_long_long" >&6; }
|
||||
if test "$gdb_cv_printf_has_long_long" = yes; then
|
||||
|
||||
$as_echo "#define PRINTF_HAS_LONG_LONG 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
# Check if the compiler and runtime support printing decfloats.
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for decfloat support in printf" >&5
|
||||
|
@ -1513,27 +1513,6 @@ if test "$gdb_cv_c_long_long" != yes; then
|
||||
AC_MSG_ERROR([Compiler must support long long for GDB.])
|
||||
fi
|
||||
|
||||
# Check if the compiler and runtime support printing long longs.
|
||||
|
||||
AC_CACHE_CHECK([for long long support in printf],
|
||||
gdb_cv_printf_has_long_long,
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
|
||||
[[char buf[32];
|
||||
long long l = 0;
|
||||
l = (l << 16) + 0x0123;
|
||||
l = (l << 16) + 0x4567;
|
||||
l = (l << 16) + 0x89ab;
|
||||
l = (l << 16) + 0xcdef;
|
||||
sprintf (buf, "0x%016llx", l);
|
||||
return (strcmp ("0x0123456789abcdef", buf));]])],
|
||||
gdb_cv_printf_has_long_long=yes,
|
||||
gdb_cv_printf_has_long_long=no,
|
||||
gdb_cv_printf_has_long_long=no)])
|
||||
if test "$gdb_cv_printf_has_long_long" = yes; then
|
||||
AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
|
||||
[Define to 1 if the "%ll" format works to print long longs.])
|
||||
fi
|
||||
|
||||
# Check if the compiler and runtime support printing decfloats.
|
||||
|
||||
AC_CACHE_CHECK([for decfloat support in printf],
|
||||
|
@ -21,6 +21,12 @@
|
||||
#include "gdbsupport/format.h"
|
||||
#include "gdbsupport/selftest.h"
|
||||
|
||||
#if USE_PRINTF_I64
|
||||
#define LL "I64"
|
||||
#else
|
||||
#define LL "ll"
|
||||
#endif
|
||||
|
||||
namespace selftests {
|
||||
namespace format_pieces {
|
||||
|
||||
@ -55,7 +61,7 @@ test_format_specifier ()
|
||||
{
|
||||
format_piece ("Hello\t ", literal_piece, 0),
|
||||
format_piece ("%d", int_arg, 0),
|
||||
format_piece ("%llx", long_long_arg, 0), /* ARI: %ll */
|
||||
format_piece ("%" LL "x", long_long_arg, 0),
|
||||
format_piece ("%%d", literal_piece, 0),
|
||||
format_piece ("%d", int_arg, 0),
|
||||
});
|
||||
@ -87,7 +93,7 @@ test_format_int_sizes ()
|
||||
format_piece ("Hello\t ", literal_piece, 0),
|
||||
format_piece ("%hu", int_arg, 0),
|
||||
format_piece ("%lu", long_arg, 0),
|
||||
format_piece ("%llu", long_long_arg, 0), /* ARI: %ll */
|
||||
format_piece ("%" LL "u", long_long_arg, 0),
|
||||
format_piece ("%zu", size_t_arg, 0)
|
||||
});
|
||||
|
||||
@ -96,7 +102,7 @@ test_format_int_sizes ()
|
||||
format_piece ("Hello\t ", literal_piece, 0),
|
||||
format_piece ("%hx", int_arg, 0),
|
||||
format_piece ("%lx", long_arg, 0),
|
||||
format_piece ("%llx", long_long_arg, 0), /* ARI: %ll */
|
||||
format_piece ("%" LL "x", long_long_arg, 0),
|
||||
format_piece ("%zx", size_t_arg, 0)
|
||||
});
|
||||
|
||||
@ -105,7 +111,7 @@ test_format_int_sizes ()
|
||||
format_piece ("Hello\t ", literal_piece, 0),
|
||||
format_piece ("%ho", int_arg, 0),
|
||||
format_piece ("%lo", long_arg, 0),
|
||||
format_piece ("%llo", long_long_arg, 0), /* ARI: %ll */
|
||||
format_piece ("%" LL "o", long_long_arg, 0),
|
||||
format_piece ("%zo", size_t_arg, 0)
|
||||
});
|
||||
|
||||
@ -114,7 +120,7 @@ test_format_int_sizes ()
|
||||
format_piece ("Hello\t ", literal_piece, 0),
|
||||
format_piece ("%hd", int_arg, 0),
|
||||
format_piece ("%ld", long_arg, 0),
|
||||
format_piece ("%lld", long_long_arg, 0), /* ARI: %ll */
|
||||
format_piece ("%" LL "d", long_long_arg, 0),
|
||||
format_piece ("%zd", size_t_arg, 0)
|
||||
});
|
||||
}
|
||||
|
@ -163,6 +163,27 @@ AC_DEFUN([GDB_AC_COMMON], [
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if the compiler and runtime support printing long longs.
|
||||
|
||||
AC_CACHE_CHECK([for long long support in printf],
|
||||
gdb_cv_printf_has_long_long,
|
||||
[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
|
||||
[[char buf[32];
|
||||
long long l = 0;
|
||||
l = (l << 16) + 0x0123;
|
||||
l = (l << 16) + 0x4567;
|
||||
l = (l << 16) + 0x89ab;
|
||||
l = (l << 16) + 0xcdef;
|
||||
sprintf (buf, "0x%016llx", l);
|
||||
return (strcmp ("0x0123456789abcdef", buf));]])],
|
||||
gdb_cv_printf_has_long_long=yes,
|
||||
gdb_cv_printf_has_long_long=no,
|
||||
gdb_cv_printf_has_long_long=no)])
|
||||
if test "$gdb_cv_printf_has_long_long" = yes; then
|
||||
AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
|
||||
[Define to 1 if the "%ll" format works to print long longs.])
|
||||
fi
|
||||
|
||||
BFD_SYS_PROCFS_H
|
||||
if test "$ac_cv_header_sys_procfs_h" = yes; then
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
|
||||
|
@ -321,6 +321,9 @@
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if the "%ll" format works to print long longs. */
|
||||
#undef PRINTF_HAS_LONG_LONG
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
#undef PTHREAD_CREATE_JOINABLE
|
||||
|
46
gdbsupport/configure
vendored
46
gdbsupport/configure
vendored
@ -9571,6 +9571,52 @@ fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if the compiler and runtime support printing long longs.
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long support in printf" >&5
|
||||
$as_echo_n "checking for long long support in printf... " >&6; }
|
||||
if ${gdb_cv_printf_has_long_long+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
if test "$cross_compiling" = yes; then :
|
||||
gdb_cv_printf_has_long_long=no
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$ac_includes_default
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char buf[32];
|
||||
long long l = 0;
|
||||
l = (l << 16) + 0x0123;
|
||||
l = (l << 16) + 0x4567;
|
||||
l = (l << 16) + 0x89ab;
|
||||
l = (l << 16) + 0xcdef;
|
||||
sprintf (buf, "0x%016llx", l);
|
||||
return (strcmp ("0x0123456789abcdef", buf));
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_run "$LINENO"; then :
|
||||
gdb_cv_printf_has_long_long=yes
|
||||
else
|
||||
gdb_cv_printf_has_long_long=no
|
||||
fi
|
||||
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gdb_cv_printf_has_long_long" >&5
|
||||
$as_echo "$gdb_cv_printf_has_long_long" >&6; }
|
||||
if test "$gdb_cv_printf_has_long_long" = yes; then
|
||||
|
||||
$as_echo "#define PRINTF_HAS_LONG_LONG 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
$as_echo "#define _STRUCTURED_PROC 1" >>confdefs.h
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user