From 0702d0d3e8313c1dc588ee5326b3f8af1cfe9a4d Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Mon, 17 Sep 2018 18:38:14 -0400 Subject: [PATCH] Rebase to FSF GDB 8.2.50.20180917 (8.3pre). Add 'gdb-rhbz795424-bitpos-arrayview.patch'. --- .gitignore | 2 +- _gdb.spec.Patch.include | 33 +- _gdb.spec.patch.include | 9 - _git_upstream_commit | 2 +- _patch_order | 11 +- gdb-6.3-gstack-20050411.patch | 6 +- gdb-6.3-readnever-20050907.patch | 2 +- gdb-6.5-bz216711-clone-is-outermost.patch | 2 +- ...379-solib-trampoline-lookup-lock-fix.patch | 2 +- gdb-6.6-buildid-locate-core-as-arg.patch | 27 +- ...warning-missing-debuginfo-rhbz981154.patch | 2 +- ...buildid-locate-rpm-librpm-workaround.patch | 2 +- gdb-6.6-buildid-locate-rpm-scl.patch | 12 +- gdb-6.6-buildid-locate-rpm.patch | 20 +- ...6.6-buildid-locate-solib-missing-ids.patch | 4 +- gdb-6.6-buildid-locate.patch | 72 +- gdb-6.8-quit-never-aborts.patch | 4 +- gdb-archer-pie-addons-keep-disabled.patch | 6 +- gdb-archer-pie-addons.patch | 12 +- gdb-archer.patch | 36 +- gdb-attach-fail-reasons-5of5.patch | 12 +- gdb-btrobust.patch | 6 +- gdb-bz1219747-attach-kills.patch | 16 +- gdb-bz533176-fortran-omp-step.patch | 4 +- gdb-bz541866-rwatch-before-run.patch | 8 +- gdb-bz568248-oom-is-error.patch | 2 +- gdb-container-rh-pkg.patch | 2 +- gdb-fedora-libncursesw.patch | 12 +- gdb-follow-child-stale-parent.patch | 2 +- gdb-glibc-strstr-workaround.patch | 2 +- gdb-gnat-dwarf-crash-3of3.patch | 18 +- gdb-jit-reader-multilib.patch | 4 +- gdb-linux_perf-bundle.patch | 4 +- gdb-moribund-utrace-workaround.patch | 4 +- gdb-python-gil.patch | 26 +- gdb-rhbz1187581-power8-regs-1of7.patch | 65 - gdb-rhbz1187581-power8-regs-2of7.patch | 45 - gdb-rhbz1187581-power8-regs-3of7.patch | 258 --- gdb-rhbz1187581-power8-regs-4of7.patch | 449 ---- gdb-rhbz1187581-power8-regs-5of7.patch | 215 -- gdb-rhbz1187581-power8-regs-6of7.patch | 187 -- gdb-rhbz1187581-power8-regs-7of7.patch | 129 -- gdb-rhbz795424-bitpos-20of25.patch | 204 +- gdb-rhbz795424-bitpos-21of25.patch | 6 +- gdb-rhbz795424-bitpos-22of25.patch | 46 +- gdb-rhbz795424-bitpos-23of25.patch | 56 +- gdb-rhbz795424-bitpos-arrayview.patch | 60 + gdb-rhbz881849-ipv6-1of3.patch | 1934 ----------------- gdb-rhbz881849-ipv6-2of3.patch | 54 - gdb-rhbz881849-ipv6-3of3.patch | 72 - gdb-vla-intel-fortran-strides.patch | 91 +- gdb-vla-intel-fortran-vla-strings.patch | 50 +- gdb-vla-intel-stringbt-fix.patch | 2 +- gdb.spec | 10 +- sources | 2 +- 55 files changed, 483 insertions(+), 3840 deletions(-) delete mode 100644 gdb-rhbz1187581-power8-regs-1of7.patch delete mode 100644 gdb-rhbz1187581-power8-regs-2of7.patch delete mode 100644 gdb-rhbz1187581-power8-regs-3of7.patch delete mode 100644 gdb-rhbz1187581-power8-regs-4of7.patch delete mode 100644 gdb-rhbz1187581-power8-regs-5of7.patch delete mode 100644 gdb-rhbz1187581-power8-regs-6of7.patch delete mode 100644 gdb-rhbz1187581-power8-regs-7of7.patch create mode 100644 gdb-rhbz795424-bitpos-arrayview.patch delete mode 100644 gdb-rhbz881849-ipv6-1of3.patch delete mode 100644 gdb-rhbz881849-ipv6-2of3.patch delete mode 100644 gdb-rhbz881849-ipv6-3of3.patch diff --git a/.gitignore b/.gitignore index 949c204..912afa8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz -/gdb-8.1.90.20180727.tar.xz /v2.0.tar.gz +/gdb-8.2.50.20180917.tar.xz diff --git a/_gdb.spec.Patch.include b/_gdb.spec.Patch.include index b3c5633..47bf685 100644 --- a/_gdb.spec.Patch.include +++ b/_gdb.spec.Patch.include @@ -504,33 +504,8 @@ Patch120: gdb-vla-intel-fix-print-char-array.patch # =fedoratest Patch121: gdb-rhbz1553104-s390x-arch12-test.patch -# Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior). -Patch122: gdb-rhbz881849-ipv6-1of3.patch - - -Patch123: gdb-rhbz881849-ipv6-2of3.patch - - -Patch124: gdb-rhbz881849-ipv6-3of3.patch - -# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). -Patch125: gdb-rhbz1187581-power8-regs-1of7.patch - -# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). -Patch126: gdb-rhbz1187581-power8-regs-2of7.patch - -# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). -Patch127: gdb-rhbz1187581-power8-regs-3of7.patch - -# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). -Patch128: gdb-rhbz1187581-power8-regs-4of7.patch - -# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). -Patch129: gdb-rhbz1187581-power8-regs-5of7.patch - -# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). -Patch130: gdb-rhbz1187581-power8-regs-6of7.patch - -# Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). -Patch131: gdb-rhbz1187581-power8-regs-7of7.patch +# This patch is needed to compile GDB after -Werror=narrowing has +# been enabled by default. +# Author: Sergio Durigan Junior. +Patch122: gdb-rhbz795424-bitpos-arrayview.patch diff --git a/_gdb.spec.patch.include b/_gdb.spec.patch.include index ca390b7..131cf93 100644 --- a/_gdb.spec.patch.include +++ b/_gdb.spec.patch.include @@ -120,12 +120,3 @@ %patch120 -p1 %patch121 -p1 %patch122 -p1 -%patch123 -p1 -%patch124 -p1 -%patch125 -p1 -%patch126 -p1 -%patch127 -p1 -%patch128 -p1 -%patch129 -p1 -%patch130 -p1 -%patch131 -p1 diff --git a/_git_upstream_commit b/_git_upstream_commit index 06f33fd..5d82e25 100644 --- a/_git_upstream_commit +++ b/_git_upstream_commit @@ -1 +1 @@ -ab080c102869dd3ad300a99d0c00b256404fd76b +e08ef628a7e3098699ec6939584e2c9f7a9e1952 diff --git a/_patch_order b/_patch_order index ec2f86f..4d199ce 100644 --- a/_patch_order +++ b/_patch_order @@ -119,13 +119,4 @@ gdb-testsuite-readline63-sigint.patch gdb-archer.patch gdb-vla-intel-fix-print-char-array.patch gdb-rhbz1553104-s390x-arch12-test.patch -gdb-rhbz881849-ipv6-1of3.patch -gdb-rhbz881849-ipv6-2of3.patch -gdb-rhbz881849-ipv6-3of3.patch -gdb-rhbz1187581-power8-regs-1of7.patch -gdb-rhbz1187581-power8-regs-2of7.patch -gdb-rhbz1187581-power8-regs-3of7.patch -gdb-rhbz1187581-power8-regs-4of7.patch -gdb-rhbz1187581-power8-regs-5of7.patch -gdb-rhbz1187581-power8-regs-6of7.patch -gdb-rhbz1187581-power8-regs-7of7.patch +gdb-rhbz795424-bitpos-arrayview.patch diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 37b09de..523d0d0 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -16,7 +16,7 @@ Subject: gdb-6.3-gstack-20050411.patch diff --git a/gdb/Makefile.in b/gdb/Makefile.in --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -1735,7 +1735,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force +@@ -1732,7 +1732,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force install: all @$(MAKE) $(FLAGS_TO_PASS) install-only @@ -25,7 +25,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e "$$t"` ; \ if test "x$$transformed_name" = x; then \ -@@ -1784,7 +1784,25 @@ install-guile: +@@ -1781,7 +1781,25 @@ install-guile: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -52,7 +52,7 @@ diff --git a/gdb/Makefile.in b/gdb/Makefile.in transformed_name=`t='$(program_transform_name)'; \ echo gdb | sed -e $$t` ; \ if test "x$$transformed_name" = x; then \ -@@ -1807,6 +1825,18 @@ uninstall: force $(CONFIG_UNINSTALL) +@@ -1804,6 +1822,18 @@ uninstall: force $(CONFIG_UNINSTALL) fi @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch index b70b58f..8a51aef 100644 --- a/gdb-6.3-readnever-20050907.patch +++ b/gdb-6.3-readnever-20050907.patch @@ -32,4 +32,4 @@ diff --git a/gdb/gcore.in b/gdb/gcore.in + "$binary_path/@GDB_TRANSFORM_NAME@" xsave_xcr0_offset = -1; diff --git a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch index 45d8570..20577ed 100644 --- a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch +++ b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch @@ -11,7 +11,7 @@ https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 diff --git a/gdb/symtab.c b/gdb/symtab.c --- a/gdb/symtab.c +++ b/gdb/symtab.c -@@ -3165,6 +3165,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) +@@ -3166,6 +3166,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) SYMBOL_LINKAGE_NAME (msymbol)); */ ; /* fall through */ diff --git a/gdb-6.6-buildid-locate-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch index 40938a5..5876a47 100644 --- a/gdb-6.6-buildid-locate-core-as-arg.patch +++ b/gdb-6.6-buildid-locate-core-as-arg.patch @@ -85,7 +85,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c #include #include "readline/readline.h" -@@ -357,12 +358,27 @@ exec_file_attach (const char *filename, int from_tty) +@@ -356,12 +357,27 @@ exec_file_attach (const char *filename, int from_tty) if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) { @@ -102,7 +102,7 @@ diff --git a/gdb/exec.c b/gdb/exec.c exec_close (); - error (_("\"%s\": not in executable format: %s"), - scratch_pathname, -- gdb_bfd_errmsg (bfd_get_error (), matching)); +- gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); + + if (is_core != 0) + throw_error (IS_CORE_ERROR, @@ -112,14 +112,14 @@ diff --git a/gdb/exec.c b/gdb/exec.c + else + error (_("\"%s\": not in executable format: %s"), + scratch_pathname, -+ gdb_bfd_errmsg (bfd_get_error (), matching)); ++ gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); } if (build_section_table (exec_bfd, §ions, §ions_end)) diff --git a/gdb/main.c b/gdb/main.c --- a/gdb/main.c +++ b/gdb/main.c -@@ -447,6 +447,37 @@ struct cmdarg +@@ -447,6 +447,35 @@ struct cmdarg char *string; }; @@ -130,8 +130,6 @@ diff --git a/gdb/main.c b/gdb/main.c +static void +exec_or_core_file_attach (const char *filename, int from_tty) +{ -+ volatile struct gdb_exception e; -+ + gdb_assert (exec_bfd == NULL); + + TRY @@ -157,7 +155,7 @@ diff --git a/gdb/main.c b/gdb/main.c static void captured_main_1 (struct captured_main_args *context) { -@@ -883,6 +914,8 @@ captured_main_1 (struct captured_main_args *context) +@@ -884,6 +913,8 @@ captured_main_1 (struct captured_main_args *context) { symarg = argv[optind]; execarg = argv[optind]; @@ -166,7 +164,7 @@ diff --git a/gdb/main.c b/gdb/main.c optind++; } -@@ -1033,11 +1066,25 @@ captured_main_1 (struct captured_main_args *context) +@@ -1034,12 +1065,25 @@ captured_main_1 (struct captured_main_args *context) && symarg != NULL && strcmp (execarg, symarg) == 0) { @@ -185,13 +183,14 @@ diff --git a/gdb/main.c b/gdb/main.c /* The exec file and the symbol-file are the same. If we can't open it, better only print one error message. - catch_command_errors returns non-zero on success! */ -- if (catch_command_errors (exec_file_attach, execarg, -- !batch_flag)) +- ret = catch_command_errors (exec_file_attach, execarg, +- !batch_flag); +- if (ret != 0) + catch_command_errors returns non-zero on success! + Do not load EXECARG as a symbol file if it has been already processed + as a core file. */ -+ if (catch_command_errors (func, execarg, !batch_flag) -+ && core_bfd == NULL) - catch_command_errors (symbol_file_add_main_adapter, symarg, - !batch_flag); ++ ret = catch_command_errors (func, execarg, !batch_flag); ++ if (ret != 0 && core_bfd == NULL) + ret = catch_command_errors (symbol_file_add_main_adapter, + symarg, !batch_flag); } diff --git a/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch b/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch index a25057e..162f3d7 100644 --- a/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch +++ b/gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch @@ -28,7 +28,7 @@ Comments by Sergio Durigan Junior : diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -581,7 +581,10 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, +@@ -578,7 +578,10 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, do_cleanups (inner); if (abfd == NULL) diff --git a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch index 375b178..e4935f5 100644 --- a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +++ b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch @@ -9,7 +9,7 @@ Subject: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -652,6 +652,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) +@@ -649,6 +649,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) #include #endif diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch index 7e39488..da2bf5d 100644 --- a/gdb-6.6-buildid-locate-rpm-scl.patch +++ b/gdb-6.6-buildid-locate-rpm-scl.patch @@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=953585 diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -689,7 +689,11 @@ static int missing_rpm_list_entries; +@@ -686,7 +686,11 @@ static int missing_rpm_list_entries; /* Returns the count of newly added rpms. */ static int @@ -24,7 +24,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { static int rpm_init_done = 0; rpmts ts; -@@ -796,7 +800,11 @@ missing_rpm_enlist (const char *filename) +@@ -793,7 +797,11 @@ missing_rpm_enlist (const char *filename) mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); if (mi != NULL) { @@ -36,7 +36,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { Header h; char *debuginfo, **slot, *s, *s2; -@@ -914,6 +922,37 @@ missing_rpm_enlist (const char *filename) +@@ -911,6 +919,37 @@ missing_rpm_enlist (const char *filename) xfree (debuginfo); count++; } @@ -74,7 +74,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c rpmdbFreeIterator_p (mi); } -@@ -924,6 +963,21 @@ missing_rpm_enlist (const char *filename) +@@ -921,6 +960,21 @@ missing_rpm_enlist (const char *filename) } static int @@ -99,7 +99,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -3469,6 +3469,16 @@ read_gdb_index_from_section (struct objfile *objfile, +@@ -3467,6 +3467,16 @@ read_gdb_index_from_buffer (struct objfile *objfile, "set use-deprecated-index-sections on". */ if (version < 6 && !deprecated_ok) { @@ -116,7 +116,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c static int warning_printed = 0; if (!warning_printed) { -@@ -3480,6 +3490,10 @@ to use the section anyway."), +@@ -3478,6 +3488,10 @@ to use the section anyway."), warning_printed = 1; } return 0; diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index d5ec4b0..c9cdce4 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -244,7 +244,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c #define BUILD_ID_VERBOSE_NONE 0 #define BUILD_ID_VERBOSE_FILENAMES 1 -@@ -640,8 +642,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) +@@ -637,8 +639,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) return result; } @@ -612,7 +612,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c avoidance. */ struct missing_filepair -@@ -695,11 +1055,17 @@ missing_filepair_change (void) +@@ -692,11 +1052,17 @@ missing_filepair_change (void) /* All their memory came just from missing_filepair_OBSTACK. */ missing_filepair_hash = NULL; } @@ -630,7 +630,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c missing_filepair_change (); } -@@ -766,14 +1132,39 @@ debug_print_missing (const char *binary, const char *debug) +@@ -763,14 +1129,39 @@ debug_print_missing (const char *binary, const char *debug) *slot = missing_filepair; @@ -690,7 +690,7 @@ diff --git a/gdb/config.in b/gdb/config.in /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS -@@ -270,6 +273,9 @@ +@@ -258,6 +261,9 @@ /* Define if Python 2.7 is being used. */ #undef HAVE_LIBPYTHON2_7 @@ -722,8 +722,8 @@ diff --git a/gdb/configure b/gdb/configure +with_rpm enable_targets enable_64_bit_bfd - enable_gdbcli -@@ -912,6 +918,11 @@ CCC + enable_gdbmi +@@ -910,6 +916,11 @@ CCC CPP MAKEINFO MAKEINFOFLAGS @@ -735,7 +735,7 @@ diff --git a/gdb/configure b/gdb/configure YACC YFLAGS XMKMF' -@@ -1583,6 +1594,8 @@ Optional Packages: +@@ -1578,6 +1589,8 @@ Optional Packages: [--with-auto-load-dir] --without-auto-load-safe-path do not restrict auto-loaded files locations @@ -744,7 +744,7 @@ diff --git a/gdb/configure b/gdb/configure --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets --with-curses use the curses library instead of the termcap library -@@ -1640,6 +1653,13 @@ Some influential environment variables: +@@ -1635,6 +1648,13 @@ Some influential environment variables: MAKEINFO Parent configure detects if it is of sufficient version. MAKEINFOFLAGS Parameters for MAKEINFO. @@ -758,7 +758,7 @@ diff --git a/gdb/configure b/gdb/configure YACC The `Yet Another Compiler Compiler' implementation to use. Defaults to the first program found out of: `bison -y', `byacc', `yacc'. -@@ -6575,6 +6595,494 @@ _ACEOF +@@ -6570,6 +6590,494 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -1503,7 +1503,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c diff --git a/gdb/symfile.h b/gdb/symfile.h --- a/gdb/symfile.h +++ b/gdb/symfile.h -@@ -540,6 +540,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data, +@@ -534,6 +534,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data, /* build-id support. */ extern struct bfd_build_id *build_id_addr_get (CORE_ADDR addr); extern void debug_print_missing (const char *binary, const char *debug); diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch index 2b96166..6da53a7 100644 --- a/gdb-6.6-buildid-locate-solib-missing-ids.patch +++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -14,7 +14,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1339862 diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c -@@ -1358,14 +1358,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1343,14 +1343,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, } { @@ -44,7 +44,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c if (build_id != NULL) { char *name, *build_id_filename; -@@ -1380,23 +1393,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1365,23 +1378,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, xfree (name); } else diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 618f41a..b37a396 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -436,7 +436,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), -@@ -65,11 +463,50 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -65,11 +463,47 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) return retval; } @@ -481,14 +481,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, + char **link_return, int add_debug_suffix) { -+ char *debugdir; + std::string link, link_all; -+ struct cleanup *back_to; -+ int ix; gdb_bfd_ref_ptr abfd; /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will -@@ -82,63 +519,296 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) +@@ -82,63 +516,296 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) { const gdb_byte *data = build_id; size_t size = build_id_len; @@ -807,7 +804,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* Prevent looping on a stripped .debug file. */ if (abfd != NULL && filename_cmp (bfd_get_filename (abfd.get ()), -@@ -151,3 +821,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) +@@ -151,3 +818,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) return std::string (); } @@ -832,9 +829,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/build-id.h b/gdb/build-id.h --- a/gdb/build-id.h +++ b/gdb/build-id.h -@@ -22,9 +22,10 @@ - +@@ -23,9 +23,10 @@ #include "gdb_bfd.h" + #include "common/rsp-low.h" -/* Locate NT_GNU_BUILD_ID from ABFD and return its content. */ +/* Separate debuginfo files have corrupted PHDR but SHDR is correct there. @@ -845,7 +842,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h /* Return true if ABFD has NT_GNU_BUILD_ID matching the CHECK value. Otherwise, issue a warning and return false. */ -@@ -38,13 +39,18 @@ extern int build_id_verify (bfd *abfd, +@@ -39,14 +40,19 @@ extern int build_id_verify (bfd *abfd, the caller. */ extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len, @@ -866,11 +863,12 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h +extern std::string find_separate_debug_file_by_buildid (struct objfile *objfile, + gdb::unique_xmalloc_ptr *build_id_filename_return); - #endif /* BUILD_ID_H */ + /* Return an hex-string representation of BUILD_ID. */ + diff --git a/gdb/coffread.c b/gdb/coffread.c --- a/gdb/coffread.c +++ b/gdb/coffread.c -@@ -733,7 +733,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -734,7 +734,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) /* Try to add separate debug file if no symbols table found. */ if (!objfile_has_partial_symbols (objfile)) { @@ -905,7 +903,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c +{ + CORE_ADDR at_entry; + struct bfd_build_id *build_id; -+ char *execfilename, *debug_filename; ++ char *execfilename; + char *build_id_filename; + struct cleanup *back_to; + @@ -949,7 +947,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c /* Issue a message saying we have no core to debug, if FROM_TTY. */ static void -@@ -464,6 +516,14 @@ core_target_open (const char *arg, int from_tty) +@@ -463,6 +515,14 @@ core_target_open (const char *arg, int from_tty) switch_to_thread (thread); } @@ -964,7 +962,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c post_create_inferior (target, from_tty); /* Now go through the target stack looking for threads since there -@@ -1066,4 +1126,11 @@ void +@@ -1071,4 +1131,11 @@ void _initialize_corelow (void) { add_target (core_target_info, core_target_open, filename_completer); @@ -979,7 +977,7 @@ diff --git a/gdb/corelow.c b/gdb/corelow.c diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -19570,6 +19570,27 @@ information files. +@@ -19772,6 +19772,27 @@ information files. @end table @@ -1007,10 +1005,22 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo @cindex @code{.gnu_debuglink} sections @cindex debug link sections A debug link is a special section of the executable file named +diff --git a/gdb/dwarf-index-cache.c b/gdb/dwarf-index-cache.c +--- a/gdb/dwarf-index-cache.c ++++ b/gdb/dwarf-index-cache.c +@@ -140,7 +140,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile) + if (!enabled ()) + return; + +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); + if (build_id == nullptr) + { + if (debug_index_cache) diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -2683,7 +2683,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) +@@ -2693,7 +2693,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) } if (dwz_bfd == NULL) @@ -1019,10 +1029,28 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c if (dwz_bfd == NULL) error (_("could not find '.gnu_debugaltlink' file for %s"), +@@ -6198,7 +6198,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) + static gdb::array_view + get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj) + { +- const bfd_build_id *build_id = build_id_bfd_get (obj->obfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (obj->obfd); + if (build_id == nullptr) + return {}; + +@@ -6211,7 +6211,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj) + static gdb::array_view + get_gdb_index_contents_from_cache_dwz (objfile *obj, dwz_file *dwz) + { +- const bfd_build_id *build_id = build_id_bfd_get (dwz->dwz_bfd.get ()); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (dwz->dwz_bfd.get ()); + if (build_id == nullptr) + return {}; + diff --git a/gdb/elfread.c b/gdb/elfread.c --- a/gdb/elfread.c +++ b/gdb/elfread.c -@@ -1290,7 +1290,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1289,7 +1289,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) && objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile_backlink == NULL) { @@ -1033,7 +1061,7 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c if (debugfile.empty ()) debugfile = find_separate_debug_file_by_debuglink (objfile); -@@ -1302,6 +1304,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1301,6 +1303,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) symbol_file_add_separate (abfd.get (), debugfile.c_str (), symfile_flags, objfile); } @@ -1061,7 +1089,7 @@ diff --git a/gdb/objfiles.h b/gdb/objfiles.h diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c --- a/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c -@@ -137,7 +137,7 @@ objfpy_get_build_id (PyObject *self, void *closure) +@@ -132,7 +132,7 @@ objfpy_get_build_id (PyObject *self, void *closure) TRY { @@ -1070,7 +1098,7 @@ diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c } CATCH (except, RETURN_MASK_ALL) { -@@ -544,7 +544,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id) +@@ -549,7 +549,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id) /* Don't return separate debug files. */ if (objfile->separate_debug_objfile_backlink != NULL) continue; @@ -1090,7 +1118,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c static struct link_map_offsets *svr4_fetch_link_map_offsets (void); static int svr4_have_link_map_offsets (void); -@@ -1356,9 +1357,51 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1341,9 +1342,51 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, continue; } @@ -1148,7 +1176,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c diff --git a/gdb/symfile.h b/gdb/symfile.h --- a/gdb/symfile.h +++ b/gdb/symfile.h -@@ -537,6 +537,10 @@ void expand_symtabs_matching +@@ -531,6 +531,10 @@ void expand_symtabs_matching void map_symbol_filenames (symbol_filename_ftype *fun, void *data, int need_fullname); diff --git a/gdb-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch index f3765de..29f1b66 100644 --- a/gdb-6.8-quit-never-aborts.patch +++ b/gdb-6.8-quit-never-aborts.patch @@ -45,7 +45,7 @@ diff --git a/gdb/extension.c b/gdb/extension.c diff --git a/gdb/top.c b/gdb/top.c --- a/gdb/top.c +++ b/gdb/top.c -@@ -1611,7 +1611,13 @@ quit_force (int *exit_arg, int from_tty) +@@ -1606,7 +1606,13 @@ quit_force (int *exit_arg, int from_tty) qt.from_tty = from_tty; @@ -62,7 +62,7 @@ diff --git a/gdb/top.c b/gdb/top.c diff --git a/gdb/utils.c b/gdb/utils.c --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -108,6 +108,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time; +@@ -98,6 +98,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time; static int debug_timestamp = 0; diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch index 672734f..1833f98 100644 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ b/gdb-archer-pie-addons-keep-disabled.patch @@ -8,7 +8,7 @@ Subject: gdb-archer-pie-addons-keep-disabled.patch diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -15516,6 +15516,50 @@ initialize_breakpoint_ops (void) +@@ -15506,6 +15506,50 @@ initialize_breakpoint_ops (void) static struct cmd_list_element *enablebreaklist = NULL; @@ -62,7 +62,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h -@@ -1679,6 +1679,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg); +@@ -1676,6 +1676,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg); UIOUT iff debugging multiple threads. */ extern void maybe_print_thread_hit_breakpoint (struct ui_out *uiout); @@ -75,7 +75,7 @@ diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h diff --git a/gdb/objfiles.c b/gdb/objfiles.c --- a/gdb/objfiles.c +++ b/gdb/objfiles.c -@@ -875,6 +875,11 @@ objfile_relocate1 (struct objfile *objfile, +@@ -880,6 +880,11 @@ objfile_relocate1 (struct objfile *objfile, obj_section_addr (s)); } diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch index 9aef617..88da22a 100644 --- a/gdb-archer-pie-addons.patch +++ b/gdb-archer-pie-addons.patch @@ -8,7 +8,7 @@ Subject: gdb-archer-pie-addons.patch diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -505,6 +505,7 @@ enum field_loc_kind +@@ -506,6 +506,7 @@ enum field_loc_kind { FIELD_LOC_KIND_BITPOS, /**< bitpos */ FIELD_LOC_KIND_ENUMVAL, /**< enumval */ @@ -16,7 +16,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h FIELD_LOC_KIND_PHYSADDR, /**< physaddr */ FIELD_LOC_KIND_PHYSNAME, /**< physname */ FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */ -@@ -556,6 +557,7 @@ union field_location +@@ -557,6 +558,7 @@ union field_location field. Otherwise, physname is the mangled label of the static field. */ @@ -24,7 +24,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h CORE_ADDR physaddr; const char *physname; -@@ -1438,6 +1440,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1439,6 +1441,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define FIELD_ENUMVAL_LVAL(thisfld) ((thisfld).loc.enumval) #define FIELD_ENUMVAL(thisfld) (FIELD_ENUMVAL_LVAL (thisfld) + 0) #define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname) @@ -32,7 +32,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h #define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr) #define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block) #define SET_FIELD_BITPOS(thisfld, bitpos) \ -@@ -1449,6 +1452,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1450,6 +1453,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define SET_FIELD_PHYSNAME(thisfld, name) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \ FIELD_STATIC_PHYSNAME (thisfld) = (name)) @@ -40,7 +40,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h #define SET_FIELD_PHYSADDR(thisfld, addr) \ (FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \ FIELD_STATIC_PHYSADDR (thisfld) = (addr)) -@@ -1465,6 +1469,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1466,6 +1470,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); #define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_ENUMVAL(thistype, n) FIELD_ENUMVAL (TYPE_FIELD (thistype, n)) #define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n)) @@ -51,7 +51,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h diff --git a/gdb/value.c b/gdb/value.c --- a/gdb/value.c +++ b/gdb/value.c -@@ -2829,7 +2829,8 @@ value_static_field (struct type *type, int fieldno) +@@ -2828,7 +2828,8 @@ value_static_field (struct type *type, int fieldno) { case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), diff --git a/gdb-archer.patch b/gdb-archer.patch index dcb989c..882b86e 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -17,7 +17,7 @@ tromey/python diff --git a/gdb/Makefile.in b/gdb/Makefile.in --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -2112,6 +2112,12 @@ stamp-h: $(srcdir)/config.in config.status +@@ -2092,6 +2092,12 @@ stamp-h: $(srcdir)/config.in config.status CONFIG_LINKS= \ $(SHELL) config.status @@ -73,7 +73,7 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi -@@ -88,8 +88,6 @@ containing @code{end}. For example: +@@ -90,8 +90,6 @@ containing @code{end}. For example: @smallexample (@value{GDBP}) python @@ -112,7 +112,7 @@ diff --git a/gdb/main.c b/gdb/main.c #include "source.h" #include "cli/cli-cmds.h" #include "objfiles.h" -@@ -479,7 +480,7 @@ exec_or_core_file_attach (const char *filename, int from_tty) +@@ -477,7 +478,7 @@ exec_or_core_file_attach (const char *filename, int from_tty) } static void @@ -121,7 +121,7 @@ diff --git a/gdb/main.c b/gdb/main.c { int argc = context->argc; char **argv = context->argv; -@@ -695,10 +696,14 @@ captured_main_1 (struct captured_main_args *context) +@@ -694,10 +695,14 @@ captured_main_1 (struct captured_main_args *context) {"args", no_argument, &set_args, 1}, {"l", required_argument, 0, 'l'}, {"return-child-result", no_argument, &return_child_result, 1}, @@ -137,7 +137,7 @@ diff --git a/gdb/main.c b/gdb/main.c { int option_index; -@@ -716,6 +721,9 @@ captured_main_1 (struct captured_main_args *context) +@@ -715,6 +720,9 @@ captured_main_1 (struct captured_main_args *context) case 0: /* Long option that just sets a flag. */ break; @@ -147,7 +147,7 @@ diff --git a/gdb/main.c b/gdb/main.c case OPT_SE: symarg = optarg; execarg = optarg; -@@ -890,7 +898,31 @@ captured_main_1 (struct captured_main_args *context) +@@ -889,7 +897,31 @@ captured_main_1 (struct captured_main_args *context) /* Now that gdb_init has created the initial inferior, we're in position to set args for that inferior. */ @@ -180,7 +180,7 @@ diff --git a/gdb/main.c b/gdb/main.c { /* The remaining options are the command-line options for the inferior. The first one is the sym/exec file, and the rest -@@ -1180,7 +1212,8 @@ captured_main_1 (struct captured_main_args *context) +@@ -1190,7 +1222,8 @@ captured_main_1 (struct captured_main_args *context) /* Read in the old history after all the command files have been read. */ @@ -190,7 +190,7 @@ diff --git a/gdb/main.c b/gdb/main.c if (batch_flag) { -@@ -1193,24 +1226,37 @@ static void +@@ -1206,24 +1239,37 @@ static void captured_main (void *data) { struct captured_main_args *context = (struct captured_main_args *) data; @@ -241,7 +241,7 @@ diff --git a/gdb/main.c b/gdb/main.c } /* No exit -- exit is through quit_command. */ } -@@ -1253,6 +1299,12 @@ print_gdb_help (struct ui_file *stream) +@@ -1266,6 +1312,12 @@ print_gdb_help (struct ui_file *stream) fputs_unfiltered (_("\ This is the GNU debugger. Usage:\n\n\ gdb [options] [executable-file [core-file or process-id]]\n\ @@ -254,7 +254,7 @@ diff --git a/gdb/main.c b/gdb/main.c gdb [options] --args executable-file [inferior-arguments ...]\n\n\ "), stream); fputs_unfiltered (_("\ -@@ -1298,6 +1350,13 @@ Output and user interface control:\n\n\ +@@ -1311,6 +1363,13 @@ Output and user interface control:\n\n\ #endif fputs_unfiltered (_("\ --dbx DBX compatibility mode.\n\ @@ -365,7 +365,7 @@ new file mode 100644 diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h -@@ -644,6 +644,9 @@ class gdbpy_enter_varobj : public gdbpy_enter +@@ -636,6 +636,9 @@ class gdbpy_enter_varobj : public gdbpy_enter }; @@ -378,7 +378,7 @@ diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h diff --git a/gdb/python/python.c b/gdb/python/python.c --- a/gdb/python/python.c +++ b/gdb/python/python.c -@@ -95,6 +95,8 @@ const struct extension_language_defn extension_language_python = +@@ -94,6 +94,8 @@ const struct extension_language_defn extension_language_python = #include "linespec.h" #include "source.h" #include "version.h" @@ -387,7 +387,7 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c #include "target.h" #include "gdbthread.h" #include "interps.h" -@@ -237,6 +239,29 @@ gdbpy_enter::~gdbpy_enter () +@@ -236,6 +238,29 @@ gdbpy_enter::~gdbpy_enter () restore_active_ext_lang (m_previous_active); } @@ -417,10 +417,10 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c /* Set the quit flag. */ static void -@@ -1367,6 +1392,92 @@ gdbpy_print_stack (void) +@@ -1312,6 +1337,92 @@ gdbpy_print_stack (void) + + - /* Return the current Progspace. - There always is one. */ +/* True if 'gdb -P' was used, false otherwise. */ +static int running_python_script; + @@ -507,10 +507,10 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c + + + + /* Return a sequence holding all the Progspaces. */ static PyObject * - gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) -@@ -2057,6 +2168,8 @@ PyMethodDef python_GdbMethods[] = +@@ -1963,6 +2074,8 @@ PyMethodDef python_GdbMethods[] = Evaluate command, a string, as a gdb CLI command. Optionally returns\n\ a Python String containing the output of the command if to_string is\n\ set to True." }, diff --git a/gdb-attach-fail-reasons-5of5.patch b/gdb-attach-fail-reasons-5of5.patch index c8b1267..659aec6 100644 --- a/gdb-attach-fail-reasons-5of5.patch +++ b/gdb-attach-fail-reasons-5of5.patch @@ -45,7 +45,7 @@ gdb/gdbserver/ diff --git a/gdb/config.in b/gdb/config.in --- a/gdb/config.in +++ b/gdb/config.in -@@ -276,6 +276,9 @@ +@@ -264,6 +264,9 @@ /* Define if librpm library is being used. */ #undef HAVE_LIBRPM @@ -55,7 +55,7 @@ diff --git a/gdb/config.in b/gdb/config.in /* Define to 1 if you have the header file. */ #undef HAVE_LIBUNWIND_IA64_H -@@ -399,6 +402,9 @@ +@@ -387,6 +390,9 @@ /* Define to 1 if you have the `scm_new_smob' function. */ #undef HAVE_SCM_NEW_SMOB @@ -68,7 +68,7 @@ diff --git a/gdb/config.in b/gdb/config.in diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -15854,6 +15854,64 @@ cat >>confdefs.h <<_ACEOF +@@ -15793,6 +15793,64 @@ cat >>confdefs.h <<_ACEOF _ACEOF @@ -136,7 +136,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -2054,6 +2054,10 @@ case $host_os in +@@ -2031,6 +2031,10 @@ case $host_os in esac AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.]) @@ -173,7 +173,7 @@ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure --- a/gdb/gdbserver/configure +++ b/gdb/gdbserver/configure -@@ -8535,6 +8535,64 @@ if $want_ipa ; then +@@ -8568,6 +8568,64 @@ if $want_ipa ; then fi fi @@ -276,7 +276,7 @@ diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c -@@ -1089,7 +1089,17 @@ linux_nat_target::create_inferior (const char *exec_file, +@@ -1092,7 +1092,17 @@ linux_nat_target::create_inferior (const char *exec_file, /* Make sure we report all signals during startup. */ pass_signals (0, NULL); diff --git a/gdb-btrobust.patch b/gdb-btrobust.patch index 40d406c..b1a65c6 100644 --- a/gdb-btrobust.patch +++ b/gdb-btrobust.patch @@ -14,7 +14,7 @@ printed, but a default backtrace will occur in this case. diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c --- a/gdb/python/py-framefilter.c +++ b/gdb/python/py-framefilter.c -@@ -1151,6 +1151,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1154,6 +1154,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, htab_eq_pointer, NULL)); @@ -22,7 +22,7 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c while (true) { gdbpy_ref<> item (PyIter_Next (iterable.get ())); -@@ -1159,8 +1160,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1162,8 +1163,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, { if (PyErr_Occurred ()) { @@ -33,7 +33,7 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c } break; } -@@ -1193,7 +1194,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1196,7 +1197,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, /* Do not exit on error printing a single frame. Print the error and continue with other frames. */ if (success == EXT_LANG_BT_ERROR) diff --git a/gdb-bz1219747-attach-kills.patch b/gdb-bz1219747-attach-kills.patch index 6ae10a2..44f339e 100644 --- a/gdb-bz1219747-attach-kills.patch +++ b/gdb-bz1219747-attach-kills.patch @@ -80,18 +80,18 @@ gdb/testsuite/ChangeLog diff --git a/gdb/main.c b/gdb/main.c --- a/gdb/main.c +++ b/gdb/main.c -@@ -1115,7 +1115,10 @@ captured_main_1 (struct captured_main_args *context) - if (isdigit (pid_or_core_arg[0])) +@@ -1120,7 +1120,10 @@ captured_main_1 (struct captured_main_args *context) { - if (catch_command_errors (attach_command, pid_or_core_arg, -- !batch_flag) == 0) -+ !batch_flag) == 0 + ret = catch_command_errors (attach_command, pid_or_core_arg, + !batch_flag); +- if (ret == 0) ++ if (ret == 0 + /* attach_command could succeed partially and core_file_command + would try to kill it. */ + && !have_inferiors ()) - catch_command_errors (core_file_command, pid_or_core_arg, - !batch_flag); - } + ret = catch_command_errors (core_file_command, + pid_or_core_arg, + !batch_flag); diff --git a/gdb/testsuite/gdb.base/attach-kills.c b/gdb/testsuite/gdb.base/attach-kills.c new file mode 100644 --- /dev/null diff --git a/gdb-bz533176-fortran-omp-step.patch b/gdb-bz533176-fortran-omp-step.patch index c42c458..e2f9794 100644 --- a/gdb-bz533176-fortran-omp-step.patch +++ b/gdb-bz533176-fortran-omp-step.patch @@ -30,7 +30,7 @@ debugging problem of GOMP outside of the scope of this Bug. diff --git a/gdb/infrun.c b/gdb/infrun.c --- a/gdb/infrun.c +++ b/gdb/infrun.c -@@ -6694,6 +6694,16 @@ process_event_stop_test (struct execution_control_state *ecs) +@@ -6691,6 +6691,16 @@ process_event_stop_test (struct execution_control_state *ecs) if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL) { @@ -47,7 +47,7 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c /* We're doing a "next". Normal (forward) execution: set a breakpoint at the -@@ -6727,6 +6737,7 @@ process_event_stop_test (struct execution_control_state *ecs) +@@ -6724,6 +6734,7 @@ process_event_stop_test (struct execution_control_state *ecs) keep_going (ecs); return; diff --git a/gdb-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch index 912af65..a297bbe 100644 --- a/gdb-bz541866-rwatch-before-run.patch +++ b/gdb-bz541866-rwatch-before-run.patch @@ -10,7 +10,7 @@ Subject: gdb-bz541866-rwatch-before-run.patch diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -8801,7 +8801,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, +@@ -8789,7 +8789,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, int enabled, int internal, unsigned flags, int display_canonical) { @@ -19,7 +19,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c if (type == bp_hardware_breakpoint) { -@@ -14350,7 +14350,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition, +@@ -14340,7 +14340,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition, if (bpt->type == bp_hardware_breakpoint) { @@ -105,7 +105,7 @@ diff --git a/gdb/configure.nat b/gdb/configure.nat NATDEPFILES="${NATDEPFILES} x86-nat.o x86-dregs.o \ i386-linux-nat.o x86-linux-nat.o linux-btrace.o \ x86-linux.o x86-linux-dregs.o" -@@ -290,6 +291,7 @@ case ${gdb_host} in +@@ -294,6 +295,7 @@ case ${gdb_host} in case ${gdb_host_cpu} in i386) # Host: GNU/Linux x86-64 @@ -116,7 +116,7 @@ diff --git a/gdb/configure.nat b/gdb/configure.nat diff --git a/gdb/target.h b/gdb/target.h --- a/gdb/target.h +++ b/gdb/target.h -@@ -1953,9 +1953,11 @@ extern struct thread_info *target_thread_handle_to_thread_info +@@ -1983,9 +1983,11 @@ extern struct thread_info *target_thread_handle_to_thread_info one. OTHERTYPE is the number of watchpoints of other types than this one used so far. */ diff --git a/gdb-bz568248-oom-is-error.patch b/gdb-bz568248-oom-is-error.patch index f3f61da..491e7f5 100644 --- a/gdb-bz568248-oom-is-error.patch +++ b/gdb-bz568248-oom-is-error.patch @@ -53,7 +53,7 @@ gdb/ diff --git a/gdb/utils.c b/gdb/utils.c --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -746,13 +746,11 @@ malloc_failure (long size) +@@ -719,13 +719,11 @@ malloc_failure (long size) { if (size > 0) { diff --git a/gdb-container-rh-pkg.patch b/gdb-container-rh-pkg.patch index 2defc8d..b8e576d 100644 --- a/gdb-container-rh-pkg.patch +++ b/gdb-container-rh-pkg.patch @@ -9,7 +9,7 @@ Subject: gdb-container-rh-pkg.patch diff --git a/gdb/remote.c b/gdb/remote.c --- a/gdb/remote.c +++ b/gdb/remote.c -@@ -13909,7 +13909,17 @@ remote_target::pid_to_exec_file (int pid) +@@ -14010,7 +14010,17 @@ remote_target::pid_to_exec_file (int pid) char *annex = NULL; if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) diff --git a/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch index 5037e29..6b01919 100644 --- a/gdb-fedora-libncursesw.patch +++ b/gdb-fedora-libncursesw.patch @@ -12,7 +12,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1270534 diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -9393,6 +9393,7 @@ if test x"$prefer_curses" = xyes; then +@@ -9362,6 +9362,7 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. @@ -20,7 +20,7 @@ diff --git a/gdb/configure b/gdb/configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing waddstr" >&5 $as_echo_n "checking for library containing waddstr... " >&6; } if ${ac_cv_search_waddstr+:} false; then : -@@ -9417,7 +9418,7 @@ return waddstr (); +@@ -9386,7 +9387,7 @@ return waddstr (); return 0; } _ACEOF @@ -29,7 +29,7 @@ diff --git a/gdb/configure b/gdb/configure if test -z "$ac_lib"; then ac_res="none required" else -@@ -9491,6 +9492,7 @@ case $host_os in +@@ -9460,6 +9461,7 @@ case $host_os in esac # These are the libraries checked by Readline. @@ -37,7 +37,7 @@ diff --git a/gdb/configure b/gdb/configure { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tgetent" >&5 $as_echo_n "checking for library containing tgetent... " >&6; } if ${ac_cv_search_tgetent+:} false; then : -@@ -9515,7 +9517,7 @@ return tgetent (); +@@ -9484,7 +9486,7 @@ return tgetent (); return 0; } _ACEOF @@ -49,7 +49,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -766,7 +766,8 @@ if test x"$prefer_curses" = xyes; then +@@ -743,7 +743,8 @@ if test x"$prefer_curses" = xyes; then # search /usr/local/include, if ncurses is installed in /usr/local. A # default installation of ncurses on alpha*-dec-osf* will lead to such # a situation. @@ -59,7 +59,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac if test "$ac_cv_search_waddstr" != no; then curses_found=yes -@@ -808,7 +809,8 @@ case $host_os in +@@ -785,7 +786,8 @@ case $host_os in esac # These are the libraries checked by Readline. diff --git a/gdb-follow-child-stale-parent.patch b/gdb-follow-child-stale-parent.patch index ab3a765..9b7b0f5 100644 --- a/gdb-follow-child-stale-parent.patch +++ b/gdb-follow-child-stale-parent.patch @@ -24,7 +24,7 @@ unwinders try to access it, breaking: diff --git a/gdb/infrun.c b/gdb/infrun.c --- a/gdb/infrun.c +++ b/gdb/infrun.c -@@ -752,6 +752,9 @@ follow_fork (void) +@@ -754,6 +754,9 @@ follow_fork (void) } else { diff --git a/gdb-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch index 2fec7cf..63bc7e3 100644 --- a/gdb-glibc-strstr-workaround.patch +++ b/gdb-glibc-strstr-workaround.patch @@ -9,7 +9,7 @@ Subject: gdb-glibc-strstr-workaround.patch diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -21270,6 +21270,26 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, +@@ -21443,6 +21443,26 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* Cache this symbol's name and the name's demangled form (if any). */ SYMBOL_SET_LANGUAGE (sym, cu->language, &objfile->objfile_obstack); linkagename = dwarf2_physname (name, die, cu); diff --git a/gdb-gnat-dwarf-crash-3of3.patch b/gdb-gnat-dwarf-crash-3of3.patch index a20da46..c227f8a 100644 --- a/gdb-gnat-dwarf-crash-3of3.patch +++ b/gdb-gnat-dwarf-crash-3of3.patch @@ -42,7 +42,7 @@ gdb/ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -10499,6 +10499,13 @@ private: +@@ -10586,6 +10586,13 @@ private: static void process_die (struct die_info *die, struct dwarf2_cu *cu) { @@ -59,7 +59,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c diff --git a/gdb/infrun.c b/gdb/infrun.c --- a/gdb/infrun.c +++ b/gdb/infrun.c -@@ -607,6 +607,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \ +@@ -609,6 +609,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \ target_pid_to_str (process_ptid)); } @@ -86,10 +86,10 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c + +#endif + - /* The saved to_close method, inherited from inf-ptrace.c. - Called by our to_close. */ - static void (*super_close) (struct target_ops *); -@@ -1027,6 +1033,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled) + static unsigned int debug_linux_nat; + static void + show_debug_linux_nat (struct ui_file *file, int from_tty, +@@ -1030,6 +1036,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled) if (debug_linux_nat) fprintf_unfiltered (gdb_stdlog, "LNPAW: Attaching to a stopped process\n"); @@ -99,7 +99,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c /* The process is definitely stopped. It is in a job control stop, unless the kernel predates the TASK_STOPPED / -@@ -1359,6 +1368,25 @@ get_detach_signal (struct lwp_info *lp) +@@ -1362,6 +1371,25 @@ get_detach_signal (struct lwp_info *lp) return gdb_signal_to_host (signo); } @@ -125,7 +125,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c return 0; } -@@ -1507,6 +1535,10 @@ linux_nat_target::detach (inferior *inf, int from_tty) +@@ -1510,6 +1538,10 @@ linux_nat_target::detach (inferior *inf, int from_tty) detach_one_lwp (main_lwp, &signo); detach_success (inf); @@ -136,7 +136,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c } } -@@ -1765,6 +1797,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) +@@ -1768,6 +1800,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) return; } diff --git a/gdb-jit-reader-multilib.patch b/gdb-jit-reader-multilib.patch index 2aa41c2..e676c9e 100644 --- a/gdb-jit-reader-multilib.patch +++ b/gdb-jit-reader-multilib.patch @@ -9,7 +9,7 @@ Subject: gdb-jit-reader-multilib.patch diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -9680,10 +9680,12 @@ _ACEOF +@@ -9649,10 +9649,12 @@ _ACEOF @@ -28,7 +28,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -843,10 +843,12 @@ AC_CHECK_SIZEOF(unsigned long long) +@@ -820,10 +820,12 @@ AC_CHECK_SIZEOF(unsigned long long) AC_CHECK_SIZEOF(unsigned long) AC_CHECK_SIZEOF(unsigned __int128) diff --git a/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch index c7533f7..95e755f 100644 --- a/gdb-linux_perf-bundle.patch +++ b/gdb-linux_perf-bundle.patch @@ -9,7 +9,7 @@ Subject: gdb-linux_perf-bundle.patch diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -12059,7 +12059,7 @@ else +@@ -12028,7 +12028,7 @@ else #include #ifndef PERF_ATTR_SIZE_VER5 @@ -21,7 +21,7 @@ diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure.ac b/gdb/configure.ac --- a/gdb/configure.ac +++ b/gdb/configure.ac -@@ -1477,7 +1477,7 @@ else +@@ -1454,7 +1454,7 @@ else AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include #ifndef PERF_ATTR_SIZE_VER5 diff --git a/gdb-moribund-utrace-workaround.patch b/gdb-moribund-utrace-workaround.patch index e02e83c..1b26f7f 100644 --- a/gdb-moribund-utrace-workaround.patch +++ b/gdb-moribund-utrace-workaround.patch @@ -14,7 +14,7 @@ Bug in FSF GDB exploited by the ptrace-on-utrace interaction. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -12010,6 +12010,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode) +@@ -11998,6 +11998,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode) traps we can no longer explain. */ old_loc->events_till_retirement = 3 * (thread_count () + 1); @@ -22,4 +22,4 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c + old_loc->events_till_retirement *= 10; old_loc->owner = NULL; - VEC_safe_push (bp_location_p, moribund_locations, old_loc); + moribund_locations.push_back (old_loc); diff --git a/gdb-python-gil.patch b/gdb-python-gil.patch index 9ff2e45..b852854 100644 --- a/gdb-python-gil.patch +++ b/gdb-python-gil.patch @@ -9,7 +9,7 @@ Subject: gdb-python-gil.patch diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi --- a/gdb/doc/python.texi +++ b/gdb/doc/python.texi -@@ -232,6 +232,14 @@ returned as a string. The default is @code{False}, in which case the +@@ -234,6 +234,14 @@ returned as a string. The default is @code{False}, in which case the return value is @code{None}. If @var{to_string} is @code{True}, the @value{GDBN} virtual terminal will be temporarily set to unlimited width and height, and its pagination will be disabled; @pxref{Screen Size}. @@ -27,7 +27,7 @@ diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h -@@ -148,6 +148,8 @@ typedef int Py_ssize_t; +@@ -144,6 +144,8 @@ typedef int Py_ssize_t; #define PyGILState_Release(ARG) ((void)(ARG)) #define PyEval_InitThreads() #define PyThreadState_Swap(ARG) ((void)(ARG)) @@ -39,7 +39,7 @@ diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h diff --git a/gdb/python/python.c b/gdb/python/python.c --- a/gdb/python/python.c +++ b/gdb/python/python.c -@@ -556,12 +556,16 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) +@@ -555,12 +555,16 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) { const char *arg; PyObject *from_tty_obj = NULL, *to_string_obj = NULL; @@ -60,7 +60,7 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c return NULL; from_tty = 0; -@@ -582,6 +586,15 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) +@@ -581,6 +585,15 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) to_string = cmp; } @@ -76,7 +76,7 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c std::string to_string_res; TRY -@@ -602,6 +615,13 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) +@@ -601,6 +614,13 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) counted_command_line lines = read_command_lines_1 (reader, 1, nullptr); @@ -87,17 +87,19 @@ diff --git a/gdb/python/python.c b/gdb/python/python.c + if (release_gil) + state = PyEval_SaveThread(); + - scoped_restore save_async = make_scoped_restore (¤t_ui->async, 0); + { + scoped_restore save_async = make_scoped_restore (¤t_ui->async, + 0); +@@ -620,12 +640,24 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) + execute_control_commands (lines.get (), from_tty); + } - scoped_restore save_uiout = make_scoped_restore (¤t_uiout); -@@ -617,10 +637,22 @@ execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw) - from_tty); - else - execute_control_commands (lines.get (), from_tty); -+ + /* Reacquire the GIL if it was released earlier. */ + if (release_gil) + PyEval_RestoreThread (state); ++ + /* Do any commands attached to breakpoint we stopped at. */ + bpstat_do_actions (); } CATCH (except, RETURN_MASK_ALL) { diff --git a/gdb-rhbz1187581-power8-regs-1of7.patch b/gdb-rhbz1187581-power8-regs-1of7.patch deleted file mode 100644 index 29bd798..0000000 --- a/gdb-rhbz1187581-power8-regs-1of7.patch +++ /dev/null @@ -1,65 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:09:48 +0200 -Subject: gdb-rhbz1187581-power8-regs-1of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit 05abfc39c719e740530000059bb963ad33462479 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Fix indentation in remote_target::download_tracepoint - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * remote.c (remote_target::download_tracepoint): Fix indentation - in for block. - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -12912,24 +12912,24 @@ remote_target::download_tracepoint (struct bp_location *loc) - error (_("Error on target while setting tracepoints.")); - } - -- for (auto action_it = stepping_actions.begin (); -- action_it != stepping_actions.end (); action_it++) -- { -- QUIT; /* Allow user to bail out with ^C. */ -- -- bool is_first = action_it == stepping_actions.begin (); -- bool has_more = action_it != stepping_actions.end (); -- -- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s", -- b->number, addrbuf, /* address */ -- is_first ? "S" : "", -- action_it->c_str (), -- has_more ? "-" : ""); -- putpkt (buf); -- remote_get_noisy_reply (); -- if (strcmp (rs->buf, "OK")) -- error (_("Error on target while setting tracepoints.")); -- } -+ for (auto action_it = stepping_actions.begin (); -+ action_it != stepping_actions.end (); action_it++) -+ { -+ QUIT; /* Allow user to bail out with ^C. */ -+ -+ bool is_first = action_it == stepping_actions.begin (); -+ bool has_more = action_it != stepping_actions.end (); -+ -+ xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s", -+ b->number, addrbuf, /* address */ -+ is_first ? "S" : "", -+ action_it->c_str (), -+ has_more ? "-" : ""); -+ putpkt (buf); -+ remote_get_noisy_reply (); -+ if (strcmp (rs->buf, "OK")) -+ error (_("Error on target while setting tracepoints.")); -+ } - - if (packet_support (PACKET_TracepointSource) == PACKET_ENABLE) - { diff --git a/gdb-rhbz1187581-power8-regs-2of7.patch b/gdb-rhbz1187581-power8-regs-2of7.patch deleted file mode 100644 index b0d42cd..0000000 --- a/gdb-rhbz1187581-power8-regs-2of7.patch +++ /dev/null @@ -1,45 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:10:46 +0200 -Subject: gdb-rhbz1187581-power8-regs-2of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit aa6f3694ce867884e43d1c0406c64df08ea24bd3 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Remove trailing '-' from the last QTDP action packet - - The has_more predicate in remote_target::download_tracepoint always - evaluates to true, so the last action packet will be sent with a - trailing '-'. This patch changes the predicate to remove the last - trailing '-'. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * remote.c (remote_target::download_tracepoint): Fix the has_more - predicate in the QTDP action list iteration. - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -12899,7 +12899,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - { - QUIT; /* Allow user to bail out with ^C. */ - -- bool has_more = (action_it != tdp_actions.end () -+ bool has_more = ((action_it + 1) != tdp_actions.end () - || !stepping_actions.empty ()); - - xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%c", -@@ -12918,7 +12918,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - QUIT; /* Allow user to bail out with ^C. */ - - bool is_first = action_it == stepping_actions.begin (); -- bool has_more = action_it != stepping_actions.end (); -+ bool has_more = (action_it + 1) != stepping_actions.end (); - - xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s", - b->number, addrbuf, /* address */ diff --git a/gdb-rhbz1187581-power8-regs-3of7.patch b/gdb-rhbz1187581-power8-regs-3of7.patch deleted file mode 100644 index 5546f2b..0000000 --- a/gdb-rhbz1187581-power8-regs-3of7.patch +++ /dev/null @@ -1,258 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:11:09 +0200 -Subject: gdb-rhbz1187581-power8-regs-3of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit 3df3a985a475db004706d64f83d9085f99053611 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Use get_remote_packet_size in download_tracepoint - - This patch changes the remote target to use the remote packet size to - build QTDP packets, and to check if there is enough room for the - packet. - - I changed the function to raise an error if the packet is too small, - instead of aborting gdb (through xsnprintf). It isn't clear if gdb - will be in a consistent state with respect to the stub after this, - since it's possible that some packets will be sent but not others, and - there could be an incomplete tracepoint on the stub. - - The char array used to build the packets is changed to a - gdb::char_vector and sized with the result from - get_remote_packet_size. - - When checking if the buffer is large enough to hold the tracepoint - condition agent expression, the length of the expression is multiplied - by two, since it is encoded with two hex digits per expression - byte. For simplicity, I assume that the result won't overflow, which - can happen for very long condition expressions. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * remote.c (remote_target::download_tracepoint): Remove BUF_SIZE. - Replace array buf with gdb::char_vector buf, of size - get_remote_packet_size (). Replace references to buf and - BUF_SIZE to buf.data () and buf.size (). Replace strcpy, strcat - and xsnprintf with snprintf. Raise errors if the buffer is too - small. - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -12799,26 +12799,35 @@ remote_target::remote_download_command_source (int num, ULONGEST addr, - void - remote_target::download_tracepoint (struct bp_location *loc) - { --#define BUF_SIZE 2048 -- - CORE_ADDR tpaddr; - char addrbuf[40]; -- char buf[BUF_SIZE]; - std::vector tdp_actions; - std::vector stepping_actions; - char *pkt; - struct breakpoint *b = loc->owner; - struct tracepoint *t = (struct tracepoint *) b; - struct remote_state *rs = get_remote_state (); -+ int ret; -+ char *err_msg = _("Tracepoint packet too large for target."); -+ size_t size_left; -+ -+ /* We use a buffer other than rs->buf because we'll build strings -+ across multiple statements, and other statements in between could -+ modify rs->buf. */ -+ gdb::char_vector buf (get_remote_packet_size ()); - - encode_actions_rsp (loc, &tdp_actions, &stepping_actions); - - tpaddr = loc->address; - sprintf_vma (addrbuf, tpaddr); -- xsnprintf (buf, BUF_SIZE, "QTDP:%x:%s:%c:%lx:%x", b->number, -- addrbuf, /* address */ -- (b->enable_state == bp_enabled ? 'E' : 'D'), -- t->step_count, t->pass_count); -+ ret = snprintf (buf.data (), buf.size (), "QTDP:%x:%s:%c:%lx:%x", -+ b->number, addrbuf, /* address */ -+ (b->enable_state == bp_enabled ? 'E' : 'D'), -+ t->step_count, t->pass_count); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ - /* Fast tracepoints are mostly handled by the target, but we can - tell the target how big of an instruction block should be moved - around. */ -@@ -12830,8 +12839,15 @@ remote_target::download_tracepoint (struct bp_location *loc) - { - if (gdbarch_fast_tracepoint_valid_at (loc->gdbarch, tpaddr, - NULL)) -- xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":F%x", -- gdb_insn_length (loc->gdbarch, tpaddr)); -+ { -+ size_left = buf.size () - strlen (buf.data ()); -+ ret = snprintf (buf.data () + strlen (buf.data ()), -+ size_left, ":F%x", -+ gdb_insn_length (loc->gdbarch, tpaddr)); -+ -+ if (ret < 0 || ret >= size_left) -+ error (err_msg); -+ } - else - /* If it passed validation at definition but fails now, - something is very wrong. */ -@@ -12855,7 +12871,14 @@ remote_target::download_tracepoint (struct bp_location *loc) - struct static_tracepoint_marker marker; - - if (target_static_tracepoint_marker_at (tpaddr, &marker)) -- strcat (buf, ":S"); -+ { -+ size_left = buf.size () - strlen (buf.data ()); -+ ret = snprintf (buf.data () + strlen (buf.data ()), -+ size_left, ":S"); -+ -+ if (ret < 0 || ret >= size_left) -+ error (err_msg); -+ } - else - error (_("Static tracepoint not valid during download")); - } -@@ -12873,10 +12896,26 @@ remote_target::download_tracepoint (struct bp_location *loc) - capabilities at definition time. */ - if (remote_supports_cond_tracepoints ()) - { -- agent_expr_up aexpr = gen_eval_for_expr (tpaddr, loc->cond.get ()); -- xsnprintf (buf + strlen (buf), BUF_SIZE - strlen (buf), ":X%x,", -- aexpr->len); -- pkt = buf + strlen (buf); -+ agent_expr_up aexpr = gen_eval_for_expr (tpaddr, -+ loc->cond.get ()); -+ -+ size_left = buf.size () - strlen (buf.data ()); -+ -+ ret = snprintf (buf.data () + strlen (buf.data ()), -+ size_left, ":X%x,", aexpr->len); -+ -+ if (ret < 0 || ret >= size_left) -+ error (err_msg); -+ -+ size_left = buf.size () - strlen (buf.data ()); -+ -+ /* Two bytes to encode each aexpr byte, plus the terminating -+ null byte. */ -+ if (aexpr->len * 2 + 1 > size_left) -+ error (err_msg); -+ -+ pkt = buf.data () + strlen (buf.data ()); -+ - for (int ndx = 0; ndx < aexpr->len; ++ndx) - pkt = pack_hex_byte (pkt, aexpr->buf[ndx]); - *pkt = '\0'; -@@ -12887,8 +12926,17 @@ remote_target::download_tracepoint (struct bp_location *loc) - } - - if (b->commands || *default_collect) -- strcat (buf, "-"); -- putpkt (buf); -+ { -+ size_left = buf.size () - strlen (buf.data ()); -+ -+ ret = snprintf (buf.data () + strlen (buf.data ()), -+ size_left, "-"); -+ -+ if (ret < 0 || ret >= size_left) -+ error (err_msg); -+ } -+ -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - error (_("Target does not support tracepoints.")); -@@ -12902,11 +12950,15 @@ remote_target::download_tracepoint (struct bp_location *loc) - bool has_more = ((action_it + 1) != tdp_actions.end () - || !stepping_actions.empty ()); - -- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%c", -- b->number, addrbuf, /* address */ -- action_it->c_str (), -- has_more ? '-' : 0); -- putpkt (buf); -+ ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%c", -+ b->number, addrbuf, /* address */ -+ action_it->c_str (), -+ has_more ? '-' : 0); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - error (_("Error on target while setting tracepoints.")); -@@ -12920,12 +12972,16 @@ remote_target::download_tracepoint (struct bp_location *loc) - bool is_first = action_it == stepping_actions.begin (); - bool has_more = (action_it + 1) != stepping_actions.end (); - -- xsnprintf (buf, BUF_SIZE, "QTDP:-%x:%s:%s%s%s", -- b->number, addrbuf, /* address */ -- is_first ? "S" : "", -- action_it->c_str (), -- has_more ? "-" : ""); -- putpkt (buf); -+ ret = snprintf (buf.data (), buf.size (), "QTDP:-%x:%s:%s%s%s", -+ b->number, addrbuf, /* address */ -+ is_first ? "S" : "", -+ action_it->c_str (), -+ has_more ? "-" : ""); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - error (_("Error on target while setting tracepoints.")); -@@ -12935,22 +12991,32 @@ remote_target::download_tracepoint (struct bp_location *loc) - { - if (b->location != NULL) - { -- strcpy (buf, "QTDPsrc:"); -+ ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ - encode_source_string (b->number, loc->address, "at", - event_location_to_string (b->location.get ()), -- buf + strlen (buf), 2048 - strlen (buf)); -- putpkt (buf); -+ buf.data () + strlen (buf.data ()), -+ buf.size () - strlen (buf.data ())); -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - warning (_("Target does not support source download.")); - } - if (b->cond_string) - { -- strcpy (buf, "QTDPsrc:"); -+ ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); -+ -+ if (ret < 0 || ret >= buf.size ()) -+ error (err_msg); -+ - encode_source_string (b->number, loc->address, -- "cond", b->cond_string, buf + strlen (buf), -- 2048 - strlen (buf)); -- putpkt (buf); -+ "cond", b->cond_string, -+ buf.data () + strlen (buf.data ()), -+ buf.size () - strlen (buf.data ())); -+ putpkt (buf.data ()); - remote_get_noisy_reply (); - if (strcmp (rs->buf, "OK")) - warning (_("Target does not support source download.")); diff --git a/gdb-rhbz1187581-power8-regs-4of7.patch b/gdb-rhbz1187581-power8-regs-4of7.patch deleted file mode 100644 index 8c553a8..0000000 --- a/gdb-rhbz1187581-power8-regs-4of7.patch +++ /dev/null @@ -1,449 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:17:16 +0200 -Subject: gdb-rhbz1187581-power8-regs-4of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit 4277c4b87addb5354cc47b98d7a73e44cfaf22c2 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Use remote register numbers in tracepoint mask - - Currently, tracepoint register masks in the QTDP packets include both - internal and remote register numbers, as well as pseudo-register - numbers. - - This patch changes this so that the mask only includes remote register - numbers. - - Register numbers from agent expressions are already set in the mask - using remote numbers. Other tracepoint actions used internal numbers, - e.g. "collect $regs" or "collect $". To handle pseudoreg - numbers, an empty agent expression is created and ax_reg_mask is - called for this expression and the pseudoreg. This will cause the ax - to set its mask with the corresponding remote raw register - numbers (using ax_regs_mask, which calls - gdbarch_ax_pseudo_register_collect). - - If ax_regs_mask and gdbarch_ax_pseudo_register_collect also generate - more ax bytecode, the ax is also appended to the collection list. It - isn't clear that this was the original intent for - gdbarch_ax_pseudo_register_collect, and none of the arches seem to do - this, but if this changes in the future, it should work. - - The patch also refactors the code used by validate_action line to - validate axs into a function that is now called from every place that - generates axs. Previously, some parts of tracepoint.c that generated - axs didn't check if the ax length was greater than MAX_AGENT_EXPR_LEN. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * tracepoint.h (class collection_list) : Remove. - : - Declare. - : Add scope parameter. - * tracepoint.c (encode_actions_1): Likewise. - (collection_list::add_register): Rename to ... - (collection_list::add_remote_register): ... this. Update - comment. - (collection_list::add_ax_registers, add_local_register): New - methods. - (collection_list::add_memrange): Add scope parameter. Call - add_local_register instead of add_register. - (finalize_tracepoint_aexpr): New function. - (collection_list::collect_symbol): Update calls to add_memrange. - Call add_local_register instead of add_register. Call - add_ax_registers. Call finalize_tracepoint_aexpr. - (encode_actions_1): Get remote regnos for $reg action. Call - add_remote_register, add_ax_registers, and add_local_register. - Update call to add_memrange. Call finalize_tracepoint_aexpr. - (validate_actionline): Call finalize_tracepoint_aexpr. - -+2018-08-06 Pedro Franco de Carvalho -+ -+ * tracepoint.h (class collection_list) : Remove. -+ : -+ Declare. -+ : Add scope parameter. -+ * tracepoint.c (encode_actions_1): Likewise. -+ (collection_list::add_register): Rename to ... -+ (collection_list::add_remote_register): ... this. Update -+ comment. -+ (collection_list::add_ax_registers, add_local_register): New -+ methods. -+ (collection_list::add_memrange): Add scope parameter. Call -+ add_local_register instead of add_register. -+ (finalize_tracepoint_aexpr): New function. -+ (collection_list::collect_symbol): Update calls to add_memrange. -+ Call add_local_register instead of add_register. Call -+ add_ax_registers. Call finalize_tracepoint_aexpr. -+ (encode_actions_1): Get remote regnos for $reg action. Call -+ add_remote_register, add_ax_registers, and add_local_register. -+ Update call to add_memrange. Call finalize_tracepoint_aexpr. -+ (validate_actionline): Call finalize_tracepoint_aexpr. -+ - 2018-08-06 Pedro Franco de Carvalho - - * remote.c (remote_target::download_tracepoint): Remove BUF_SIZE. - -diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c ---- a/gdb/tracepoint.c -+++ b/gdb/tracepoint.c -@@ -615,6 +615,19 @@ report_agent_reqs_errors (struct agent_expr *aexpr) - error (_("Expression is too complicated.")); - } - -+/* Call ax_reqs on AEXPR and raise an error if something is wrong. */ -+ -+static void -+finalize_tracepoint_aexpr (struct agent_expr *aexpr) -+{ -+ ax_reqs (aexpr); -+ -+ if (aexpr->len > MAX_AGENT_EXPR_LEN) -+ error (_("Expression is too complicated.")); -+ -+ report_agent_reqs_errors (aexpr); -+} -+ - /* worker function */ - void - validate_actionline (const char *line, struct breakpoint *b) -@@ -699,12 +712,7 @@ validate_actionline (const char *line, struct breakpoint *b) - exp.get (), - trace_string); - -- if (aexpr->len > MAX_AGENT_EXPR_LEN) -- error (_("Expression is too complicated.")); -- -- ax_reqs (aexpr.get ()); -- -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - } - } - while (p && *p++ == ','); -@@ -731,11 +739,7 @@ validate_actionline (const char *line, struct breakpoint *b) - long. */ - agent_expr_up aexpr = gen_eval_for_expr (loc->address, exp.get ()); - -- if (aexpr->len > MAX_AGENT_EXPR_LEN) -- error (_("Expression is too complicated.")); -- -- ax_reqs (aexpr.get ()); -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - } - } - while (p && *p++ == ','); -@@ -811,10 +815,10 @@ memrange_sortmerge (std::vector &memranges) - } - } - --/* Add a register to a collection list. */ -+/* Add remote register number REGNO to the collection list mask. */ - - void --collection_list::add_register (unsigned int regno) -+collection_list::add_remote_register (unsigned int regno) - { - if (info_verbose) - printf_filtered ("collect register %d\n", regno); -@@ -824,12 +828,74 @@ collection_list::add_register (unsigned int regno) - m_regs_mask[regno / 8] |= 1 << (regno % 8); - } - -+/* Add all the registers from the mask in AEXPR to the mask in the -+ collection list. Registers in the AEXPR mask are already remote -+ register numbers. */ -+ -+void -+collection_list::add_ax_registers (struct agent_expr *aexpr) -+{ -+ if (aexpr->reg_mask_len > 0) -+ { -+ for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) -+ { -+ QUIT; /* Allow user to bail out with ^C. */ -+ if (aexpr->reg_mask[ndx1] != 0) -+ { -+ /* Assume chars have 8 bits. */ -+ for (int ndx2 = 0; ndx2 < 8; ndx2++) -+ if (aexpr->reg_mask[ndx1] & (1 << ndx2)) -+ /* It's used -- record it. */ -+ add_remote_register (ndx1 * 8 + ndx2); -+ } -+ } -+ } -+} -+ -+/* If REGNO is raw, add its corresponding remote register number to -+ the mask. If REGNO is a pseudo-register, figure out the necessary -+ registers using a temporary agent expression, and add it to the -+ list if it needs more than just a mask. */ -+ -+void -+collection_list::add_local_register (struct gdbarch *gdbarch, -+ unsigned int regno, -+ CORE_ADDR scope) -+{ -+ if (regno < gdbarch_num_regs (gdbarch)) -+ { -+ int remote_regno = gdbarch_remote_register_number (gdbarch, regno); -+ -+ if (remote_regno < 0) -+ error (_("Can't collect register %d"), regno); -+ -+ add_remote_register (remote_regno); -+ } -+ else -+ { -+ agent_expr_up aexpr (new agent_expr (gdbarch, scope)); -+ -+ ax_reg_mask (aexpr.get (), regno); -+ -+ finalize_tracepoint_aexpr (aexpr.get ()); -+ -+ add_ax_registers (aexpr.get ()); -+ -+ /* Usually ax_reg_mask for a pseudo-regiser only sets the -+ corresponding raw registers in the ax mask, but if this isn't -+ the case add the expression that is generated to the -+ collection list. */ -+ if (aexpr->len > 0) -+ add_aexpr (std::move (aexpr)); -+ } -+} -+ - /* Add a memrange to a collection list. */ - - void - collection_list::add_memrange (struct gdbarch *gdbarch, - int type, bfd_signed_vma base, -- ULONGEST len) -+ ULONGEST len, CORE_ADDR scope) - { - if (info_verbose) - printf_filtered ("(%d,%s,%s)\n", type, paddress (gdbarch, base), pulongest (len)); -@@ -840,7 +906,7 @@ collection_list::add_memrange (struct gdbarch *gdbarch, - m_memranges.emplace_back (type, base, base + len); - - if (type != memrange_absolute) /* Better collect the base register! */ -- add_register (type); -+ add_local_register (gdbarch, type, scope); - } - - /* Add a symbol to a collection list. */ -@@ -882,19 +948,19 @@ collection_list::collect_symbol (struct symbol *sym, - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT) - treat_as_expr = 1; - else -- add_memrange (gdbarch, memrange_absolute, offset, len); -+ add_memrange (gdbarch, memrange_absolute, offset, len, scope); - break; - case LOC_REGISTER: - reg = SYMBOL_REGISTER_OPS (sym)->register_number (sym, gdbarch); - if (info_verbose) - printf_filtered ("LOC_REG[parm] %s: ", - SYMBOL_PRINT_NAME (sym)); -- add_register (reg); -+ add_local_register (gdbarch, reg, scope); - /* Check for doubles stored in two registers. */ - /* FIXME: how about larger types stored in 3 or more regs? */ - if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FLT && - len > register_size (gdbarch, reg)) -- add_register (reg + 1); -+ add_local_register (gdbarch, reg + 1, scope); - break; - case LOC_REF_ARG: - printf_filtered ("Sorry, don't know how to do LOC_REF_ARG yet.\n"); -@@ -911,7 +977,7 @@ collection_list::collect_symbol (struct symbol *sym, - SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } -- add_memrange (gdbarch, reg, offset, len); -+ add_memrange (gdbarch, reg, offset, len, scope); - break; - case LOC_REGPARM_ADDR: - reg = SYMBOL_VALUE (sym); -@@ -923,7 +989,7 @@ collection_list::collect_symbol (struct symbol *sym, - SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } -- add_memrange (gdbarch, reg, offset, len); -+ add_memrange (gdbarch, reg, offset, len, scope); - break; - case LOC_LOCAL: - reg = frame_regno; -@@ -935,7 +1001,7 @@ collection_list::collect_symbol (struct symbol *sym, - SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } -- add_memrange (gdbarch, reg, offset, len); -+ add_memrange (gdbarch, reg, offset, len, scope); - break; - - case LOC_UNRESOLVED: -@@ -968,26 +1034,10 @@ collection_list::collect_symbol (struct symbol *sym, - return; - } - -- ax_reqs (aexpr.get ()); -- -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - - /* Take care of the registers. */ -- if (aexpr->reg_mask_len > 0) -- { -- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) -- { -- QUIT; /* Allow user to bail out with ^C. */ -- if (aexpr->reg_mask[ndx1] != 0) -- { -- /* Assume chars have 8 bits. */ -- for (int ndx2 = 0; ndx2 < 8; ndx2++) -- if (aexpr->reg_mask[ndx1] & (1 << ndx2)) -- /* It's used -- record it. */ -- add_register (ndx1 * 8 + ndx2); -- } -- } -- } -+ add_ax_registers (aexpr.get ()); - - add_aexpr (std::move (aexpr)); - } -@@ -1257,8 +1307,18 @@ encode_actions_1 (struct command_line *action, - - if (0 == strncasecmp ("$reg", action_exp, 4)) - { -- for (i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++) -- collect->add_register (i); -+ for (i = 0; i < gdbarch_num_regs (target_gdbarch ()); -+ i++) -+ { -+ int remote_regno = (gdbarch_remote_register_number -+ (target_gdbarch (), i)); -+ -+ /* Ignore arch regnos without a corresponding -+ remote regno. This can happen for regnos not -+ in the tdesc. */ -+ if (remote_regno >= 0) -+ collect->add_remote_register (remote_regno); -+ } - action_exp = strchr (action_exp, ','); /* more? */ - } - else if (0 == strncasecmp ("$arg", action_exp, 4)) -@@ -1288,27 +1348,10 @@ encode_actions_1 (struct command_line *action, - target_gdbarch (), - trace_string); - -- ax_reqs (aexpr.get ()); -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - - /* take care of the registers */ -- if (aexpr->reg_mask_len > 0) -- { -- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) -- { -- QUIT; /* allow user to bail out with ^C */ -- if (aexpr->reg_mask[ndx1] != 0) -- { -- /* assume chars have 8 bits */ -- for (int ndx2 = 0; ndx2 < 8; ndx2++) -- if (aexpr->reg_mask[ndx1] & (1 << ndx2)) -- { -- /* It's used -- record it. */ -- collect->add_register (ndx1 * 8 + ndx2); -- } -- } -- } -- } -+ collect->add_ax_registers (aexpr.get ()); - - collect->add_aexpr (std::move (aexpr)); - action_exp = strchr (action_exp, ','); /* more? */ -@@ -1340,7 +1383,8 @@ encode_actions_1 (struct command_line *action, - name); - if (info_verbose) - printf_filtered ("OP_REGISTER: "); -- collect->add_register (i); -+ collect->add_local_register (target_gdbarch (), -+ i, tloc->address); - break; - } - -@@ -1352,7 +1396,8 @@ encode_actions_1 (struct command_line *action, - check_typedef (exp->elts[1].type); - collect->add_memrange (target_gdbarch (), - memrange_absolute, addr, -- TYPE_LENGTH (exp->elts[1].type)); -+ TYPE_LENGTH (exp->elts[1].type), -+ tloc->address); - collect->append_exp (exp.get ()); - break; - -@@ -1376,28 +1421,10 @@ encode_actions_1 (struct command_line *action, - exp.get (), - trace_string); - -- ax_reqs (aexpr.get ()); -- -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - - /* Take care of the registers. */ -- if (aexpr->reg_mask_len > 0) -- { -- for (int ndx1 = 0; ndx1 < aexpr->reg_mask_len; ndx1++) -- { -- QUIT; /* Allow user to bail out with ^C. */ -- if (aexpr->reg_mask[ndx1] != 0) -- { -- /* Assume chars have 8 bits. */ -- for (int ndx2 = 0; ndx2 < 8; ndx2++) -- if (aexpr->reg_mask[ndx1] & (1 << ndx2)) -- { -- /* It's used -- record it. */ -- collect->add_register (ndx1 * 8 + ndx2); -- } -- } -- } -- } -+ collect->add_ax_registers (aexpr.get ()); - - collect->add_aexpr (std::move (aexpr)); - collect->append_exp (exp.get ()); -@@ -1422,8 +1449,7 @@ encode_actions_1 (struct command_line *action, - agent_expr_up aexpr = gen_eval_for_expr (tloc->address, - exp.get ()); - -- ax_reqs (aexpr.get ()); -- report_agent_reqs_errors (aexpr.get ()); -+ finalize_tracepoint_aexpr (aexpr.get ()); - - /* Even though we're not officially collecting, add - to the collect list anyway. */ -diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h ---- a/gdb/tracepoint.h -+++ b/gdb/tracepoint.h -@@ -263,9 +263,14 @@ public: - void add_aexpr (agent_expr_up aexpr); - - void add_register (unsigned int regno); -+ void add_remote_register (unsigned int regno); -+ void add_ax_registers (struct agent_expr *aexpr); -+ void add_local_register (struct gdbarch *gdbarch, -+ unsigned int regno, -+ CORE_ADDR scope); - void add_memrange (struct gdbarch *gdbarch, - int type, bfd_signed_vma base, -- ULONGEST len); -+ ULONGEST len, CORE_ADDR scope); - void collect_symbol (struct symbol *sym, - struct gdbarch *gdbarch, - long frame_regno, long frame_offset, diff --git a/gdb-rhbz1187581-power8-regs-5of7.patch b/gdb-rhbz1187581-power8-regs-5of7.patch deleted file mode 100644 index eaca52f..0000000 --- a/gdb-rhbz1187581-power8-regs-5of7.patch +++ /dev/null @@ -1,215 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:17:46 +0200 -Subject: gdb-rhbz1187581-power8-regs-5of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit a04b9d62a234923826e431a209d396a628661548 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Variable size for regs mask in collection list - - This patch changes collection_list to allow larger register masks. - - The mask is changed from an array to a vector and is initialized to - hold the maximum possible remote register number. The stringify - method is updated to resize temp_buf if needed. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * tracepoint.h (collection_list) : Change type to - std::vector. - * tracepoint.c (collection_list::collection_list): Remove - m_regs_mask initializer from initializer list. Resize - m_regs_mask using the largest remote register number. - (collection_list::add_remote_register): Remove size check on - m_regs_mask. Use at to access element. - (collection_list::stringify): Change type of temp_buf to - gdb::char_vector. Update uses of temp_buf. Resize if needed to - stringify the register mask. Use pack_hex_byte for the register - mask. - -+2018-08-06 Pedro Franco de Carvalho -+ -+ * tracepoint.h (collection_list) : Change type to -+ std::vector. -+ * tracepoint.c (collection_list::collection_list): Remove -+ m_regs_mask initializer from initializer list. Resize -+ m_regs_mask using the largest remote register number. -+ (collection_list::add_remote_register): Remove size check on -+ m_regs_mask. Use at to access element. -+ (collection_list::stringify): Change type of temp_buf to -+ gdb::char_vector. Update uses of temp_buf. Resize if needed to -+ stringify the register mask. Use pack_hex_byte for the register -+ mask. -+ - 2018-08-06 Pedro Franco de Carvalho - - * tracepoint.h (class collection_list) : Remove. - -diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c ---- a/gdb/tracepoint.c -+++ b/gdb/tracepoint.c -@@ -822,10 +822,8 @@ collection_list::add_remote_register (unsigned int regno) - { - if (info_verbose) - printf_filtered ("collect register %d\n", regno); -- if (regno >= (8 * sizeof (m_regs_mask))) -- error (_("Internal: register number %d too large for tracepoint"), -- regno); -- m_regs_mask[regno / 8] |= 1 << (regno % 8); -+ -+ m_regs_mask.at (regno / 8) |= 1 << (regno % 8); - } - - /* Add all the registers from the mask in AEXPR to the mask in the -@@ -1136,9 +1134,20 @@ collection_list::add_static_trace_data () - } - - collection_list::collection_list () -- : m_regs_mask (), -- m_strace_data (false) -+ : m_strace_data (false) - { -+ int max_remote_regno = 0; -+ for (int i = 0; i < gdbarch_num_regs (target_gdbarch ()); i++) -+ { -+ int remote_regno = (gdbarch_remote_register_number -+ (target_gdbarch (), i)); -+ -+ if (remote_regno >= 0 && remote_regno > max_remote_regno) -+ max_remote_regno = remote_regno; -+ } -+ -+ m_regs_mask.resize ((max_remote_regno / 8) + 1); -+ - m_memranges.reserve (128); - m_aexprs.reserve (128); - } -@@ -1148,7 +1157,8 @@ collection_list::collection_list () - std::vector - collection_list::stringify () - { -- char temp_buf[2048]; -+ gdb::char_vector temp_buf (2048); -+ - int count; - char *end; - long i; -@@ -1158,35 +1168,45 @@ collection_list::stringify () - { - if (info_verbose) - printf_filtered ("\nCollecting static trace data\n"); -- end = temp_buf; -+ end = temp_buf.data (); - *end++ = 'L'; -- str_list.emplace_back (temp_buf, end - temp_buf); -+ str_list.emplace_back (temp_buf.data (), end - temp_buf.data ()); - } - -- for (i = sizeof (m_regs_mask) - 1; i > 0; i--) -+ for (i = m_regs_mask.size () - 1; i > 0; i--) - if (m_regs_mask[i] != 0) /* Skip leading zeroes in regs_mask. */ - break; - if (m_regs_mask[i] != 0) /* Prepare to send regs_mask to the stub. */ - { - if (info_verbose) - printf_filtered ("\nCollecting registers (mask): 0x"); -- end = temp_buf; -+ -+ /* One char for 'R', one for the null terminator and two per -+ mask byte. */ -+ std::size_t new_size = (i + 1) * 2 + 2; -+ if (new_size > temp_buf.size ()) -+ temp_buf.resize (new_size); -+ -+ end = temp_buf.data (); - *end++ = 'R'; - for (; i >= 0; i--) - { - QUIT; /* Allow user to bail out with ^C. */ - if (info_verbose) - printf_filtered ("%02X", m_regs_mask[i]); -- sprintf (end, "%02X", m_regs_mask[i]); -- end += 2; -+ -+ end = pack_hex_byte (end, m_regs_mask[i]); - } -- str_list.emplace_back (temp_buf); -+ *end = '\0'; -+ -+ str_list.emplace_back (temp_buf.data ()); - } - if (info_verbose) - printf_filtered ("\n"); - if (!m_memranges.empty () && info_verbose) - printf_filtered ("Collecting memranges: \n"); -- for (i = 0, count = 0, end = temp_buf; i < m_memranges.size (); i++) -+ for (i = 0, count = 0, end = temp_buf.data (); -+ i < m_memranges.size (); i++) - { - QUIT; /* Allow user to bail out with ^C. */ - if (info_verbose) -@@ -1200,9 +1220,9 @@ collection_list::stringify () - } - if (count + 27 > MAX_AGENT_EXPR_LEN) - { -- str_list.emplace_back (temp_buf, count); -+ str_list.emplace_back (temp_buf.data (), count); - count = 0; -- end = temp_buf; -+ end = temp_buf.data (); - } - - { -@@ -1222,7 +1242,7 @@ collection_list::stringify () - } - - count += strlen (end); -- end = temp_buf + count; -+ end = temp_buf.data () + count; - } - - for (i = 0; i < m_aexprs.size (); i++) -@@ -1230,9 +1250,9 @@ collection_list::stringify () - QUIT; /* Allow user to bail out with ^C. */ - if ((count + 10 + 2 * m_aexprs[i]->len) > MAX_AGENT_EXPR_LEN) - { -- str_list.emplace_back (temp_buf, count); -+ str_list.emplace_back (temp_buf.data (), count); - count = 0; -- end = temp_buf; -+ end = temp_buf.data (); - } - sprintf (end, "X%08X,", m_aexprs[i]->len); - end += 10; /* 'X' + 8 hex digits + ',' */ -@@ -1244,9 +1264,9 @@ collection_list::stringify () - - if (count != 0) - { -- str_list.emplace_back (temp_buf, count); -+ str_list.emplace_back (temp_buf.data (), count); - count = 0; -- end = temp_buf; -+ end = temp_buf.data (); - } - - return str_list; -diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h ---- a/gdb/tracepoint.h -+++ b/gdb/tracepoint.h -@@ -293,8 +293,9 @@ public: - { return m_computed; } - - private: -- /* room for up to 256 regs */ -- unsigned char m_regs_mask[32]; -+ /* We need the allocator zero-initialize the mask, so we don't use -+ gdb::byte_vector. */ -+ std::vector m_regs_mask; - - std::vector m_memranges; - diff --git a/gdb-rhbz1187581-power8-regs-6of7.patch b/gdb-rhbz1187581-power8-regs-6of7.patch deleted file mode 100644 index b0a5e1f..0000000 --- a/gdb-rhbz1187581-power8-regs-6of7.patch +++ /dev/null @@ -1,187 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:18:15 +0200 -Subject: gdb-rhbz1187581-power8-regs-6of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit 296956befef3711ed458c7cba8041fde0dab9c50 -Author: Pedro Franco de Carvalho -Date: Mon Aug 6 16:24:55 2018 -0300 - - Allow larger regblock sizes when saving tracefiles - - The tracefile.c:trace_save function assumes trace_regblock_size won't - be larger than the MAX_TRACE_UPLOAD constant, used to size the buffer - which holds trace data. This can cause buffer overruns when this is - not the case. This patch changes this function so that the larger - size is used to size the buffer. - - gdb/ChangeLog: - 2018-08-06 Pedro Franco de Carvalho - - * tracefile.c: Include common/byte-vector.h. - (trace_save): Change type of buf to gdb::byte_vector. Initialize - with trace_regblock_size if needed. Update uses of buf. - -+2018-08-06 Pedro Franco de Carvalho -+ -+ * tracefile.c: Include common/byte-vector.h. -+ (trace_save): Change type of buf to gdb::byte_vector. Initialize -+ with trace_regblock_size if needed. Update uses of buf. -+ - 2018-08-06 Pedro Franco de Carvalho - - * tracepoint.h (collection_list) : Change type to - -diff --git a/gdb/tracefile.c b/gdb/tracefile.c ---- a/gdb/tracefile.c -+++ b/gdb/tracefile.c -@@ -22,6 +22,7 @@ - #include "ctf.h" - #include "exec.h" - #include "regcache.h" -+#include "common/byte-vector.h" - - /* Helper macros. */ - -@@ -67,7 +68,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, - - ULONGEST offset = 0; - #define MAX_TRACE_UPLOAD 2000 -- gdb_byte buf[MAX_TRACE_UPLOAD]; -+ gdb::byte_vector buf (std::max (MAX_TRACE_UPLOAD, trace_regblock_size)); - enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); - - /* If the target is to save the data to a file on its own, then just -@@ -144,7 +145,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, - /* We ask for big blocks, in the hopes of efficiency, but - will take less if the target has packet size limitations - or some such. */ -- gotten = target_get_raw_trace_data (buf, offset, -+ gotten = target_get_raw_trace_data (buf.data (), offset, - MAX_TRACE_UPLOAD); - if (gotten < 0) - error (_("Failure to get requested trace buffer data")); -@@ -152,7 +153,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, - if (gotten == 0) - break; - -- writer->ops->write_trace_buffer (writer, buf, gotten); -+ writer->ops->write_trace_buffer (writer, buf.data (), gotten); - - offset += gotten; - } -@@ -163,7 +164,7 @@ trace_save (const char *filename, struct trace_file_writer *writer, - /* Parse the trace buffers according to how data are stored - in trace buffer in GDBserver. */ - -- gotten = target_get_raw_trace_data (buf, offset, 6); -+ gotten = target_get_raw_trace_data (buf.data (), offset, 6); - - if (gotten == 0) - break; -@@ -171,10 +172,10 @@ trace_save (const char *filename, struct trace_file_writer *writer, - /* Read the first six bytes in, which is the tracepoint - number and trace frame size. */ - tp_num = (uint16_t) -- extract_unsigned_integer (&buf[0], 2, byte_order); -+ extract_unsigned_integer (&((buf.data ())[0]), 2, byte_order); - - tf_size = (uint32_t) -- extract_unsigned_integer (&buf[2], 4, byte_order); -+ extract_unsigned_integer (&((buf.data ())[2]), 4, byte_order); - - writer->ops->frame_ops->start (writer, tp_num); - gotten = 6; -@@ -192,7 +193,8 @@ trace_save (const char *filename, struct trace_file_writer *writer, - /* We'll fetch one block each time, in order to - handle the extremely large 'M' block. We first - fetch one byte to get the type of the block. */ -- gotten = target_get_raw_trace_data (buf, offset, 1); -+ gotten = target_get_raw_trace_data (buf.data (), -+ offset, 1); - if (gotten < 1) - error (_("Failure to get requested trace buffer data")); - -@@ -205,13 +207,13 @@ trace_save (const char *filename, struct trace_file_writer *writer, - { - case 'R': - gotten -- = target_get_raw_trace_data (buf, offset, -+ = target_get_raw_trace_data (buf.data (), offset, - trace_regblock_size); - if (gotten < trace_regblock_size) - error (_("Failure to get requested trace" - " buffer data")); - -- TRACE_WRITE_R_BLOCK (writer, buf, -+ TRACE_WRITE_R_BLOCK (writer, buf.data (), - trace_regblock_size); - break; - case 'M': -@@ -221,7 +223,8 @@ trace_save (const char *filename, struct trace_file_writer *writer, - LONGEST t; - int j; - -- t = target_get_raw_trace_data (buf,offset, 10); -+ t = target_get_raw_trace_data (buf.data (), -+ offset, 10); - if (t < 10) - error (_("Failure to get requested trace" - " buffer data")); -@@ -231,10 +234,10 @@ trace_save (const char *filename, struct trace_file_writer *writer, - - gotten = 0; - addr = (ULONGEST) -- extract_unsigned_integer (buf, 8, -+ extract_unsigned_integer (buf.data (), 8, - byte_order); - mlen = (unsigned short) -- extract_unsigned_integer (&buf[8], 2, -+ extract_unsigned_integer (&((buf.data ())[8]), 2, - byte_order); - - TRACE_WRITE_M_BLOCK_HEADER (writer, addr, -@@ -252,14 +255,15 @@ trace_save (const char *filename, struct trace_file_writer *writer, - else - read_length = mlen - j; - -- t = target_get_raw_trace_data (buf, -+ t = target_get_raw_trace_data (buf.data (), - offset + j, - read_length); - if (t < read_length) - error (_("Failure to get requested" - " trace buffer data")); - -- TRACE_WRITE_M_BLOCK_MEMORY (writer, buf, -+ TRACE_WRITE_M_BLOCK_MEMORY (writer, -+ buf.data (), - read_length); - - j += read_length; -@@ -274,18 +278,18 @@ trace_save (const char *filename, struct trace_file_writer *writer, - LONGEST val; - - gotten -- = target_get_raw_trace_data (buf, offset, -- 12); -+ = target_get_raw_trace_data (buf.data (), -+ offset, 12); - if (gotten < 12) - error (_("Failure to get requested" - " trace buffer data")); - -- vnum = (int) extract_signed_integer (buf, -+ vnum = (int) extract_signed_integer (buf.data (), - 4, - byte_order); - val -- = extract_signed_integer (&buf[4], 8, -- byte_order); -+ = extract_signed_integer (&((buf.data ())[4]), -+ 8, byte_order); - - TRACE_WRITE_V_BLOCK (writer, vnum, val); - } diff --git a/gdb-rhbz1187581-power8-regs-7of7.patch b/gdb-rhbz1187581-power8-regs-7of7.patch deleted file mode 100644 index ee82673..0000000 --- a/gdb-rhbz1187581-power8-regs-7of7.patch +++ /dev/null @@ -1,129 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Jan Kratochvil -Date: Thu, 9 Aug 2018 17:18:49 +0200 -Subject: gdb-rhbz1187581-power8-regs-7of7.patch - -;; Add GDB support to access/display POWER8 registers (IBM, RH BZ 1187581). - -commit a7f25a84f4cc1df5248c46346337f19a2a66af5a -Author: Simon Marchi -Date: Mon Aug 6 16:54:47 2018 -0400 - - Fix compilation failure in remote.c - - A recent patch introduced a few of these: - - /home/emaisin/src/binutils-gdb/gdb/remote.c:12862:19: error: format not a string literal and no format arguments [-Werror=format-security] - error (err_msg); - ^ - - Fix them by replacing the call to error with - - error ("%s", err_msg); - - gdb/ChangeLog: - - * remote.c (remote_target::download_tracepoint): Fix format - string errors. - -+2018-08-06 Simon Marchi -+ -+ * remote.c (remote_target::download_tracepoint): Fix format -+ string errors. -+ - 2018-08-06 Pedro Franco de Carvalho - - * tracefile.c: Include common/byte-vector.h. - -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -12826,7 +12826,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - t->step_count, t->pass_count); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - /* Fast tracepoints are mostly handled by the target, but we can - tell the target how big of an instruction block should be moved -@@ -12846,7 +12846,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - gdb_insn_length (loc->gdbarch, tpaddr)); - - if (ret < 0 || ret >= size_left) -- error (err_msg); -+ error ("%s", err_msg); - } - else - /* If it passed validation at definition but fails now, -@@ -12877,7 +12877,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - size_left, ":S"); - - if (ret < 0 || ret >= size_left) -- error (err_msg); -+ error ("%s", err_msg); - } - else - error (_("Static tracepoint not valid during download")); -@@ -12905,14 +12905,14 @@ remote_target::download_tracepoint (struct bp_location *loc) - size_left, ":X%x,", aexpr->len); - - if (ret < 0 || ret >= size_left) -- error (err_msg); -+ error ("%s", err_msg); - - size_left = buf.size () - strlen (buf.data ()); - - /* Two bytes to encode each aexpr byte, plus the terminating - null byte. */ - if (aexpr->len * 2 + 1 > size_left) -- error (err_msg); -+ error ("%s", err_msg); - - pkt = buf.data () + strlen (buf.data ()); - -@@ -12933,7 +12933,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - size_left, "-"); - - if (ret < 0 || ret >= size_left) -- error (err_msg); -+ error ("%s", err_msg); - } - - putpkt (buf.data ()); -@@ -12956,7 +12956,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - has_more ? '-' : 0); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - putpkt (buf.data ()); - remote_get_noisy_reply (); -@@ -12979,7 +12979,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - has_more ? "-" : ""); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - putpkt (buf.data ()); - remote_get_noisy_reply (); -@@ -12994,7 +12994,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - encode_source_string (b->number, loc->address, "at", - event_location_to_string (b->location.get ()), -@@ -13010,7 +13010,7 @@ remote_target::download_tracepoint (struct bp_location *loc) - ret = snprintf (buf.data (), buf.size (), "QTDPsrc:"); - - if (ret < 0 || ret >= buf.size ()) -- error (err_msg); -+ error ("%s", err_msg); - - encode_source_string (b->number, loc->address, - "cond", b->cond_string, diff --git a/gdb-rhbz795424-bitpos-20of25.patch b/gdb-rhbz795424-bitpos-20of25.patch index e2c2f48..ad2daf4 100644 --- a/gdb-rhbz795424-bitpos-20of25.patch +++ b/gdb-rhbz795424-bitpos-20of25.patch @@ -557,7 +557,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *); static struct value *assign_aggregate (struct value *, struct value *, -@@ -697,7 +698,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) +@@ -692,7 +693,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) } static const gdb_byte * @@ -566,7 +566,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c { if (valaddr == NULL) return NULL; -@@ -706,7 +707,7 @@ cond_offset_host (const gdb_byte *valaddr, long offset) +@@ -701,7 +702,7 @@ cond_offset_host (const gdb_byte *valaddr, long offset) } static CORE_ADDR @@ -684,7 +684,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c val = value_cast (value_type (component), val); -@@ -4462,7 +4464,7 @@ ensure_lval (struct value *val) +@@ -4502,7 +4504,7 @@ ensure_lval (struct value *val) if (VALUE_LVAL (val) == not_lval || VALUE_LVAL (val) == lval_internalvar) { @@ -693,7 +693,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c const CORE_ADDR addr = value_as_long (value_allocate_space_in_inferior (len)); -@@ -4546,7 +4548,7 @@ static CORE_ADDR +@@ -4586,7 +4588,7 @@ static CORE_ADDR value_pointer (struct value *value, struct type *type) { struct gdbarch *gdbarch = get_type_arch (type); @@ -702,7 +702,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c gdb_byte *buf = (gdb_byte *) alloca (len); CORE_ADDR addr; -@@ -6657,7 +6659,7 @@ value_tag_from_contents_and_address (struct type *type, +@@ -6694,7 +6696,7 @@ value_tag_from_contents_and_address (struct type *type, const gdb_byte *valaddr, CORE_ADDR address) { @@ -711,7 +711,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *tag_type; if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset, -@@ -7150,7 +7152,7 @@ ada_in_variant (LONGEST val, struct type *type, int field_num) +@@ -7187,7 +7189,7 @@ ada_in_variant (LONGEST val, struct type *type, int field_num) only in that it can handle packed values of arbitrary type. */ static struct value * @@ -720,7 +720,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *arg_type) { struct type *type; -@@ -7162,7 +7164,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, +@@ -7199,7 +7201,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0) { @@ -729,7 +729,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno); return ada_value_primitive_packed_val (arg1, value_contents (arg1), -@@ -7239,9 +7241,9 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, +@@ -7276,9 +7278,9 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, Returns 1 if found, 0 otherwise. */ static int @@ -741,7 +741,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c int *index_p) { int i; -@@ -7260,8 +7262,8 @@ find_struct_field (const char *name, struct type *type, int offset, +@@ -7297,8 +7299,8 @@ find_struct_field (const char *name, struct type *type, int offset, for (i = 0; i < TYPE_NFIELDS (type); i += 1) { @@ -752,7 +752,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c const char *t_field_name = TYPE_FIELD_NAME (type, i); if (t_field_name == NULL) -@@ -7363,7 +7365,7 @@ num_visible_fields (struct type *type) +@@ -7400,7 +7402,7 @@ num_visible_fields (struct type *type) long explanation in find_struct_field's function documentation. */ static struct value * @@ -761,7 +761,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *type) { int i; -@@ -7411,7 +7413,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, +@@ -7448,7 +7450,7 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, int j; struct type *field_type = ada_check_typedef (TYPE_FIELD_TYPE (type, i)); @@ -770,7 +770,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c for (j = 0; j < TYPE_NFIELDS (field_type); j += 1) { -@@ -7443,8 +7445,8 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, +@@ -7480,8 +7482,8 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, return NULL; } @@ -781,7 +781,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c /* Return field #INDEX in ARG, where the index is that returned by -@@ -7453,7 +7455,7 @@ static struct value *ada_index_struct_field_1 (int *, struct value *, +@@ -7490,7 +7492,7 @@ static struct value *ada_index_struct_field_1 (int *, struct value *, * If found, return value, else return NULL. */ static struct value * @@ -790,7 +790,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *type) { return ada_index_struct_field_1 (&index, arg, offset, type); -@@ -7465,7 +7467,7 @@ ada_index_struct_field (int index, struct value *arg, int offset, +@@ -7502,7 +7504,7 @@ ada_index_struct_field (int index, struct value *arg, int offset, * *INDEX_P. */ static struct value * @@ -799,7 +799,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *type) { int i; -@@ -7555,7 +7557,8 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) +@@ -7593,7 +7595,8 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) v = ada_search_struct_field (name, arg, 0, t); else { @@ -809,7 +809,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c struct type *field_type; CORE_ADDR address; -@@ -7899,8 +7902,8 @@ ada_coerce_ref (struct value *val0) +@@ -7942,8 +7945,8 @@ ada_coerce_ref (struct value *val0) /* Return OFF rounded upward if necessary to a multiple of ALIGNMENT (a power of 2). */ @@ -820,7 +820,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c { return (off + alignment - 1) & ~(alignment - 1); } -@@ -8290,10 +8293,9 @@ ada_template_to_fixed_record_type_1 (struct type *type, +@@ -8333,10 +8336,9 @@ ada_template_to_fixed_record_type_1 (struct type *type, struct value *mark = value_mark (); struct value *dval; struct type *rtype; @@ -833,7 +833,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c int f; /* Compute the number of fields in this record type that are going -@@ -8370,7 +8372,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, +@@ -8413,7 +8415,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, that follow this one. */ if (ada_is_aligner_type (field_type)) { @@ -842,7 +842,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c field_valaddr = cond_offset_host (field_valaddr, field_offset); field_address = cond_offset_target (field_address, field_offset); -@@ -8506,11 +8508,11 @@ ada_template_to_fixed_record_type_1 (struct type *type, +@@ -8549,11 +8551,11 @@ ada_template_to_fixed_record_type_1 (struct type *type, if (TYPE_LENGTH (type) <= 0) { if (TYPE_NAME (rtype)) @@ -858,7 +858,7 @@ diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c } else { -@@ -8974,7 +8976,8 @@ to_fixed_array_type (struct type *type0, struct value *dval, +@@ -9017,7 +9019,8 @@ to_fixed_array_type (struct type *type0, struct value *dval, type was a regular (non-packed) array type. As a result, the bitsize of the array elements needs to be set again, and the array length needs to be recomputed based on that bitsize. */ @@ -889,7 +889,7 @@ diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h const struct value_print_options *); struct value *ada_convert_actual (struct value *actual, -@@ -261,7 +261,7 @@ extern int ada_is_constrained_packed_array_type (struct type *); +@@ -263,7 +263,7 @@ extern int ada_is_constrained_packed_array_type (struct type *); extern struct value *ada_value_primitive_packed_val (struct value *, const gdb_byte *, @@ -901,7 +901,7 @@ diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c -@@ -896,8 +896,8 @@ ada_print_type (struct type *type0, const char *varstring, +@@ -891,8 +891,8 @@ ada_print_type (struct type *type0, const char *varstring, const char *name = ada_type_name (type); if (!ada_is_range_type_name (name)) @@ -912,7 +912,7 @@ diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c else { fprintf_filtered (stream, "range "); -@@ -918,7 +918,8 @@ ada_print_type (struct type *type0, const char *varstring, +@@ -913,7 +913,8 @@ ada_print_type (struct type *type0, const char *varstring, } break; case TYPE_CODE_FLT: @@ -1140,7 +1140,7 @@ diff --git a/gdb/annotate.h b/gdb/annotate.h diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c -@@ -228,7 +228,7 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch, +@@ -227,7 +227,7 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch, const struct floatformat ** default_floatformat_for_type (struct gdbarch *gdbarch, @@ -1164,7 +1164,7 @@ diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c -@@ -1098,7 +1098,7 @@ arm_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, +@@ -1096,7 +1096,7 @@ arm_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, /* Are we able to use a hardware watchpoint for the LEN bytes starting at ADDR? */ int @@ -1299,7 +1299,7 @@ diff --git a/gdb/ax.h b/gdb/ax.h diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -2053,9 +2053,9 @@ should_be_inserted (struct bp_location *bl) +@@ -2057,9 +2057,9 @@ should_be_inserted (struct bp_location *bl) { fprintf_unfiltered (gdb_stdlog, "infrun: stepping past non-steppable watchpoint. " @@ -1311,7 +1311,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c } return 0; } -@@ -6816,7 +6816,7 @@ breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1, +@@ -6805,7 +6805,7 @@ breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1, static int breakpoint_address_match_range (const address_space *aspace1, CORE_ADDR addr1, @@ -1320,7 +1320,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c CORE_ADDR addr2) { return ((gdbarch_has_global_breakpoints (target_gdbarch ()) -@@ -10899,7 +10899,7 @@ can_use_hardware_watchpoint (const std::vector &vals) +@@ -10887,7 +10887,7 @@ can_use_hardware_watchpoint (const std::vector &vals) && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) { CORE_ADDR vaddr = value_address (v); @@ -1445,7 +1445,7 @@ diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c --- a/gdb/compile/compile-c-support.c +++ b/gdb/compile/compile-c-support.c -@@ -307,11 +307,11 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, +@@ -270,11 +270,11 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, default: fprintf_unfiltered (stream, @@ -1571,7 +1571,7 @@ diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -1817,7 +1817,7 @@ rw_pieced_value (struct value *v, struct value *from) +@@ -1855,7 +1855,7 @@ rw_pieced_value (struct value *v, struct value *from) for (; i < c->pieces.size () && offset < max_offset; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1580,7 +1580,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c this_size_bits = p->size - bits_to_skip; if (this_size_bits > max_offset - offset) -@@ -2064,7 +2064,7 @@ write_pieced_value (struct value *to, struct value *from) +@@ -2102,7 +2102,7 @@ write_pieced_value (struct value *to, struct value *from) static int check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, @@ -1589,7 +1589,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c { struct piece_closure *c = (struct piece_closure *) value_computed_closure (value); -@@ -2077,7 +2077,7 @@ check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, +@@ -2115,7 +2115,7 @@ check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, for (i = 0; i < c->pieces.size () && bit_length > 0; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1598,7 +1598,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c if (bit_offset > 0) { -@@ -2179,8 +2179,8 @@ indirect_pieced_value (struct value *value) +@@ -2219,8 +2219,8 @@ indirect_pieced_value (struct value *value) = (struct piece_closure *) value_computed_closure (value); struct type *type; struct frame_info *frame; @@ -1609,7 +1609,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c struct dwarf_expr_piece *piece = NULL; LONGEST byte_offset; enum bfd_endian byte_order; -@@ -2197,7 +2197,7 @@ indirect_pieced_value (struct value *value) +@@ -2237,7 +2237,7 @@ indirect_pieced_value (struct value *value) for (i = 0; i < c->pieces.size () && bit_length > 0; i++) { struct dwarf_expr_piece *p = &c->pieces[i]; @@ -1618,7 +1618,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c if (bit_offset > 0) { -@@ -2486,9 +2486,9 @@ if (frame != NULL) select_frame (frame); +@@ -2526,9 +2526,9 @@ if (frame != NULL) select_frame (frame); case DWARF_VALUE_STACK: { struct value *value = ctx.fetch (0); @@ -1634,7 +1634,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -2021,11 +2021,11 @@ dwarf2_complex_location_expr_complaint (void) +@@ -2031,11 +2031,11 @@ dwarf2_complex_location_expr_complaint (void) } static void @@ -1650,7 +1650,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c } static void -@@ -14949,8 +14949,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, +@@ -15077,8 +15077,8 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, object, and then subtract off the number of bits of the field itself. The result is the bit offset of the LSB of the field. */ @@ -1683,7 +1683,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c if (exp->elts[*pos].opcode == BINOP_COMMA) { -@@ -800,11 +801,11 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, +@@ -799,11 +800,11 @@ binop_promote (const struct language_defn *language, struct gdbarch *gdbarch, /* FIXME: Also mixed integral/booleans, with result an integer. */ { const struct builtin_type *builtin = builtin_type (gdbarch); @@ -1698,7 +1698,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c int unsigned_operation; /* Determine type length and signedness after promotion for -@@ -1546,7 +1547,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1549,7 +1550,7 @@ evaluate_subexp_standard (struct type *expect_type, struct value **argvec; int code; int ix; @@ -1707,7 +1707,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c struct type **arg_types; pc = (*pos)++; -@@ -1729,7 +1730,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1732,7 +1733,7 @@ evaluate_subexp_standard (struct type *expect_type, struct type *range_type = TYPE_INDEX_TYPE (type); struct type *element_type = TYPE_TARGET_TYPE (type); struct value *array = allocate_value (expect_type); @@ -1802,7 +1802,7 @@ diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c diff --git a/gdb/findvar.c b/gdb/findvar.c --- a/gdb/findvar.c +++ b/gdb/findvar.c -@@ -821,7 +821,7 @@ struct value * +@@ -823,7 +823,7 @@ struct value * default_value_from_register (struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_id frame_id) { @@ -1811,7 +1811,7 @@ diff --git a/gdb/findvar.c b/gdb/findvar.c struct value *value = allocate_value (type); struct frame_info *frame; -@@ -865,7 +865,7 @@ read_frame_register_value (struct value *value, struct frame_info *frame) +@@ -867,7 +867,7 @@ read_frame_register_value (struct value *value, struct frame_info *frame) LONGEST offset = 0; LONGEST reg_offset = value_offset (value); int regnum = VALUE_REGNUM (value); @@ -1820,7 +1820,7 @@ diff --git a/gdb/findvar.c b/gdb/findvar.c gdb_assert (VALUE_LVAL (value) == lval_register); -@@ -880,7 +880,7 @@ read_frame_register_value (struct value *value, struct frame_info *frame) +@@ -882,7 +882,7 @@ read_frame_register_value (struct value *value, struct frame_info *frame) while (len > 0) { struct value *regval = get_frame_register_value (frame, regnum); @@ -1832,7 +1832,7 @@ diff --git a/gdb/findvar.c b/gdb/findvar.c diff --git a/gdb/frame.c b/gdb/frame.c --- a/gdb/frame.c +++ b/gdb/frame.c -@@ -1396,7 +1396,7 @@ deprecated_frame_register_read (struct frame_info *frame, int regnum, +@@ -1398,7 +1398,7 @@ deprecated_frame_register_read (struct frame_info *frame, int regnum, int get_frame_register_bytes (struct frame_info *frame, int regnum, @@ -1841,7 +1841,7 @@ diff --git a/gdb/frame.c b/gdb/frame.c int *optimizedp, int *unavailablep) { struct gdbarch *gdbarch = get_frame_arch (frame); -@@ -1425,7 +1425,7 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, +@@ -1427,7 +1427,7 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, } if (len > maxsize) error (_("Bad debug information detected: " @@ -1877,7 +1877,7 @@ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h -@@ -193,8 +193,8 @@ extern void set_gdbarch_wchar_signed (struct gdbarch *gdbarch, int wchar_signed) +@@ -195,8 +195,8 @@ extern void set_gdbarch_wchar_signed (struct gdbarch *gdbarch, int wchar_signed) NAME, if non-NULL, is the type name, which may be used to distinguish different target formats of the same length. */ @@ -1903,7 +1903,7 @@ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -2906,7 +2906,7 @@ floatformat_from_type (const struct type *type) +@@ -2915,7 +2915,7 @@ floatformat_from_type (const struct type *type) least as long as OBJFILE. */ struct type * @@ -1912,7 +1912,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c const char *name) { struct type *type; -@@ -3360,8 +3360,8 @@ is_public_ancestor (struct type *base, struct type *dclass) +@@ -3369,8 +3369,8 @@ is_public_ancestor (struct type *base, struct type *dclass) static int is_unique_ancestor_worker (struct type *base, struct type *dclass, @@ -1923,7 +1923,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c CORE_ADDR address, struct value *val) { int i, count = 0; -@@ -3372,7 +3372,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, +@@ -3381,7 +3381,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, for (i = 0; i < TYPE_N_BASECLASSES (dclass) && count < 2; ++i) { struct type *iter; @@ -1932,7 +1932,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c iter = check_typedef (TYPE_BASECLASS (dclass, i)); -@@ -3413,7 +3413,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, +@@ -3422,7 +3422,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, int is_unique_ancestor (struct type *base, struct value *val) { @@ -1941,7 +1941,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c return is_unique_ancestor_worker (base, value_type (val), &offset, value_contents_for_printing (val), -@@ -4642,7 +4642,7 @@ recursive_dump_type (struct type *type, int spaces) +@@ -4651,7 +4651,7 @@ recursive_dump_type (struct type *type, int spaces) break; } puts_filtered ("\n"); @@ -1950,7 +1950,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c if (TYPE_OBJFILE_OWNED (type)) { printfi_filtered (spaces, "objfile "); -@@ -5085,7 +5085,7 @@ copy_type (const struct type *type) +@@ -5096,7 +5096,7 @@ copy_type (const struct type *type) struct type * arch_type (struct gdbarch *gdbarch, @@ -1962,7 +1962,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -862,7 +862,7 @@ struct type +@@ -863,7 +863,7 @@ struct type type_length_units function should be used in order to get the length expressed in target addressable memory units. */ @@ -1971,7 +1971,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h /* * Core type, shared by a group of qualified types. */ -@@ -1783,7 +1783,7 @@ extern unsigned int type_length_units (struct type *type); +@@ -1790,7 +1790,7 @@ extern unsigned int type_length_units (struct type *type); /* * Helper function to construct objfile-owned types. */ @@ -1980,7 +1980,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h const char *); extern struct type *init_integer_type (struct objfile *, int, int, const char *); -@@ -1800,7 +1800,7 @@ extern struct type *init_pointer_type (struct objfile *, int, const char *, +@@ -1807,7 +1807,7 @@ extern struct type *init_pointer_type (struct objfile *, int, const char *, struct type *); /* Helper functions to construct architecture-owned types. */ @@ -2122,7 +2122,7 @@ diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c -@@ -8153,7 +8153,7 @@ i386_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, +@@ -8155,7 +8155,7 @@ i386_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, const struct floatformat ** i386_floatformat_for_type (struct gdbarch *gdbarch, @@ -2360,7 +2360,7 @@ diff --git a/gdb/memrange.h b/gdb/memrange.h diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c --- a/gdb/mips-linux-nat.c +++ b/gdb/mips-linux-nat.c -@@ -614,7 +614,7 @@ mips_linux_nat_target::stopped_data_address (CORE_ADDR *paddr) +@@ -610,7 +610,7 @@ mips_linux_nat_target::stopped_data_address (CORE_ADDR *paddr) the specified region can be covered by the watch registers. */ int @@ -2577,7 +2577,7 @@ diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c -@@ -1308,7 +1308,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot) +@@ -1300,7 +1300,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot) } int @@ -2622,7 +2622,7 @@ diff --git a/gdb/printcmd.c b/gdb/printcmd.c diff --git a/gdb/procfs.c b/gdb/procfs.c --- a/gdb/procfs.c +++ b/gdb/procfs.c -@@ -3358,7 +3358,7 @@ procfs_target::remove_watchpoint (CORE_ADDR addr, int len, +@@ -3361,7 +3361,7 @@ procfs_target::remove_watchpoint (CORE_ADDR addr, int len, } int @@ -2691,7 +2691,7 @@ diff --git a/gdb/regcache.c b/gdb/regcache.c diff --git a/gdb/regcache.h b/gdb/regcache.h --- a/gdb/regcache.h +++ b/gdb/regcache.h -@@ -244,8 +244,8 @@ public: +@@ -256,8 +256,8 @@ public: enum register_status raw_read (int regnum, T *val); /* Partial transfer of raw registers. Return the status of the register. */ @@ -2702,7 +2702,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h /* Make certain that the register REGNUM is up-to-date. */ virtual void raw_update (int regnum) = 0; -@@ -257,8 +257,8 @@ public: +@@ -269,8 +269,8 @@ public: enum register_status cooked_read (int regnum, T *val); /* Partial transfer of a cooked register. */ @@ -2713,7 +2713,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h /* Read register REGNUM from the regcache and return a new value. This will call mark_value_bytes_unavailable as appropriate. */ -@@ -268,7 +268,7 @@ protected: +@@ -280,7 +280,7 @@ protected: /* Perform a partial register transfer using a read, modify, write operation. Will fail if register is currently invalid. */ @@ -2722,7 +2722,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h gdb_byte *out, bool is_raw); }; -@@ -326,11 +326,12 @@ public: +@@ -338,11 +338,12 @@ public: /* Partial transfer of raw registers. Perform read, modify, write style operations. */ @@ -2737,7 +2737,7 @@ diff --git a/gdb/regcache.h b/gdb/regcache.h const gdb_byte *buf); void supply_regset (const struct regset *regset, -@@ -381,7 +382,7 @@ private: +@@ -393,7 +394,7 @@ private: /* Perform a partial register transfer using a read, modify, write operation. */ @@ -2758,7 +2758,7 @@ diff --git a/gdb/remote.c b/gdb/remote.c int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, struct expression *) override; -@@ -10413,7 +10413,7 @@ int remote_hw_watchpoint_length_limit = -1; +@@ -10446,7 +10446,7 @@ int remote_hw_watchpoint_length_limit = -1; int remote_hw_breakpoint_limit = -1; int @@ -2770,7 +2770,7 @@ diff --git a/gdb/remote.c b/gdb/remote.c diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c -@@ -288,7 +288,7 @@ rust_printchar (int c, struct type *type, struct ui_file *stream) +@@ -301,7 +301,7 @@ rust_printchar (int c, struct type *type, struct ui_file *stream) static void rust_printstr (struct ui_file *stream, struct type *type, @@ -2779,7 +2779,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c const char *user_encoding, int force_ellipses, const struct value_print_options *options) { -@@ -497,7 +497,7 @@ static const struct generic_val_print_decorations rust_decorations = +@@ -517,7 +517,7 @@ static const struct generic_val_print_decorations rust_decorations = /* la_val_print implementation for Rust. */ static void @@ -2791,7 +2791,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c --- a/gdb/s390-linux-nat.c +++ b/gdb/s390-linux-nat.c -@@ -952,7 +952,8 @@ s390_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, +@@ -951,7 +951,8 @@ s390_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, } int @@ -2884,8 +2884,8 @@ diff --git a/gdb/symmisc.c b/gdb/symmisc.c diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c -@@ -39,7 +39,7 @@ struct dummy_target : public target_ops - bool have_continuable_watchpoint () override; +@@ -38,7 +38,7 @@ struct dummy_target : public target_ops + int have_steppable_watchpoint () override; bool stopped_data_address (CORE_ADDR *arg0) override; bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; - int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) override; @@ -2893,8 +2893,8 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; -@@ -207,7 +207,7 @@ struct debug_target : public target_ops - bool have_continuable_watchpoint () override; +@@ -205,7 +205,7 @@ struct debug_target : public target_ops + int have_steppable_watchpoint () override; bool stopped_data_address (CORE_ADDR *arg0) override; bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; - int region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) override; @@ -2902,7 +2902,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; -@@ -1098,19 +1098,19 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int +@@ -1071,19 +1071,19 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int } int @@ -2925,7 +2925,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c { int result; fprintf_unfiltered (gdb_stdlog, "-> %s->region_ok_for_hw_watchpoint (...)\n", this->beneath ()->shortname ()); -@@ -1118,7 +1118,7 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) +@@ -1091,7 +1091,7 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) fprintf_unfiltered (gdb_stdlog, "<- %s->region_ok_for_hw_watchpoint (", this->beneath ()->shortname ()); target_debug_print_CORE_ADDR (arg0); fputs_unfiltered (", ", gdb_stdlog); @@ -2946,7 +2946,7 @@ diff --git a/gdb/target.c b/gdb/target.c static void default_rcmd (struct target_ops *, const char *, struct ui_file *); -@@ -3181,7 +3181,7 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename) +@@ -3184,7 +3184,7 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename) static int default_region_ok_for_hw_watchpoint (struct target_ops *self, @@ -2958,7 +2958,7 @@ diff --git a/gdb/target.c b/gdb/target.c diff --git a/gdb/target.h b/gdb/target.h --- a/gdb/target.h +++ b/gdb/target.h -@@ -562,7 +562,7 @@ struct target_ops +@@ -563,7 +563,7 @@ struct target_ops /* Documentation of this routine is provided with the corresponding target_* macro. */ @@ -2970,12 +2970,12 @@ diff --git a/gdb/target.h b/gdb/target.h diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c -@@ -829,10 +829,10 @@ collection_list::add_register (unsigned int regno) +@@ -893,10 +893,10 @@ collection_list::add_local_register (struct gdbarch *gdbarch, void collection_list::add_memrange (struct gdbarch *gdbarch, int type, bfd_signed_vma base, -- unsigned long len) -+ ULONGEST len) +- unsigned long len, CORE_ADDR scope) ++ ULONGEST len, CORE_ADDR scope) { if (info_verbose) - printf_filtered ("(%d,%s,%ld)\n", type, paddress (gdbarch, base), len); @@ -2983,7 +2983,7 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c /* type: memrange_absolute == memory, other n == basereg */ /* base: addr if memory, offset if reg relative. */ -@@ -852,7 +852,7 @@ collection_list::collect_symbol (struct symbol *sym, +@@ -916,7 +916,7 @@ collection_list::collect_symbol (struct symbol *sym, CORE_ADDR scope, int trace_string) { @@ -2992,7 +2992,7 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c unsigned int reg; bfd_signed_vma offset; int treat_as_expr = 0; -@@ -873,8 +873,8 @@ collection_list::collect_symbol (struct symbol *sym, +@@ -937,8 +937,8 @@ collection_list::collect_symbol (struct symbol *sym, offset = SYMBOL_VALUE_ADDRESS (sym); if (info_verbose) { @@ -3003,7 +3003,7 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c paddress (gdbarch, offset)); } /* A struct may be a C++ class with static fields, go to general -@@ -906,9 +906,9 @@ collection_list::collect_symbol (struct symbol *sym, +@@ -970,9 +970,9 @@ collection_list::collect_symbol (struct symbol *sym, offset = frame_offset + SYMBOL_VALUE (sym); if (info_verbose) { @@ -3014,8 +3014,8 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c + SYMBOL_PRINT_NAME (sym), pulongest (len), paddress (gdbarch, offset), reg); } - add_memrange (gdbarch, reg, offset, len); -@@ -918,9 +918,9 @@ collection_list::collect_symbol (struct symbol *sym, + add_memrange (gdbarch, reg, offset, len, scope); +@@ -982,9 +982,9 @@ collection_list::collect_symbol (struct symbol *sym, offset = 0; if (info_verbose) { @@ -3026,8 +3026,8 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c + SYMBOL_PRINT_NAME (sym), pulongest (len), paddress (gdbarch, offset), reg); } - add_memrange (gdbarch, reg, offset, len); -@@ -930,9 +930,9 @@ collection_list::collect_symbol (struct symbol *sym, + add_memrange (gdbarch, reg, offset, len, scope); +@@ -994,9 +994,9 @@ collection_list::collect_symbol (struct symbol *sym, offset = frame_offset + SYMBOL_VALUE (sym); if (info_verbose) { @@ -3038,8 +3038,8 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c + SYMBOL_PRINT_NAME (sym), pulongest (len), paddress (gdbarch, offset), reg); } - add_memrange (gdbarch, reg, offset, len); -@@ -2447,7 +2447,8 @@ info_scope_command (const char *args_in, int from_tty) + add_memrange (gdbarch, reg, offset, len, scope); +@@ -2492,7 +2492,8 @@ info_scope_command (const char *args_in, int from_tty) const char *symname; const char *save_args = args_in; struct block_iterator iter; @@ -3049,7 +3049,7 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c struct gdbarch *gdbarch; int regno; const char *args = args_in; -@@ -2591,8 +2592,11 @@ info_scope_command (const char *args_in, int from_tty) +@@ -2636,8 +2637,11 @@ info_scope_command (const char *args_in, int from_tty) } } if (SYMBOL_TYPE (sym)) @@ -3066,12 +3066,12 @@ diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h --- a/gdb/tracepoint.h +++ b/gdb/tracepoint.h -@@ -265,7 +265,7 @@ public: - void add_register (unsigned int regno); +@@ -269,7 +269,7 @@ public: + CORE_ADDR scope); void add_memrange (struct gdbarch *gdbarch, int type, bfd_signed_vma base, -- unsigned long len); -+ ULONGEST len); +- unsigned long len, CORE_ADDR scope); ++ ULONGEST len, CORE_ADDR scope); void collect_symbol (struct symbol *sym, struct gdbarch *gdbarch, long frame_regno, long frame_offset, @@ -3111,7 +3111,7 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c { struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); -@@ -659,7 +659,7 @@ value_concat (struct value *arg1, struct value *arg2) +@@ -657,7 +657,7 @@ value_concat (struct value *arg1, struct value *arg2) struct value *inval1; struct value *inval2; struct value *outval = NULL; @@ -3120,7 +3120,7 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c int count, idx; char inchar; struct type *type1 = check_typedef (value_type (arg1)); -@@ -1419,7 +1419,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) +@@ -1417,7 +1417,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) int value_logical_not (struct value *arg1) { @@ -3129,7 +3129,7 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c const gdb_byte *p; struct type *type1; -@@ -1447,11 +1447,11 @@ value_logical_not (struct value *arg1) +@@ -1445,11 +1445,11 @@ value_logical_not (struct value *arg1) static int value_strcmp (struct value *arg1, struct value *arg2) { @@ -3189,7 +3189,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c gdb_byte buffer[sizeof (LONGEST)]; if (value_bitsize (toval)) -@@ -3357,7 +3357,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial) +@@ -3356,7 +3356,7 @@ compare_parameters (struct type *t1, struct type *t2, int skip_artificial) the form "DOMAIN::NAME". */ static struct value * @@ -3198,7 +3198,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c struct type *curtype, const char *name, struct type *intype, int want_address, -@@ -3391,7 +3391,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, +@@ -3390,7 +3390,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, if (want_address) return value_from_longest (lookup_memberptr_type (TYPE_FIELD_TYPE (t, i), domain), @@ -3207,7 +3207,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c else if (noside != EVAL_NORMAL) return allocate_value (TYPE_FIELD_TYPE (t, i)); else -@@ -3564,7 +3564,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, +@@ -3563,7 +3563,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--) { struct value *v; @@ -3216,7 +3216,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c if (BASETYPE_VIA_VIRTUAL (t, i)) base_offset = 0; -@@ -3713,7 +3713,7 @@ value_rtti_indirect_type (struct value *v, int *full, +@@ -3712,7 +3712,7 @@ value_rtti_indirect_type (struct value *v, int *full, struct value * value_full_object (struct value *argp, struct type *rtype, @@ -3278,7 +3278,7 @@ diff --git a/gdb/valprint.c b/gdb/valprint.c annotate_elt_rep_end (); i = rep1 - 1; -@@ -2669,7 +2669,7 @@ print_converted_chars_to_obstack (struct obstack *obstack, +@@ -2668,7 +2668,7 @@ print_converted_chars_to_obstack (struct obstack *obstack, void generic_printstr (struct ui_file *stream, struct type *type, @@ -3443,7 +3443,7 @@ diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h extern int x86_stopped_by_watchpoint (); extern int x86_stopped_data_address (CORE_ADDR *addr_p); extern int x86_insert_watchpoint (CORE_ADDR addr, int len, -@@ -82,7 +82,7 @@ struct x86_nat_target : public BaseTarget +@@ -75,7 +75,7 @@ struct x86_nat_target : public BaseTarget int can_use_hw_breakpoint (enum bptype type, int cnt, int othertype) override { return x86_can_use_hw_breakpoint (type, cnt, othertype); } diff --git a/gdb-rhbz795424-bitpos-21of25.patch b/gdb-rhbz795424-bitpos-21of25.patch index 5617a50..a70254f 100644 --- a/gdb-rhbz795424-bitpos-21of25.patch +++ b/gdb-rhbz795424-bitpos-21of25.patch @@ -111,7 +111,7 @@ diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c diff --git a/gdb/utils.c b/gdb/utils.c --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -2834,6 +2834,17 @@ string_to_core_addr (const char *my_string) +@@ -2807,6 +2807,17 @@ string_to_core_addr (const char *my_string) return addr; } @@ -132,7 +132,7 @@ diff --git a/gdb/utils.c b/gdb/utils.c diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -2088,6 +2088,7 @@ search_struct_method (const char *name, struct value **arg1p, +@@ -2087,6 +2087,7 @@ search_struct_method (const char *name, struct value **arg1p, { CORE_ADDR address; @@ -160,7 +160,7 @@ diff --git a/gdb/value.c b/gdb/value.c if (!val->contents) { check_type_length_before_alloc (val->enclosing_type); -@@ -2876,6 +2879,7 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type) +@@ -2875,6 +2878,7 @@ set_value_enclosing_type (struct value *val, struct type *new_encl_type) if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val))) { check_type_length_before_alloc (new_encl_type); diff --git a/gdb-rhbz795424-bitpos-22of25.patch b/gdb-rhbz795424-bitpos-22of25.patch index 8072f77..9e6882c 100644 --- a/gdb-rhbz795424-bitpos-22of25.patch +++ b/gdb-rhbz795424-bitpos-22of25.patch @@ -154,7 +154,7 @@ diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c const struct target_desc *read_description () override; -@@ -1207,7 +1207,7 @@ arm_linux_nat_target::stopped_by_watchpoint () +@@ -1203,7 +1203,7 @@ arm_linux_nat_target::stopped_by_watchpoint () bool arm_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start, @@ -299,7 +299,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c override; int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) override; -@@ -1659,11 +1659,11 @@ can_use_watchpoint_cond_accel (void) +@@ -1649,11 +1649,11 @@ can_use_watchpoint_cond_accel (void) CONDITION_VALUE will hold the value which should be put in the DVC register. */ static void @@ -314,7 +314,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c CORE_ADDR addr_end_data, addr_end_dvc; /* The DVC register compares bytes within fixed-length windows which -@@ -1751,7 +1751,7 @@ num_memory_accesses (const std::vector &chain) +@@ -1741,7 +1741,7 @@ num_memory_accesses (const std::vector &chain) of the constant. */ static int check_condition (CORE_ADDR watch_addr, struct expression *cond, @@ -323,7 +323,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c { int pc = 1, num_accesses_left, num_accesses_right; struct value *left_val, *right_val; -@@ -1802,7 +1802,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond, +@@ -1792,7 +1792,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond, the condition expression, thus only triggering the watchpoint when it is true. */ bool @@ -333,7 +333,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c int rw, struct expression *cond) { -@@ -1820,7 +1821,7 @@ ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len, +@@ -1810,7 +1811,7 @@ ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len, static void create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr, @@ -342,7 +342,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c struct expression *cond, int insert) { if (len == 1 -@@ -2086,7 +2087,7 @@ ppc_linux_nat_target::stopped_by_watchpoint () +@@ -2076,7 +2077,7 @@ ppc_linux_nat_target::stopped_by_watchpoint () bool ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, CORE_ADDR start, @@ -354,7 +354,7 @@ diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c diff --git a/gdb/procfs.c b/gdb/procfs.c --- a/gdb/procfs.c +++ b/gdb/procfs.c -@@ -1561,7 +1561,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr) +@@ -1565,7 +1565,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr) } static int @@ -363,7 +363,7 @@ diff --git a/gdb/procfs.c b/gdb/procfs.c { struct { procfs_ctl_t cmd; -@@ -3214,7 +3214,7 @@ procfs_target::pid_to_str (ptid_t ptid) +@@ -3217,7 +3217,7 @@ procfs_target::pid_to_str (ptid_t ptid) /* Insert a watchpoint. */ static int @@ -384,7 +384,7 @@ diff --git a/gdb/remote.c b/gdb/remote.c int can_use_hw_breakpoint (enum bptype, int, int) override; -@@ -10342,7 +10342,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, +@@ -10375,7 +10375,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, p = strchr (rs->buf, '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); @@ -393,7 +393,7 @@ diff --git a/gdb/remote.c b/gdb/remote.c putpkt (rs->buf); getpkt (&rs->buf, &rs->buf_size, 0); -@@ -10362,7 +10362,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, +@@ -10395,7 +10395,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, bool remote_target::watchpoint_addr_within_range (CORE_ADDR addr, @@ -402,7 +402,7 @@ diff --git a/gdb/remote.c b/gdb/remote.c { CORE_ADDR diff = remote_address_masked (addr - start); -@@ -10391,7 +10391,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len, +@@ -10424,7 +10424,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len, p = strchr (rs->buf, '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); @@ -420,15 +420,15 @@ diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c override; - int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; + int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override; - bool have_continuable_watchpoint () override { return true; } bool stopped_by_watchpoint () override; int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, + struct expression *) override; diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c -@@ -38,9 +38,9 @@ struct dummy_target : public target_ops +@@ -37,9 +37,9 @@ struct dummy_target : public target_ops + bool stopped_by_watchpoint () override; int have_steppable_watchpoint () override; - bool have_continuable_watchpoint () override; bool stopped_data_address (CORE_ADDR *arg0) override; - bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; + bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override; @@ -438,9 +438,9 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; bool supports_terminal_ours () override; -@@ -206,9 +206,9 @@ struct debug_target : public target_ops +@@ -204,9 +204,9 @@ struct debug_target : public target_ops + bool stopped_by_watchpoint () override; int have_steppable_watchpoint () override; - bool have_continuable_watchpoint () override; bool stopped_data_address (CORE_ADDR *arg0) override; - bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) override; + bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override; @@ -450,7 +450,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c int masked_watch_num_registers (CORE_ADDR arg0, CORE_ADDR arg1) override; int can_do_single_step () override; bool supports_terminal_ours () override; -@@ -1068,19 +1068,19 @@ debug_target::stopped_data_address (CORE_ADDR *arg0) +@@ -1041,19 +1041,19 @@ debug_target::stopped_data_address (CORE_ADDR *arg0) } bool @@ -473,7 +473,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c { bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath ()->shortname ()); -@@ -1090,7 +1090,7 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int +@@ -1063,7 +1063,7 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int fputs_unfiltered (", ", gdb_stdlog); target_debug_print_CORE_ADDR (arg1); fputs_unfiltered (", ", gdb_stdlog); @@ -482,7 +482,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c fputs_unfiltered (") = ", gdb_stdlog); target_debug_print_bool (result); fputs_unfiltered ("\n", gdb_stdlog); -@@ -1126,19 +1126,19 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) +@@ -1099,19 +1099,19 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) } bool @@ -505,7 +505,7 @@ diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c { bool result; fprintf_unfiltered (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath ()->shortname ()); -@@ -1146,7 +1146,7 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2 +@@ -1119,7 +1119,7 @@ debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2 fprintf_unfiltered (gdb_stdlog, "<- %s->can_accel_watchpoint_condition (", this->beneath ()->shortname ()); target_debug_print_CORE_ADDR (arg0); fputs_unfiltered (", ", gdb_stdlog); @@ -526,7 +526,7 @@ diff --git a/gdb/target.c b/gdb/target.c static int default_region_ok_for_hw_watchpoint (struct target_ops *, CORE_ADDR, LONGEST); -@@ -3189,7 +3189,7 @@ default_region_ok_for_hw_watchpoint (struct target_ops *self, +@@ -3192,7 +3192,7 @@ default_region_ok_for_hw_watchpoint (struct target_ops *self, static int default_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, @@ -538,7 +538,7 @@ diff --git a/gdb/target.c b/gdb/target.c diff --git a/gdb/target.h b/gdb/target.h --- a/gdb/target.h +++ b/gdb/target.h -@@ -557,7 +557,7 @@ struct target_ops +@@ -558,7 +558,7 @@ struct target_ops TARGET_DEFAULT_RETURN (false); virtual bool stopped_data_address (CORE_ADDR *) TARGET_DEFAULT_RETURN (false); @@ -547,7 +547,7 @@ diff --git a/gdb/target.h b/gdb/target.h TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range); /* Documentation of this routine is provided with the corresponding -@@ -565,7 +565,7 @@ struct target_ops +@@ -566,7 +566,7 @@ struct target_ops virtual int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint); diff --git a/gdb-rhbz795424-bitpos-23of25.patch b/gdb-rhbz795424-bitpos-23of25.patch index ebbe696..d87895c 100644 --- a/gdb-rhbz795424-bitpos-23of25.patch +++ b/gdb-rhbz795424-bitpos-23of25.patch @@ -357,8 +357,8 @@ diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c { struct type *value_type = value_enclosing_type (args[i]); struct type *arg_type = check_typedef (value_type); -- int container_len = (TYPE_LENGTH (value_type) + 3) & ~3; -+ ssize_t container_len = (TYPE_LENGTH (value_type) + 3) & ~3; +- int container_len = (TYPE_LENGTH (arg_type) + 3) & ~3; ++ ssize_t container_len = (TYPE_LENGTH (arg_type) + 3) & ~3; sp -= container_len; write_memory (sp, value_contents (args[i]), container_len); @@ -620,7 +620,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c if (mips_debug && out != NULL) { int i; -@@ -4543,13 +4543,13 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -4561,13 +4561,13 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE]; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); @@ -637,7 +637,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c /* The EABI passes structures that do not fit in a register by reference. */ -@@ -4819,7 +4819,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -4837,7 +4837,7 @@ mips_eabi_return_value (struct gdbarch *gdbarch, struct value *function, static int mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, @@ -646,7 +646,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c { int i; -@@ -4834,7 +4834,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, +@@ -4852,7 +4852,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, for (i = 0; i < TYPE_NFIELDS (arg_type); i++) { @@ -655,7 +655,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c struct type *field_type; /* We're only looking at normal fields. */ -@@ -4876,7 +4876,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -4894,7 +4894,7 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int argreg; int float_argreg; int argnum; @@ -664,7 +664,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c int stack_offset = 0; enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR func_addr = find_function_addr (function, NULL); -@@ -5227,11 +5227,11 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -5245,11 +5245,11 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, : MIPS_V0_REGNUM); field < TYPE_NFIELDS (type); field++, regnum += 2) { @@ -680,7 +680,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16) { /* A 16-byte long double field goes in two consecutive -@@ -5273,8 +5273,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, +@@ -5291,8 +5291,8 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, if (offset + xfer > TYPE_LENGTH (type)) xfer = TYPE_LENGTH (type) - offset; if (mips_debug) @@ -691,7 +691,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c mips_xfer_register (gdbarch, regcache, gdbarch_num_regs (gdbarch) + regnum, xfer, BFD_ENDIAN_UNKNOWN, readbuf, writebuf, -@@ -5332,7 +5332,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -5350,7 +5350,7 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int argreg; int float_argreg; int argnum; @@ -700,7 +700,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c int stack_offset = 0; enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR func_addr = find_function_addr (function, NULL); -@@ -5396,13 +5396,13 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -5414,13 +5414,13 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, const gdb_byte *val; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); @@ -717,7 +717,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c val = value_contents (arg); -@@ -5856,8 +5856,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -5874,8 +5874,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int argreg; int float_argreg; int argnum; @@ -728,7 +728,7 @@ diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); CORE_ADDR func_addr = find_function_addr (function, NULL); -@@ -5917,13 +5917,13 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -5935,13 +5935,13 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, const gdb_byte *val; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); @@ -944,7 +944,7 @@ diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c --- a/gdb/sparc64-tdep.c +++ b/gdb/sparc64-tdep.c -@@ -1205,7 +1205,7 @@ sparc64_16_byte_align_p (struct type *type) +@@ -1206,7 +1206,7 @@ sparc64_16_byte_align_p (struct type *type) static void sparc64_store_floating_fields (struct regcache *regcache, struct type *type, @@ -953,7 +953,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c { struct gdbarch *gdbarch = regcache->arch (); int len = TYPE_LENGTH (type); -@@ -1265,7 +1265,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, +@@ -1266,7 +1266,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, for (i = 0; i < TYPE_NFIELDS (type); i++) { struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); @@ -962,7 +962,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c sparc64_store_floating_fields (regcache, subtype, valbuf, element, subpos); -@@ -1297,7 +1297,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, +@@ -1298,7 +1298,7 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type, static void sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, @@ -971,7 +971,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c { struct gdbarch *gdbarch = regcache->arch (); -@@ -1353,7 +1353,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, +@@ -1354,7 +1354,7 @@ sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, for (i = 0; i < TYPE_NFIELDS (type); i++) { struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, i)); @@ -980,7 +980,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos); } -@@ -1386,7 +1386,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, +@@ -1387,7 +1387,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, for (i = 0; i < nargs; i++) { struct type *type = value_type (args[i]); @@ -989,7 +989,7 @@ diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c if (sparc64_structure_or_union_p (type) || (sparc64_complex_floating_p (type) && len == 32)) -@@ -1486,7 +1486,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, +@@ -1487,7 +1487,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, { const gdb_byte *valbuf = value_contents (args[i]); struct type *type = value_type (args[i]); @@ -1028,10 +1028,10 @@ diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c int stack_offset = 4; - int references_offset = 4; + LONGEST references_offset = 4; - CORE_ADDR func_addr = find_function_addr (function, NULL); enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); struct type *func_type = value_type (function); -@@ -915,7 +915,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, + /* The first arg passed on stack. Mostly the first 10 args are passed by +@@ -914,7 +914,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* Now make space on the stack for the args. */ for (argnum = 0; argnum < nargs; argnum++) { @@ -1040,7 +1040,7 @@ diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c if (argnum >= 10 - argreg) references_offset += len; stack_offset += len; -@@ -934,7 +934,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -933,7 +933,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, const gdb_byte *val; struct value *arg = args[argnum]; struct type *arg_type = check_typedef (value_type (arg)); @@ -1049,7 +1049,7 @@ diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c enum type_code typecode = TYPE_CODE (arg_type); val = value_contents (arg); -@@ -1090,7 +1090,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, +@@ -1089,7 +1089,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else internal_error (__FILE__, __LINE__, @@ -1131,7 +1131,7 @@ diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c --- a/gdb/xtensa-tdep.c +++ b/gdb/xtensa-tdep.c -@@ -1626,8 +1626,7 @@ xtensa_store_return_value (struct type *type, +@@ -1625,8 +1625,7 @@ xtensa_store_return_value (struct type *type, if (len > (callsize > 8 ? 8 : 16)) internal_error (__FILE__, __LINE__, @@ -1141,7 +1141,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c areg = arreg_number (gdbarch, gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb); -@@ -1701,18 +1700,18 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1700,18 +1699,18 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, { enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); int i; @@ -1163,7 +1163,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c int regno; /* regno if in register. */ } u; }; -@@ -1736,9 +1735,10 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1735,9 +1734,10 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, { struct value *arg = args[i]; struct type *arg_type = check_typedef (value_type (arg)); @@ -1177,7 +1177,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c switch (TYPE_CODE (arg_type)) { case TYPE_CODE_INT: -@@ -1808,8 +1808,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1807,8 +1807,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long); break; } @@ -1187,7 +1187,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c /* Align size and onstack_size. */ size = (size + info->align - 1) & ~(info->align - 1); -@@ -1854,7 +1854,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1853,7 +1853,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, if (info->onstack) { @@ -1196,7 +1196,7 @@ diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c CORE_ADDR offset = sp + info->u.offset; /* Odd-sized structs are aligned to the lower side of a memory -@@ -1870,7 +1870,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, +@@ -1869,7 +1869,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, } else { diff --git a/gdb-rhbz795424-bitpos-arrayview.patch b/gdb-rhbz795424-bitpos-arrayview.patch new file mode 100644 index 0000000..603a475 --- /dev/null +++ b/gdb-rhbz795424-bitpos-arrayview.patch @@ -0,0 +1,60 @@ +From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 +From: Sergio Durigan Junior +Date: Wed, 12 Sep 2018 00:02:17 -0400 +Subject: gdb-rhbz795424-bitpos-arrayview.patch + +;; This patch is needed to compile GDB after -Werror=narrowing has +;; been enabled by default. +;; Author: Sergio Durigan Junior. + +diff --git a/gdb/common/array-view.h b/gdb/common/array-view.h +--- a/gdb/common/array-view.h ++++ b/gdb/common/array-view.h +@@ -85,7 +85,7 @@ public: + using value_type = T; + using reference = T &; + using const_reference = const T &; +- using size_type = size_t; ++ using size_type = ULONGEST; + + /* Default construction creates an empty view. */ + constexpr array_view () noexcept +@@ -114,7 +114,7 @@ public: + count. */ + template>> +- constexpr array_view (U *array, size_t size) noexcept ++ constexpr array_view (U *array, ULONGEST size) noexcept + : m_array (array), m_size (size) + {} + +@@ -128,7 +128,7 @@ public: + {} + + /* Create an array view from an array. */ +- template>> + constexpr array_view (U (&array)[Size]) noexcept + : m_array (array), m_size (Size) +@@ -161,9 +161,9 @@ public: + /*constexpr14*/ T *end () noexcept { return m_array + m_size; } + constexpr const T *end () const noexcept { return m_array + m_size; } + +- /*constexpr14*/ reference operator[] (size_t index) noexcept ++ /*constexpr14*/ reference operator[] (ULONGEST index) noexcept + { return m_array[index]; } +- constexpr const_reference operator[] (size_t index) const noexcept ++ constexpr const_reference operator[] (ULONGEST index) const noexcept + { return m_array[index]; } + + constexpr size_type size () const noexcept { return m_size; } +@@ -185,7 +185,7 @@ operator== (const gdb::array_view &lhs, const gdb::array_view &rhs) + if (lhs.size () != rhs.size ()) + return false; + +- for (size_t i = 0; i < lhs.size (); i++) ++ for (ULONGEST i = 0; i < lhs.size (); i++) + if (!(lhs[i] == rhs[i])) + return false; + diff --git a/gdb-rhbz881849-ipv6-1of3.patch b/gdb-rhbz881849-ipv6-1of3.patch deleted file mode 100644 index 7c3a664..0000000 --- a/gdb-rhbz881849-ipv6-1of3.patch +++ /dev/null @@ -1,1934 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Fri, 18 May 2018 01:29:24 -0400 -Subject: gdb-rhbz881849-ipv6-1of3.patch - -;; Implement IPv6 support for GDB/gdbserver (RH BZ 881849, Sergio Durigan Junior). - -Implement IPv6 support for GDB/gdbserver - -This patch implements IPv6 support for both GDB and gdbserver. Based -on my research, it is the fourth attempt to do that since 2006. Since -I used ideas from all of the previous patches, I also added their -authors's names on the ChangeLogs as a way to recognize their -efforts. For reference sake, you can find the previous attempts at: - - https://sourceware.org/ml/gdb-patches/2006-09/msg00192.html - - https://sourceware.org/ml/gdb-patches/2014-02/msg00248.html - - https://sourceware.org/ml/gdb-patches/2016-02/msg00226.html - -The basic idea behind the patch is to start using the new -'getaddrinfo'/'getnameinfo' calls, which are responsible for -translating names and addresses in a protocol-independent way. This -means that if we ever have a new version of the IP protocol, we won't -need to change the code again (or, at least, won't have to change the -majority of the code). - -The function 'getaddrinfo' returns a linked list of possible addresses -to connect to. Dealing with multiple addresses proved to be a hard -task with the current TCP auto-retry mechanism implemented on -ser-tcp:net_open. For example, when gdbserver listened only on an -IPv4 socket: - - $ ./gdbserver --once 127.0.0.1:1234 ./a.out - -and GDB was instructed to try to connect to both IPv6 and IPv4 -sockets: - - $ ./gdb -ex 'target extended-remote localhost:1234' ./a.out - -the user would notice a somewhat big delay before GDB was able to -connect to the IPv4 socket. This happened because GDB was trying to -connect to the IPv6 socket first, and had to wait until the connection -timed out before it tried to connect to the IPv4 socket. - -For that reason, I had to rewrite the main loop and implement a new -method for handling multiple connections. After some discussion, -Pedro and I agreed on the following algorithm: - - 1) For each entry returned by 'getaddrinfo', we try to open a socket - and connect to it. - - 2.a) If we have a successful 'connect', we just use that connection. - - 2.b) If we don't have a successfull 'connect', but if we've got a - ECONNREFUSED (meaning the the connection was refused), we keep track - of this fact by using a flag. - - 2.c) If we don't have a successfull 'connect', but if we've got a - EINPROGRESS (meaning that the connection is in progress), we perform - a 'select' call on the socket until we have a result (either a - successful connection, or an error on the socket). - - 3) If tcp_auto_retry is true, and we haven't gotten a successful - connection, and at least one of our attempts failed with - ECONNREFUSED, then we wait a little bit (i.e., call - 'wait_for_connect'), check to see if there was a - timeout/interruption (in which case we bail out), and then go back - to (1). - -After multiple tests, I was able to connect without delay on the -scenario described above, and was also able to connect in all other -types of scenarios. - -I also implemented some hostname parsing functions (along with their -corresponding unit tests) which are used to help GDB and gdbserver to -parse hostname strings provided by the user. These new functions are -living inside common/netstuff.[ch]. I've had to do that since IPv6 -introduces a new URL scheme, which defines that square brackets can be -used to enclose the host part and differentiate it from the -port (e.g., "[::1]:1234" means "host ::1, port 1234"). I spent some -time thinking about a reasonable way to interpret what the user wants, -and I came up with the following: - - - If the user has provided a prefix that doesn't specify the protocol - version (i.e., "tcp:" or "udp:"), or if the user has not provided - any prefix, don't make any assumptions (i.e., assume AF_UNSPEC when - dealing with 'getaddrinfo') *unless* the host starts with "[" (in - which case, assume it's an IPv6 host). - - - If the user has provided a prefix that does specify the protocol - version (i.e., "tcp4:", "tcp6:", "udp4:" or "udp6:"), then respect - that. - -This method doesn't follow strictly what RFC 2732 proposes (that -literal IPv6 addresses should be provided enclosed in "[" and "]") -because IPv6 addresses still can be provided without square brackets -in our case, but since we have prefixes to specify protocol versions I -think this is not an issue. - -Another thing worth mentioning is the new 'GDB_TEST_SOCKETHOST' -testcase parameter, which makes it possible to specify the -hostname (without the port) to be used when testing GDB and -gdbserver. For example, to run IPv6 tests: - - $ make check-gdb RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp6:[::1]' - -Or, to run IPv4 tests: - - $ make check-gdb RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp4:127.0.0.1' - -This required a few changes on the gdbserver-base.exp, and also a -minimal adjustment on gdb.server/run-without-local-binary.exp. - -Finally, I've implemented a new testcase, -gdb.server/server-connect.exp, which is supposed to run on the native -host and perform various "smoke tests" using different connection -methods. - -This patch has been regression-tested on BuildBot and locally, and -also built using a x86_64-w64-mingw32 GCC, and no problems were found. - -gdb/ChangeLog: -2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser - Tsutomu Seki - Pedro Alves - - * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add - 'unittests/parse-connection-spec-selftests.c'. - (COMMON_SFILES): Add 'common/netstuff.c'. - (HFILES_NO_SRCDIR): Add 'common/netstuff.h'. - * NEWS (Changes since GDB 8.2): Mention IPv6 support. - * common/netstuff.c: New file. - * common/netstuff.h: New file. - * ser-tcp.c: Include 'netstuff.h' and 'wspiapi.h'. - (wait_for_connect): Update comment. New parameter - 'gdb::optional sock' instead of 'struct serial *scb'. - Use 'sock' directly instead of 'scb->fd'. - (try_connect): New function, with code from 'net_open'. - (net_open): Rewrite main loop to deal with multiple - sockets/addresses. Handle IPv6-style hostnames; implement - support for IPv6 connections. - * unittests/parse-connection-spec-selftests.c: New file. - -gdb/gdbserver/ChangeLog: -2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser - Tsutomu Seki - - * Makefile.in (SFILES): Add '$(srcdir)/common/netstuff.c'. - (OBS): Add 'common/netstuff.o'. - (GDBREPLAY_OBS): Likewise. - * gdbreplay.c: Include 'wspiapi.h' and 'netstuff.h'. - (remote_open): Implement support for IPv6 - connections. - * remote-utils.c: Include 'netstuff.h', 'filestuff.h' - and 'wspiapi.h'. - (handle_accept_event): Accept connections from IPv6 sources. - (remote_prepare): Handle IPv6-style hostnames; implement - support for IPv6 connections. - (remote_open): Implement support for printing connections from - IPv6 sources. - -gdb/testsuite/ChangeLog: -2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser - Tsutomu Seki - - * README (Testsuite Parameters): Mention new 'GDB_TEST_SOCKETHOST' - parameter. - * boards/native-extended-gdbserver.exp: Do not set 'sockethost' - by default. - * boards/native-gdbserver.exp: Likewise. - * gdb.server/run-without-local-binary.exp: Improve regexp used - for detecting when a remote debugging connection succeeds. - * gdb.server/server-connect.exp: New file. - * lib/gdbserver-support.exp (gdbserver_default_get_comm_port): - Do not prefix the port number with ":". - (gdbserver_start): New global GDB_TEST_SOCKETHOST. Implement - support for detecting and using it. Add '$debughost_gdbserver' - to the list of arguments used to start gdbserver. Handle case - when gdbserver cannot resolve a network name. - -gdb/doc/ChangeLog: -2018-07-11 Sergio Durigan Junior - Jan Kratochvil - Paul Fertser - Tsutomu Seki - - * gdb.texinfo (Remote Connection Commands): Add explanation - about new IPv6 support. Add new connection prefixes. - -diff --git a/gdb/Makefile.in b/gdb/Makefile.in ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -430,6 +430,7 @@ SUBDIR_UNITTESTS_SRCS = \ - unittests/offset-type-selftests.c \ - unittests/observable-selftests.c \ - unittests/optional-selftests.c \ -+ unittests/parse-connection-spec-selftests.c \ - unittests/ptid-selftests.c \ - unittests/rsp-low-selftests.c \ - unittests/scoped_fd-selftests.c \ -@@ -967,6 +968,7 @@ COMMON_SFILES = \ - common/job-control.c \ - common/gdb_tilde_expand.c \ - common/gdb_vecs.c \ -+ common/netstuff.c \ - common/new-op.c \ - common/pathstuff.c \ - common/print-utils.c \ -@@ -1448,6 +1450,7 @@ HFILES_NO_SRCDIR = \ - common/gdb_vecs.h \ - common/gdb_wait.h \ - common/common-inferior.h \ -+ common/netstuff.h \ - common/host-defs.h \ - common/pathstuff.h \ - common/print-utils.h \ -diff --git a/gdb/NEWS b/gdb/NEWS ---- a/gdb/NEWS -+++ b/gdb/NEWS -@@ -1,6 +1,12 @@ - What has changed in GDB? - (Organized release by release) - -+*** Changes since GDB 8.2 -+ -+* GDB and GDBserver now support IPv6 connections. IPv6 addresses -+ can be passed using the '[ADDRESS]:PORT' notation, or the regular -+ 'ADDRESS:PORT' method. -+ - *** Changes in GDB 8.2 - - * The 'set disassembler-options' command now supports specifying options -diff --git a/gdb/common/netstuff.c b/gdb/common/netstuff.c -new file mode 100644 ---- /dev/null -+++ b/gdb/common/netstuff.c -@@ -0,0 +1,155 @@ -+/* Operations on network stuff. -+ Copyright (C) 2018 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 . */ -+ -+#include "common-defs.h" -+#include "netstuff.h" -+#include -+ -+#ifdef USE_WIN32API -+#include -+#include -+#else -+#include -+#include -+#include -+#include -+#include -+#endif -+ -+/* See common/netstuff.h. */ -+ -+scoped_free_addrinfo::~scoped_free_addrinfo () -+{ -+ freeaddrinfo (m_res); -+} -+ -+/* See common/netstuff.h. */ -+ -+parsed_connection_spec -+parse_connection_spec_without_prefix (std::string spec, struct addrinfo *hint) -+{ -+ parsed_connection_spec ret; -+ size_t last_colon_pos = 0; -+ /* We're dealing with IPv6 if: -+ -+ - ai_family is AF_INET6, or -+ - ai_family is not AF_INET, and -+ - spec[0] is '[', or -+ - the number of ':' on spec is greater than 1. */ -+ bool is_ipv6 = (hint->ai_family == AF_INET6 -+ || (hint->ai_family != AF_INET -+ && (spec[0] == '[' -+ || std::count (spec.begin (), -+ spec.end (), ':') > 1))); -+ -+ if (is_ipv6) -+ { -+ if (spec[0] == '[') -+ { -+ /* IPv6 addresses can be written as '[ADDR]:PORT', and we -+ support this notation. */ -+ size_t close_bracket_pos = spec.find_first_of (']'); -+ -+ if (close_bracket_pos == std::string::npos) -+ error (_("Missing close bracket in hostname '%s'"), -+ spec.c_str ()); -+ -+ hint->ai_family = AF_INET6; -+ -+ const char c = spec[close_bracket_pos + 1]; -+ -+ if (c == '\0') -+ last_colon_pos = std::string::npos; -+ else if (c != ':') -+ error (_("Invalid cruft after close bracket in '%s'"), -+ spec.c_str ()); -+ -+ /* Erase both '[' and ']'. */ -+ spec.erase (0, 1); -+ spec.erase (close_bracket_pos - 1, 1); -+ } -+ else if (spec.find_first_of (']') != std::string::npos) -+ error (_("Missing open bracket in hostname '%s'"), -+ spec.c_str ()); -+ } -+ -+ if (last_colon_pos == 0) -+ last_colon_pos = spec.find_last_of (':'); -+ -+ /* The length of the hostname part. */ -+ size_t host_len; -+ -+ if (last_colon_pos != std::string::npos) -+ { -+ /* The user has provided a port. */ -+ host_len = last_colon_pos; -+ ret.port_str = spec.substr (last_colon_pos + 1); -+ } -+ else -+ host_len = spec.size (); -+ -+ ret.host_str = spec.substr (0, host_len); -+ -+ /* Default hostname is localhost. */ -+ if (ret.host_str.empty ()) -+ ret.host_str = "localhost"; -+ -+ return ret; -+} -+ -+/* See common/netstuff.h. */ -+ -+parsed_connection_spec -+parse_connection_spec (const char *spec, struct addrinfo *hint) -+{ -+ /* Struct to hold the association between valid prefixes, their -+ family and socktype. */ -+ struct host_prefix -+ { -+ /* The prefix. */ -+ const char *prefix; -+ -+ /* The 'ai_family'. */ -+ int family; -+ -+ /* The 'ai_socktype'. */ -+ int socktype; -+ }; -+ static const struct host_prefix prefixes[] = -+ { -+ { "udp:", AF_UNSPEC, SOCK_DGRAM }, -+ { "tcp:", AF_UNSPEC, SOCK_STREAM }, -+ { "udp4:", AF_INET, SOCK_DGRAM }, -+ { "tcp4:", AF_INET, SOCK_STREAM }, -+ { "udp6:", AF_INET6, SOCK_DGRAM }, -+ { "tcp6:", AF_INET6, SOCK_STREAM }, -+ }; -+ -+ for (const host_prefix prefix : prefixes) -+ if (startswith (spec, prefix.prefix)) -+ { -+ spec += strlen (prefix.prefix); -+ hint->ai_family = prefix.family; -+ hint->ai_socktype = prefix.socktype; -+ hint->ai_protocol -+ = hint->ai_socktype == SOCK_DGRAM ? IPPROTO_UDP : IPPROTO_TCP; -+ break; -+ } -+ -+ return parse_connection_spec_without_prefix (spec, hint); -+} -diff --git a/gdb/common/netstuff.h b/gdb/common/netstuff.h -new file mode 100644 ---- /dev/null -+++ b/gdb/common/netstuff.h -@@ -0,0 +1,76 @@ -+/* Operations on network stuff. -+ Copyright (C) 2018 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 . */ -+ -+#ifndef NETSTUFF_H -+#define NETSTUFF_H -+ -+#include -+ -+/* Like NI_MAXHOST/NI_MAXSERV, but enough for numeric forms. */ -+#define GDB_NI_MAX_ADDR 64 -+#define GDB_NI_MAX_PORT 16 -+ -+/* Helper class to guarantee that we always call 'freeaddrinfo'. */ -+ -+class scoped_free_addrinfo -+{ -+public: -+ /* Default constructor. */ -+ explicit scoped_free_addrinfo (struct addrinfo *ainfo) -+ : m_res (ainfo) -+ { -+ } -+ -+ /* Destructor responsible for free'ing M_RES by calling -+ 'freeaddrinfo'. */ -+ ~scoped_free_addrinfo (); -+ -+ DISABLE_COPY_AND_ASSIGN (scoped_free_addrinfo); -+ -+private: -+ /* The addrinfo resource. */ -+ struct addrinfo *m_res; -+}; -+ -+/* The struct we return after parsing the connection spec. */ -+ -+struct parsed_connection_spec -+{ -+ /* The hostname. */ -+ std::string host_str; -+ -+ /* The port, if any. */ -+ std::string port_str; -+}; -+ -+ -+/* Parse SPEC (which is a string in the form of "ADDR:PORT") and -+ return a 'parsed_connection_spec' structure with the proper fields -+ filled in. Also adjust HINT accordingly. */ -+extern parsed_connection_spec -+ parse_connection_spec_without_prefix (std::string spec, -+ struct addrinfo *hint); -+ -+/* Parse SPEC (which is a string in the form of -+ "[tcp[6]:|udp[6]:]ADDR:PORT") and return a 'parsed_connection_spec' -+ structure with the proper fields filled in. Also adjust HINT -+ accordingly. */ -+extern parsed_connection_spec parse_connection_spec (const char *spec, -+ struct addrinfo *hint); -+ -+#endif /* ! NETSTUFF_H */ -diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog ---- a/gdb/doc/ChangeLog -+++ b/gdb/doc/ChangeLog -@@ -1,3 +1,11 @@ -+2018-07-11 Sergio Durigan Junior -+ Jan Kratochvil -+ Paul Fertser -+ Tsutomu Seki -+ -+ * gdb.texinfo (Remote Connection Commands): Add explanation -+ about new IPv6 support. Add new connection prefixes. -+ - 2018-07-02 Maciej W. Rozycki - - PR tdep/8282 -diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -20548,16 +20548,27 @@ If you're using a serial line, you may want to give @value{GDBN} the - @code{target} command. - - @item target remote @code{@var{host}:@var{port}} -+@itemx target remote @code{@var{[host]}:@var{port}} - @itemx target remote @code{tcp:@var{host}:@var{port}} -+@itemx target remote @code{tcp:@var{[host]}:@var{port}} -+@itemx target remote @code{tcp4:@var{host}:@var{port}} -+@itemx target remote @code{tcp6:@var{host}:@var{port}} -+@itemx target remote @code{tcp6:@var{[host]}:@var{port}} - @itemx target extended-remote @code{@var{host}:@var{port}} -+@itemx target extended-remote @code{@var{[host]}:@var{port}} - @itemx target extended-remote @code{tcp:@var{host}:@var{port}} -+@itemx target extended-remote @code{tcp:@var{[host]}:@var{port}} -+@itemx target extended-remote @code{tcp4:@var{host}:@var{port}} -+@itemx target extended-remote @code{tcp6:@var{host}:@var{port}} -+@itemx target extended-remote @code{tcp6:@var{[host]}:@var{port}} - @cindex @acronym{TCP} port, @code{target remote} - Debug using a @acronym{TCP} connection to @var{port} on @var{host}. --The @var{host} may be either a host name or a numeric @acronym{IP} --address; @var{port} must be a decimal number. The @var{host} could be --the target machine itself, if it is directly connected to the net, or --it might be a terminal server which in turn has a serial line to the --target. -+The @var{host} may be either a host name, a numeric @acronym{IPv4} -+address, or a numeric @acronym{IPv6} address (with or without the -+square brackets to separate the address from the port); @var{port} -+must be a decimal number. The @var{host} could be the target machine -+itself, if it is directly connected to the net, or it might be a -+terminal server which in turn has a serial line to the target. - - For example, to connect to port 2828 on a terminal server named - @code{manyfarms}: -@@ -20566,6 +20577,28 @@ For example, to connect to port 2828 on a terminal server named - target remote manyfarms:2828 - @end smallexample - -+To connect to port 2828 on a terminal server whose address is -+@code{2001:0db8:85a3:0000:0000:8a2e:0370:7334}, you can either use the -+square bracket syntax: -+ -+@smallexample -+target remote [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:2828 -+@end smallexample -+ -+@noindent -+or explicitly specify the @acronym{IPv6} protocol: -+ -+@smallexample -+target remote tcp6:2001:0db8:85a3:0000:0000:8a2e:0370:7334:2828 -+@end smallexample -+ -+This last example may be confusing to the reader, because there is no -+visible separation between the hostname and the port number. -+Therefore, we recommend the user to provide @acronym{IPv6} addresses -+using square brackets for clarity. However, it is important to -+mention that for @value{GDBN} there is no ambiguity: the number after -+the last colon is considered to be the port number. -+ - If your remote target is actually running on the same machine as your - debugger session (e.g.@: a simulator for your target running on the - same host), you can omit the hostname. For example, to connect to -@@ -20579,7 +20612,15 @@ target remote :1234 - Note that the colon is still required here. - - @item target remote @code{udp:@var{host}:@var{port}} -+@itemx target remote @code{udp:@var{[host]}:@var{port}} -+@itemx target remote @code{udp4:@var{host}:@var{port}} -+@itemx target remote @code{udp6:@var{[host]}:@var{port}} -+@itemx target extended-remote @code{udp:@var{host}:@var{port}} - @itemx target extended-remote @code{udp:@var{host}:@var{port}} -+@itemx target extended-remote @code{udp:@var{[host]}:@var{port}} -+@itemx target extended-remote @code{udp4:@var{host}:@var{port}} -+@itemx target extended-remote @code{udp6:@var{host}:@var{port}} -+@itemx target extended-remote @code{udp6:@var{[host]}:@var{port}} - @cindex @acronym{UDP} port, @code{target remote} - Debug using @acronym{UDP} packets to @var{port} on @var{host}. For example, to - connect to @acronym{UDP} port 2828 on a terminal server named @code{manyfarms}: -diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog ---- a/gdb/gdbserver/ChangeLog -+++ b/gdb/gdbserver/ChangeLog -@@ -1,3 +1,22 @@ -+2018-07-11 Sergio Durigan Junior -+ Jan Kratochvil -+ Paul Fertser -+ Tsutomu Seki -+ -+ * Makefile.in (SFILES): Add '$(srcdir)/common/netstuff.c'. -+ (OBS): Add 'common/netstuff.o'. -+ (GDBREPLAY_OBS): Likewise. -+ * gdbreplay.c: Include 'wspiapi.h' and 'netstuff.h'. -+ (remote_open): Implement support for IPv6 -+ connections. -+ * remote-utils.c: Include 'netstuff.h', 'filestuff.h' -+ and 'wspiapi.h'. -+ (handle_accept_event): Accept connections from IPv6 sources. -+ (remote_prepare): Handle IPv6-style hostnames; implement -+ support for IPv6 connections. -+ (remote_open): Implement support for printing connections from -+ IPv6 sources. -+ - 2018-07-11 Pedro Alves - - PR gdb/23377 -diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in ---- a/gdb/gdbserver/Makefile.in -+++ b/gdb/gdbserver/Makefile.in -@@ -211,6 +211,7 @@ SFILES = \ - $(srcdir)/common/job-control.c \ - $(srcdir)/common/gdb_tilde_expand.c \ - $(srcdir)/common/gdb_vecs.c \ -+ $(srcdir)/common/netstuff.c \ - $(srcdir)/common/new-op.c \ - $(srcdir)/common/pathstuff.c \ - $(srcdir)/common/print-utils.c \ -@@ -254,6 +255,7 @@ OBS = \ - common/format.o \ - common/gdb_tilde_expand.o \ - common/gdb_vecs.o \ -+ common/netstuff.o \ - common/new-op.o \ - common/pathstuff.o \ - common/print-utils.o \ -@@ -290,6 +292,7 @@ GDBREPLAY_OBS = \ - common/common-exceptions.o \ - common/common-utils.o \ - common/errors.o \ -+ common/netstuff.o \ - common/print-utils.o \ - gdbreplay.o \ - utils.o \ -diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c ---- a/gdb/gdbserver/gdbreplay.c -+++ b/gdb/gdbserver/gdbreplay.c -@@ -46,8 +46,11 @@ - - #if USE_WIN32API - #include -+#include - #endif - -+#include "netstuff.h" -+ - #ifndef HAVE_SOCKLEN_T - typedef int socklen_t; - #endif -@@ -142,56 +145,108 @@ remote_close (void) - static void - remote_open (char *name) - { -- if (!strchr (name, ':')) -+ char *last_colon = strrchr (name, ':'); -+ -+ if (last_colon == NULL) - { - fprintf (stderr, "%s: Must specify tcp connection as host:addr\n", name); - fflush (stderr); - exit (1); - } -- else -- { -+ - #ifdef USE_WIN32API -- static int winsock_initialized; -+ static int winsock_initialized; - #endif -- char *port_str; -- int port; -- struct sockaddr_in sockaddr; -- socklen_t tmp; -- int tmp_desc; -+ char *port_str; -+ int tmp; -+ int tmp_desc; -+ struct addrinfo hint; -+ struct addrinfo *ainfo; - -- port_str = strchr (name, ':'); -+ memset (&hint, 0, sizeof (hint)); -+ /* Assume no prefix will be passed, therefore we should use -+ AF_UNSPEC. */ -+ hint.ai_family = AF_UNSPEC; -+ hint.ai_socktype = SOCK_STREAM; -+ hint.ai_protocol = IPPROTO_TCP; - -- port = atoi (port_str + 1); -+ parsed_connection_spec parsed = parse_connection_spec (name, &hint); -+ -+ if (parsed.port_str.empty ()) -+ error (_("Missing port on hostname '%s'"), name); - - #ifdef USE_WIN32API -- if (!winsock_initialized) -- { -- WSADATA wsad; -+ if (!winsock_initialized) -+ { -+ WSADATA wsad; - -- WSAStartup (MAKEWORD (1, 0), &wsad); -- winsock_initialized = 1; -- } -+ WSAStartup (MAKEWORD (1, 0), &wsad); -+ winsock_initialized = 1; -+ } - #endif - -- tmp_desc = socket (PF_INET, SOCK_STREAM, 0); -- if (tmp_desc == -1) -- perror_with_name ("Can't open socket"); -+ int r = getaddrinfo (parsed.host_str.c_str (), parsed.port_str.c_str (), -+ &hint, &ainfo); - -- /* Allow rapid reuse of this port. */ -- tmp = 1; -- setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, -- sizeof (tmp)); -+ if (r != 0) -+ { -+ fprintf (stderr, "%s:%s: cannot resolve name: %s\n", -+ parsed.host_str.c_str (), parsed.port_str.c_str (), -+ gai_strerror (r)); -+ fflush (stderr); -+ exit (1); -+ } -+ -+ scoped_free_addrinfo free_ainfo (ainfo); -+ -+ struct addrinfo *p; -+ -+ for (p = ainfo; p != NULL; p = p->ai_next) -+ { -+ tmp_desc = socket (p->ai_family, p->ai_socktype, p->ai_protocol); - -- sockaddr.sin_family = PF_INET; -- sockaddr.sin_port = htons (port); -- sockaddr.sin_addr.s_addr = INADDR_ANY; -+ if (tmp_desc >= 0) -+ break; -+ } -+ -+ if (p == NULL) -+ perror_with_name ("Cannot open socket"); - -- if (bind (tmp_desc, (struct sockaddr *) &sockaddr, sizeof (sockaddr)) -- || listen (tmp_desc, 1)) -- perror_with_name ("Can't bind address"); -+ /* Allow rapid reuse of this port. */ -+ tmp = 1; -+ setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, -+ sizeof (tmp)); -+ -+ switch (p->ai_family) -+ { -+ case AF_INET: -+ ((struct sockaddr_in *) p->ai_addr)->sin_addr.s_addr = INADDR_ANY; -+ break; -+ case AF_INET6: -+ ((struct sockaddr_in6 *) p->ai_addr)->sin6_addr = in6addr_any; -+ break; -+ default: -+ fprintf (stderr, "Invalid 'ai_family' %d\n", p->ai_family); -+ exit (1); -+ } -+ -+ if (bind (tmp_desc, p->ai_addr, p->ai_addrlen) != 0) -+ perror_with_name ("Can't bind address"); -+ -+ if (p->ai_socktype == SOCK_DGRAM) -+ remote_desc = tmp_desc; -+ else -+ { -+ struct sockaddr_storage sockaddr; -+ socklen_t sockaddrsize = sizeof (sockaddr); -+ char orig_host[GDB_NI_MAX_ADDR], orig_port[GDB_NI_MAX_PORT]; -+ -+ if (listen (tmp_desc, 1) != 0) -+ perror_with_name ("Can't listen on socket"); -+ -+ remote_desc = accept (tmp_desc, (struct sockaddr *) &sockaddr, -+ &sockaddrsize); - -- tmp = sizeof (sockaddr); -- remote_desc = accept (tmp_desc, (struct sockaddr *) &sockaddr, &tmp); - if (remote_desc == -1) - perror_with_name ("Accept failed"); - -@@ -206,6 +261,16 @@ remote_open (char *name) - setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY, - (char *) &tmp, sizeof (tmp)); - -+ if (getnameinfo ((struct sockaddr *) &sockaddr, sockaddrsize, -+ orig_host, sizeof (orig_host), -+ orig_port, sizeof (orig_port), -+ NI_NUMERICHOST | NI_NUMERICSERV) == 0) -+ { -+ fprintf (stderr, "Remote debugging from host %s, port %s\n", -+ orig_host, orig_port); -+ fflush (stderr); -+ } -+ - #ifndef USE_WIN32API - close (tmp_desc); /* No longer need this */ - -diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c ---- a/gdb/gdbserver/remote-utils.c -+++ b/gdb/gdbserver/remote-utils.c -@@ -26,6 +26,8 @@ - #include "dll.h" - #include "rsp-low.h" - #include "gdbthread.h" -+#include "netstuff.h" -+#include "filestuff.h" - #include - #if HAVE_SYS_IOCTL_H - #include -@@ -63,6 +65,7 @@ - - #if USE_WIN32API - #include -+#include - #endif - - #if __QNX__ -@@ -151,19 +154,18 @@ enable_async_notification (int fd) - static int - handle_accept_event (int err, gdb_client_data client_data) - { -- struct sockaddr_in sockaddr; -- socklen_t tmp; -+ struct sockaddr_storage sockaddr; -+ socklen_t len = sizeof (sockaddr); - - if (debug_threads) - debug_printf ("handling possible accept event\n"); - -- tmp = sizeof (sockaddr); -- remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &tmp); -+ remote_desc = accept (listen_desc, (struct sockaddr *) &sockaddr, &len); - if (remote_desc == -1) - perror_with_name ("Accept failed"); - - /* Enable TCP keep alive process. */ -- tmp = 1; -+ socklen_t tmp = 1; - setsockopt (remote_desc, SOL_SOCKET, SO_KEEPALIVE, - (char *) &tmp, sizeof (tmp)); - -@@ -192,8 +194,19 @@ handle_accept_event (int err, gdb_client_data client_data) - delete_file_handler (listen_desc); - - /* Convert IP address to string. */ -- fprintf (stderr, "Remote debugging from host %s\n", -- inet_ntoa (sockaddr.sin_addr)); -+ char orig_host[GDB_NI_MAX_ADDR], orig_port[GDB_NI_MAX_PORT]; -+ -+ int r = getnameinfo ((struct sockaddr *) &sockaddr, len, -+ orig_host, sizeof (orig_host), -+ orig_port, sizeof (orig_port), -+ NI_NUMERICHOST | NI_NUMERICSERV); -+ -+ if (r != 0) -+ fprintf (stderr, _("Could not obtain remote address: %s\n"), -+ gai_strerror (r)); -+ else -+ fprintf (stderr, _("Remote debugging from host %s, port %s\n"), -+ orig_host, orig_port); - - enable_async_notification (remote_desc); - -@@ -222,10 +235,7 @@ remote_prepare (const char *name) - #ifdef USE_WIN32API - static int winsock_initialized; - #endif -- int port; -- struct sockaddr_in sockaddr; - socklen_t tmp; -- char *port_end; - - remote_is_stdio = 0; - if (strcmp (name, STDIO_CONNECTION_NAME) == 0) -@@ -238,17 +248,25 @@ remote_prepare (const char *name) - return; - } - -- port_str = strchr (name, ':'); -- if (port_str == NULL) -+ struct addrinfo hint; -+ struct addrinfo *ainfo; -+ -+ memset (&hint, 0, sizeof (hint)); -+ /* Assume no prefix will be passed, therefore we should use -+ AF_UNSPEC. */ -+ hint.ai_family = AF_UNSPEC; -+ hint.ai_socktype = SOCK_STREAM; -+ hint.ai_protocol = IPPROTO_TCP; -+ -+ parsed_connection_spec parsed -+ = parse_connection_spec_without_prefix (name, &hint); -+ -+ if (parsed.port_str.empty ()) - { - cs.transport_is_reliable = 0; - return; - } - -- port = strtoul (port_str + 1, &port_end, 10); -- if (port_str[1] == '\0' || *port_end != '\0') -- error ("Bad port argument: %s", name); -- - #ifdef USE_WIN32API - if (!winsock_initialized) - { -@@ -259,8 +277,26 @@ remote_prepare (const char *name) - } - #endif - -- listen_desc = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP); -- if (listen_desc == -1) -+ int r = getaddrinfo (parsed.host_str.c_str (), parsed.port_str.c_str (), -+ &hint, &ainfo); -+ -+ if (r != 0) -+ error (_("%s: cannot resolve name: %s"), name, gai_strerror (r)); -+ -+ scoped_free_addrinfo freeaddrinfo (ainfo); -+ -+ struct addrinfo *iter; -+ -+ for (iter = ainfo; iter != NULL; iter = iter->ai_next) -+ { -+ listen_desc = gdb_socket_cloexec (iter->ai_family, iter->ai_socktype, -+ iter->ai_protocol); -+ -+ if (listen_desc >= 0) -+ break; -+ } -+ -+ if (iter == NULL) - perror_with_name ("Can't open socket"); - - /* Allow rapid reuse of this port. */ -@@ -268,14 +304,25 @@ remote_prepare (const char *name) - setsockopt (listen_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, - sizeof (tmp)); - -- sockaddr.sin_family = PF_INET; -- sockaddr.sin_port = htons (port); -- sockaddr.sin_addr.s_addr = INADDR_ANY; -+ switch (iter->ai_family) -+ { -+ case AF_INET: -+ ((struct sockaddr_in *) iter->ai_addr)->sin_addr.s_addr = INADDR_ANY; -+ break; -+ case AF_INET6: -+ ((struct sockaddr_in6 *) iter->ai_addr)->sin6_addr = in6addr_any; -+ break; -+ default: -+ internal_error (__FILE__, __LINE__, -+ _("Invalid 'ai_family' %d\n"), iter->ai_family); -+ } - -- if (bind (listen_desc, (struct sockaddr *) &sockaddr, sizeof (sockaddr)) -- || listen (listen_desc, 1)) -+ if (bind (listen_desc, iter->ai_addr, iter->ai_addrlen) != 0) - perror_with_name ("Can't bind address"); - -+ if (listen (listen_desc, 1) != 0) -+ perror_with_name ("Can't listen on socket"); -+ - cs.transport_is_reliable = 1; - } - -@@ -350,18 +397,24 @@ remote_open (const char *name) - #endif /* USE_WIN32API */ - else - { -- int port; -- socklen_t len; -- struct sockaddr_in sockaddr; -- -- len = sizeof (sockaddr); -- if (getsockname (listen_desc, -- (struct sockaddr *) &sockaddr, &len) < 0 -- || len < sizeof (sockaddr)) -+ char listen_port[GDB_NI_MAX_PORT]; -+ struct sockaddr_storage sockaddr; -+ socklen_t len = sizeof (sockaddr); -+ -+ if (getsockname (listen_desc, (struct sockaddr *) &sockaddr, &len) < 0) - perror_with_name ("Can't determine port"); -- port = ntohs (sockaddr.sin_port); - -- fprintf (stderr, "Listening on port %d\n", port); -+ int r = getnameinfo ((struct sockaddr *) &sockaddr, len, -+ NULL, 0, -+ listen_port, sizeof (listen_port), -+ NI_NUMERICSERV); -+ -+ if (r != 0) -+ fprintf (stderr, _("Can't obtain port where we are listening: %s"), -+ gai_strerror (r)); -+ else -+ fprintf (stderr, _("Listening on port %s\n"), listen_port); -+ - fflush (stderr); - - /* Register the event loop handler. */ -diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c ---- a/gdb/ser-tcp.c -+++ b/gdb/ser-tcp.c -@@ -25,6 +25,7 @@ - #include "cli/cli-decode.h" - #include "cli/cli-setshow.h" - #include "filestuff.h" -+#include "netstuff.h" - - #include - -@@ -39,6 +40,7 @@ - - #ifdef USE_WIN32API - #include -+#include - #ifndef ETIMEDOUT - #define ETIMEDOUT WSAETIMEDOUT - #endif -@@ -81,12 +83,13 @@ static unsigned int tcp_retry_limit = 15; - - #define POLL_INTERVAL 5 - --/* Helper function to wait a while. If SCB is non-null, wait on its -- file descriptor. Otherwise just wait on a timeout, updating *POLLS. -- Returns -1 on timeout or interrupt, otherwise the value of select. */ -+/* Helper function to wait a while. If SOCK is not -1, wait on its -+ file descriptor. Otherwise just wait on a timeout, updating -+ *POLLS. Returns -1 on timeout or interrupt, otherwise the value of -+ select. */ - - static int --wait_for_connect (struct serial *scb, unsigned int *polls) -+wait_for_connect (int sock, unsigned int *polls) - { - struct timeval t; - int n; -@@ -120,24 +123,24 @@ wait_for_connect (struct serial *scb, unsigned int *polls) - t.tv_usec = 0; - } - -- if (scb) -+ if (sock >= 0) - { - fd_set rset, wset, eset; - - FD_ZERO (&rset); -- FD_SET (scb->fd, &rset); -+ FD_SET (sock, &rset); - wset = rset; - eset = rset; -- -+ - /* POSIX systems return connection success or failure by signalling - wset. Windows systems return success in wset and failure in - eset. -- -+ - We must call select here, rather than gdb_select, because - the serial structure has not yet been initialized - the - MinGW select wrapper will not know that this FD refers - to a socket. */ -- n = select (scb->fd + 1, &rset, &wset, &eset, &t); -+ n = select (sock + 1, &rset, &wset, &eset, &t); - } - else - /* Use gdb_select here, since we have no file descriptors, and on -@@ -153,80 +156,28 @@ wait_for_connect (struct serial *scb, unsigned int *polls) - return n; - } - --/* Open a tcp socket. */ -+/* Try to connect to the host represented by AINFO. If the connection -+ succeeds, return its socket. Otherwise, return -1 and set ERRNO -+ accordingly. POLLS is used when 'connect' returns EINPROGRESS, and -+ we need to invoke 'wait_for_connect' to obtain the status. */ - --int --net_open (struct serial *scb, const char *name) -+static int -+try_connect (const struct addrinfo *ainfo, unsigned int *polls) - { -- char hostname[100]; -- const char *port_str; -- int n, port, tmp; -- int use_udp; -- struct hostent *hostent; -- struct sockaddr_in sockaddr; --#ifdef USE_WIN32API -- u_long ioarg; --#else -- int ioarg; --#endif -- unsigned int polls = 0; -- -- use_udp = 0; -- if (startswith (name, "udp:")) -- { -- use_udp = 1; -- name = name + 4; -- } -- else if (startswith (name, "tcp:")) -- name = name + 4; -- -- port_str = strchr (name, ':'); -- -- if (!port_str) -- error (_("net_open: No colon in host name!")); /* Shouldn't ever -- happen. */ -- -- tmp = std::min (port_str - name, (ptrdiff_t) sizeof hostname - 1); -- strncpy (hostname, name, tmp); /* Don't want colon. */ -- hostname[tmp] = '\000'; /* Tie off host name. */ -- port = atoi (port_str + 1); -- -- /* Default hostname is localhost. */ -- if (!hostname[0]) -- strcpy (hostname, "localhost"); -- -- hostent = gethostbyname (hostname); -- if (!hostent) -- { -- fprintf_unfiltered (gdb_stderr, "%s: unknown host\n", hostname); -- errno = ENOENT; -- return -1; -- } -+ int sock = gdb_socket_cloexec (ainfo->ai_family, ainfo->ai_socktype, -+ ainfo->ai_protocol); - -- sockaddr.sin_family = PF_INET; -- sockaddr.sin_port = htons (port); -- memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr, -- sizeof (struct in_addr)); -- -- retry: -- -- if (use_udp) -- scb->fd = gdb_socket_cloexec (PF_INET, SOCK_DGRAM, 0); -- else -- scb->fd = gdb_socket_cloexec (PF_INET, SOCK_STREAM, 0); -- -- if (scb->fd == -1) -+ if (sock < 0) - return -1; -- -+ - /* Set socket nonblocking. */ -- ioarg = 1; -- ioctl (scb->fd, FIONBIO, &ioarg); -+ int ioarg = 1; -+ -+ ioctl (sock, FIONBIO, &ioarg); - - /* Use Non-blocking connect. connect() will return 0 if connected - already. */ -- n = connect (scb->fd, (struct sockaddr *) &sockaddr, sizeof (sockaddr)); -- -- if (n < 0) -+ if (connect (sock, ainfo->ai_addr, ainfo->ai_addrlen) < 0) - { - #ifdef USE_WIN32API - int err = WSAGetLastError(); -@@ -234,21 +185,26 @@ net_open (struct serial *scb, const char *name) - int err = errno; - #endif - -- /* Maybe we're waiting for the remote target to become ready to -- accept connections. */ -- if (tcp_auto_retry -+ /* If we've got a "connection refused" error, just return -+ -1. The caller will know what to do. */ -+ if ( - #ifdef USE_WIN32API -- && err == WSAECONNREFUSED -+ err == WSAECONNREFUSED - #else -- && err == ECONNREFUSED -+ err == ECONNREFUSED - #endif -- && wait_for_connect (NULL, &polls) >= 0) -+ ) - { -- close (scb->fd); -- goto retry; -+ close (sock); -+ errno = err; -+ return -1; - } - - if ( -+ /* Any other error (except EINPROGRESS) will be "swallowed" -+ here. We return without specifying a return value, and -+ set errno if the caller wants to inspect what -+ happened. */ - #ifdef USE_WIN32API - /* Under Windows, calling "connect" with a non-blocking socket - results in WSAEWOULDBLOCK, not WSAEINPROGRESS. */ -@@ -258,66 +214,166 @@ net_open (struct serial *scb, const char *name) - #endif - ) - { -+ close (sock); - errno = err; -- net_close (scb); - return -1; - } - - /* Looks like we need to wait for the connect. */ -- do -- { -- n = wait_for_connect (scb, &polls); -- } -+ int n; -+ -+ do -+ n = wait_for_connect (sock, polls); - while (n == 0); -+ - if (n < 0) - { -- net_close (scb); -+ int saved_errno = errno; -+ -+ /* A negative value here means that we either timed out or -+ got interrupted by the user. Just return. */ -+ close (sock); -+ errno = saved_errno; - return -1; - } - } - - /* Got something. Is it an error? */ -- { -- int res, err; -- socklen_t len; -- -- len = sizeof (err); -- /* On Windows, the fourth parameter to getsockopt is a "char *"; -- on UNIX systems it is generally "void *". The cast to "char *" -- is OK everywhere, since in C++ any data pointer type can be -- implicitly converted to "void *". */ -- res = getsockopt (scb->fd, SOL_SOCKET, SO_ERROR, (char *) &err, &len); -- if (res < 0 || err) -- { -- /* Maybe the target still isn't ready to accept the connection. */ -- if (tcp_auto_retry -+ int err; -+ socklen_t len = sizeof (err); -+ -+ /* On Windows, the fourth parameter to getsockopt is a "char *"; -+ on UNIX systems it is generally "void *". The cast to "char *" -+ is OK everywhere, since in C++ any data pointer type can be -+ implicitly converted to "void *". */ -+ int ret = getsockopt (sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len); -+ -+ if (ret < 0) -+ { -+ int saved_errno = errno; -+ -+ close (sock); -+ errno = saved_errno; -+ return -1; -+ } -+ else if (ret == 0 && err != 0) -+ { -+ close (sock); -+ errno = err; -+ return -1; -+ } -+ -+ /* The connection succeeded. Return the socket. */ -+ return sock; -+} -+ -+/* Open a tcp socket. */ -+ -+int -+net_open (struct serial *scb, const char *name) -+{ -+ struct addrinfo hint; -+ struct addrinfo *ainfo; -+ -+ memset (&hint, 0, sizeof (hint)); -+ /* Assume no prefix will be passed, therefore we should use -+ AF_UNSPEC. */ -+ hint.ai_family = AF_UNSPEC; -+ hint.ai_socktype = SOCK_STREAM; -+ hint.ai_protocol = IPPROTO_TCP; -+ -+ parsed_connection_spec parsed = parse_connection_spec (name, &hint); -+ -+ if (parsed.port_str.empty ()) -+ error (_("Missing port on hostname '%s'"), name); -+ -+ int r = getaddrinfo (parsed.host_str.c_str (), -+ parsed.port_str.c_str (), -+ &hint, &ainfo); -+ -+ if (r != 0) -+ { -+ fprintf_unfiltered (gdb_stderr, _("%s: cannot resolve name: %s\n"), -+ name, gai_strerror (r)); -+ errno = ENOENT; -+ return -1; -+ } -+ -+ scoped_free_addrinfo free_ainfo (ainfo); -+ -+ /* Flag to indicate whether we've got a connection refused. It will -+ be true if any of the connections tried was refused. */ -+ bool got_connrefused; -+ /* If a connection succeeeds, SUCCESS_AINFO will point to the -+ 'struct addrinfo' that succeed. */ -+ struct addrinfo *success_ainfo = NULL; -+ unsigned int polls = 0; -+ -+ /* Assume the worst. */ -+ scb->fd = -1; -+ -+ do -+ { -+ got_connrefused = false; -+ -+ for (struct addrinfo *iter = ainfo; iter != NULL; iter = iter->ai_next) -+ { -+ /* Iterate over the list of possible addresses to connect -+ to. For each, we'll try to connect and see if it -+ succeeds. */ -+ int sock = try_connect (iter, &polls); -+ -+ if (sock >= 0) -+ { -+ /* We've gotten a successful connection. Save its -+ 'struct addrinfo', the socket, and break. */ -+ success_ainfo = iter; -+ scb->fd = sock; -+ break; -+ } -+ else if ( - #ifdef USE_WIN32API -- && err == WSAECONNREFUSED -+ errno == WSAECONNREFUSED - #else -- && err == ECONNREFUSED -+ errno == ECONNREFUSED - #endif -- && wait_for_connect (NULL, &polls) >= 0) -- { -- close (scb->fd); -- goto retry; -- } -- if (err) -- errno = err; -- net_close (scb); -- return -1; -- } -- } -+ ) -+ got_connrefused = true; -+ } -+ } -+ /* Just retry if: -+ -+ - tcp_auto_retry is true, and -+ - We haven't gotten a connection yet, and -+ - Any of our connection attempts returned with ECONNREFUSED, and -+ - wait_for_connect signals that we can keep going. */ -+ while (tcp_auto_retry -+ && success_ainfo == NULL -+ && got_connrefused -+ && wait_for_connect (-1, &polls) >= 0); -+ -+ if (success_ainfo == NULL) -+ { -+ net_close (scb); -+ return -1; -+ } - - /* Turn off nonblocking. */ -- ioarg = 0; -+#ifdef USE_WIN32API -+ u_long ioarg = 0; -+#else -+ int ioarg = 0; -+#endif -+ - ioctl (scb->fd, FIONBIO, &ioarg); - -- if (use_udp == 0) -+ if (success_ainfo->ai_socktype == IPPROTO_TCP) - { - /* Disable Nagle algorithm. Needed in some cases. */ -- tmp = 1; -+ int tmp = 1; -+ - setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, -- (char *)&tmp, sizeof (tmp)); -+ (char *) &tmp, sizeof (tmp)); - } - - #ifdef SIGPIPE -diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog ---- a/gdb/testsuite/ChangeLog -+++ b/gdb/testsuite/ChangeLog -@@ -1,3 +1,23 @@ -+2018-07-11 Sergio Durigan Junior -+ Jan Kratochvil -+ Paul Fertser -+ Tsutomu Seki -+ -+ * README (Testsuite Parameters): Mention new 'GDB_TEST_SOCKETHOST' -+ parameter. -+ * boards/native-extended-gdbserver.exp: Do not set 'sockethost' -+ by default. -+ * boards/native-gdbserver.exp: Likewise. -+ * gdb.server/run-without-local-binary.exp: Improve regexp used -+ for detecting when a remote debugging connection succeeds. -+ * gdb.server/server-connect.exp: New file. -+ * lib/gdbserver-support.exp (gdbserver_default_get_comm_port): -+ Do not prefix the port number with ":". -+ (gdbserver_start): New global GDB_TEST_SOCKETHOST. Implement -+ support for detecting and using it. Add '$debughost_gdbserver' -+ to the list of arguments used to start gdbserver. Handle case -+ when gdbserver cannot resolve a network name. -+ - 2018-07-11 Sergio Durigan Junior - - PR c++/23373 -diff --git a/gdb/testsuite/README b/gdb/testsuite/README ---- a/gdb/testsuite/README -+++ b/gdb/testsuite/README -@@ -259,6 +259,20 @@ This make (not runtest) variable is used to specify whether the - testsuite preloads the read1.so library into expect. Any non-empty - value means true. See "Race detection" below. - -+GDB_TEST_SOCKETHOST -+ -+This variable can provide the hostname/address that should be used -+when performing GDBserver-related tests. This is useful in some -+situations, e.g., when you want to test the IPv6 connectivity of GDB -+and GDBserver, or when using a different hostname/address is needed. -+For example, to make GDB and GDBserver use IPv6-only connections, you -+can do: -+ -+ make check TESTS="gdb.server/*.exp" RUNTESTFLAGS='GDB_TEST_SOCKETHOST=tcp6:[::1]' -+ -+Note that only a hostname/address can be provided, without a port -+number. -+ - Race detection - ************** - -diff --git a/gdb/testsuite/boards/native-extended-gdbserver.exp b/gdb/testsuite/boards/native-extended-gdbserver.exp ---- a/gdb/testsuite/boards/native-extended-gdbserver.exp -+++ b/gdb/testsuite/boards/native-extended-gdbserver.exp -@@ -24,8 +24,6 @@ load_generic_config "extended-gdbserver" - load_board_description "gdbserver-base" - load_board_description "local-board" - --set_board_info sockethost "localhost:" -- - # We will be using the extended GDB remote protocol. - set_board_info gdb_protocol "extended-remote" - -diff --git a/gdb/testsuite/boards/native-gdbserver.exp b/gdb/testsuite/boards/native-gdbserver.exp ---- a/gdb/testsuite/boards/native-gdbserver.exp -+++ b/gdb/testsuite/boards/native-gdbserver.exp -@@ -30,7 +30,6 @@ set_board_info gdb,do_reload_on_run 1 - # There's no support for argument-passing (yet). - set_board_info noargs 1 - --set_board_info sockethost "localhost:" - set_board_info use_gdb_stub 1 - set_board_info exit_is_reliable 1 - -diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp ---- a/gdb/testsuite/gdb.server/run-without-local-binary.exp -+++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp -@@ -53,7 +53,7 @@ save_vars { GDBFLAGS } { - set use_gdb_stub 0 - - gdb_test "target ${gdbserver_protocol} ${gdbserver_gdbport}" \ -- "Remote debugging using $gdbserver_gdbport" \ -+ "Remote debugging using [string_to_regexp $gdbserver_gdbport]" \ - "connect to gdbserver" - - gdb_test "run" \ -diff --git a/gdb/testsuite/gdb.server/server-connect.exp b/gdb/testsuite/gdb.server/server-connect.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.server/server-connect.exp -@@ -0,0 +1,111 @@ -+# This testcase is part of GDB, the GNU debugger. -+# -+# Copyright 2018 Free Software Foundation, Inc. -+# -+# 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 . -+ -+# Test multiple types of connection (IPv4, IPv6, TCP, UDP) and make -+# sure both gdbserver and GDB work. -+ -+load_lib gdbserver-support.exp -+ -+standard_testfile normal.c -+ -+if {[skip_gdbserver_tests]} { -+ return 0 -+} -+ -+# We want to have control over where we start gdbserver. -+if { [is_remote target] } { -+ return 0 -+} -+ -+if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { -+ return -1 -+} -+ -+# Make sure we're disconnected, in case we're testing with an -+# extended-remote board, therefore already connected. -+gdb_test "disconnect" ".*" -+ -+set target_exec [gdbserver_download_current_prog] -+ -+# An array containing the test instructions for each scenario. The -+# description of each field is as follows: -+# -+# - The connection specification to be used when starting -+# gdbserver/GDB. This string will be used to set the -+# GDB_TEST_SOCKETHOST when calling gdbserver_start. -+# -+# - A flag indicating whether gdbserver should fail when we attempt to -+# start it. Useful when testing erroneous connection specs such as -+# "tcp8:". -+# -+# - The prefix that should be prepended to the test messages. -+set test_params \ -+ { \ -+ { "tcp4:127.0.0.1" 0 "tcp4" } \ -+ { "tcp6:::1" 0 "tcp6" } \ -+ { "tcp6:[::1]" 0 "tcp6-with-brackets" } \ -+ { "tcp:localhost" 0 "tcp" } \ -+ { "udp4:127.0.0.1" 0 "udp4" } \ -+ { "udp6:::1" 0 "udp6" } \ -+ { "udp6:[::1]" 0 "udp6-with-brackets" } \ -+ { "tcp8:123" 1 "tcp8" } \ -+ { "udp123:::" 1 "udp123" } \ -+ { "garbage:1234" 1 "garbage:1234" } \ -+ } -+ -+# The best way to test different types of connections is to set the -+# GDB_TEST_SOCKETHOST variable accordingly. -+save_vars { GDB_TEST_SOCKETHOST } { -+ foreach line $test_params { -+ set sockhost [lindex $line 0] -+ set gdbserver_should_fail [lindex $line 1] -+ set prefix [lindex $line 2] -+ -+ with_test_prefix $prefix { -+ set GDB_TEST_SOCKETHOST $sockhost -+ set test "start gdbserver" -+ -+ # Try to start gdbserver. -+ set catchres [catch {set res [gdbserver_start "" $target_exec]} errmsg] -+ -+ if { $catchres != 0 } { -+ if { $gdbserver_should_fail } { -+ pass "$test: gdbserver failed as expected" -+ } else { -+ fail "$test: $errmsg" -+ } -+ continue -+ } else { -+ if { $gdbserver_should_fail } { -+ fail "$test: gdbserver should fail but did not" -+ } else { -+ pass "$test" -+ } -+ } -+ -+ set gdbserver_protocol [lindex $res 0] -+ set gdbserver_gdbport [lindex $res 1] -+ set test "connect to gdbserver using $sockhost" -+ -+ if { [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] == 0 } { -+ pass $test -+ } else { -+ fail $test -+ } -+ } -+ } -+} -diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp ---- a/gdb/testsuite/lib/gdbserver-support.exp -+++ b/gdb/testsuite/lib/gdbserver-support.exp -@@ -211,7 +211,7 @@ proc gdbserver_default_get_remote_address { host port } { - # Default routine to compute the "comm" argument for gdbserver. - - proc gdbserver_default_get_comm_port { port } { -- return ":$port" -+ return "$port" - } - - # Start a gdbserver process with initial OPTIONS and trailing ARGUMENTS. -@@ -221,6 +221,7 @@ proc gdbserver_default_get_comm_port { port } { - - proc gdbserver_start { options arguments } { - global portnum -+ global GDB_TEST_SOCKETHOST - - # Port id -- either specified in baseboard file, or managed here. - if [target_info exists gdb,socketport] { -@@ -231,10 +232,22 @@ proc gdbserver_start { options arguments } { - } - - # Extract the local and remote host ids from the target board struct. -- if [target_info exists sockethost] { -+ if { [info exists GDB_TEST_SOCKETHOST] } { -+ # The user is not supposed to provide a port number, just a -+ # hostname/address, therefore we add the trailing ":" here. -+ set debughost "${GDB_TEST_SOCKETHOST}:" -+ # Escape open and close square brackets. -+ set debughost_tmp [string map { [ \\[ ] \\] } $debughost] -+ # We need a "gdbserver" version of the debughost, which will -+ # have the possible connection prefix stripped. This is -+ # because gdbserver currently doesn't recognize the prefixes. -+ regsub -all "^\(tcp:|udp:|tcp4:|udp4:|tcp6:|udp6:\)" $debughost_tmp "" debughost_gdbserver -+ } elseif [target_info exists sockethost] { - set debughost [target_info sockethost] -+ set debughost_gdbserver $debughost - } else { - set debughost "localhost:" -+ set debughost_gdbserver $debughost - } - - # Some boards use a different value for the port that is passed to -@@ -277,8 +290,14 @@ proc gdbserver_start { options arguments } { - if { $options != "" } { - append gdbserver_command " $options" - } -+ if { $debughost_gdbserver != "" } { -+ append gdbserver_command " $debughost_gdbserver" -+ } - if { $portnum != "" } { -- append gdbserver_command " [$get_comm_port $portnum]" -+ if { $debughost_gdbserver == "" } { -+ append gdbserver_command " " -+ } -+ append gdbserver_command "[$get_comm_port $portnum]" - } - if { $arguments != "" } { - append gdbserver_command " $arguments" -@@ -307,6 +326,9 @@ proc gdbserver_start { options arguments } { - continue - } - } -+ -re ".*: cannot resolve name: Name or service not known\r\n" { -+ error "gdbserver cannot resolve name." -+ } - timeout { - error "Timeout waiting for gdbserver response." - } -diff --git a/gdb/unittests/parse-connection-spec-selftests.c b/gdb/unittests/parse-connection-spec-selftests.c -new file mode 100644 ---- /dev/null -+++ b/gdb/unittests/parse-connection-spec-selftests.c -@@ -0,0 +1,249 @@ -+/* Self tests for parsing connection specs for GDB, the GNU debugger. -+ -+ Copyright (C) 2018 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 . */ -+ -+#include "defs.h" -+#include "selftest.h" -+#include "common/netstuff.h" -+#include "diagnostics.h" -+#ifdef USE_WIN32API -+#include -+#include -+#else -+#include -+#include -+#include -+#include -+#include -+#endif -+ -+namespace selftests { -+namespace parse_connection_spec_tests { -+ -+/* Auxiliary struct that holds info about a specific test for a -+ connection spec. */ -+ -+struct parse_conn_test -+{ -+ /* The connection spec. */ -+ const char *connspec; -+ -+ /* Expected result from 'parse_connection_spec'. */ -+ parsed_connection_spec expected_result; -+ -+ /* True if this test should fail, false otherwise. If true, only -+ the CONNSPEC field should be considered as valid. */ -+ bool should_fail; -+ -+ /* The expected AI_FAMILY to be found on the 'struct addrinfo' -+ HINT. */ -+ int exp_ai_family; -+ -+ /* The expected AI_SOCKTYPE to be found on the 'struct addrinfo' -+ HINT. */ -+ int exp_ai_socktype; -+ -+ /* The expected AI_PROTOCOL to be found on the 'struct addrinfo' -+ HINT. */ -+ int exp_ai_protocol; -+}; -+ -+/* Some defines to help us fill a 'struct parse_conn_test'. */ -+ -+/* Initialize a full entry. */ -+#define INIT_ENTRY(ADDR, EXP_HOST, EXP_PORT, SHOULD_FAIL, EXP_AI_FAMILY, \ -+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \ -+ { ADDR, { EXP_HOST, EXP_PORT }, SHOULD_FAIL, EXP_AI_FAMILY, \ -+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL } -+ -+/* Initialize an unprefixed entry. In this case, we don't expect -+ anything on the 'struct addrinfo' HINT. */ -+#define INIT_UNPREFIXED_ENTRY(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, 0, 0, 0) -+ -+/* Initialized an unprefixed IPv6 entry. In this case, we don't -+ expect anything on the 'struct addrinfo' HINT. */ -+#define INIT_UNPREFIXED_IPV6_ENTRY(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, AF_INET6, 0, 0) -+ -+/* Initialize a prefixed entry. */ -+#define INIT_PREFIXED_ENTRY(ADDR, EXP_HOST, EXP_PORT, EXP_AI_FAMILY, \ -+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) \ -+ INIT_ENTRY (ADDR, EXP_HOST, EXP_PORT, false, EXP_AI_FAMILY, \ -+ EXP_AI_SOCKTYPE, EXP_AI_PROTOCOL) -+ -+/* Initialize an entry prefixed with "tcp4:". */ -+#define INIT_PREFIXED_IPV4_TCP(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET, SOCK_STREAM, \ -+ IPPROTO_TCP) -+ -+/* Initialize an entry prefixed with "tcp6:". */ -+#define INIT_PREFIXED_IPV6_TCP(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET6, SOCK_STREAM, \ -+ IPPROTO_TCP) -+ -+/* Initialize an entry prefixed with "udp4:". */ -+#define INIT_PREFIXED_IPV4_UDP(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET, SOCK_DGRAM, \ -+ IPPROTO_UDP) -+ -+/* Initialize an entry prefixed with "udp6:". */ -+#define INIT_PREFIXED_IPV6_UDP(ADDR, EXP_HOST, EXP_PORT) \ -+ INIT_PREFIXED_ENTRY (ADDR, EXP_HOST, EXP_PORT, AF_INET6, SOCK_DGRAM, \ -+ IPPROTO_UDP) -+ -+/* Initialize a bogus entry, i.e., a connection spec that should -+ fail. */ -+#define INIT_BOGUS_ENTRY(ADDR) \ -+ INIT_ENTRY (ADDR, "", "", true, 0, 0, 0) -+ -+/* The variable which holds all of our tests. */ -+ -+static const parse_conn_test conn_test[] = -+ { -+ /* Unprefixed addresses. */ -+ -+ /* IPv4, host and port present. */ -+ INIT_UNPREFIXED_ENTRY ("127.0.0.1:1234", "127.0.0.1", "1234"), -+ /* IPv4, only host. */ -+ INIT_UNPREFIXED_ENTRY ("127.0.0.1", "127.0.0.1", ""), -+ /* IPv4, missing port. */ -+ INIT_UNPREFIXED_ENTRY ("127.0.0.1:", "127.0.0.1", ""), -+ -+ /* IPv6, host and port present, no brackets. */ -+ INIT_UNPREFIXED_ENTRY ("::1:1234", "::1", "1234"), -+ /* IPv6, missing port, no brackets. */ -+ INIT_UNPREFIXED_ENTRY ("::1:", "::1", ""), -+ /* IPv6, host and port present, with brackets. */ -+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:1234", "::1", "1234"), -+ /* IPv6, only host, with brackets. */ -+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]", "::1", ""), -+ /* IPv6, missing port, with brackets. */ -+ INIT_UNPREFIXED_IPV6_ENTRY ("[::1]:", "::1", ""), -+ -+ /* Unspecified, only port. */ -+ INIT_UNPREFIXED_ENTRY (":1234", "localhost", "1234"), -+ -+ /* Prefixed addresses. */ -+ -+ /* Prefixed "tcp4:" IPv4, host and port presents. */ -+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:1234", "127.0.0.1", "1234"), -+ /* Prefixed "tcp4:" IPv4, only port. */ -+ INIT_PREFIXED_IPV4_TCP ("tcp4::1234", "localhost", "1234"), -+ /* Prefixed "tcp4:" IPv4, only host. */ -+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1", "127.0.0.1", ""), -+ /* Prefixed "tcp4:" IPv4, missing port. */ -+ INIT_PREFIXED_IPV4_TCP ("tcp4:127.0.0.1:", "127.0.0.1", ""), -+ -+ /* Prefixed "udp4:" IPv4, host and port present. */ -+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:1234", "127.0.0.1", "1234"), -+ /* Prefixed "udp4:" IPv4, only port. */ -+ INIT_PREFIXED_IPV4_UDP ("udp4::1234", "localhost", "1234"), -+ /* Prefixed "udp4:" IPv4, only host. */ -+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1", "127.0.0.1", ""), -+ /* Prefixed "udp4:" IPv4, missing port. */ -+ INIT_PREFIXED_IPV4_UDP ("udp4:127.0.0.1:", "127.0.0.1", ""), -+ -+ -+ /* Prefixed "tcp6:" IPv6, host and port present. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:::1:1234", "::1", "1234"), -+ /* Prefixed "tcp6:" IPv6, only port. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6::1234", "localhost", "1234"), -+ /* Prefixed "tcp6:" IPv6, only host. */ -+ //INIT_PREFIXED_IPV6_TCP ("tcp6:::1", "::1", ""), -+ /* Prefixed "tcp6:" IPv6, missing port. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:::1:", "::1", ""), -+ -+ /* Prefixed "udp6:" IPv6, host and port present. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:::1:1234", "::1", "1234"), -+ /* Prefixed "udp6:" IPv6, only port. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6::1234", "localhost", "1234"), -+ /* Prefixed "udp6:" IPv6, only host. */ -+ //INIT_PREFIXED_IPV6_UDP ("udp6:::1", "::1", ""), -+ /* Prefixed "udp6:" IPv6, missing port. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:::1:", "::1", ""), -+ -+ /* Prefixed "tcp6:" IPv6 with brackets, host and port present. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:1234", "::1", "1234"), -+ /* Prefixed "tcp6:" IPv6 with brackets, only host. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]", "::1", ""), -+ /* Prefixed "tcp6:" IPv6 with brackets, missing port. */ -+ INIT_PREFIXED_IPV6_TCP ("tcp6:[::1]:", "::1", ""), -+ -+ /* Prefixed "udp6:" IPv6 with brackets, host and port present. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:1234", "::1", "1234"), -+ /* Prefixed "udp6:" IPv6 with brackets, only host. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]", "::1", ""), -+ /* Prefixed "udp6:" IPv6 with brackets, missing port. */ -+ INIT_PREFIXED_IPV6_UDP ("udp6:[::1]:", "::1", ""), -+ -+ -+ /* Bogus addresses. */ -+ INIT_BOGUS_ENTRY ("tcp6:[::1]123:44"), -+ INIT_BOGUS_ENTRY ("[::1"), -+ INIT_BOGUS_ENTRY ("tcp6:::1]:"), -+ }; -+ -+/* Test a connection spec C. */ -+ -+static void -+test_conn (const parse_conn_test &c) -+{ -+ struct addrinfo hint; -+ parsed_connection_spec ret; -+ -+ memset (&hint, 0, sizeof (hint)); -+ -+ TRY -+ { -+ ret = parse_connection_spec (c.connspec, &hint); -+ } -+ CATCH (ex, RETURN_MASK_ERROR) -+ { -+ /* If we caught an error, we should check if this connection -+ spec was supposed to fail. */ -+ SELF_CHECK (c.should_fail); -+ return; -+ } -+ END_CATCH -+ -+ SELF_CHECK (!c.should_fail); -+ SELF_CHECK (ret.host_str == c.expected_result.host_str); -+ SELF_CHECK (ret.port_str == c.expected_result.port_str); -+ SELF_CHECK (hint.ai_family == c.exp_ai_family); -+ SELF_CHECK (hint.ai_socktype == c.exp_ai_socktype); -+ SELF_CHECK (hint.ai_protocol == c.exp_ai_protocol); -+} -+ -+/* Run the tests associated with parsing connection specs. */ -+ -+static void -+run_tests () -+{ -+ for (const parse_conn_test &c : conn_test) -+ test_conn (c); -+} -+} /* namespace parse_connection_spec_tests */ -+} /* namespace selftests */ -+ -+void -+_initialize_parse_connection_spec_selftests () -+{ -+ selftests::register_test ("parse_connection_spec", -+ selftests::parse_connection_spec_tests::run_tests); -+} diff --git a/gdb-rhbz881849-ipv6-2of3.patch b/gdb-rhbz881849-ipv6-2of3.patch deleted file mode 100644 index 390be0f..0000000 --- a/gdb-rhbz881849-ipv6-2of3.patch +++ /dev/null @@ -1,54 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Mon, 30 Jul 2018 15:23:27 -0400 -Subject: gdb-rhbz881849-ipv6-2of3.patch - -Match any kind of error after "cannot resolve name" on lib/gdbserver-support.exp:gdbserver_start - -On commit: - -commit 7f1f7e23939adc7d71036a17fc6081e3af7ca585 -Author: Sergio Durigan Junior -Date: Fri Jul 13 16:20:34 2018 -0400 - - Expect for another variant of error message when gdbserver cannot resolve hostname - -I extended the regular expression being used to identify whether -gdbserver could not resolve a (host)name. This was needed because the -error message being printed had a different variation across some -systems. However, as it turns out, I've just noticed that the message -has yet another variation: - - target remote tcp8:123:2353 - tcp8:123:2353: cannot resolve name: System error - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - tcp8:123:2353: No such file or directory. - (gdb) FAIL: gdb.server/server-connect.exp: tcp8: connect to gdbserver using tcp8:123 - -which is causing FAILs on some systems (namely, Fedora-i686 on -BuildBot). - -So instead of trying to predict everything that can be printed, I -decided to just match anything after the "cannot resolve name: " part. -This patch implements that. - -Regression tested on the BuildBot. - -gdb/testsuite/ChangeLog: -2018-07-30 Sergio Durigan Junior - - * lib/gdbserver-support.exp (gdbserver_start): Match any kind of - error after "cannot resolve name" string. - -diff --git a/gdb/testsuite/lib/gdbserver-support.exp b/gdb/testsuite/lib/gdbserver-support.exp ---- a/gdb/testsuite/lib/gdbserver-support.exp -+++ b/gdb/testsuite/lib/gdbserver-support.exp -@@ -326,7 +326,7 @@ proc gdbserver_start { options arguments } { - continue - } - } -- -re ".*: cannot resolve name: Name or service not known\r\n" { -+ -re ".*: cannot resolve name: .*\r\n" { - error "gdbserver cannot resolve name." - } - timeout { diff --git a/gdb-rhbz881849-ipv6-3of3.patch b/gdb-rhbz881849-ipv6-3of3.patch deleted file mode 100644 index 789cb18..0000000 --- a/gdb-rhbz881849-ipv6-3of3.patch +++ /dev/null @@ -1,72 +0,0 @@ -From FEDORA_PATCHES Mon Sep 17 00:00:00 2001 -From: Sergio Durigan Junior -Date: Fri, 3 Aug 2018 18:04:38 -0400 -Subject: gdb-rhbz881849-ipv6-3of3.patch - -Fix thinko when deciding whether to disable TCP's Nagle algorithm - -This patch fixes a thinko that happened when I was implementing the -IPv6 support on GDB/gdbserver. On certain situations, it is necessary -to disable TCP's Nagle algorithm (NODELAY). For obvious reasons, this -only applies when we are dealing with a TCP connection. - -While implementing the IPv6 patch, I noticed that the net_open -function (on gdb/ser-tcp.c) kept a flag indicating whether the -connection type was UDP or TCP. I eliminated that flag, and started -using the 'struct addrinfo *' related to the successful connection -directly. However, I made a mistake: - - if (success_ainfo->ai_socktype == IPPROTO_TCP) - ^^^^^^^^^^^ - { - /* Disable Nagle algorithm. Needed in some cases. */ - int tmp = 1; - - setsockopt (scb->fd, IPPROTO_TCP, TCP_NODELAY, - (char *) &tmp, sizeof (tmp)); - } - -The 'ai_socktype' field specifies the socket type (SOCK_STREAM or -SOCK_DGRAM), and not the protocol. This test was always failing, and -the Nagle algorithm was never being disabled. - -The obvious fix is to use the 'ai_protocol' field. This is what this -patch does. - -Huge "thank you" to Joel Brobecker who reported the regression (he was -experiencing an unusual delay while debugging a bare-metal program -running under QEMU) and helped me set up a proper reproducer for the -bug. - -gdb/ChangeLog: -2018-08-03 Sergio Durigan Junior - - * ser-tcp.c (net_open): Fix thinko when deciding whether to - disable TCP's Nagle algorithm (use "ai_protocol" instead of - "ai_socktype"). - -diff --git a/gdb/ChangeLog b/gdb/ChangeLog ---- a/gdb/ChangeLog -+++ b/gdb/ChangeLog -@@ -1,3 +1,9 @@ -+2018-08-03 Sergio Durigan Junior -+ -+ * ser-tcp.c (net_open): Fix thinko when deciding whether to -+ disable TCP's Nagle algorithm (use "ai_protocol" instead of -+ "ai_socktype"). -+ - 2018-07-25 Alan Hayward - - * target-descriptions.c (tdesc_register_bitsize): Rename. -diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c ---- a/gdb/ser-tcp.c -+++ b/gdb/ser-tcp.c -@@ -367,7 +367,7 @@ net_open (struct serial *scb, const char *name) - - ioctl (scb->fd, FIONBIO, &ioarg); - -- if (success_ainfo->ai_socktype == IPPROTO_TCP) -+ if (success_ainfo->ai_protocol == IPPROTO_TCP) - { - /* Disable Nagle algorithm. Needed in some cases. */ - int tmp = 1; diff --git a/gdb-vla-intel-fortran-strides.patch b/gdb-vla-intel-fortran-strides.patch index faf836c..6054a4c 100644 --- a/gdb-vla-intel-fortran-strides.patch +++ b/gdb-vla-intel-fortran-strides.patch @@ -37,7 +37,7 @@ dbfd7140bf4c0500d1f5d192be781f83f78f7922 diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -2600,11 +2600,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, +@@ -2659,11 +2659,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, /* See dwarf2loc.h. */ int @@ -54,7 +54,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c if (prop == NULL) return 0; -@@ -2628,7 +2631,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, +@@ -2687,7 +2690,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, *value = value_as_address (val); } @@ -63,7 +63,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c } } break; -@@ -2650,7 +2653,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, +@@ -2709,7 +2712,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, if (!value_optimized_out (val)) { *value = value_as_address (val); @@ -72,7 +72,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c } } } -@@ -2658,8 +2661,8 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, +@@ -2717,8 +2720,8 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, case PROP_CONST: *value = prop->data.const_val; @@ -83,7 +83,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c case PROP_ADDR_OFFSET: { struct dwarf2_property_baton *baton -@@ -2680,11 +2683,38 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, +@@ -2739,11 +2742,38 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, val = value_at (baton->offset_info.type, pinfo->addr + baton->offset_info.offset); *value = value_as_address (val); @@ -143,7 +143,7 @@ diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -17550,7 +17550,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17705,7 +17705,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type, *orig_base_type; struct type *range_type; struct attribute *attr; @@ -152,7 +152,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c int low_default_is_valid; int high_bound_is_count = 0; const char *name; -@@ -17570,7 +17570,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17725,7 +17725,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) low.kind = PROP_CONST; high.kind = PROP_CONST; @@ -162,7 +162,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c /* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow omitting DW_AT_lower_bound. */ -@@ -17603,6 +17605,14 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17758,6 +17760,14 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) break; } @@ -177,7 +177,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c attr = dwarf2_attr (die, DW_AT_lower_bound, cu); if (attr) attr_to_dynamic_prop (attr, die, cu, &low); -@@ -17680,7 +17690,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17850,7 +17860,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask)) high.data.const_val |= negative_mask; @@ -189,7 +189,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c diff --git a/gdb/eval.c b/gdb/eval.c --- a/gdb/eval.c +++ b/gdb/eval.c -@@ -377,29 +377,325 @@ init_array_element (struct value *array, struct value *element, +@@ -377,29 +377,324 @@ init_array_element (struct value *array, struct value *element, return index; } @@ -207,8 +207,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c + int *pos, int nargs, enum noside noside) { - int pc = (*pos) + 1; -+ int i, dim_count = 0; - LONGEST low_bound, high_bound; +- LONGEST low_bound, high_bound; - struct type *range = check_typedef (TYPE_INDEX_TYPE (value_type (array))); - enum range_type range_type - = (enum range_type) longest_to_int (exp->elts[pc].longconst); @@ -219,6 +218,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c - low_bound = TYPE_LOW_BOUND (range); - else - low_bound = value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside)); ++ int i, dim_count = 0; + struct value *new_array = array; + struct type *array_type = check_typedef (value_type (new_array)); + struct type *elt_type; @@ -533,7 +533,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c } -@@ -1926,19 +2222,8 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1930,19 +2225,8 @@ evaluate_subexp_standard (struct type *expect_type, switch (code) { case TYPE_CODE_ARRAY: @@ -554,7 +554,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c case TYPE_CODE_PTR: case TYPE_CODE_FUNC: -@@ -2334,49 +2619,6 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2338,49 +2622,6 @@ evaluate_subexp_standard (struct type *expect_type, } return (arg1); @@ -604,7 +604,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c case BINOP_LOGICAL_AND: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) -@@ -3293,6 +3535,9 @@ calc_f77_array_dims (struct type *array_type) +@@ -3301,6 +3542,9 @@ calc_f77_array_dims (struct type *array_type) int ndimen = 1; struct type *tmp_type; @@ -832,7 +832,7 @@ diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -902,7 +902,8 @@ operator== (const range_bounds &l, const range_bounds &r) +@@ -911,7 +911,8 @@ operator== (const range_bounds &l, const range_bounds &r) struct type * create_range_type (struct type *result_type, struct type *index_type, const struct dynamic_prop *low_bound, @@ -842,7 +842,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c { if (result_type == NULL) result_type = alloc_type_copy (index_type); -@@ -917,6 +918,7 @@ create_range_type (struct type *result_type, struct type *index_type, +@@ -926,6 +927,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); TYPE_RANGE_DATA (result_type)->low = *low_bound; TYPE_RANGE_DATA (result_type)->high = *high_bound; @@ -850,7 +850,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0) TYPE_UNSIGNED (result_type) = 1; -@@ -945,7 +947,7 @@ struct type * +@@ -954,7 +956,7 @@ struct type * create_static_range_type (struct type *result_type, struct type *index_type, LONGEST low_bound, LONGEST high_bound) { @@ -859,7 +859,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c low.kind = PROP_CONST; low.data.const_val = low_bound; -@@ -953,7 +955,11 @@ create_static_range_type (struct type *result_type, struct type *index_type, +@@ -962,7 +964,11 @@ create_static_range_type (struct type *result_type, struct type *index_type, high.kind = PROP_CONST; high.data.const_val = high_bound; @@ -872,7 +872,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c return result_type; } -@@ -1171,16 +1177,20 @@ create_array_type_with_stride (struct type *result_type, +@@ -1180,16 +1186,20 @@ create_array_type_with_stride (struct type *result_type, && (!type_not_associated (result_type) && !type_not_allocated (result_type))) { @@ -894,7 +894,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c else if (bit_stride > 0) TYPE_LENGTH (result_type) = (bit_stride * (high_bound - low_bound + 1) + 7) / 8; -@@ -1981,12 +1991,12 @@ resolve_dynamic_range (struct type *dyn_range_type, +@@ -1990,12 +2000,12 @@ resolve_dynamic_range (struct type *dyn_range_type, CORE_ADDR value; struct type *static_range_type, *static_target_type; const struct dynamic_prop *prop; @@ -909,7 +909,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c { low_bound.kind = PROP_CONST; low_bound.data.const_val = value; -@@ -1998,7 +2008,7 @@ resolve_dynamic_range (struct type *dyn_range_type, +@@ -2007,7 +2017,7 @@ resolve_dynamic_range (struct type *dyn_range_type, } prop = &TYPE_RANGE_DATA (dyn_range_type)->high; @@ -918,7 +918,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c { high_bound.kind = PROP_CONST; high_bound.data.const_val = value; -@@ -2013,12 +2023,20 @@ resolve_dynamic_range (struct type *dyn_range_type, +@@ -2022,12 +2032,20 @@ resolve_dynamic_range (struct type *dyn_range_type, high_bound.data.const_val = 0; } @@ -943,7 +943,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -612,6 +612,10 @@ struct range_bounds +@@ -613,6 +613,10 @@ struct range_bounds struct dynamic_prop high; @@ -954,7 +954,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h /* True if HIGH range bound contains the number of elements in the subrange. This affects how the final hight bound is computed. */ -@@ -776,7 +780,6 @@ struct main_type +@@ -777,7 +781,6 @@ struct main_type /* * Union member used for range types. */ struct range_bounds *bounds; @@ -962,7 +962,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h } flds_bnds; /* * Slot to point to additional language-specific fields of this -@@ -1329,6 +1332,15 @@ extern bool set_type_align (struct type *, ULONGEST); +@@ -1330,6 +1333,15 @@ extern bool set_type_align (struct type *, ULONGEST); TYPE_RANGE_DATA(range_type)->high.kind #define TYPE_LOW_BOUND_KIND(range_type) \ TYPE_RANGE_DATA(range_type)->low.kind @@ -978,7 +978,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h /* Property accessors for the type data location. */ #define TYPE_DATA_LOCATION(thistype) \ -@@ -1363,6 +1375,9 @@ extern bool set_type_align (struct type *, ULONGEST); +@@ -1364,6 +1376,9 @@ extern bool set_type_align (struct type *, ULONGEST); TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \ TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) @@ -988,7 +988,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) -@@ -1892,6 +1907,7 @@ extern struct type *create_array_type_with_stride +@@ -1899,6 +1914,7 @@ extern struct type *create_array_type_with_stride struct dynamic_prop *, unsigned int); extern struct type *create_range_type (struct type *, struct type *, @@ -999,7 +999,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h diff --git a/gdb/parse.c b/gdb/parse.c --- a/gdb/parse.c +++ b/gdb/parse.c -@@ -989,24 +989,20 @@ operator_length_standard (const struct expression *expr, int endpos, +@@ -988,24 +988,20 @@ operator_length_standard (const struct expression *expr, int endpos, case OP_RANGE: oplen = 3; @@ -1038,7 +1038,7 @@ diff --git a/gdb/parse.c b/gdb/parse.c diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y --- a/gdb/rust-exp.y +++ b/gdb/rust-exp.y -@@ -2478,24 +2478,28 @@ convert_ast_to_expression (struct parser_state *state, +@@ -2475,24 +2475,28 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, case OP_RANGE: { @@ -1047,13 +1047,13 @@ diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y if (operation->left.op != NULL) { - convert_ast_to_expression (state, operation->left.op, top); + convert_ast_to_expression (operation->left.op, top); - kind = HIGH_BOUND_DEFAULT; + kind = SUBARRAY_LOW_BOUND; } if (operation->right.op != NULL) { - convert_ast_to_expression (state, operation->right.op, top); + convert_ast_to_expression (operation->right.op, top); - if (kind == BOTH_BOUND_DEFAULT) - kind = (operation->inclusive - ? LOW_BOUND_DEFAULT : LOW_BOUND_DEFAULT_EXCLUSIVE); @@ -1078,7 +1078,7 @@ diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c -@@ -1149,13 +1149,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside) +@@ -1181,13 +1181,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside) kind = (enum range_type) longest_to_int (exp->elts[*pos + 1].longconst); *pos += 3; @@ -1095,7 +1095,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c if (noside == EVAL_SKIP) return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); -@@ -1244,7 +1242,7 @@ rust_compute_range (struct type *type, struct value *range, +@@ -1276,7 +1274,7 @@ rust_compute_range (struct type *type, struct value *range, *low = 0; *high = 0; @@ -1104,7 +1104,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c if (TYPE_NFIELDS (type) == 0) return; -@@ -1252,15 +1250,14 @@ rust_compute_range (struct type *type, struct value *range, +@@ -1284,15 +1282,14 @@ rust_compute_range (struct type *type, struct value *range, i = 0; if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0) { @@ -1122,7 +1122,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c *high = value_as_long (value_field (range, i)); if (rust_inclusive_range_type_p (type)) -@@ -1278,7 +1275,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1310,7 +1307,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, struct type *rhstype; LONGEST low, high_bound; /* Initialized to appease the compiler. */ @@ -1131,7 +1131,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c LONGEST high = 0; int want_slice = 0; -@@ -1376,7 +1373,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1408,7 +1405,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, error (_("Cannot subscript non-array type")); if (want_slice @@ -1140,7 +1140,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c low = low_bound; if (low < 0) error (_("Index less than zero")); -@@ -1394,7 +1391,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1426,7 +1423,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, CORE_ADDR addr; struct value *addrval, *tem; @@ -1761,7 +1761,7 @@ diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f diff --git a/gdb/valarith.c b/gdb/valarith.c --- a/gdb/valarith.c +++ b/gdb/valarith.c -@@ -187,10 +187,16 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) +@@ -187,11 +187,17 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) struct type *array_type = check_typedef (value_type (array)); struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); ULONGEST elt_size = type_length_units (elt_type); @@ -1774,16 +1774,17 @@ diff --git a/gdb/valarith.c b/gdb/valarith.c + else + elt_offs *= elt_size; - if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) -- && elt_offs >= type_length_units (array_type))) -+ && abs (elt_offs) >= type_length_units (array_type))) + if (index < lowerbound + || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) +- && elt_offs >= type_length_units (array_type)) ++ && abs (elt_offs) >= type_length_units (array_type)) + || (VALUE_LVAL (array) != lval_memory + && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type))) { - if (type_not_associated (array_type)) - error (_("no such vector element (vector not associated)")); diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -3808,56 +3808,195 @@ value_of_this_silent (const struct language_defn *lang) +@@ -3807,56 +3807,195 @@ value_of_this_silent (const struct language_defn *lang) struct value * value_slice (struct value *array, int lowbound, int length) diff --git a/gdb-vla-intel-fortran-vla-strings.patch b/gdb-vla-intel-fortran-vla-strings.patch index 8c15121..1646bd3 100644 --- a/gdb-vla-intel-fortran-vla-strings.patch +++ b/gdb-vla-intel-fortran-vla-strings.patch @@ -33,7 +33,7 @@ git diff --stat -p gdb/master...gdb/users/bheckel/fortran-vla-strings diff --git a/gdb/NEWS b/gdb/NEWS --- a/gdb/NEWS +++ b/gdb/NEWS -@@ -106,6 +106,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd* +@@ -203,6 +203,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd* *** Changes in GDB 8.1 @@ -77,7 +77,7 @@ diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -1789,7 +1789,8 @@ static void read_signatured_type (struct signatured_type *); +@@ -1799,7 +1799,8 @@ static void read_signatured_type (struct signatured_type *); static int attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, struct dwarf2_cu *cu, @@ -87,7 +87,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c /* memory allocation interface */ -@@ -13648,7 +13649,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -13748,7 +13749,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) { newobj->static_link = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop); @@ -95,8 +95,8 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c + attr_to_dynamic_prop (attr, die, cu, newobj->static_link, NULL, 0); } - cu->list_in_scope = &local_symbols; -@@ -16313,7 +16314,8 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) + cu->list_in_scope = cu->builder->get_local_symbols (); +@@ -16468,7 +16469,8 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) byte_stride_prop = (struct dynamic_prop *) alloca (sizeof (struct dynamic_prop)); @@ -106,7 +106,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c if (!stride_ok) { complaint (_("unable to read array DW_AT_byte_stride " -@@ -17074,29 +17076,90 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17229,29 +17231,90 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; @@ -150,7 +150,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c + operand. */ + DW_OP_deref_size, + /* Operand for DW_OP_deref_size. */ -+ DW_UNSND(byte_size) }; ++ (gdb_byte) DW_UNSND(byte_size) }; + + if (!attr_to_dynamic_prop (attr, die, cu, &high, append_ops, + ARRAY_SIZE(append_ops))) @@ -208,7 +208,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -17444,7 +17507,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17599,7 +17662,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) static int attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, @@ -218,7 +218,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c { struct dwarf2_property_baton *baton; struct obstack *obstack -@@ -17455,14 +17519,33 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -17610,14 +17674,33 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, if (attr_form_is_block (attr)) { @@ -256,7 +256,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c } else if (attr_form_is_ref (attr)) { -@@ -17495,8 +17578,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -17650,8 +17733,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, baton = XOBNEW (obstack, struct dwarf2_property_baton); baton->referenced_type = die_type (target_die, target_cu); baton->locexpr.per_cu = cu->per_cu; @@ -287,7 +287,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c prop->data.baton = baton; prop->kind = PROP_LOCEXPR; gdb_assert (prop->data.baton != NULL); -@@ -17607,7 +17710,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17762,7 +17865,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_byte_stride, cu); if (attr) @@ -296,7 +296,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c complaint (_("Missing DW_AT_byte_stride " "- DIE at 0x%s [in module %s]"), sect_offset_str (die->sect_off), -@@ -17615,7 +17718,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -17770,7 +17873,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_lower_bound, cu); if (attr) @@ -305,20 +305,20 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c else if (!low_default_is_valid) complaint (_("Missing DW_AT_lower_bound " "- DIE at %s [in module %s]"), -@@ -17623,10 +17726,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - objfile_name (cu->per_cu->dwarf2_per_objfile->objfile)); +@@ -17779,10 +17882,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - attr = dwarf2_attr (die, DW_AT_upper_bound, cu); + struct attribute *attr_ub, *attr_count; + attr = attr_ub = dwarf2_attr (die, DW_AT_upper_bound, cu); - if (!attr_to_dynamic_prop (attr, die, cu, &high)) + if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0)) { - attr = dwarf2_attr (die, DW_AT_count, cu); + attr = attr_count = dwarf2_attr (die, DW_AT_count, cu); - if (attr_to_dynamic_prop (attr, die, cu, &high)) + if (attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0)) { /* If bounds are constant do the final calculation here. */ if (low.kind == PROP_CONST && high.kind == PROP_CONST) -@@ -25127,7 +25230,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -25337,7 +25440,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_allocated, cu); if (attr_form_is_block (attr)) { @@ -327,7 +327,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c add_dyn_prop (DYN_PROP_ALLOCATED, prop, type); } else if (attr != NULL) -@@ -25141,7 +25244,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -25351,7 +25454,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) attr = dwarf2_attr (die, DW_AT_associated, cu); if (attr_form_is_block (attr)) { @@ -336,7 +336,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c add_dyn_prop (DYN_PROP_ASSOCIATED, prop, type); } else if (attr != NULL) -@@ -25153,7 +25256,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -25363,7 +25466,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) /* Read DW_AT_data_location and set in type. */ attr = dwarf2_attr (die, DW_AT_data_location, cu); @@ -500,7 +500,7 @@ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -1904,7 +1904,8 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1913,7 +1913,8 @@ is_dynamic_type_internal (struct type *type, int top_level) type = check_typedef (type); /* We only want to recognize references at the outermost level. */ @@ -510,7 +510,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c type = check_typedef (TYPE_TARGET_TYPE (type)); /* Types that have a dynamic TYPE_DATA_LOCATION are considered -@@ -1938,6 +1939,7 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1947,6 +1948,7 @@ is_dynamic_type_internal (struct type *type, int top_level) } case TYPE_CODE_ARRAY: @@ -518,7 +518,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c { gdb_assert (TYPE_NFIELDS (type) == 1); -@@ -2056,7 +2058,8 @@ resolve_dynamic_array (struct type *type, +@@ -2065,7 +2067,8 @@ resolve_dynamic_array (struct type *type, struct dynamic_prop *prop; unsigned int bit_stride = 0; @@ -528,7 +528,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c type = copy_type (type); -@@ -2081,11 +2084,15 @@ resolve_dynamic_array (struct type *type, +@@ -2090,11 +2093,15 @@ resolve_dynamic_array (struct type *type, ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type)); @@ -545,7 +545,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type); if (prop != NULL) { -@@ -2240,6 +2247,28 @@ resolve_dynamic_struct (struct type *type, +@@ -2249,6 +2256,28 @@ resolve_dynamic_struct (struct type *type, return resolved_type; } @@ -574,7 +574,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c /* Worker for resolved_dynamic_type. */ static struct type * -@@ -2288,7 +2317,12 @@ resolve_dynamic_type_internal (struct type *type, +@@ -2297,7 +2326,12 @@ resolve_dynamic_type_internal (struct type *type, break; } diff --git a/gdb-vla-intel-stringbt-fix.patch b/gdb-vla-intel-stringbt-fix.patch index b2170f4..7b420ab 100644 --- a/gdb-vla-intel-stringbt-fix.patch +++ b/gdb-vla-intel-stringbt-fix.patch @@ -38,7 +38,7 @@ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c #include "common/underlying.h" #include "common/byte-vector.h" -@@ -2348,6 +2349,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2388,6 +2389,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, ctx.per_cu = per_cu; ctx.obj_address = 0; diff --git a/gdb.spec b/gdb.spec index 4997f0c..918f9d9 100644 --- a/gdb.spec +++ b/gdb.spec @@ -18,15 +18,15 @@ Name: %{?scl_prefix}gdb # Freeze it when GDB gets branched -%global snapsrc 20180727 +%global snapsrc 20180917 # See timestamp of source gnulib installed into gdb/gnulib/ . %global snapgnulib 20161115 %global tarname gdb-%{version} -Version: 8.1.90.%{snapsrc} +Version: 8.2.50.%{snapsrc} # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 45%{?dist} +Release: 1%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and LGPLv3+ and BSD and Public Domain and GFDL Group: Development/Debuggers @@ -1022,6 +1022,10 @@ fi %endif %changelog +* Mon Sep 17 2018 Sergio Durigan Junior - 8.2.50.20180917-1.fc30 +- Rebase to FSF GDB 8.2.50.20180917 (8.3pre). +- Add 'gdb-rhbz795424-bitpos-arrayview.patch'. + * Tue Aug 21 2018 Sergio Durigan Junior - 8.1.90.20180727-45.fc30 - Enable verbose output when running "make". diff --git a/sources b/sources index 5d8b853..c17ff7d 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ SHA512 (gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz) = a8b1c54dd348cfeb37da73f968742896be3dd13a4215f8d8519870c2abea915f5176c3fa6989ddd10f20020a16f0fab20cbae68ee8d58a82234d8778023520f8 -SHA512 (gdb-8.1.90.20180727.tar.xz) = 0f8e9cfaeaf9f22361b3b8d5d490d0a8bea3eeaaa0c6813d5df0a6d5267ff3f597747cc0e97d70c4196d78ee32e0e82d5893283d71b449d89703893bf1ae0014 SHA512 (v2.0.tar.gz) = ec63151e842c81cc73ea11ba560b63e005cefbe19d98de24ae5c8caa4de7c9c1d71d1ec5b6214a347592eac675b75a3d2b26d4691ca86f91020ebfea8e912939 +SHA512 (gdb-8.2.50.20180917.tar.xz) = 92f07fc062ff9d7cb5683507a256f65ae9d29b7d6368d22f474041201c129b1d3f687f02e89e509d5fd8e9c08dbc8bbf9d9aad56d9dbdc2f6e2baef223cc90ef