diff --git a/gdb-6.3-attach-see-vdso-test.patch b/gdb-6.3-attach-see-vdso-test.patch index 0c2ccc1cf91d6acc297694c5bce1a9a661453836..635bb0d8f518e209e45a6c9a07c01e008887fd95 100644 --- a/gdb-6.3-attach-see-vdso-test.patch +++ b/gdb-6.3-attach-see-vdso-test.patch @@ -105,4 +105,3 @@ new file mode 100644 +# work. + +remote_exec build "kill -9 ${testpid}" - diff --git a/gdb-6.3-bz140532-ppc-unwinding-test.patch b/gdb-6.3-bz140532-ppc-unwinding-test.patch index 0a7f1bc3fc1ed7c1d5ac3c1a121a1ce73784587d..fe29989731dcd821a5351b1945ef9e2b22703684 100644 --- a/gdb-6.3-bz140532-ppc-unwinding-test.patch +++ b/gdb-6.3-bz140532-ppc-unwinding-test.patch @@ -310,4 +310,3 @@ diff --git a/gdb/testsuite/gdb.arch/powerpc-prologue.exp b/gdb/testsuite/gdb.arc verbose "Skipping PowerPC prologue tests." return } - diff --git a/gdb-6.3-bz202689-exec-from-pthread-test.patch b/gdb-6.3-bz202689-exec-from-pthread-test.patch index 6d5549300108b64e634b3e79954f6ea6154051c2..ef49932e5c965a33523879f3fc75bb1af344fc7a 100644 --- a/gdb-6.3-bz202689-exec-from-pthread-test.patch +++ b/gdb-6.3-bz202689-exec-from-pthread-test.patch @@ -1,7 +1,3 @@ -2007-01-17 Jan Kratochvil - - * gdb.threads/threaded-exec.exp, gdb.threads/threaded-exec.c: New files. - diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c new file mode 100644 --- /dev/null @@ -99,4 +95,3 @@ new file mode 100644 + pass "Program exited" + } +} - diff --git a/gdb-6.3-focus-cmd-prev-test.patch b/gdb-6.3-focus-cmd-prev-test.patch index 61cbcad9a607818ba25b6030c99bc212156a1f36..b50dad3d8b2faeac9cd9417e6a0d95d3ca89bc33 100644 --- a/gdb-6.3-focus-cmd-prev-test.patch +++ b/gdb-6.3-focus-cmd-prev-test.patch @@ -43,4 +43,3 @@ new file mode 100644 + pass $test + } +} - diff --git a/gdb-6.3-gstack-20050411.patch b/gdb-6.3-gstack-20050411.patch index 66061d980525d93ff1a380dab728a195c8780159..982f885a62d041d74b5ab4cb8f00dfde7cbccf59 100644 --- a/gdb-6.3-gstack-20050411.patch +++ b/gdb-6.3-gstack-20050411.patch @@ -1,13 +1,7 @@ -2004-11-23 Andrew Cagney - - * Makefile.in (uninstall-gstack, install-gstack): New rules, add - to install and uninstall. - * gstack.sh, gstack.1: New files. - diff --git a/gdb/Makefile.in b/gdb/Makefile.in --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -1749,7 +1749,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force +@@ -1768,7 +1768,7 @@ info install-info clean-info dvi pdf install-pdf html install-html: force install: all @$(MAKE) $(FLAGS_TO_PASS) install-only @@ -16,7 +10,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 \ -@@ -1798,7 +1798,25 @@ install-guile: +@@ -1817,7 +1817,25 @@ install-guile: install-python: $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(GDB_DATADIR)/python/gdb @@ -43,7 +37,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 \ -@@ -1821,6 +1839,18 @@ uninstall: force $(CONFIG_UNINSTALL) +@@ -1840,6 +1858,18 @@ uninstall: force $(CONFIG_UNINSTALL) fi @$(MAKE) DO=uninstall "DODIRS=$(SUBDIRS)" $(FLAGS_TO_PASS) subdir_do @@ -247,4 +241,3 @@ new file mode 100644 + +# Kill the test inferior. +kill_wait_spawned_process $test_spawn_id - diff --git a/gdb-6.3-inferior-notification-20050721.patch b/gdb-6.3-inferior-notification-20050721.patch index 9e1b27c7031de53e93bf9aa050a545636101826f..22592764deab7d6ed6cfef6aedad3d831dd20093 100644 --- a/gdb-6.3-inferior-notification-20050721.patch +++ b/gdb-6.3-inferior-notification-20050721.patch @@ -1,14 +1,3 @@ -2005-07-21 Jeff Johnston - - * gdb.base/attach-32.exp: New test for attaching in 32-bit - mode on 64-bit systems. - * gdb.base/attach-32.c: Ditto. - * gdb.base/attach-32b.c: Ditto. - -2007-12-26 Jan Kratochvil - - * gdb.base/attach-32.exp: Fix forgotten $GDBFLAGS as set. - diff --git a/gdb/testsuite/gdb.base/attach-32.c b/gdb/testsuite/gdb.base/attach-32.c new file mode 100644 --- /dev/null @@ -254,7 +243,7 @@ new file mode 100644 +} + +set GDBFLAGS_orig $GDBFLAGS -+set GDBFLAGS "--pid=$testpid" ++set GDBFLAGS "-iex \"set height 0\" --pid=$testpid" +gdb_start +set GDBFLAGS $GDBFLAGS_orig + @@ -276,7 +265,7 @@ new file mode 100644 +} + +set GDBFLAGS_orig $GDBFLAGS -+set GDBFLAGS "--pid=$testpid" ++set GDBFLAGS "-iex \"set height 0\" --pid=$testpid" +gdb_start +set GDBFLAGS $GDBFLAGS_orig + @@ -313,4 +302,3 @@ new file mode 100644 + } + return (0); +} - diff --git a/gdb-6.3-inheritancetest-20050726.patch b/gdb-6.3-inheritancetest-20050726.patch index cde4b9b283b00ccd861275d6649f5d09556dc134..c3007ea2858c8170e79123cbbee1f66cde525e19 100644 --- a/gdb-6.3-inheritancetest-20050726.patch +++ b/gdb-6.3-inheritancetest-20050726.patch @@ -1,10 +1,3 @@ -2005-07-26 Jeff Johnston - - * gdb.cp/b146835.exp: New testcase. - * gdb.cp/b146835.cc: Ditto. - * gdb.cp/b146835b.cc: Ditto. - * gdb.cp/b146835.h: Ditto. - diff --git a/gdb/testsuite/gdb.cp/b146835.cc b/gdb/testsuite/gdb.cp/b146835.cc new file mode 100644 --- /dev/null @@ -151,4 +144,3 @@ new file mode 100644 +void A::funcD (class E *e, class D *d) {} +void A::funcE (E *e, D *d) {} +void A::funcF (unsigned long x, D *d) {} - diff --git a/gdb-6.3-mapping-zero-inode-test.patch b/gdb-6.3-mapping-zero-inode-test.patch index f1d5f43bc4ffae3e337d92040eb110c16f9d1634..92a5c1aadd6ac7c7c1602c213f820eb61f41b604 100644 --- a/gdb-6.3-mapping-zero-inode-test.patch +++ b/gdb-6.3-mapping-zero-inode-test.patch @@ -237,4 +237,3 @@ new file mode 100644 + fail $test + } +} - diff --git a/gdb-6.3-test-dtorfix-20050121.patch b/gdb-6.3-test-dtorfix-20050121.patch index ba431b4126b1b5beaa673e8e0b7ea974f033c9c7..ad8676a11b6ae771b1109931431a13b4f9818e64 100644 --- a/gdb-6.3-test-dtorfix-20050121.patch +++ b/gdb-6.3-test-dtorfix-20050121.patch @@ -237,4 +237,3 @@ new file mode 100644 +} + +gdb_continue_to_breakpoint "First line ~C" - diff --git a/gdb-6.3-test-movedir-20050125.patch b/gdb-6.3-test-movedir-20050125.patch index 7c37204f88f55641966245c67803b5f87cf2c881..828cc24292d52d6099adb0298e715f2ff2be94ec 100644 --- a/gdb-6.3-test-movedir-20050125.patch +++ b/gdb-6.3-test-movedir-20050125.patch @@ -1,9 +1,3 @@ -i2005-01-25 Elena Zannoni - - * gdb.base/move-dir.exp: New test. - * gdb.base/move-dir.c: Ditto. - * gdb.base/move-dir.h: Ditto. - diff --git a/gdb/testsuite/gdb.base/move-dir.c b/gdb/testsuite/gdb.base/move-dir.c new file mode 100644 --- /dev/null @@ -93,4 +87,3 @@ new file mode 100644 + printf ("%s\n", ostring);; +} + - diff --git a/gdb-6.3-test-pie-20050107.patch b/gdb-6.3-test-pie-20050107.patch index f7dd03d5dcca7a47f79b5482267b1ccf9dc0b31c..6d24c5249145371df3e6b3dbb6945eba4bd5d1f6 100644 --- a/gdb-6.3-test-pie-20050107.patch +++ b/gdb-6.3-test-pie-20050107.patch @@ -2017,4 +2017,3 @@ new file mode 100644 + return 0; +} + - diff --git a/gdb-6.3-test-self-20050110.patch b/gdb-6.3-test-self-20050110.patch index e5afa99c1ad4e5f3517154766bbb928f6f24c658..d9a7eb38e76993f0825bce031324b4606598d097 100644 --- a/gdb-6.3-test-self-20050110.patch +++ b/gdb-6.3-test-self-20050110.patch @@ -1,11 +1,3 @@ -2004-02-23 Elena Zannoni - - * gdb.gdb/selftest.exp: Make sure that the debug directory is - set up properly. - * gdb.gdb/complaints.exp: Ditto. - * gdb.gdb/xfullpath.exp: Ditto. - * gdb.gdb/observer.exp: Ditto. - diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp --- a/gdb/testsuite/lib/selftest-support.exp +++ b/gdb/testsuite/lib/selftest-support.exp @@ -32,4 +24,3 @@ diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest if {$result < 0} then { warning "Couldn't test self" - diff --git a/gdb-6.3-threaded-watchpoints2-20050225.patch b/gdb-6.3-threaded-watchpoints2-20050225.patch index c88ab73e43e22b18e491f65b18a56de25e4ce11c..dc11e5fc37cae75c82664acd6c65f726fef7a863 100644 --- a/gdb-6.3-threaded-watchpoints2-20050225.patch +++ b/gdb-6.3-threaded-watchpoints2-20050225.patch @@ -1,47 +1,3 @@ -2005-02-28 Jeff Johnston - - * config/i386/nm-linux.h: Change dr register routines to - accept a ptid_t first argument. Change all calling macros - to default the inferior_ptid for the first argument. - (i386_linux_insert_watchpoint): New prototype. - (i386_linux_remove_watchpoint, i386_linux_insert_hw_breakpoint): Ditto. - (i386_linux_remove_hw_breakpoint): Ditto. - (target_insert_watchpoint, target_remove_watchpoint): Undef and - override. - (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Ditto. - * config/i386/nm-linux64.h: Ditto except add amd64 versions of - the watchpoint/hw-breakpoint insert/remove routines. - * i386-nat.c: Include "inferior.h" to define inferior_ptid. - * i386-linux-nat.c: Change all dr get/set routines to accept - ptid_t as first argument and to use this argument to determine - the tid for PTRACE. - (i386_linux_set_debug_regs_for_thread): New function. - (i386_linux_sync_debug_registers_callback): Ditto. - (i386_linux_sync_debug_registers_across_threads): Ditto. - (i386_linux_insert_watchpoint, i386_linux_remove_watchpoint): Ditto. - (i386_linux_hw_breakpoint, i386_linux_remove_hw_breakpoint): Ditto. - (i386_linux_new_thread): Ditto. - (_initialize_i386_linux_nat): Ditto. - * amd64-linux-nat.c: Change all dr get/set routines to accept - ptid_t as first argument and to use this argument to determine - the tid for PTRACE. - (amd64_linux_set_debug_regs_for_thread): New function. - (amd64_linux_sync_debug_registers_callback): Ditto. - (amd64_linux_sync_debug_registers_across_threads): Ditto. - (amd64_linux_insert_watchpoint, amd64_linux_remove_watchpoint): Ditto. - (amd64_linux_hw_breakpoint, amd64_linux_remove_hw_breakpoint): Ditto. - (amd64_linux_new_thread): Ditto. - (_initialize_amd64_linux_nat): Register linux new thread observer. - * testsuite/gdb.threads/watchthreads-threaded.c: New test case. - * testsuite/gdb.threads/watchthreads-threaded.exp: Ditto. - -[ With recent upstream GDB (6.8) reduced only to the testcase. ] - -[ It was called watchthreads2.{exp,c} before but it conflicted with FSF GDB new - testcase of the same name. ] - -FIXME: The testcase does not expects multiple watchpoints hits per one stop. - diff --git a/gdb/testsuite/gdb.threads/watchthreads-threaded.c b/gdb/testsuite/gdb.threads/watchthreads-threaded.c new file mode 100644 --- /dev/null @@ -244,4 +200,3 @@ new file mode 100644 +} else { + fail $message +} - diff --git a/gdb-6.5-BEA-testsuite.patch b/gdb-6.5-BEA-testsuite.patch index 37343ec70a118d76980da4c1d68cf9d983ecc557..19075e0cc3485d90031103574ce40b19f4412330 100644 --- a/gdb-6.5-BEA-testsuite.patch +++ b/gdb-6.5-BEA-testsuite.patch @@ -928,4 +928,3 @@ new file mode 100644 +rm -rf $WORKDIR + +exit $FAILURES - diff --git a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch index c0c49f994131825c8cf2a93c630a7a6232371e13..95899d6fb348e3cc46e0fbae0367b63fa9d45c29 100644 --- a/gdb-6.5-bz109921-DW_AT_decl_file-test.patch +++ b/gdb-6.5-bz109921-DW_AT_decl_file-test.patch @@ -1,21 +1,3 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109921 - -It is duplicite to its upstream variant: -http://sourceware.org/ml/gdb-cvs/2007-01/msg00157.html -http://sourceware.org/ml/gdb-patches/2007-01/msg00434.html -2007-01-21 Jan Kratochvil - Daniel Jacobowitz - - * gdb.base/included.c, gdb.base/included.exp, - gdb.base/included.h: New files. - ------------------------------------------------------------------------------- - -2007-01-09 Jan Kratochvil - - * gdb.dwarf2/dw2-included.exp, gdb.dwarf2/dw2-included.c, - gdb.dwarf2/dw2-included.h: New files. - diff --git a/gdb/testsuite/gdb.dwarf2/dw2-included.c b/gdb/testsuite/gdb.dwarf2/dw2-included.c new file mode 100644 --- /dev/null @@ -124,4 +106,3 @@ new file mode 100644 + USA. */ + +int integer; - diff --git a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index e9fa786f786193b6295827d3c98653909875c707..4fdd93774a57ffd4e5558e95f36bd8625522f17c 100644 --- a/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -1,44 +1,9 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=185337 - -2008-02-24 Jan Kratochvil - - Port to GDB-6.8pre. - -currently for trivial nonthreaded helloworld with no debug info up to -ggdb2 you -will get: - (gdb) p errno - [some error] - -* with -ggdb2 and less "errno" in fact does not exist anywhere as it was - compiled to "(*__errno_location ())" and the macro definition is not present. - Unfortunately gdb will find the TLS symbol and it will try to access it but - as the program has been compiled without -lpthread the TLS base register - (%gs on i386) is not setup and it will result in: - Cannot access memory at address 0x8 - -Attached suggestion patch how to deal with the most common "errno" symbol -for the most common under-ggdb3 compiled programs. - -Original patch hooked into target_translate_tls_address. But its inferior -call invalidates `struct frame *' in the callers - RH BZ 690908. - -https://bugzilla.redhat.com/show_bug.cgi?id=1166549 - -2007-11-03 Jan Kratochvil - - * ./gdb/dwarf2read.c (read_partial_die, dwarf2_linkage_name): Prefer - DW_AT_MIPS_linkage_name over DW_AT_name now only for non-C. - -glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug: - <81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location - <81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location - diff --git a/gdb/printcmd.c b/gdb/printcmd.c --- a/gdb/printcmd.c +++ b/gdb/printcmd.c -@@ -1183,6 +1183,10 @@ print_command_1 (const char *exp, int voidprint) +@@ -1214,6 +1214,10 @@ print_command_1 (const char *args, int voidprint) - if (exp && *exp) + if (exp != nullptr && *exp) { + /* '*((int *(*) (void)) __errno_location) ()' is incompatible with + function descriptors. */ @@ -254,4 +219,3 @@ new file mode 100644 + +# TODO: Test the error on resolving ERRNO with only libc loaded. +# Just how to find the current libc filename? - diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch deleted file mode 100644 index d90e7c834fb7e52b10efbe820a988cede3213b95..0000000000000000000000000000000000000000 --- a/gdb-6.5-bz216711-clone-is-outermost.patch +++ /dev/null @@ -1,297 +0,0 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=216711 - -FIXME: This workaround should be dropped and -glibc/sysdeps/unix/sysv/linux/x86_64/clone.S should get CFI for the child -instead. - -2006-12-17 Jan Kratochvil - - * gdb/amd64-linux-tdep.c (linux_clone_code): New variable. - (LINUX_CLONE_LEN): New definition. - (amd64_linux_clone_running, amd64_linux_outermost_frame): New function. - (amd64_linux_init_abi): Initialize `outermost_frame_p'. - * gdb/i386-tdep.c (i386_gdbarch_init): Likewise. - * gdb/i386-tdep.h (gdbarch_tdep): Add `outermost_frame_p' member. - * gdb/amd64-tdep.c (amd64_frame_this_id): Call `outermost_frame_p'. - -2006-12-17 Jan Kratochvil - - * gdb.threads/bt-clone-stop.exp, gdb.threads/bt-clone-stop.c: - New file. - -2007-10-16 Jan Kratochvil - - Port to GDB-6.7. - -diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c ---- a/gdb/amd64-linux-tdep.c -+++ b/gdb/amd64-linux-tdep.c -@@ -291,6 +291,80 @@ amd64_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum, - - /* Set the program counter for process PTID to PC. */ - -+/* Detect the outermost frame; during unwind of -+ #5 0x000000305cec68c3 in clone () from /lib64/tls/libc.so.6 -+ avoid the additional bogus frame -+ #6 0x0000000000000000 in ?? -+ We compare if the `linux_clone_code' block is _before_ unwound PC. */ -+ -+static const unsigned char linux_clone_code[] = -+{ -+/* libc/sysdeps/unix/sysv/linux/x86_64/clone.S */ -+/* #ifdef RESET_PID */ -+/* ... */ -+/* mov $SYS_ify(getpid), %eax */ -+/* 0xb8, 0x27, 0x00, 0x00, 0x00 */ -+/* OR */ -+/* mov $SYS_ify(getpid), %rax */ -+/* 0x48, 0xc7, 0xc0, 0x27, 0x00, 0x00, 0x00 */ -+/* so just: */ -+ 0x27, 0x00, 0x00, 0x00, -+/* syscall */ -+ 0x0f, 0x05, -+/* movl %eax, %fs:PID */ -+ 0x64, 0x89, 0x04, 0x25, 0x94, 0x00, 0x00, 0x00, -+/* movl %eax, %fs:TID */ -+ 0x64, 0x89, 0x04, 0x25, 0x90, 0x00, 0x00, 0x00, -+/* #endif */ -+/* |* Set up arguments for the function call. *| */ -+/* popq %rax |* Function to call. *| */ -+ 0x58, -+/* popq %rdi |* Argument. *| */ -+ 0x5f, -+/* call *%rax$ */ -+ 0xff, 0xd0 -+}; -+ -+#define LINUX_CLONE_LEN (sizeof linux_clone_code) -+ -+static int -+amd64_linux_clone_running (struct frame_info *this_frame) -+{ -+ CORE_ADDR pc = get_frame_pc (this_frame); -+ unsigned char buf[LINUX_CLONE_LEN]; -+ -+ if (!safe_frame_unwind_memory (this_frame, pc - LINUX_CLONE_LEN, buf, -+ LINUX_CLONE_LEN)) -+ return 0; -+ -+ if (memcmp (buf, linux_clone_code, LINUX_CLONE_LEN) != 0) -+ return 0; -+ -+ return 1; -+} -+ -+static int -+amd64_linux_outermost_frame (struct frame_info *this_frame) -+{ -+ CORE_ADDR pc = get_frame_pc (this_frame); -+ const char *name; -+ -+ find_pc_partial_function (pc, &name, NULL, NULL); -+ -+ /* If we have NAME, we can optimize the search. -+ `clone' NAME still needs to have the code checked as its name may be -+ present in the user code. -+ `__clone' NAME should not be present in the user code but in the initial -+ parts of the `__clone' implementation the unwind still makes sense. -+ More detailed unwinding decision would be too much sensitive to possible -+ subtle changes in specific glibc revisions. */ -+ if (name == NULL || strcmp (name, "clone") == 0 -+ || strcmp ("__clone", name) == 0) -+ return (amd64_linux_clone_running (this_frame) != 0); -+ -+ return 0; -+} -+ - static void - amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc) - { -@@ -1808,6 +1882,8 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch) - - tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET; - -+ tdep->outermost_frame_p = amd64_linux_outermost_frame; -+ - /* Add the %orig_rax register used for syscall restarting. */ - set_gdbarch_write_pc (gdbarch, amd64_linux_write_pc); - -diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c ---- a/gdb/amd64-tdep.c -+++ b/gdb/amd64-tdep.c -@@ -2601,6 +2601,7 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame, - { - struct amd64_frame_cache *cache = - amd64_frame_cache (this_frame, this_cache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); - - if (!cache->base_p) - return UNWIND_UNAVAILABLE; -@@ -2609,6 +2610,10 @@ amd64_frame_unwind_stop_reason (struct frame_info *this_frame, - if (cache->base == 0) - return UNWIND_OUTERMOST; - -+ /* Detect OS dependent outermost frames; such as `clone'. */ -+ if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame)) -+ return UNWIND_OUTERMOST; -+ - return UNWIND_NO_REASON; - } - -@@ -2743,6 +2748,7 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame, - { - struct amd64_frame_cache *cache = - amd64_sigtramp_frame_cache (this_frame, this_cache); -+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame)); - - if (!cache->base_p) - (*this_id) = frame_id_build_unavailable_stack (get_frame_pc (this_frame)); -@@ -2751,6 +2757,11 @@ amd64_sigtramp_frame_this_id (struct frame_info *this_frame, - /* This marks the outermost frame. */ - return; - } -+ else if (tdep->outermost_frame_p && tdep->outermost_frame_p (this_frame)) -+ { -+ /* Detect OS dependent outermost frames; such as `clone'. */ -+ return; -+ } - else - (*this_id) = frame_id_build (cache->base + 16, get_frame_pc (this_frame)); - } -diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c ---- a/gdb/i386-tdep.c -+++ b/gdb/i386-tdep.c -@@ -8407,6 +8407,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - - tdep->xsave_xcr0_offset = -1; - -+ /* Unwinding stops on i386 automatically. */ -+ tdep->outermost_frame_p = NULL; -+ - tdep->record_regmap = i386_record_regmap; - - set_gdbarch_type_align (gdbarch, i386_type_align); -diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h ---- a/gdb/i386-tdep.h -+++ b/gdb/i386-tdep.h -@@ -251,6 +251,9 @@ struct gdbarch_tdep - - /* Regsets. */ - const struct regset *fpregset; -+ -+ /* Detect OS dependent outermost frames; such as `clone'. */ -+ int (*outermost_frame_p) (struct frame_info *this_frame); - }; - - /* Floating-point registers. */ -diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.c b/gdb/testsuite/gdb.threads/bt-clone-stop.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.threads/bt-clone-stop.c -@@ -0,0 +1,39 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2006 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 2 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, write to the Free Software -+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -+ MA 02110-1301, USA. */ -+ -+ -+#include -+#include -+#include -+ -+ -+void *threader (void *arg) -+{ -+ assert (0); -+ return NULL; -+} -+ -+int main (void) -+{ -+ pthread_t t1; -+ -+ pthread_create (&t1, NULL, threader, (void *) NULL); -+ for (;;) -+ pause(); -+} -diff --git a/gdb/testsuite/gdb.threads/bt-clone-stop.exp b/gdb/testsuite/gdb.threads/bt-clone-stop.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.threads/bt-clone-stop.exp -@@ -0,0 +1,61 @@ -+# Copyright 2006 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 2 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, write to the Free Software -+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ -+# Backtraced `clone' must not have `PC == 0' as its previous frame. -+ -+if $tracelevel then { -+ strace $tracelevel -+} -+ -+set testfile bt-clone-stop -+set srcfile ${testfile}.c -+set binfile [standard_output_file ${testfile}] -+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested "Couldn't compile test program" -+ return -1 -+} -+ -+# Get things started. -+ -+gdb_exit -+gdb_start -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_load ${binfile} -+ -+# threader: threader.c:8: threader: Assertion `0' failed. -+# Program received signal SIGABRT, Aborted. -+ -+gdb_test "run" \ -+ {Thread 2 "bt-clone-stop" received signal SIGABRT.*} \ -+ "run" -+ -+# Former gdb unwind (the first function is `clone'): -+# #5 0x0000003421ecd62d in ?? () from /lib64/libc.so.6 -+# #6 0x0000000000000000 in ?? () -+# (gdb) -+# Tested `amd64_linux_outermost_frame' functionality should omit the line `#6'. -+# -+# Two `-re' cases below must be in this order (1st is a subset of the 2nd one). -+# Unhandled case below should not happen and it is fortunately handled by -+# `amd64_linux_outermost_frame' as FAIL (and result `0x0 entry output invalid'). -+gdb_test_multiple "bt" "0x0 entry output invalid" { -+ -re "in threader \\(.*\n#\[0-9\]* *0x0* in .*$gdb_prompt $" { -+ fail "0x0 entry found" -+ } -+ -re "in threader \\(.*$gdb_prompt $" { -+ pass "0x0 entry not found" -+ } -+} - diff --git a/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch index 7b580687208326f2b5e59183bdd66413fb5412f7..fcebc27d2f077b9de012a088cb105c9eb8fcaf81 100644 --- a/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +++ b/gdb-6.5-bz218379-ppc-solib-trampoline-test.patch @@ -1,5 +1,3 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218379 - diff --git a/gdb/testsuite/gdb.base/step-over-trampoline.c b/gdb/testsuite/gdb.base/step-over-trampoline.c new file mode 100644 --- /dev/null @@ -92,4 +90,3 @@ new file mode 100644 + fail "stepped into trampoline" + } +} - 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 302a25b9f0e078fda9103be3ba5cbb8fd47d345e..557fe6a8d3abb849709ec91652ef85ed0407f414 100644 --- a/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch +++ b/gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch @@ -1,10 +1,8 @@ -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 -@@ -3177,6 +3177,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) - SYMBOL_LINKAGE_NAME (msymbol)); */ +@@ -3166,6 +3166,13 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent) + msymbol->linkage_name ()); */ ; /* fall through */ + /* `msymbol' trampoline may be located before its .text symbol @@ -12,9 +10,8 @@ diff --git a/gdb/symtab.c b/gdb/symtab.c + Avoid `find_pc_sect_line'<->`find_pc_line' infinite loop. + Red Hat Bug 218379. */ + else if (BMSYMBOL_VALUE_ADDRESS (mfunsym) == pc) -+ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", MSYMBOL_LINKAGE_NAME (msymbol.minsym), paddress (target_gdbarch (), pc)); ++ warning ("In stub for %s (0x%s); interlocked, please submit the binary to http://bugzilla.redhat.com", msymbol.minsym->linkage_name (), paddress (target_gdbarch (), pc)); + /* fall through */ else return find_pc_line (BMSYMBOL_VALUE_ADDRESS (mfunsym), 0); } - diff --git a/gdb-6.5-bz243845-stale-testing-zombie-test.patch b/gdb-6.5-bz243845-stale-testing-zombie-test.patch index b7d248d35fd0d46b93d813e66c6271076b908157..8fc7412cf802e0d4a9b526bae3b7e2940799e91c 100644 --- a/gdb-6.5-bz243845-stale-testing-zombie-test.patch +++ b/gdb-6.5-bz243845-stale-testing-zombie-test.patch @@ -78,4 +78,3 @@ new file mode 100644 +} else { + fail $test +} - diff --git a/gdb-6.5-gcore-buffer-limit-test.patch b/gdb-6.5-gcore-buffer-limit-test.patch index 6d57b0d1233f7aee39eaa10d03ae898057ee7a3d..d8cd495e27e33dfae90e3b0fa0adffbaf563c602 100644 --- a/gdb-6.5-gcore-buffer-limit-test.patch +++ b/gdb-6.5-gcore-buffer-limit-test.patch @@ -139,4 +139,3 @@ new file mode 100644 + +# Cleanup. +exec kill -9 $pid_of_bin - diff --git a/gdb-6.5-ia64-libunwind-leak-test.patch b/gdb-6.5-ia64-libunwind-leak-test.patch index efa56afa653ee035d9d68d2288cdd2c1195cad01..d9393175964f2556f3d0836ef5fe792cbbc2371b 100644 --- a/gdb-6.5-ia64-libunwind-leak-test.patch +++ b/gdb-6.5-ia64-libunwind-leak-test.patch @@ -120,4 +120,3 @@ new file mode 100644 + fail $test + } +} - diff --git a/gdb-6.5-last-address-space-byte-test.patch b/gdb-6.5-last-address-space-byte-test.patch index bcf1af97c11888d9b484b5897b4f13674d050a8d..005204e71f54ce841327fa2557a5f8c5abcc8a02 100644 --- a/gdb-6.5-last-address-space-byte-test.patch +++ b/gdb-6.5-last-address-space-byte-test.patch @@ -52,4 +52,3 @@ new file mode 100644 + "Read the last address space byte" + +set timeout ${timeoutold} - diff --git a/gdb-6.5-missed-trap-on-step-test.patch b/gdb-6.5-missed-trap-on-step-test.patch index bd71f7f97c2fed83fc3d3424cfc47f4415fa405e..82e2291e9be9510f588539562f92c8a42fa07976 100644 --- a/gdb-6.5-missed-trap-on-step-test.patch +++ b/gdb-6.5-missed-trap-on-step-test.patch @@ -1,6 +1,3 @@ -Fix has been committed to: - gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch - diff --git a/gdb/testsuite/gdb.base/watchpoint-during-step.c b/gdb/testsuite/gdb.base/watchpoint-during-step.c new file mode 100644 --- /dev/null @@ -85,4 +82,3 @@ new file mode 100644 +# we step from as in this case it is a valid upstream KFAIL gdb/38 + +gdb_test "step" ".*Old value = 2.*New value = 3.*" "Catch the watchpoint" - diff --git a/gdb-6.5-readline-long-line-crash-test.patch b/gdb-6.5-readline-long-line-crash-test.patch index 9f4f9b309fcfcb8a59edf118537340c32636ce3e..51bc7fda9692b62e61204ad9369bf7db7b682a6b 100644 --- a/gdb-6.5-readline-long-line-crash-test.patch +++ b/gdb-6.5-readline-long-line-crash-test.patch @@ -1,5 +1,3 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=214196 - diff --git a/gdb/testsuite/gdb.base/readline-overflow.exp b/gdb/testsuite/gdb.base/readline-overflow.exp new file mode 100644 --- /dev/null @@ -109,4 +107,3 @@ new file mode 100644 + "No executable file specified..*" \ + "All the characters transferred" +} - diff --git a/gdb-6.5-section-num-fixup-test.patch b/gdb-6.5-section-num-fixup-test.patch index 9c9cbbff878259b063faf7eb7994704c878b500a..22d492020757b938b009d46cd3932be682ec23d1 100644 --- a/gdb-6.5-section-num-fixup-test.patch +++ b/gdb-6.5-section-num-fixup-test.patch @@ -112,4 +112,3 @@ new file mode 100644 +gdb_test "start" \ + "main \\(\\) at .*${srcfilemain}.*" \ + "start" - diff --git a/gdb-6.5-sharedlibrary-path.patch b/gdb-6.5-sharedlibrary-path.patch index ebbf301d8fa4f6140adf377e12f6153b5b794071..4cd88aa7d3be2af4e6af7f328347f3de0c8d1150 100644 --- a/gdb-6.5-sharedlibrary-path.patch +++ b/gdb-6.5-sharedlibrary-path.patch @@ -1,25 +1,3 @@ -If you provided some relative path to the shared library, such as with - export LD_LIBRARY_PATH=. -then gdb would fail to match the shared library name during the TLS lookup. - -Dropped the workaround/fix for gdb-6.8.50.20081128 - is it still needed? - -The testsuite needs `gdb-6.3-bz146810-solib_absolute_prefix_is_empty.patch'. -The testsuite needs `gdb-6.5-tls-of-separate-debuginfo.patch'. - -2006-09-01 Jan Kratochvil - - * solib-svr4.c (svr4_fetch_objfile_link_map): Match even absolute - requested pathnames to the internal loaded relative pathnames. - -2007-10-16 Jan Kratochvil - - Port to GDB-6.7. - -2008-02-27 Jan Kratochvil - - Port to gdb-6.7.50.20080227. - diff --git a/gdb/testsuite/gdb.threads/tls-sepdebug-main.c b/gdb/testsuite/gdb.threads/tls-sepdebug-main.c new file mode 100644 --- /dev/null @@ -169,4 +147,3 @@ new file mode 100644 + "\\\$1 = \[0-9\].*" \ + "print TLS variable from a shared library with $name-directory separate debug info file" +} - diff --git a/gdb-6.6-buildid-locate-core-as-arg.patch b/gdb-6.6-buildid-locate-core-as-arg.patch index 73c231787d4c4f19174dc3997a7c4b7aa0ff35b7..c24a59c145c10a03de1eaa6027dff1c7c98a02f0 100644 --- a/gdb-6.6-buildid-locate-core-as-arg.patch +++ b/gdb-6.6-buildid-locate-core-as-arg.patch @@ -1,84 +1,16 @@ -http://sourceware.org/ml/gdb-patches/2010-01/msg00558.html - -[ Fixed up since the mail. ] - -On Thu, 21 Jan 2010 18:17:15 +0100, Doug Evans wrote: -> Not an exhaustive list, but if we go down the path of converting "gdb -> corefile" to "gdb -c corefile", then we also need to think about "file -> corefile" being converted to "core corefile" [or "target core -> corefile", "core" is apparently deprecated in favor of "target core"] -> and "target exec corefile" -> "target core corefile". Presumably -> "file corefile" (and "target exec corefile") would discard the -> currently selected executable. But maybe not. Will that be confusing -> for users? I don't know. - -While thinking about it overriding some GDB _commands_ was not my intention. - -There is a general assumption if I have a shell COMMAND and some FILE I can do -$ COMMAND FILE -and COMMAND will appropriately load the FILE. - -FSF GDB currently needs to specify also the executable file for core files -which already inhibits this intuitive expectation. OTOH with the build-id -locating patch which could allow such intuitive start notneeding the -executable file. Still it currently did not work due to the required "-c": -$ COMMAND -c COREFILE - -Entering "file", "core-file" or "attach" commands is already explicit enough -so that it IMO should do what the command name says without any -autodetections. The second command line argument -(captured_main->pid_or_core_arg) is also autodetected (for PID or CORE) but -neither "attach" accepts a core file nor "core-file" accepts a PID. - -The patch makes sense only with the build-id patchset so this is not submit -for FSF GDB inclusion yet. I am fine with your patch (+/- Hui Zhu's pending -bfd_check_format_matches) as the patch below is its natural extension. - -Sorry for the delay, -Jan - -2010-01-25 Jan Kratochvil - - * exceptions.h (enum errors ): New. - * exec.c: Include exceptions.h. - (exec_file_attach ): Call throw_error (IS_CORE_ERROR, ...). - * main.c (exec_or_core_file_attach): New. - (captured_main ): Set also corearg. - (captured_main ): New variable func. - Call exec_or_core_file_attach if COREARG matches EXECARG. Call - symbol_file_add_main only if CORE_BFD remained NULL. - -Http://sourceware.org/ml/gdb-patches/2010-01/msg00517.html -2010-01-20 Doug Evans - - * exec.c (exec_file_attach): Print a more useful error message if the - user did "gdb core". - -diff --git a/gdb/common/common-exceptions.h b/gdb/common/common-exceptions.h ---- a/gdb/common/common-exceptions.h -+++ b/gdb/common/common-exceptions.h -@@ -104,6 +104,9 @@ enum errors { - "_ERROR" is appended to the name. */ - MAX_COMPLETIONS_REACHED_ERROR, - -+ /* Attempt to load a core file as executable. */ -+ IS_CORE_ERROR, -+ - /* Add more errors here. */ - NR_ERRORS - }; diff --git a/gdb/exec.c b/gdb/exec.c --- a/gdb/exec.c +++ b/gdb/exec.c -@@ -36,6 +36,7 @@ - #include "gdb_bfd.h" - #include "gcore.h" - #include "source.h" -+#include "exceptions.h" +@@ -18,6 +18,8 @@ + along with this program. If not, see . */ - #include - #include "readline/readline.h" -@@ -355,12 +356,27 @@ exec_file_attach (const char *filename, int from_tty) + #include "defs.h" ++#include "arch-utils.h" ++#include "exceptions.h" + #include "frame.h" + #include "inferior.h" + #include "target.h" +@@ -345,12 +347,27 @@ exec_file_attach (const char *filename, int from_tty) if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) { @@ -99,20 +31,33 @@ diff --git a/gdb/exec.c b/gdb/exec.c + + if (is_core != 0) + throw_error (IS_CORE_ERROR, -+ _("\"%s\" is a core file.\n" -+ "Please specify an executable to debug."), -+ scratch_pathname); ++ _("\"%s\" is a core file.\n" ++ "Please specify an executable to debug."), ++ scratch_pathname); + else -+ error (_("\"%s\": not in executable format: %s"), ++ error (_("\"%ss\": not in executable format: %s"), + scratch_pathname, + gdb_bfd_errmsg (bfd_get_error (), matching).c_str ()); } if (build_section_table (exec_bfd, §ions, §ions_end)) +diff --git a/gdb/gdbsupport/common-exceptions.h b/gdb/gdbsupport/common-exceptions.h +--- a/gdb/gdbsupport/common-exceptions.h ++++ b/gdb/gdbsupport/common-exceptions.h +@@ -106,6 +106,9 @@ enum errors { + "_ERROR" is appended to the name. */ + MAX_COMPLETIONS_REACHED_ERROR, + ++ /* Attempt to load a core file as executable. */ ++ IS_CORE_ERROR, ++ + /* Add more errors here. */ + NR_ERRORS + }; diff --git a/gdb/main.c b/gdb/main.c --- a/gdb/main.c +++ b/gdb/main.c -@@ -448,6 +448,35 @@ struct cmdarg +@@ -467,6 +467,34 @@ struct cmdarg char *string; }; @@ -125,11 +70,11 @@ diff --git a/gdb/main.c b/gdb/main.c +{ + gdb_assert (exec_bfd == NULL); + -+ TRY ++ try + { + exec_file_attach (filename, from_tty); + } -+ CATCH (e, RETURN_MASK_ALL) ++ catch (gdb_exception_error &e) + { + if (e.error == IS_CORE_ERROR) + { @@ -140,15 +85,14 @@ diff --git a/gdb/main.c b/gdb/main.c + if (exec_bfd != NULL) + return; + } -+ throw_exception (e); ++ throw_exception (std::move (e)); + } -+ END_CATCH +} + static void captured_main_1 (struct captured_main_args *context) { -@@ -893,6 +922,8 @@ captured_main_1 (struct captured_main_args *context) +@@ -907,6 +935,8 @@ captured_main_1 (struct captured_main_args *context) { symarg = argv[optind]; execarg = argv[optind]; @@ -157,7 +101,7 @@ diff --git a/gdb/main.c b/gdb/main.c optind++; } -@@ -1043,12 +1074,25 @@ captured_main_1 (struct captured_main_args *context) +@@ -1063,12 +1093,25 @@ captured_main_1 (struct captured_main_args *context) && symarg != NULL && strcmp (execarg, symarg) == 0) { @@ -187,4 +131,3 @@ diff --git a/gdb/main.c b/gdb/main.c 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 3de8e1e5a11fbfc8d4bf95e4ac3f73356309b3c4..8b682329c1da68fb84aad7ab74eea3f1955fddad 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 @@ -1,20 +1,3 @@ -Comments by Sergio Durigan Junior : - - This is the fix for RH BZ #981154 - - It is mainly a testcase addition, but a minor fix in the gdb/build-id.c - file was also needed. - - gdb/build-id.c was added by: - - commit dc294be54c96414035eed7d53dafdea0a6f31a72 - Author: Tom Tromey - Date: Tue Oct 8 19:56:15 2013 +0000 - - and had a little thinko there. The variable 'filename' needs to be set to - NULL after it is free'd, otherwise the code below thinks that it is still - valid and doesn't print the necessary warning ("Try: yum install ..."). - diff --git a/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp b/gdb/testsuite/gdb.base/rhbz981154-misleading-yum-install-warning.exp new file mode 100644 --- /dev/null @@ -117,4 +100,3 @@ new file mode 100644 + +# Leaving the link there will cause breakage in the next run. +remote_exec build "rm -f [standard_output_file ${build_id_without_debug}]" - diff --git a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch index 39311a58dc765e1cc79ed010ac3c8755071da2e7..b9c925f6a085c040479a4d410ee172e9a1e5c73a 100644 --- a/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +++ b/gdb-6.6-buildid-locate-rpm-librpm-workaround.patch @@ -1,7 +1,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -712,6 +712,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) +@@ -709,6 +709,19 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) #include #endif @@ -32,4 +32,3 @@ diff --git a/gdb/proc-service.list b/gdb/proc-service.list + /* gdb-6.6-buildid-locate-rpm.patch */ + rpmsqEnable; }; - diff --git a/gdb-6.6-buildid-locate-rpm-scl.patch b/gdb-6.6-buildid-locate-rpm-scl.patch index c203fef11e3603f85eaa04d60306d27daa8e96d2..e4583749211cc87b406320c5ad8d5305f935c8b5 100644 --- a/gdb-6.6-buildid-locate-rpm-scl.patch +++ b/gdb-6.6-buildid-locate-rpm-scl.patch @@ -1,10 +1,7 @@ -warning: Skipping deprecated .gdb_index section -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 -@@ -746,7 +746,11 @@ static int missing_rpm_list_entries; +@@ -743,7 +743,11 @@ static int missing_rpm_list_entries; /* Returns the count of newly added rpms. */ static int @@ -16,7 +13,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { static int rpm_init_done = 0; rpmts ts; -@@ -853,7 +857,11 @@ missing_rpm_enlist (const char *filename) +@@ -850,7 +854,11 @@ missing_rpm_enlist (const char *filename) mi = rpmtsInitIterator_p (ts, RPMTAG_BASENAMES, filename, 0); if (mi != NULL) { @@ -28,7 +25,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { Header h; char *debuginfo, **slot, *s, *s2; -@@ -971,6 +979,37 @@ missing_rpm_enlist (const char *filename) +@@ -968,6 +976,37 @@ missing_rpm_enlist (const char *filename) xfree (debuginfo); count++; } @@ -66,10 +63,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c rpmdbFreeIterator_p (mi); } -@@ -981,6 +1020,21 @@ missing_rpm_enlist (const char *filename) +@@ -977,6 +1016,20 @@ missing_rpm_enlist (const char *filename) + return count; } - static int +#ifdef GDB_INDEX_VERIFY_VENDOR +missing_rpm_enlist (const char *filename) +{ @@ -82,16 +79,15 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +{ + return missing_rpm_enlist_1 (filename, 1); +} -+ -+static int +#endif - missing_rpm_list_compar (const char *const *ap, const char *const *bp) ++ + static bool + missing_rpm_list_compar (const char *ap, const char *bp) { - return strcoll (*ap, *bp); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -3501,6 +3501,16 @@ read_gdb_index_from_buffer (struct objfile *objfile, +@@ -3497,6 +3497,16 @@ read_gdb_index_from_buffer (struct objfile *objfile, "set use-deprecated-index-sections on". */ if (version < 6 && !deprecated_ok) { @@ -108,7 +104,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c static int warning_printed = 0; if (!warning_printed) { -@@ -3512,6 +3522,10 @@ to use the section anyway."), +@@ -3508,6 +3518,10 @@ to use the section anyway."), warning_printed = 1; } return 0; @@ -119,4 +115,3 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c } /* Version 7 indices generated by gold refer to the CU for a symbol instead of the TU (for symbols coming from TUs), - diff --git a/gdb-6.6-buildid-locate-rpm.patch b/gdb-6.6-buildid-locate-rpm.patch index 64a96b741d1727eec380f0256c85f3829fafface..a8477209a4276e0f349ad370a5b801e135f4381f 100644 --- a/gdb-6.6-buildid-locate-rpm.patch +++ b/gdb-6.6-buildid-locate-rpm.patch @@ -228,16 +228,15 @@ diff --git a/gdb/aclocal.m4 b/gdb/aclocal.m4 diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -35,6 +35,8 @@ - #include "elf/common.h" - #include "elf-bfd.h" - #include -+#include "elf/external.h" +@@ -33,6 +33,7 @@ + #include "gdb_bfd.h" + #include "gdbcmd.h" + #include "gdbcore.h" +#include "inferior.h" - - #define BUILD_ID_VERBOSE_NONE 0 - #define BUILD_ID_VERBOSE_FILENAMES 1 -@@ -700,8 +702,366 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) + #include "libbfd.h" + #include "objfiles.h" + #include "observable.h" +@@ -698,8 +699,374 @@ build_id_to_filename (const struct bfd_build_id *build_id, char **link_return) return result; } @@ -506,10 +505,10 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + return count; +} + -+static int -+missing_rpm_list_compar (const char *const *ap, const char *const *bp) ++static bool ++missing_rpm_list_compar (const char *ap, const char *bp) +{ -+ return strcoll (*ap, *bp); ++ return strcoll (ap, bp) < 0; +} + +/* It returns a NULL-terminated array of strings needing to be FREEd. It may @@ -518,39 +517,50 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +static void +missing_rpm_list_print (void) +{ -+ char **array, **array_iter; + struct missing_rpm *list_iter; -+ struct cleanup *cleanups; + + if (missing_rpm_list_entries == 0) + return; + -+ array = (char **) xmalloc (sizeof (*array) * missing_rpm_list_entries); -+ cleanups = make_cleanup (xfree, array); ++ std::vector array (missing_rpm_list_entries); ++ size_t idx = 0; + -+ array_iter = array; + for (list_iter = missing_rpm_list; list_iter != NULL; + list_iter = list_iter->next) + { -+ *array_iter++ = list_iter->rpm; ++ array[idx++] = list_iter->rpm; + } -+ gdb_assert (array_iter == array + missing_rpm_list_entries); ++ gdb_assert (idx == missing_rpm_list_entries); ++ ++ std::sort (array.begin (), array.end (), missing_rpm_list_compar); ++ ++ /* We zero out the number of missing RPMs here because of a nasty ++ bug (see RHBZ 1801974). ++ ++ When we call 'puts_unfiltered' below, if pagination is on and if ++ the number of missing RPMs is big enough to trigger pagination, ++ we will end up in an infinite recursion. The call chain looks ++ like this: ++ ++ missing_rpm_list_print -> puts_unfiltered -> fputs_maybe_filtered ++ -> prompt_for_continue -> display_gdb_prompt -> ++ debug_flush_missing -> missing_rpm_list_print ... + -+ qsort (array, missing_rpm_list_entries, sizeof (*array), -+ (int (*) (const void *, const void *)) missing_rpm_list_compar); ++ For this reason, we make sure MISSING_RPM_LIST_ENTRIES is zero ++ *before* calling any print function. */ ++ missing_rpm_list_entries = 0; + + printf_unfiltered (_("Missing separate debuginfos, use: %s"), +#ifdef DNF_DEBUGINFO_INSTALL + "dnf " +#endif + "debuginfo-install"); -+ for (array_iter = array; array_iter < array + missing_rpm_list_entries; -+ array_iter++) ++ for (const char *el : array) + { -+ putchar_unfiltered (' '); -+ puts_unfiltered (*array_iter); ++ puts_unfiltered (" "); ++ puts_unfiltered (el); + } -+ putchar_unfiltered ('\n'); ++ puts_unfiltered ("\n"); + + while (missing_rpm_list != NULL) + { @@ -558,9 +568,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + missing_rpm_list = list_iter->next; + xfree (list_iter); + } -+ missing_rpm_list_entries = 0; -+ -+ do_cleanups (cleanups); +} + +static void @@ -605,7 +612,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c avoidance. */ struct missing_filepair -@@ -755,11 +1115,17 @@ missing_filepair_change (void) +@@ -753,11 +1120,17 @@ missing_filepair_change (void) /* All their memory came just from missing_filepair_OBSTACK. */ missing_filepair_hash = NULL; } @@ -623,7 +630,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c missing_filepair_change (); } -@@ -826,14 +1192,39 @@ debug_print_missing (const char *binary, const char *debug) +@@ -824,14 +1197,38 @@ debug_print_missing (const char *binary, const char *debug) *slot = missing_filepair; @@ -632,14 +639,13 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c +#ifdef HAVE_LIBRPM + if (missing_exec == MISSING_EXEC_NOT_TRIED) + { -+ char *execfilename; ++ const char *execfilename = get_exec_file (0); - fprintf_unfiltered (gdb_stdlog, - _("Missing separate debuginfo for %s\n"), binary); - if (debug != NULL) - fprintf_unfiltered (gdb_stdlog, _("Try to install the hash file %s\n"), - debug); -+ execfilename = get_exec_file (0); + if (execfilename != NULL) + { + if (missing_rpm_enlist (execfilename) == 0) @@ -673,7 +679,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c diff --git a/gdb/config.in b/gdb/config.in --- a/gdb/config.in +++ b/gdb/config.in -@@ -33,6 +33,9 @@ +@@ -36,6 +36,9 @@ /* Define to BFD's default target vector. */ #undef DEFAULT_BFD_VEC @@ -683,9 +689,9 @@ 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 -@@ -261,6 +264,9 @@ - /* Define if Python 2.7 is being used. */ - #undef HAVE_LIBPYTHON2_7 +@@ -245,6 +248,9 @@ + /* Define if you have the mpfr library. */ + #undef HAVE_LIBMPFR +/* Define if librpm library is being used. */ +#undef HAVE_LIBRPM @@ -696,7 +702,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 -@@ -751,6 +751,11 @@ CODESIGN_CERT +@@ -761,6 +761,11 @@ CODESIGN_CERT HAVE_NATIVE_GCORE_TARGET TARGET_OBS subdirs @@ -708,7 +714,7 @@ diff --git a/gdb/configure b/gdb/configure GDB_DATADIR DEBUGDIR MAKEINFO_EXTRA_FLAGS -@@ -855,6 +860,7 @@ with_gdb_datadir +@@ -864,6 +869,7 @@ with_gdb_datadir with_relocated_sources with_auto_load_dir with_auto_load_safe_path @@ -716,7 +722,7 @@ diff --git a/gdb/configure b/gdb/configure enable_targets enable_64_bit_bfd enable_gdbmi -@@ -915,6 +921,11 @@ CCC +@@ -926,6 +932,11 @@ CCC CPP MAKEINFO MAKEINFOFLAGS @@ -728,7 +734,7 @@ diff --git a/gdb/configure b/gdb/configure YACC YFLAGS XMKMF' -@@ -1588,6 +1599,8 @@ Optional Packages: +@@ -1598,6 +1609,8 @@ Optional Packages: [--with-auto-load-dir] --without-auto-load-safe-path do not restrict auto-loaded files locations @@ -737,7 +743,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 -@@ -1645,6 +1658,13 @@ Some influential environment variables: +@@ -1661,6 +1674,13 @@ Some influential environment variables: MAKEINFO Parent configure detects if it is of sufficient version. MAKEINFOFLAGS Parameters for MAKEINFO. @@ -751,7 +757,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'. -@@ -6626,6 +6646,494 @@ _ACEOF +@@ -6587,6 +6607,494 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_auto_load_safe_path" >&5 $as_echo "$with_auto_load_safe_path" >&6; } @@ -1249,7 +1255,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 -@@ -166,6 +166,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, +@@ -144,6 +144,199 @@ AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir, [Directories safe to hold auto-loaded files.]) AC_MSG_RESULT([$with_auto_load_safe_path]) @@ -1449,30 +1455,18 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac AC_CONFIG_SUBDIRS(testsuite) # Check whether to support alternative target configurations -diff --git a/gdb/corelow.c b/gdb/corelow.c ---- a/gdb/corelow.c -+++ b/gdb/corelow.c -@@ -365,7 +365,7 @@ build_id_locate_exec (int from_tty) - symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; - } - else -- debug_print_missing (_("the main executable file"), build_id_filename); -+ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename); - - do_cleanups (back_to); - diff --git a/gdb/event-top.c b/gdb/event-top.c --- a/gdb/event-top.c +++ b/gdb/event-top.c -@@ -40,6 +40,7 @@ - #include "common/buffer.h" +@@ -41,6 +41,7 @@ #include "ser-event.h" #include "gdb_select.h" + #include "gdbsupport/gdb-sigmask.h" +#include "symfile.h" /* readline include files. */ #include "readline/readline.h" -@@ -359,6 +360,8 @@ display_gdb_prompt (const char *new_prompt) +@@ -363,6 +364,8 @@ display_gdb_prompt (const char *new_prompt) /* Reset the nesting depth used when trace-commands is set. */ reset_command_nest_depth (); @@ -1481,7 +1475,7 @@ diff --git a/gdb/event-top.c b/gdb/event-top.c /* Do not call the python hook on an explicit prompt change as passed to this function, as this forms a secondary/local prompt, IE, displayed but not set. */ -@@ -770,7 +773,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) +@@ -772,7 +775,10 @@ command_line_handler (gdb::unique_xmalloc_ptr &&rl) command_handler (cmd); if (ui->prompt_state != PROMPTED) @@ -1496,7 +1490,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 -@@ -534,6 +534,8 @@ void map_symbol_filenames (symbol_filename_ftype *fun, void *data, +@@ -542,6 +542,8 @@ extern void generic_load (const char *args, int from_tty); /* 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); @@ -1505,4 +1499,3 @@ diff --git a/gdb/symfile.h b/gdb/symfile.h /* From dwarf2read.c */ - diff --git a/gdb-6.6-buildid-locate-solib-missing-ids.patch b/gdb-6.6-buildid-locate-solib-missing-ids.patch index c8bb3ba846367b0c5453a7caf4c2bd87cc919d4c..e34856cd6066ba4de4b00f98785e3f45b4e8b9cf 100644 --- a/gdb-6.6-buildid-locate-solib-missing-ids.patch +++ b/gdb-6.6-buildid-locate-solib-missing-ids.patch @@ -1,10 +1,7 @@ -gdb returns an incorrect back trace when applying a debuginfo -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 -@@ -1347,14 +1347,27 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1346,14 +1346,27 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, } { @@ -34,7 +31,7 @@ diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c if (build_id != NULL) { char *name, *build_id_filename; -@@ -1369,23 +1382,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1368,23 +1381,7 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, xfree (name); } else @@ -225,4 +222,3 @@ new file mode 100644 + +gdb_test "bt" +gdb_test "info shared" - diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 10f6162e2d8a5a4fca3f22794961a96872505e3c..86cd307362dfa532b5e986283fba0d331c982998 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -1,19 +1,47 @@ +diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h +--- a/bfd/libbfd-in.h ++++ b/bfd/libbfd-in.h +@@ -127,7 +127,7 @@ static inline char * + bfd_strdup (const char *str) + { + size_t len = strlen (str) + 1; +- char *buf = bfd_malloc (len); ++ char *buf = (char *) bfd_malloc (len); + if (buf != NULL) + memcpy (buf, str, len); + return buf; +diff --git a/bfd/libbfd.h b/bfd/libbfd.h +--- a/bfd/libbfd.h ++++ b/bfd/libbfd.h +@@ -132,7 +132,7 @@ static inline char * + bfd_strdup (const char *str) + { + size_t len = strlen (str) + 1; +- char *buf = bfd_malloc (len); ++ char *buf = (char *) bfd_malloc (len); + if (buf != NULL) + memcpy (buf, str, len); + return buf; diff --git a/gdb/build-id.c b/gdb/build-id.c --- a/gdb/build-id.c +++ b/gdb/build-id.c -@@ -26,11 +26,67 @@ +@@ -24,13 +24,71 @@ + #include "gdbsupport/gdb_vecs.h" + #include "symfile.h" #include "objfiles.h" ++#include ++#include "elf-bfd.h" ++#include "elf/common.h" ++#include "elf/external.h" ++#include "elf/internal.h" #include "filenames.h" ++#include "gdb_bfd.h" ++#include "gdbcmd.h" #include "gdbcore.h" +#include "libbfd.h" -+#include "gdbcore.h" -+#include "gdbcmd.h" ++#include "objfiles.h" +#include "observable.h" -+#include "elf/external.h" -+#include "elf/internal.h" -+#include "elf/common.h" -+#include "elf-bfd.h" -+#include ++#include "symfile.h" + +#define BUILD_ID_VERBOSE_NONE 0 +#define BUILD_ID_VERBOSE_FILENAMES 1 @@ -68,9 +96,9 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c -build_id_bfd_get (bfd *abfd) +build_id_bfd_shdr_get (bfd *abfd) { - if (!bfd_check_format (abfd, bfd_object)) - return NULL; -@@ -42,6 +98,348 @@ build_id_bfd_get (bfd *abfd) + if (!bfd_check_format (abfd, bfd_object) + && !bfd_check_format (abfd, bfd_core)) +@@ -43,6 +101,348 @@ build_id_bfd_get (bfd *abfd) return NULL; } @@ -359,7 +387,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + +static void build_id_addr_candidate (bfd *abfd, asection *sect, void *obj) +{ -+ if (build_id_addr >= bfd_section_vma (abfd, sect)) ++ if (build_id_addr >= bfd_section_vma (sect)) + { + struct build_id_addr_sect *candidate; + @@ -394,7 +422,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + candidate = candidate->next) + { + i_phdr = elf_get_phdr (core_bfd, -+ bfd_section_vma (core_bfd, candidate->sect), ++ bfd_section_vma (candidate->sect), + &e_phnum, &loadbase); + if (i_phdr != NULL) + break; @@ -419,7 +447,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c /* See build-id.h. */ int -@@ -50,7 +448,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -51,7 +451,7 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) const struct bfd_build_id *found; int retval = 0; @@ -428,7 +456,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,62 +463,173 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) +@@ -66,56 +466,159 @@ build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) return retval; } @@ -474,8 +502,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c -build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, - const bfd_byte *build_id) +build_id_to_debug_bfd_1 (const std::string &orig_link, size_t build_id_len, -+ const bfd_byte *build_id, char **link_return, -+ int add_debug_suffix) ++ const bfd_byte *build_id, char **link_return) { + gdb_bfd_ref_ptr ret_bfd = {}; + std::string ret_link; @@ -516,9 +543,6 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c - { - if (separate_debug_file_debug) - printf_unfiltered (_(" no, unable to open.\n")); -+ if (add_debug_suffix) -+ link += ".debug"; -+ + ret_link = link; + + struct stat statbuf_trash; @@ -543,7 +567,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + + continue; + } -+ + +- return {}; + /* We expect to be silent on the non-existing files. */ + gdb_bfd_ref_ptr debug_bfd = gdb_bfd_open (filename.get (), gnutarget, -1); + @@ -562,8 +587,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + + continue; + } - -- return {}; ++ + ret_bfd = debug_bfd; + break; } @@ -575,6 +599,8 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c { if (separate_debug_file_debug) - printf_unfiltered (_(" no, build-id does not match.\n")); +- +- return {}; + printf_unfiltered (_(" yes!\n")); + } + else @@ -583,15 +609,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + always the non-.%u-suffixed file. */ + std::string link0 = orig_link; + -+ if (add_debug_suffix) -+ link0 += ".debug"; -+ + /* If the symlink has target request to install the target. + BASE-debuginfo.rpm contains the symlink but BASE.rpm may be missing. + https://bugzilla.redhat.com/show_bug.cgi?id=981154 */ + std::string link0_resolved (link_resolve (link0.c_str (), 0)); - -- return {}; ++ + if (link_all.empty ()) + link_all = link0_resolved; + else @@ -620,16 +642,17 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + return ret_bfd; } - /* See build-id.h. */ + /* Common code for finding BFDs of a given build-id. This function +@@ -124,7 +627,7 @@ build_id_to_debug_bfd_1 (const std::string &link, size_t build_id_len, - gdb_bfd_ref_ptr --build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) -+build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, -+ char **link_return, int add_debug_suffix) + static gdb_bfd_ref_ptr + build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, +- const char *suffix) ++ const char *suffix, char **link_return) { /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will cause "/.build-id/..." lookups. */ -@@ -143,16 +652,16 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) +@@ -147,16 +650,17 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, if (size > 0) { size--; @@ -642,26 +665,25 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c while (size-- > 0) string_appendf (link, "%02x", (unsigned) *data++); -- link += ".debug"; -- + link += suffix; + gdb_bfd_ref_ptr debug_bfd - = build_id_to_debug_bfd_1 (link, build_id_len, build_id); -+ = build_id_to_debug_bfd_1 (link, build_id_len, build_id, -+ link_return, add_debug_suffix); ++ = build_id_to_debug_bfd_1 (link, build_id_len, build_id, link_return); if (debug_bfd != NULL) return debug_bfd; -@@ -166,7 +675,8 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) +@@ -170,7 +674,8 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, if (strcmp (gdb_sysroot, TARGET_SYSROOT_PREFIX) != 0) { link = gdb_sysroot + link; - debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id); + debug_bfd = build_id_to_debug_bfd_1 (link, build_id_len, build_id, -+ link_return, add_debug_suffix); ++ link_return); if (debug_bfd != NULL) return debug_bfd; } -@@ -175,22 +685,190 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) +@@ -179,38 +684,208 @@ build_id_to_bfd_suffix (size_t build_id_len, const bfd_byte *build_id, return {}; } @@ -671,12 +693,11 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + gdb_bfd_ref_ptr abfd; + char *result; + -+ abfd = build_id_to_debug_bfd (build_id->size, build_id->data, link_return, 0); ++ abfd = build_id_to_exec_bfd (build_id->size, build_id->data, link_return); + if (abfd == NULL) + return NULL; + -+ result = xstrdup (bfd_get_filename (abfd)); -+ abfd.release (); ++ result = xstrdup (bfd_get_filename (abfd.get ())); + return result; +} + @@ -818,6 +839,29 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c + /* See build-id.h. */ + gdb_bfd_ref_ptr +-build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id) ++build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id, ++ char **link_return) + { +- return build_id_to_bfd_suffix (build_id_len, build_id, ".debug"); ++ return build_id_to_bfd_suffix (build_id_len, build_id, ".debug", ++ link_return); + } + + /* See build-id.h. */ + + gdb_bfd_ref_ptr +-build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id) ++build_id_to_exec_bfd (size_t build_id_len, const bfd_byte *build_id, ++ char **link_return) + { +- return build_id_to_bfd_suffix (build_id_len, build_id, ""); ++ return build_id_to_bfd_suffix (build_id_len, build_id, "", link_return); + } + + /* See build-id.h. */ + std::string -find_separate_debug_file_by_buildid (struct objfile *objfile) +find_separate_debug_file_by_buildid (struct objfile *objfile, @@ -840,7 +884,7 @@ diff --git a/gdb/build-id.c b/gdb/build-id.c gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size, - build_id->data)); + build_id->data, -+ (!build_id_filename_return ? NULL : &build_id_filename_cstr), 1)); ++ (!build_id_filename_return ? NULL : &build_id_filename_cstr))); + if (build_id_filename_return) + { + if (!build_id_filename_cstr) @@ -855,7 +899,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 ()), -@@ -203,3 +881,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) +@@ -223,3 +898,21 @@ find_separate_debug_file_by_buildid (struct objfile *objfile) return std::string (); } @@ -882,7 +926,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h +++ b/gdb/build-id.h @@ -23,9 +23,10 @@ #include "gdb_bfd.h" - #include "common/rsp-low.h" + #include "gdbsupport/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. @@ -893,18 +937,26 @@ 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. */ -@@ -39,14 +40,19 @@ extern int build_id_verify (bfd *abfd, - the caller. */ +@@ -38,21 +39,26 @@ extern int build_id_verify (bfd *abfd, + can be found, return NULL. */ extern gdb_bfd_ref_ptr build_id_to_debug_bfd (size_t build_id_len, - const bfd_byte *build_id); + const bfd_byte *build_id, -+ char **link_return, -+ int add_debug_suffix); ++ char **link_return); + +extern char *build_id_to_filename (const struct bfd_build_id *build_id, + char **link_return); + /* Find and open a BFD for an executable file given a build-id. If no BFD + can be found, return NULL. The returned reference to the BFD must be + released by the caller. */ + + extern gdb_bfd_ref_ptr build_id_to_exec_bfd (size_t build_id_len, +- const bfd_byte *build_id); ++ const bfd_byte *build_id, ++ char **link_return); + /* Find the separate debug file for OBJFILE, by using the build-id associated with OBJFILE's BFD. If successful, returns the file name for the separate debug file, otherwise, return an empty string. */ @@ -919,7 +971,7 @@ diff --git a/gdb/build-id.h b/gdb/build-id.h diff --git a/gdb/coffread.c b/gdb/coffread.c --- a/gdb/coffread.c +++ b/gdb/coffread.c -@@ -732,7 +732,8 @@ coff_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -709,7 +709,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)) { @@ -932,88 +984,55 @@ diff --git a/gdb/coffread.c b/gdb/coffread.c diff --git a/gdb/corelow.c b/gdb/corelow.c --- a/gdb/corelow.c +++ b/gdb/corelow.c -@@ -43,6 +43,10 @@ - #include "gdb_bfd.h" - #include "completer.h" - #include "common/filestuff.h" +@@ -22,6 +22,10 @@ + #include + #include + #include "frame.h" /* required by inferior.h */ +#include "auxv.h" ++#include "build-id.h" +#include "elf/common.h" +#include "gdbcmd.h" -+#include "build-id.h" - - #ifndef O_LARGEFILE - #define O_LARGEFILE 0 -@@ -320,6 +324,54 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) + #include "inferior.h" + #include "infrun.h" + #include "symtab.h" +@@ -322,6 +326,8 @@ add_to_thread_list (bfd *abfd, asection *asect, void *reg_sect_arg) inferior_ptid = ptid; /* Yes, make it current. */ } -+static int build_id_core_loads = 1; -+ -+static void -+build_id_locate_exec (int from_tty) -+{ -+ CORE_ADDR at_entry; -+ struct bfd_build_id *build_id; -+ char *execfilename; -+ char *build_id_filename; -+ struct cleanup *back_to; -+ -+ if (exec_bfd != NULL || symfile_objfile != NULL) -+ return; -+ -+ if (target_auxv_search (current_top_target (), AT_ENTRY, &at_entry) <= 0) -+ return; -+ -+ build_id = build_id_addr_get (at_entry); -+ if (build_id == NULL) -+ return; -+ back_to = make_cleanup (xfree, build_id); -+ -+ /* SYMFILE_OBJFILE should refer to the main executable (not only to its -+ separate debug info file). gcc44+ keeps .eh_frame only in the main -+ executable without its duplicate .debug_frame in the separate debug info -+ file - such .eh_frame would not be found if SYMFILE_OBJFILE would refer -+ directly to the separate debug info file. */ -+ -+ execfilename = build_id_to_filename (build_id, &build_id_filename); -+ make_cleanup (xfree, build_id_filename); -+ -+ if (execfilename != NULL) -+ { -+ make_cleanup (xfree, execfilename); -+ exec_file_attach (execfilename, from_tty); -+ symbol_file_add_main (execfilename, -+ symfile_add_flag (!from_tty ? 0 : SYMFILE_VERBOSE)); -+ if (symfile_objfile != NULL) -+ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; -+ } -+ else -+ debug_print_missing (_("the main executable file"), build_id_filename); -+ -+ do_cleanups (back_to); -+ -+ /* No automatic SOLIB_ADD as the libraries would get read twice. */ -+} ++static bool build_id_core_loads = true; + /* Issue a message saying we have no core to debug, if FROM_TTY. */ static void -@@ -455,6 +507,14 @@ core_target_open (const char *arg, int from_tty) - switch_to_thread (thread); - } +@@ -358,19 +364,25 @@ core_file_command (const char *filename, int from_tty) + static void + locate_exec_from_corefile_build_id (bfd *abfd, int from_tty) + { +- const bfd_build_id *build_id = build_id_bfd_get (abfd); ++ const bfd_build_id *build_id = build_id_bfd_shdr_get (abfd); + if (build_id == nullptr) + return; -+ /* Find the build_id identifiers. If it gets executed after -+ POST_CREATE_INFERIOR we would clash with asking to discard the already -+ loaded VDSO symbols. If it gets executed before bfd_map_over_sections -+ INFERIOR_PTID is still not set and libthread_db initialization crashes on -+ PID == 0 in ps_pglobal_lookup. */ -+ if (build_id_core_loads != 0) -+ build_id_locate_exec (from_tty); -+ - post_create_inferior (target, from_tty); ++ char *build_id_filename; + gdb_bfd_ref_ptr execbfd +- = build_id_to_exec_bfd (build_id->size, build_id->data); ++ = build_id_to_exec_bfd (build_id->size, build_id->data, ++ &build_id_filename); - /* Now go through the target stack looking for threads since there -@@ -1063,4 +1123,11 @@ void + if (execbfd != nullptr) + { + exec_file_attach (bfd_get_filename (execbfd.get ()), from_tty); + symbol_file_add_main (bfd_get_filename (execbfd.get ()), + symfile_add_flag (from_tty ? SYMFILE_VERBOSE : 0)); ++ if (symfile_objfile != NULL) ++ symfile_objfile->flags |= OBJF_BUILD_ID_CORE_LOADED; + } ++ else ++ debug_print_missing (BUILD_ID_MAIN_EXECUTABLE_FILENAME, build_id_filename); + } + + /* See gdbcore.h. */ +@@ -998,4 +1010,11 @@ void _initialize_corelow (void) { add_target (core_target_info, core_target_open, filename_completer); @@ -1028,7 +1047,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 -@@ -19949,6 +19949,27 @@ information files. +@@ -20862,6 +20862,27 @@ information files. @end table @@ -1059,28 +1078,38 @@ diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo 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 -@@ -93,7 +93,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile) - if (!enabled ()) +@@ -94,7 +94,7 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile) return; + /* Get build id of objfile. */ - 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) +@@ -112,7 +112,8 @@ index_cache::store (struct dwarf2_per_objfile *dwarf2_per_objfile) + + if (dwz != nullptr) + { +- const bfd_build_id *dwz_build_id = build_id_bfd_get (dwz->dwz_bfd.get ()); ++ const bfd_build_id *dwz_build_id ++ = build_id_bfd_shdr_get (dwz->dwz_bfd.get ()); + + if (dwz_build_id == nullptr) + { diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -2727,7 +2727,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) +@@ -2718,7 +2718,7 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) } if (dwz_bfd == NULL) - dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid); -+ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL, 1); ++ dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL); if (dwz_bfd == NULL) error (_("could not find '.gnu_debugaltlink' file for %s"), -@@ -6237,7 +6237,7 @@ get_gdb_index_contents_from_section (objfile *obj, T *section_owner) +@@ -6276,7 +6276,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) { @@ -1089,7 +1118,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c if (build_id == nullptr) return {}; -@@ -6250,7 +6250,7 @@ get_gdb_index_contents_from_cache (objfile *obj, dwarf2_per_objfile *dwarf2_obj) +@@ -6289,7 +6289,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) { @@ -1101,7 +1130,7 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c diff --git a/gdb/elfread.c b/gdb/elfread.c --- a/gdb/elfread.c +++ b/gdb/elfread.c -@@ -1287,7 +1287,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1299,7 +1299,9 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) && objfile->separate_debug_objfile == NULL && objfile->separate_debug_objfile_backlink == NULL) { @@ -1112,22 +1141,26 @@ diff --git a/gdb/elfread.c b/gdb/elfread.c if (debugfile.empty ()) debugfile = find_separate_debug_file_by_debuglink (objfile); -@@ -1299,6 +1301,10 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) +@@ -1311,8 +1313,12 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (), symfile_flags, objfile); } +- else +- has_dwarf2 = false; + /* Check if any separate debug info has been extracted out. */ + else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") + != NULL) + debug_print_missing (objfile_name (objfile), build_id_filename.get ()); ++ else ++ has_dwarf2 = false; } - } + /* Read the CTF section only if there is no DWARF info. */ diff --git a/gdb/objfiles.h b/gdb/objfiles.h --- a/gdb/objfiles.h +++ b/gdb/objfiles.h -@@ -554,6 +554,10 @@ struct objfile - htab_t static_links {}; +@@ -627,6 +627,10 @@ struct objfile + htab_up static_links; }; +/* This file was loaded according to the BUILD_ID_CORE_LOADS rules. */ @@ -1142,14 +1175,14 @@ diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c +++ b/gdb/python/py-objfile.c @@ -132,7 +132,7 @@ objfpy_get_build_id (PyObject *self, void *closure) - TRY + try { - build_id = build_id_bfd_get (objfile->obfd); + build_id = build_id_bfd_shdr_get (objfile->obfd); } - CATCH (except, RETURN_MASK_ALL) + catch (const gdb_exception &except) { -@@ -535,7 +535,7 @@ objfpy_lookup_objfile_by_build_id (const char *build_id) +@@ -600,7 +600,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; @@ -1169,7 +1202,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); -@@ -1345,9 +1346,51 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, +@@ -1344,9 +1345,51 @@ svr4_read_so_list (svr4_info *info, CORE_ADDR lm, CORE_ADDR prev_lm, continue; } @@ -1227,10 +1260,17 @@ 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 -@@ -531,6 +531,10 @@ void expand_symtabs_matching +@@ -532,12 +532,17 @@ void expand_symtabs_matching void map_symbol_filenames (symbol_filename_ftype *fun, void *data, int need_fullname); ++ + /* Target-agnostic function to load the sections of an executable into memory. + + ARGS should be in the form "EXECUTABLE [OFFSET]", where OFFSET is an + optional offset to apply to each section. */ + extern void generic_load (const char *args, int from_tty); + +/* 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); @@ -1289,10 +1329,10 @@ diff --git a/gdb/testsuite/gdb.base/new-ui-pending-input.exp b/gdb/testsuite/gdb diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp -@@ -1716,6 +1716,16 @@ proc default_gdb_start { } { - warning "Couldn't set the width to 0." +@@ -1891,6 +1891,17 @@ proc default_gdb_start { } { } } + + # Turn off the missing warnings as the testsuite does not expect it. + send_gdb "set build-id-verbose 0\n" + gdb_expect 10 { @@ -1303,9 +1343,10 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp + warning "Could not disable the missing debug infos warnings.." + } + } ++ + gdb_debug_init return 0 } - diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp --- a/gdb/testsuite/lib/mi-support.exp +++ b/gdb/testsuite/lib/mi-support.exp @@ -1326,4 +1367,3 @@ diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp if { $separate_inferior_pty } { mi_create_inferior_pty - diff --git a/gdb-6.6-bz229517-gcore-without-terminal.patch b/gdb-6.6-bz229517-gcore-without-terminal.patch index f0eaf8a32788deccbe044ed12a16ef243457b989..1b7756eab9a268436190ac7f3644104d80bad283 100644 --- a/gdb-6.6-bz229517-gcore-without-terminal.patch +++ b/gdb-6.6-bz229517-gcore-without-terminal.patch @@ -1,11 +1,3 @@ -2007-04-22 Jan Kratochvil - - * gdb_gcore.sh: Redirect GDB from ` - - * gdb.base/gcorebg.exp, gdb.base/gcorebg.c: New files. - diff --git a/gdb/testsuite/gdb.base/gcorebg.c b/gdb/testsuite/gdb.base/gcorebg.c new file mode 100644 --- /dev/null @@ -178,4 +170,3 @@ new file mode 100644 + +set env(PATH) $oldpath +remote_file target delete "./gdb" - diff --git a/gdb-6.6-bz230000-power6-disassembly-test.patch b/gdb-6.6-bz230000-power6-disassembly-test.patch index 417ab4470232f509839ab925374a1a855a014220..cf225239ec93a54ee2ada99fd6a1541e4ca050c4 100644 --- a/gdb-6.6-bz230000-power6-disassembly-test.patch +++ b/gdb-6.6-bz230000-power6-disassembly-test.patch @@ -1,9 +1,3 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000 - -The original testcase - https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=230000#c1 -requires too recent GCC. - diff --git a/gdb/testsuite/gdb.arch/powerpc-power6.exp b/gdb/testsuite/gdb.arch/powerpc-power6.exp new file mode 100644 --- /dev/null @@ -84,4 +78,3 @@ new file mode 100644 + .long 0xfc020444 /* ddivq f0,f2,f0 */ + .long 0xec820d04 /* dcmpu cr1,f2,f1 */ + .long 0xfc820504 /* dcmpuq cr1,f2,f0 */ - diff --git a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch index df7426be932f5b2a87d5d4b6be7d3b01089cae00..b1d405ae29b52335f8094b6848088b86e67c2881 100644 --- a/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +++ b/gdb-6.6-bz237572-ppc-atomic-sequence-test.patch @@ -1,8 +1,3 @@ -2007-06-25 Jan Kratochvil - - * gdb.threads/atomic-seq-threaded.c, - gdb.threads/atomic-seq-threaded.exp: New files. - diff --git a/gdb/testsuite/gdb.threads/atomic-seq-threaded.c b/gdb/testsuite/gdb.threads/atomic-seq-threaded.c new file mode 100644 --- /dev/null @@ -268,4 +263,3 @@ new file mode 100644 +gdb_test "c" \ + ".*Program exited normally\\..*" \ + "run till program exit" - diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch deleted file mode 100644 index 804eb8e255d95038b36acddd127b4ededab04b3b..0000000000000000000000000000000000000000 --- a/gdb-6.6-scheduler_locking-step-is-default.patch +++ /dev/null @@ -1,71 +0,0 @@ -diff --git a/gdb/infrun.c b/gdb/infrun.c ---- a/gdb/infrun.c -+++ b/gdb/infrun.c -@@ -2075,7 +2075,7 @@ static const char *const scheduler_enums[] = { - schedlock_replay, - NULL - }; --static const char *scheduler_mode = schedlock_replay; -+static const char *scheduler_mode = schedlock_step; - static void - show_scheduler_mode (struct ui_file *file, int from_tty, - struct cmd_list_element *c, const char *value) -diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp ---- a/gdb/testsuite/gdb.mi/mi-cli.exp -+++ b/gdb/testsuite/gdb.mi/mi-cli.exp -@@ -199,7 +199,7 @@ mi_expect_stop "breakpoint-hit" "main" "" ".*basics.c" \ - # Test that the token is output even for CLI commands - # Also test that *stopped includes frame information. - mi_gdb_test "34 next" \ -- ".*34\\\^running.*\\*running,thread-id=\"all\"" \ -+ ".*34\\\^running.*\\*running,thread-id=\"1\"" \ - "34 next: run" - - # Test that the new current source line is output to the console -diff --git a/gdb/testsuite/gdb.mi/mi-console.exp b/gdb/testsuite/gdb.mi/mi-console.exp ---- a/gdb/testsuite/gdb.mi/mi-console.exp -+++ b/gdb/testsuite/gdb.mi/mi-console.exp -@@ -60,6 +60,9 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb - - mi_run_to_main - -+# thread-id=\"all\" vs. thread-id=\"1\" below: -+mi_gdb_test "210-gdb-set scheduler-locking off" "210\\^done" "set scheduler-locking off" -+ - # The output we get from the target depends on how it is hosted. If - # we are semihosted (e.g., the sim or a remote target that supports - # the File I/O remote protocol extension), we see the target I/O -diff --git a/gdb/testsuite/gdb.mi/mi-logging.exp b/gdb/testsuite/gdb.mi/mi-logging.exp ---- a/gdb/testsuite/gdb.mi/mi-logging.exp -+++ b/gdb/testsuite/gdb.mi/mi-logging.exp -@@ -53,7 +53,7 @@ close $chan - - set mi_log_prompt "\[(\]gdb\[)\] \[\r\n\]+" - --if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { -+if [regexp "\\^done\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { - pass "log file contents" - } else { - fail "log file contents" -@@ -76,7 +76,7 @@ set chan [open $milogfile] - set logcontent [read $chan] - close $chan - --if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"all\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { -+if [regexp "1001\\^done\[\r\n\]+$mi_log_prompt.*1002\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt.*1003\\^running\[\r\n\]+\\*running,thread-id=\"1\"\[\r\n\]+$mi_log_prompt\\*stopped,reason=\"end-stepping-range\",.*\[\r\n\]+$mi_log_prompt" $logcontent] { - pass "redirect log file contents" - } else { - fail "redirect log file contents" -diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp ---- a/gdb/testsuite/gdb.opt/inline-cmds.exp -+++ b/gdb/testsuite/gdb.opt/inline-cmds.exp -@@ -331,7 +331,7 @@ proc mi_cli_step {cli_output_re message} { - - send_gdb "interpreter-exec console \"step\"\n" - gdb_expect { -- -re "\\^running\r\n\\*running,thread-id=\"all\"\r\n${mi_gdb_prompt}${cli_output_re}" { -+ -re "\\^running\r\n\\*running,thread-id=\"1\"\r\n${mi_gdb_prompt}${cli_output_re}" { - pass $message - } - timeout { - diff --git a/gdb-6.6-testsuite-timeouts.patch b/gdb-6.6-testsuite-timeouts.patch index 07747caa55e04b9df2185ff097736418f973dca9..9634bec8347d92ab4e1f1948238f710a5ce9bb2e 100644 --- a/gdb-6.6-testsuite-timeouts.patch +++ b/gdb-6.6-testsuite-timeouts.patch @@ -22,4 +22,3 @@ diff --git a/gdb/testsuite/gdb.base/annota3.exp b/gdb/testsuite/gdb.base/annota3 # The commands we test here produce many lines of output; disable "press # to continue" prompts. gdb_test_no_output "set height 0" - diff --git a/gdb-6.7-charsign-test.patch b/gdb-6.7-charsign-test.patch index 87b1242a36a0070f96fe3fa783d621b76be93def..5a5531692d8e1b30fade8f014fa4c91832d19521 100644 --- a/gdb-6.7-charsign-test.patch +++ b/gdb-6.7-charsign-test.patch @@ -1,15 +1,3 @@ -https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224128 - -2007-01-25 Jan Kratochvil - - * gdb.base/charsign.exp, gdb.base/charsign.c: New files. - [ stripped ] - -2007-10-19 Jan Kratochvil - - Port to GDB-6.7 - only the testcase left, patch has been reverted, - char-vectors restricted. - diff --git a/gdb/testsuite/gdb.base/charsign.c b/gdb/testsuite/gdb.base/charsign.c new file mode 100644 --- /dev/null @@ -120,4 +108,3 @@ new file mode 100644 +do_test {} +do_test {-fsigned-char} +do_test {-funsigned-char} - diff --git a/gdb-6.7-ppc-clobbered-registers-O2-test.patch b/gdb-6.7-ppc-clobbered-registers-O2-test.patch index 75e8740ee28a28eff0c84ac2bd0adc1319d2a10a..832b9499b0ac5a8a9ae98b04d53b3b1468e9966a 100644 --- a/gdb-6.7-ppc-clobbered-registers-O2-test.patch +++ b/gdb-6.7-ppc-clobbered-registers-O2-test.patch @@ -1,18 +1,3 @@ -2007-11-04 Jan Kratochvil - - * gdb.arch/ppc-clobbered-registers-O2.exp: `powerpc64' changed to - `powerpc*'. - -Testcase for: - -http://sourceware.org/ml/gdb-patches/2007-09/msg00228.html - -2007-10-21 Luis Machado - - * rs6000-tdep.c (ppc_dwarf2_frame_init_reg): New function. - * (rs6000_gdbarch_init): Install ppc_dwarf2_frame_init_reg as - default dwarf2_frame_set_init_reg function. - diff --git a/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c b/gdb/testsuite/gdb.arch/ppc-clobbered-registers-O2.c new file mode 100644 --- /dev/null @@ -98,4 +83,3 @@ new file mode 100644 + +gdb_test backtrace ".*operand0=.*operand1=.*" \ + "Check value of call clobbered registers" - diff --git a/gdb-6.7-testsuite-stable-results.patch b/gdb-6.7-testsuite-stable-results.patch index 0585906abee71aea4878a2e67a742931cabadfc8..64ef4d34966f29c55596dd0276b75ba40d11c8e4 100644 --- a/gdb-6.7-testsuite-stable-results.patch +++ b/gdb-6.7-testsuite-stable-results.patch @@ -1,22 +1,3 @@ -gdb/testsuite/gdb.base/fileio.c: -gdb/testsuite/gdb.base/fileio.exp: -2007-12-08 Jan Kratochvil - - * gdb.base/fileio.c (ROOTSUBDIR): New macro. - (main): CHDIR into ROOTSUBDIR. CHOWN ROOTSUBDIR and CHDIR into - ROOTSUBDIR if we are being run as root. - * gdb.base/fileio.exp: Change the startup and finish cleanup. - Change the test file reference to be into the `fileio.dir' directory. - -sources/gdb/testsuite/gdb.base/dump.exp: -Found on RHEL-5.s390x. - -gdb-6.8.50.20090209/gdb/testsuite/gdb.base/auxv.exp: -random FAIL: gdb.base/auxv.exp: matching auxv data from live and gcore - -gdb-6.8.50.20090209/gdb/testsuite/gdb.base/annota1.exp: -frames-invalid can happen asynchronously. - diff --git a/gdb/testsuite/gdb.base/fileio.c b/gdb/testsuite/gdb.base/fileio.c --- a/gdb/testsuite/gdb.base/fileio.c +++ b/gdb/testsuite/gdb.base/fileio.c @@ -94,4 +75,3 @@ diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.e set timeout $oldtimeout return 0 - diff --git a/gdb-6.8-bz436037-reg-no-longer-active.patch b/gdb-6.8-bz436037-reg-no-longer-active.patch deleted file mode 100644 index 8dab2bbe534a7a44ca950912a44f144ec4cb3d28..0000000000000000000000000000000000000000 --- a/gdb-6.8-bz436037-reg-no-longer-active.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/gdb/valops.c b/gdb/valops.c ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -1092,6 +1092,8 @@ value_assign (struct value *toval, struct value *fromval) - struct gdbarch *gdbarch; - int value_reg; - -+ value_reg = VALUE_REGNUM (toval); -+ - /* Figure out which frame this is in currently. - - We use VALUE_FRAME_ID for obtaining the value's frame id instead of -@@ -1101,8 +1103,14 @@ value_assign (struct value *toval, struct value *fromval) - frame. */ - frame = frame_find_by_id (VALUE_FRAME_ID (toval)); - -- value_reg = VALUE_REGNUM (toval); -- -+ /* "set $reg+=1" should work on programs with no debug info, -+ but frame_find_by_id returns NULL here (RH bug 436037). -+ Use current frame, it represents CPU state in this case. -+ If frame_find_by_id is changed to do it internally -+ (it is contemplated there), remove this. */ -+ if (!frame) -+ frame = get_current_frame (); -+ /* Probably never happens. */ - if (!frame) - error (_("Value being assigned to is no longer active.")); - - diff --git a/gdb-6.8-bz442765-threaded-exec-test.patch b/gdb-6.8-bz442765-threaded-exec-test.patch index 651a19c51b7807d38a517dc196490dca45ad9218..a2d3d8f83201c08805f588133e8b906d9f3642f4 100644 --- a/gdb-6.8-bz442765-threaded-exec-test.patch +++ b/gdb-6.8-bz442765-threaded-exec-test.patch @@ -1,5 +1,3 @@ -Test various forms of threads tracking across exec(2). - diff --git a/gdb/testsuite/gdb.threads/threaded-exec.c b/gdb/testsuite/gdb.threads/threaded-exec.c --- a/gdb/testsuite/gdb.threads/threaded-exec.c +++ b/gdb/testsuite/gdb.threads/threaded-exec.c @@ -171,4 +169,3 @@ diff --git a/gdb/testsuite/gdb.threads/threaded-exec.exp b/gdb/testsuite/gdb.thr gdb_test_multiple {} "Program exited" { -re "\r\n\\\[Inferior .* exited normally\\\]\r\n$gdb_prompt $" { - diff --git a/gdb-6.8-bz466901-backtrace-full-prelinked.patch b/gdb-6.8-bz466901-backtrace-full-prelinked.patch index 33498b376dcccfad8b17c43ab10277228a9067e9..78725fd0863ad720d230fcfea52af89cea319a14 100644 --- a/gdb-6.8-bz466901-backtrace-full-prelinked.patch +++ b/gdb-6.8-bz466901-backtrace-full-prelinked.patch @@ -1,5 +1,3 @@ -Fix resolving of variables at locations lists in prelinked libs (BZ 466901). - diff --git a/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S b/gdb/testsuite/gdb.dwarf2/dw2-loclist-prelinked-func.S new file mode 100644 --- /dev/null @@ -471,4 +469,3 @@ new file mode 100644 + +# `abort' can get expressed as `*__GI_abort'. +gdb_test "bt full" "in \[^ \]*abort \\(.*in func \\(.*\r\n\[\t \]+i = -?\[0-9\].*in main \\(.*" "Backtrace after abort()" - diff --git a/gdb-6.8-quit-never-aborts.patch b/gdb-6.8-quit-never-aborts.patch index f42719bfe05088cd5d2a3b12e5518ac74b5865fa..d6e87c65285209d243ee5994e15a1408687499cd 100644 --- a/gdb-6.8-quit-never-aborts.patch +++ b/gdb-6.8-quit-never-aborts.patch @@ -1,10 +1,3 @@ -We may abort the process of detaching threads with multiple SIGINTs - which are -being sent during a testcase terminating its child GDB. - -Some of the threads may not be properly PTRACE_DETACHed which hurts if they -should have been detached with SIGSTOP (as they are accidentally left running -on the debugger termination). - diff --git a/gdb/defs.h b/gdb/defs.h --- a/gdb/defs.h +++ b/gdb/defs.h @@ -22,7 +15,7 @@ diff --git a/gdb/defs.h b/gdb/defs.h diff --git a/gdb/extension.c b/gdb/extension.c --- a/gdb/extension.c +++ b/gdb/extension.c -@@ -820,6 +820,11 @@ check_quit_flag (void) +@@ -823,6 +823,11 @@ check_quit_flag (void) int i, result = 0; const struct extension_language_defn *extlang; @@ -37,7 +30,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 -@@ -1626,7 +1626,13 @@ quit_force (int *exit_arg, int from_tty) +@@ -1703,7 +1703,13 @@ quit_force (int *exit_arg, int from_tty) qt.from_tty = from_tty; @@ -50,13 +43,13 @@ diff --git a/gdb/top.c b/gdb/top.c +#endif /* Get out of tfind mode, and kill or detach all inferiors. */ - TRY + try diff --git a/gdb/utils.c b/gdb/utils.c --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -100,6 +100,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time; +@@ -102,6 +102,13 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time; - static int debug_timestamp = 0; + static bool debug_timestamp = false; +#ifdef NEED_DETACH_SIGSTOP +/* Nonzero means we are already processing the quitting cleanups and we should @@ -65,7 +58,6 @@ diff --git a/gdb/utils.c b/gdb/utils.c +int quit_flag_cleanup; +#endif + - /* Nonzero means that strings with character values >0x7F should be printed - as octal escapes. Zero means just print the value (e.g. it's an + /* True means that strings with character values >0x7F should be printed + as octal escapes. False means just print the value (e.g. it's an international character, and the terminal or window can cope.) */ - diff --git a/gdb-8.3.1.tar.xz b/gdb-9.2.tar.xz similarity index 67% rename from gdb-8.3.1.tar.xz rename to gdb-9.2.tar.xz index c4a4cdaca0c0613d70d88b4b0dc95e03c4c21daf..45c82f8603527b34338db5f4b3475f168f0feeb0 100644 Binary files a/gdb-8.3.1.tar.xz and b/gdb-9.2.tar.xz differ diff --git a/gdb-archer-next-over-throw-cxx-exec.patch b/gdb-archer-next-over-throw-cxx-exec.patch index 38751e49336fb7af15a6d9d3015e580829db1acb..9afd7d79f46d101d5a84a4544e0f9d24da8be001 100644 --- a/gdb-archer-next-over-throw-cxx-exec.patch +++ b/gdb-archer-next-over-throw-cxx-exec.patch @@ -1,6 +1,3 @@ -Archer-upstreamed: -http://sourceware.org/ml/archer/2010-q2/msg00031.html - diff --git a/gdb/testsuite/gdb.cp/cxxexec.cc b/gdb/testsuite/gdb.cp/cxxexec.cc new file mode 100644 --- /dev/null @@ -78,4 +75,3 @@ new file mode 100644 +# Run to end. The buggy GDB failed instead with: +# Cannot access memory at address ADDR. +gdb_continue_to_end "" "continue" 1 - diff --git a/gdb-archer-pie-addons-keep-disabled.patch b/gdb-archer-pie-addons-keep-disabled.patch index 338d0dc4751b935a534857cc9668e90a2d4f604d..0f8a3516aae7bdd178c3731da8c89ab3a1a82c3d 100644 --- a/gdb-archer-pie-addons-keep-disabled.patch +++ b/gdb-archer-pie-addons-keep-disabled.patch @@ -1,7 +1,7 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -15441,6 +15441,50 @@ static struct cmd_list_element *enablebreaklist = NULL; +@@ -15396,6 +15396,51 @@ static struct cmd_list_element *enablebreaklist = NULL; cmd_list_element *commands_cmd_element = nullptr; @@ -45,17 +45,18 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c + } + + if (changed) -+ qsort (bp_locations, bp_locations_count, sizeof (*bp_locations), -+ bp_locations_compare); ++ std::sort (bp_locations, bp_locations + bp_locations_count, ++ bp_location_is_less_than); +} + ++void _initialize_breakpoint (void); void _initialize_breakpoint (void) { diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h -@@ -1664,6 +1664,9 @@ extern const char *ep_parse_optional_if_clause (const char **arg); +@@ -1696,6 +1696,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); @@ -68,7 +69,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, +@@ -816,6 +816,11 @@ objfile_relocate1 (struct objfile *objfile, obj_section_addr (s)); } @@ -80,4 +81,15 @@ diff --git a/gdb/objfiles.c b/gdb/objfiles.c /* Data changed. */ return 1; } - +diff --git a/gdb/value.c b/gdb/value.c +--- a/gdb/value.c ++++ b/gdb/value.c +@@ -2840,7 +2840,7 @@ value_static_field (struct type *type, int fieldno) + case FIELD_LOC_KIND_PHYSADDR: + retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), + TYPE_FIELD_STATIC_PHYSADDR (type, fieldno) +- + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))])); ++ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); + break; + case FIELD_LOC_KIND_PHYSNAME: + { diff --git a/gdb-archer-pie-addons.patch b/gdb-archer-pie-addons.patch index 2152aa0fb04002b28c2545f3f88b2437bbac61e8..934bb2fd02f057374a8d6f88965bf512aeba7367 100644 --- a/gdb-archer-pie-addons.patch +++ b/gdb-archer-pie-addons.patch @@ -1,7 +1,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -507,6 +507,7 @@ enum field_loc_kind +@@ -516,6 +516,7 @@ enum field_loc_kind { FIELD_LOC_KIND_BITPOS, /**< bitpos */ FIELD_LOC_KIND_ENUMVAL, /**< enumval */ @@ -9,7 +9,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 */ -@@ -558,6 +559,7 @@ union field_location +@@ -566,6 +567,7 @@ union field_location field. Otherwise, physname is the mangled label of the static field. */ @@ -17,7 +17,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h CORE_ADDR physaddr; const char *physname; -@@ -1436,6 +1438,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1474,6 +1476,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) @@ -25,7 +25,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) \ -@@ -1447,6 +1450,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1485,6 +1488,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)) @@ -33,7 +33,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)) -@@ -1463,6 +1467,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *); +@@ -1501,6 +1505,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)) @@ -44,14 +44,13 @@ 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 -@@ -2827,7 +2827,8 @@ value_static_field (struct type *type, int fieldno) +@@ -2839,7 +2839,8 @@ value_static_field (struct type *type, int fieldno) { case FIELD_LOC_KIND_PHYSADDR: retval = value_at_lazy (TYPE_FIELD_TYPE (type, fieldno), - TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)); + TYPE_FIELD_STATIC_PHYSADDR (type, fieldno) -+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type))))); ++ + (TYPE_OBJFILE (type) == NULL ? 0 : TYPE_OBJFILE (type)->section_offsets[SECT_OFF_TEXT (TYPE_OBJFILE (type))])); break; case FIELD_LOC_KIND_PHYSNAME: { - diff --git a/gdb-archer-vla-tests.patch b/gdb-archer-vla-tests.patch index ff25c8d3d79a35a35d453445a56ae98881aeee55..7b9057ae325a1c8c1356c970390238bc233a17c9 100644 --- a/gdb-archer-vla-tests.patch +++ b/gdb-archer-vla-tests.patch @@ -1,7 +1,7 @@ diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp --- a/gdb/testsuite/gdb.ada/packed_array.exp +++ b/gdb/testsuite/gdb.ada/packed_array.exp -@@ -56,5 +56,11 @@ gdb_test_multiple "$test" "$test" { +@@ -53,5 +53,11 @@ gdb_test_multiple "$test" "$test" { # are. Observed with (FSF GNU Ada 4.5.3 20110124). xfail $test } @@ -2797,7 +2797,7 @@ new file mode 100644 +gdb_breakpoint [gdb_get_line_number "varx-allocated"] +gdb_continue_to_breakpoint "varx-allocated" +# $1 = (( ( 0, 0, 0, 0, 0, 0) ( 0, 0, 0, 0, 0, 0) --- , 0) ) ( ( 0, 0, ...) ...) ...) -+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx allocated" ++gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4), allocatable \\(6,5:15,17:28\\)" "ptype varx allocated" +# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. +gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varx allocated" + @@ -2824,7 +2824,7 @@ new file mode 100644 +gdb_test "p varv(3, 7, 19)" "\\$\[0-9\]* = 6" "p varv(3, 7, 19) associated" +# Intel Fortran Compiler 10.1.008 uses -1 there, GCC uses 1. +gdb_test "p l" "\\$\[0-9\]* = (\\.TRUE\\.|4294967295)" "p l if varv associated" -+gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)" "ptype varx with varv associated" ++gdb_test "ptype varx" "type = real(\\(kind=4\\)|\\*4), allocatable \\(6,5:15,17:28\\)" "ptype varx with varv associated" +# Intel Fortran Compiler 10.1.008 uses the pointer type. +gdb_test "ptype varv" "type = (PTR TO -> \\( )?real(\\(kind=4\\)|\\*4) \\(6,5:15,17:28\\)\\)?" "ptype varv associated" + @@ -2845,7 +2845,7 @@ new file mode 100644 +gdb_breakpoint [gdb_get_line_number "varx-deallocated"] +gdb_continue_to_breakpoint "varx-deallocated" +gdb_test "p varx" "\\$\[0-9\]* = " "p varx deallocated" -+gdb_test "ptype varx" {type = real\(kind=4\) \(:,:,:\)} "ptype varx deallocated" ++gdb_test "ptype varx" {type = real\(kind=4\), allocatable \(:,:,:\)} "ptype varx deallocated" +gdb_test "p l" "\\$\[0-9\]* = \\.FALSE\\." "p l if varx deallocated" +gdb_test "p varx(1,5,17)" {no such vector element \(vector not allocated\)} "p varx(1,5,17) deallocated" +gdb_test "ptype varx(1,5,17)" {no such vector element \(vector not allocated\)} "ptype varx(1,5,17) deallocated" @@ -3683,7 +3683,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -170,6 +170,11 @@ proc gdb_unload {} { - send_gdb "y\n" + send_gdb "y\n" answer exp_continue } + -re "A program is being debugged already..*Are you sure you want to change the file.*y or n. $"\ @@ -3692,7 +3692,7 @@ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp + exp_continue + } -re "Discard symbol table from .*y or n.*$" { - send_gdb "y\n" + send_gdb "y\n" answer exp_continue diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp --- a/gdb/testsuite/lib/pascal.exp @@ -3728,4 +3728,3 @@ diff --git a/gdb/testsuite/lib/pascal.exp b/gdb/testsuite/lib/pascal.exp } set pascal_init_done 1 } - diff --git a/gdb-archer.patch b/gdb-archer.patch index 575b70b10c9e82cad47ef47f62f2f89cfc2bc243..e457fbfd735ff56a4ae16d20963b647e4408a856 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -1,27 +1,3 @@ -http://sourceware.org/gdb/wiki/ProjectArcher -http://sourceware.org/gdb/wiki/ArcherBranchManagement - -GIT snapshot: -commit 718a1618b2f691a7f407213bb50f100ac59f91c3 - -tromey/python - -diff --git a/gdb/Makefile.in b/gdb/Makefile.in ---- a/gdb/Makefile.in -+++ b/gdb/Makefile.in -@@ -2082,6 +2082,12 @@ stamp-h: $(srcdir)/config.in config.status - CONFIG_LINKS= \ - $(SHELL) config.status - -+.gdbinit: $(srcdir)/gdbinit.in config.status -+ CONFIG_FILES=".gdbinit:gdbinit.in" \ -+ CONFIG_COMMANDS= \ -+ CONFIG_HEADERS= \ -+ $(SHELL) config.status -+ - config.status: $(srcdir)/configure configure.nat configure.tgt configure.host ../bfd/development.sh - $(SHELL) config.status --recheck - diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in @@ -33,47 +9,14 @@ diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in gdb/command/explore.py \ gdb/command/backtrace.py \ gdb/command/frame_filters.py \ -@@ -92,6 +93,8 @@ PYTHON_FILE_LIST = \ +@@ -92,6 +93,7 @@ PYTHON_FILE_LIST = \ gdb/function/as_string.py \ gdb/function/caller_is.py \ gdb/function/strfns.py \ -+ gdb/function/caller_is.py \ + gdb/function/in_scope.py \ gdb/printer/__init__.py \ gdb/printer/bound_registers.py -diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo ---- a/gdb/doc/gdb.texinfo -+++ b/gdb/doc/gdb.texinfo -@@ -1251,6 +1251,16 @@ for remote debugging. - Run using @var{device} for your program's standard input and output. - @c FIXME: kingdon thinks there is more to -tty. Investigate. - -+@item -P -+@cindex @code{-P} -+@itemx --python -+@cindex @code{--python} -+Change interpretation of command line so that the argument immediately -+following this switch is taken to be the name of a Python script file. -+This option stops option processing; subsequent options are passed to -+Python as @code{sys.argv}. This option is only available if Python -+scripting support was enabled when @value{GDBN} was configured. -+ - @c resolve the situation of these eventually - @item -tui - @cindex @code{--tui} -diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi ---- a/gdb/doc/python.texi -+++ b/gdb/doc/python.texi -@@ -90,8 +90,6 @@ containing @code{end}. For example: - - @smallexample - (@value{GDBP}) python --Type python script --End with a line saying just "end". - >print 23 - >end - 23 diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in --- a/gdb/gdb-gdb.gdb.in +++ b/gdb/gdb-gdb.gdb.in @@ -93,173 +36,6 @@ diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in if !$gdb_init_done set variable $gdb_init_done = 1 -diff --git a/gdb/main.c b/gdb/main.c ---- a/gdb/main.c -+++ b/gdb/main.c -@@ -33,6 +33,7 @@ - - #include "interps.h" - #include "main.h" -+#include "python/python.h" - #include "source.h" - #include "cli/cli-cmds.h" - #include "objfiles.h" -@@ -478,7 +479,7 @@ exec_or_core_file_attach (const char *filename, int from_tty) - } - - static void --captured_main_1 (struct captured_main_args *context) -+captured_main_1 (struct captured_main_args *context, int &python_script) - { - int argc = context->argc; - char **argv = context->argv; -@@ -698,10 +699,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}, -+#if HAVE_PYTHON -+ {"python", no_argument, 0, 'P'}, -+ {"P", no_argument, 0, 'P'}, -+#endif - {0, no_argument, 0, 0} - }; - -- while (1) -+ while (!python_script) - { - int option_index; - -@@ -719,6 +724,9 @@ captured_main_1 (struct captured_main_args *context) - case 0: - /* Long option that just sets a flag. */ - break; -+ case 'P': -+ python_script = 1; -+ break; - case OPT_SE: - symarg = optarg; - execarg = optarg; -@@ -898,7 +906,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. */ -- if (set_args) -+ if (python_script) -+ { -+ /* The first argument is a python script to evaluate, and -+ subsequent arguments are passed to the script for -+ processing there. */ -+ if (optind >= argc) -+ { -+ fprintf_unfiltered (gdb_stderr, -+ _("%s: Python script file name required\n"), -+ argv[0]); -+ exit (1); -+ } -+ -+ /* FIXME: should handle inferior I/O intelligently here. -+ E.g., should be possible to run gdb in pipeline and have -+ Python (and gdb) output go to stderr or file; and if a -+ prompt is needed, open the tty. */ -+ quiet = 1; -+ /* FIXME: should read .gdbinit if, and only if, a prompt is -+ requested by the script. Though... maybe this is not -+ ideal? */ -+ /* FIXME: likewise, reading in history. */ -+ inhibit_gdbinit = 1; -+ } -+ else if (set_args) - { - /* The remaining options are the command-line options for the - inferior. The first one is the sym/exec file, and the rest -@@ -1199,7 +1231,8 @@ captured_main_1 (struct captured_main_args *context) - - /* Read in the old history after all the command files have been - read. */ -- init_history (); -+ if (!python_script) -+ init_history (); - - if (batch_flag) - { -@@ -1215,24 +1248,37 @@ static void - captured_main (void *data) - { - struct captured_main_args *context = (struct captured_main_args *) data; -+ int python_script = 0; - -- captured_main_1 (context); -+ captured_main_1 (context, python_script); - -- /* NOTE: cagney/1999-11-07: There is probably no reason for not -- moving this loop and the code found in captured_command_loop() -- into the command_loop() proper. The main thing holding back that -- change - SET_TOP_LEVEL() - has been eliminated. */ -- while (1) -+#if HAVE_PYTHON -+ if (python_script) - { -- TRY -- { -- captured_command_loop (); -- } -- CATCH (ex, RETURN_MASK_ALL) -+ extern int pagination_enabled; -+ pagination_enabled = 0; -+ run_python_script (context->argc - optind, &context->argv[optind]); -+ return; -+ } -+ else -+#endif -+ { -+ /* NOTE: cagney/1999-11-07: There is probably no reason for not -+ moving this loop and the code found in captured_command_loop() -+ into the command_loop() proper. The main thing holding back that -+ change - SET_TOP_LEVEL() - has been eliminated. */ -+ while (1) - { -- exception_print (gdb_stderr, ex); -+ TRY -+ { -+ captured_command_loop (); -+ } -+ CATCH (ex, RETURN_MASK_ALL) -+ { -+ exception_print (gdb_stderr, ex); -+ } -+ END_CATCH - } -- END_CATCH - } - /* No exit -- exit is through quit_command. */ - } -@@ -1275,6 +1321,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\ -+ gdb [options] --args executable-file [inferior-arguments ...]\n"), stream); -+#if HAVE_PYTHON -+ fputs_unfiltered (_("\ -+ gdb [options] [--python|-P] script-file [script-arguments ...]\n"), stream); -+#endif -+ fputs_unfiltered (_("\n\ - gdb [options] --args executable-file [inferior-arguments ...]\n\n\ - "), stream); - fputs_unfiltered (_("\ -@@ -1320,6 +1372,13 @@ Output and user interface control:\n\n\ - #endif - fputs_unfiltered (_("\ - --dbx DBX compatibility mode.\n\ -+"), stream); -+#if HAVE_PYTHON -+ fputs_unfiltered (_("\ -+ --python, -P Following argument is Python script file; remaining\n\ -+ arguments are passed to script.\n"), stream); -+#endif -+ fputs_unfiltered (_("\ - -q, --quiet, --silent\n\ - Do not print version number on startup.\n\n\ - "), stream); diff --git a/gdb/python/lib/gdb/command/ignore_errors.py b/gdb/python/lib/gdb/command/ignore_errors.py new file mode 100644 --- /dev/null @@ -354,177 +130,6 @@ new file mode 100644 + return wanted == found + +InScope () -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 -@@ -709,6 +709,9 @@ private: - PyThreadState *m_save; - }; - -+struct cleanup *ensure_python_env (struct gdbarch *gdbarch, -+ const struct language_defn *language); -+ - extern struct gdbarch *python_gdbarch; - extern const struct language_defn *python_language; - -diff --git a/gdb/python/python.c b/gdb/python/python.c ---- a/gdb/python/python.c -+++ b/gdb/python/python.c -@@ -94,6 +94,8 @@ const struct extension_language_defn extension_language_python = - #include "linespec.h" - #include "source.h" - #include "common/version.h" -+#include "inferior.h" -+#include "gdbthread.h" - #include "target.h" - #include "gdbthread.h" - #include "interps.h" -@@ -235,6 +237,29 @@ gdbpy_enter::~gdbpy_enter () - restore_active_ext_lang (m_previous_active); - } - -+static void -+restore_python_env (void *p) -+{ -+ gdbpy_enter *env = (gdbpy_enter *) p; -+ -+ delete env; -+} -+ -+/* Called before entering the Python interpreter to install the -+ current language and architecture to be used for Python values. -+ Also set the active extension language for GDB so that SIGINT's -+ are directed our way, and if necessary install the right SIGINT -+ handler. */ -+ -+struct cleanup * -+ensure_python_env (struct gdbarch *gdbarch, -+ const struct language_defn *language) -+{ -+ gdbpy_enter *env = new gdbpy_enter (gdbarch, language); -+ -+ return make_cleanup (restore_python_env, env); -+} -+ - /* Set the quit flag. */ - - static void -@@ -1283,6 +1308,92 @@ gdbpy_print_stack_or_quit () - - - -+/* True if 'gdb -P' was used, false otherwise. */ -+static int running_python_script; -+ -+/* True if we are currently in a call to 'gdb.cli', false otherwise. */ -+static int in_cli; -+ -+/* Enter the command loop. */ -+ -+static PyObject * -+gdbpy_cli (PyObject *unused1, PyObject *unused2) -+{ -+ if (! running_python_script || in_cli) -+ return PyErr_Format (PyExc_RuntimeError, "cannot invoke CLI recursively"); -+ -+ if (current_uiout->is_mi_like_p ()) -+ return PyErr_Format (PyExc_RuntimeError, _("Cannot invoke CLI from MI.")); -+ -+ in_cli = 1; -+ /* See captured_command_loop. */ -+ -+ /* Give the interpreter a chance to print a prompt. */ -+ interp_pre_command_loop (top_level_interpreter ()); -+ -+ /* Now it's time to start the event loop. */ -+ start_event_loop (); -+ -+ in_cli = 0; -+ -+ Py_RETURN_NONE; -+} -+ -+/* Set up the Python argument vector and evaluate a script. This is -+ used to implement 'gdb -P'. */ -+ -+void -+run_python_script (int argc, char **argv) -+{ -+ FILE *input; -+ -+ /* We never free this, since we plan to exit at the end. */ -+ ensure_python_env (get_current_arch (), current_language); -+ -+ running_python_script = 1; -+ -+#if PYTHON_ABI_VERSION < 3 -+ PySys_SetArgv (argc - 1, argv + 1); -+#else -+ { -+ wchar_t **wargv = (wchar_t **) alloca (sizeof (*wargv) * (argc + 1)); -+ int i; -+ -+ for (i = 1; i < argc; i++) -+ { -+ size_t len = mbstowcs (NULL, argv[i], 0); -+ /* Python-related GDB sources are built with -DNDEBUG -+ https://sourceware.org/bugzilla/show_bug.cgi?id=20445 */ -+ size_t len2 ATTRIBUTE_UNUSED; -+ -+ if (len == (size_t) -1) -+ { -+ fprintf (stderr, "Invalid multibyte argument #%d \"%s\"\n", -+ i, argv[i]); -+ exit (1); -+ } -+ wargv[i] = (wchar_t *) alloca (sizeof (**wargv) * (len + 1)); -+ len2 = mbstowcs (wargv[i], argv[i], len + 1); -+ assert (len2 == len); -+ } -+ wargv[argc] = NULL; -+ PySys_SetArgv (argc - 1, wargv + 1); -+ } -+#endif -+ -+ input = fopen (argv[0], "r"); -+ if (! input) -+ { -+ fprintf (stderr, "could not open %s: %s\n", argv[0], strerror (errno)); -+ exit (1); -+ } -+ PyRun_SimpleFile (input, argv[0]); -+ fclose (input); -+ exit (0); -+} -+ -+ -+ - /* Return a sequence holding all the Progspaces. */ - - static PyObject * -@@ -1937,6 +2048,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." }, -+ { "cli", gdbpy_cli, METH_NOARGS, -+ "Enter the gdb CLI" }, - { "parameter", gdbpy_parameter, METH_VARARGS, - "Return a gdb parameter's value" }, - -diff --git a/gdb/python/python.h b/gdb/python/python.h ---- a/gdb/python/python.h -+++ b/gdb/python/python.h -@@ -25,7 +25,10 @@ - /* This is all that python exports to gdb. */ - extern const struct extension_language_defn extension_language_python; - -+ - /* Command element for the 'python' command. */ - extern cmd_list_element *python_cmd_element; - -+extern void run_python_script (int argc, char **argv); -+ - #endif /* PYTHON_PYTHON_H */ diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp --- a/gdb/testsuite/gdb.python/py-frame.exp +++ b/gdb/testsuite/gdb.python/py-frame.exp @@ -540,7 +145,7 @@ diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp -@@ -399,6 +399,15 @@ proc test_value_after_death {} { +@@ -419,6 +419,15 @@ proc test_value_after_death {} { "print value's type" } @@ -556,7 +161,7 @@ diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py # Regression test for invalid subscript operations. The bug was that # the type of the value was not being checked before allowing a # subscript operation to proceed. -@@ -585,6 +594,7 @@ test_value_in_inferior +@@ -606,6 +615,7 @@ test_value_in_inferior test_value_from_buffer test_inferior_function_call test_value_after_death @@ -564,34 +169,3 @@ diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py # Test either C or C++ values. -diff --git a/gdb/varobj.c b/gdb/varobj.c ---- a/gdb/varobj.c -+++ b/gdb/varobj.c -@@ -217,6 +217,14 @@ is_root_p (const struct varobj *var) - } - - #ifdef HAVE_PYTHON -+/* Helper function to install a Python environment suitable for -+ use during operations on VAR. */ -+struct cleanup * -+varobj_ensure_python_env (const struct varobj *var) -+{ -+ return ensure_python_env (var->root->exp->gdbarch, -+ var->root->exp->language_defn); -+} - - /* See python-internal.h. */ - gdbpy_enter_varobj::gdbpy_enter_varobj (const struct varobj *var) -diff --git a/gdb/varobj.h b/gdb/varobj.h ---- a/gdb/varobj.h -+++ b/gdb/varobj.h -@@ -328,6 +328,8 @@ extern bool varobj_has_more (const struct varobj *var, int to); - - extern bool varobj_is_dynamic_p (const struct varobj *var); - -+extern struct cleanup *varobj_ensure_python_env (const struct varobj *var); -+ - extern bool varobj_default_value_is_changeable_p (const struct varobj *var); - extern bool varobj_value_is_changeable_p (const struct varobj *var); - - diff --git a/gdb-attach-fail-reasons-5of5.patch b/gdb-attach-fail-reasons-5of5.patch index cfcf1830b550d28d6d2d7f13d5dfeae81cf272bf..89e1953451ffb85a0d9a7f0fcd16ba5c044297b5 100644 --- a/gdb-attach-fail-reasons-5of5.patch +++ b/gdb-attach-fail-reasons-5of5.patch @@ -1,43 +1,7 @@ -http://sourceware.org/ml/gdb-patches/2012-03/msg00171.html - -Hi, - -and here is the last bit for new SELinux 'deny_ptrace': - https://bugzilla.redhat.com/show_bug.cgi?id=786878 - -As even PTRACE_TRACEME fails in such case it needs to install hook for even -that event. - -Thanks, -Jan - -gdb/ -2012-03-06 Jan Kratochvil - - * common/linux-ptrace.c [HAVE_SELINUX_SELINUX_H]: include - selinux/selinux.h. - (linux_ptrace_attach_warnings): Call linux_ptrace_create_warnings. - (linux_ptrace_create_warnings): New. - * common/linux-ptrace.h (linux_ptrace_create_warnings): New declaration. - * config.in: Regenerate. - * configure: Regenerate. - * configure.ac: Check selinux/selinux.h and the selinux library. - * inf-ptrace.c (inf_ptrace_me): Check the ptrace result. - * linux-nat.c (linux_nat_create_inferior): New variable ex. Wrap - to_create_inferior into TRY_CATCH, call linux_ptrace_create_warnings. - -gdb/gdbserver/ - * config.in: Regenerate. - * configure: Regenerate. - * configure.ac: Check selinux/selinux.h and the selinux library. - * linux-low.c (linux_traceme): New function. - (linux_create_inferior, linux_tracefork_child): Call it instead of - direct ptrace. - diff --git a/gdb/config.in b/gdb/config.in --- a/gdb/config.in +++ b/gdb/config.in -@@ -267,6 +267,9 @@ +@@ -251,6 +251,9 @@ /* Define if librpm library is being used. */ #undef HAVE_LIBRPM @@ -47,7 +11,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 -@@ -390,6 +393,9 @@ +@@ -386,6 +389,9 @@ /* Define to 1 if you have the `scm_new_smob' function. */ #undef HAVE_SCM_NEW_SMOB @@ -60,7 +24,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 -@@ -15898,6 +15898,64 @@ cat >>confdefs.h <<_ACEOF +@@ -16434,6 +16434,64 @@ cat >>confdefs.h <<_ACEOF _ACEOF @@ -128,7 +92,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 -@@ -2051,6 +2051,10 @@ case $host_os in +@@ -1964,6 +1964,10 @@ case $host_os in esac AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.]) @@ -142,9 +106,9 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in --- a/gdb/gdbserver/config.in +++ b/gdb/gdbserver/config.in -@@ -126,6 +126,9 @@ - /* Define to 1 if you have the `mcheck' library (-lmcheck). */ - #undef HAVE_LIBMCHECK +@@ -125,6 +125,9 @@ + /* Define to 1 if you have the `dl' library (-ldl). */ + #undef HAVE_LIBDL +/* Define to 1 if you have the `selinux' library (-lselinux). */ +#undef HAVE_LIBSELINUX @@ -152,7 +116,7 @@ diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in /* Define if the target supports branch tracing. */ #undef HAVE_LINUX_BTRACE -@@ -202,6 +205,9 @@ +@@ -210,6 +213,9 @@ /* Define to 1 if you have the `pwrite' function. */ #undef HAVE_PWRITE @@ -165,7 +129,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 -@@ -8589,6 +8589,64 @@ if $want_ipa ; then +@@ -9398,6 +9398,64 @@ if $want_ipa ; then fi fi @@ -233,7 +197,7 @@ diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac --- a/gdb/gdbserver/configure.ac +++ b/gdb/gdbserver/configure.ac -@@ -478,6 +478,10 @@ if $want_ipa ; then +@@ -465,6 +465,10 @@ if $want_ipa ; then fi fi @@ -247,7 +211,7 @@ diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c -@@ -967,7 +967,16 @@ linux_ptrace_fun () +@@ -968,7 +968,16 @@ linux_ptrace_fun () { if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0) < 0) @@ -268,22 +232,21 @@ 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 -@@ -1099,7 +1099,17 @@ linux_nat_target::create_inferior (const char *exec_file, +@@ -1092,7 +1092,16 @@ linux_nat_target::create_inferior (const char *exec_file, /* Make sure we report all signals during startup. */ pass_signals ({}); - inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty); -+ TRY ++ try + { + inf_ptrace_target::create_inferior (exec_file, allargs, env, from_tty); + } -+ CATCH (ex, RETURN_MASK_ERROR) ++ catch (const gdb_exception_error &ex) + { + std::string result = linux_ptrace_create_warnings (); + -+ throw_error (ex.error, "%s%s", result.c_str (), ex.message); ++ throw_error (ex.error, "%s%s", result.c_str (), ex.message->c_str ()); + } -+ END_CATCH } /* Callback for linux_proc_attach_tgid_threads. Attach to PTID if not @@ -347,4 +310,3 @@ diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h extern void linux_check_ptrace_features (void); extern void linux_enable_event_reporting (pid_t pid, int attached); extern void linux_disable_event_reporting (pid_t pid); - diff --git a/gdb-btrobust.patch b/gdb-btrobust.patch index 7c5eafaa392e4e78f460eb49b9ff99d24780c114..6d857da9d9bdee32d5d76c027afcbe948f42f55b 100644 --- a/gdb-btrobust.patch +++ b/gdb-btrobust.patch @@ -1,12 +1,7 @@ -This should fix the error with glib. An error message will still be -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 -@@ -1139,6 +1139,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1204,6 +1204,7 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, htab_eq_pointer, NULL)); @@ -14,7 +9,7 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c while (true) { gdbpy_ref<> item (PyIter_Next (iterable.get ())); -@@ -1147,8 +1148,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1212,8 +1213,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, { if (PyErr_Occurred ()) { @@ -25,7 +20,7 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c } break; } -@@ -1181,7 +1182,8 @@ gdbpy_apply_frame_filter (const struct extension_language_defn *extlang, +@@ -1245,7 +1246,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) @@ -35,4 +30,3 @@ diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c } return success; - diff --git a/gdb-bz1219747-attach-kills.patch b/gdb-bz1219747-attach-kills.patch index 6dc27e79066cb97e57f24205c158d987ea4fda98..c4e7d2ba916999dd9681cb2992641a653144a25d 100644 --- a/gdb-bz1219747-attach-kills.patch +++ b/gdb-bz1219747-attach-kills.patch @@ -1,78 +1,7 @@ -http://sourceware.org/ml/gdb-patches/2015-10/msg00301.html - -Hi, - -in some cases with deleted main executable GDB will want to kill the inferior. - -$ cp /bin/sleep /tmp/sleep;/tmp/sleep 1h&p=$! -$ rm /tmp/sleep -$ gdb /tmp/sleep $p -GNU gdb (GDB) 7.10.50.20151016-cvs -/tmp/sleep: No such file or directory. -Attaching to process 9694 -/tmp/sleep (deleted): No such file or directory. -A program is being debugged already. Kill it? (y or n) _ - -The first attachment of "/tmp/sleep" commandline argument errors at: - -267 if (scratch_chan < 0) -268 perror_with_name (filename); -1051 if (catch_command_errors_const (exec_file_attach, execarg, -1052 !batch_flag)) - -Then GDB tries to attach to the process $p: - -1082 if (catch_command_errors (attach_command, pid_or_core_arg, -1083 !batch_flag) == 0) - -This succeeds and since this moment GDB has a valid inferior. But despite that -the lines -1082 if (catch_command_errors (attach_command, pid_or_core_arg, -1083 !batch_flag) == 0) -still fail because consequently attach_command() fails to find the associated -executable file: - -267 if (scratch_chan < 0) -268 perror_with_name (filename); -1082 if (catch_command_errors (attach_command, pid_or_core_arg, -1083 !batch_flag) == 0) - -and therefore GDB executes the following: - -(gdb) bt -2179 if (have_inferiors ()) -2180 { -2181 if (!from_tty -2182 || !have_live_inferiors () -2183 || query (_("A program is being debugged already. Kill it? "))) -2184 iterate_over_inferiors (dispose_inferior, NULL); -2185 else -2186 error (_("Program not killed.")); -2187 } -1084 catch_command_errors (core_file_command, pid_or_core_arg, -1085 !batch_flag); - -No regressions on {x86_64,x86_64-m32,i686}-fedora24pre-linux-gnu. - -Thanks, -Jan - -gdb/ChangeLog -2015-10-16 Jan Kratochvil - - * main.c (captured_main): Run core_file_command for pid_or_core_arg - only if not have_inferiors (). - -gdb/testsuite/ChangeLog -2015-10-16 Jan Kratochvil - - * gdb.base/attach-kills.c: New. - * gdb.base/attach-kills.exp: New. - diff --git a/gdb/main.c b/gdb/main.c --- a/gdb/main.c +++ b/gdb/main.c -@@ -1129,7 +1129,10 @@ captured_main_1 (struct captured_main_args *context) +@@ -1148,7 +1148,10 @@ captured_main_1 (struct captured_main_args *context) { ret = catch_command_errors (attach_command, pid_or_core_arg, !batch_flag); @@ -168,4 +97,3 @@ new file mode 100644 +} + +kill_wait_spawned_process $test_spawn_id - diff --git a/gdb-bz533176-fortran-omp-step.patch b/gdb-bz533176-fortran-omp-step.patch index 7213a4efa65a21141012dfd4504a38b5a902e5f2..1f93fb71bd1f7d24f29e59ff9ab22c53a3e47a1e 100644 --- a/gdb-bz533176-fortran-omp-step.patch +++ b/gdb-bz533176-fortran-omp-step.patch @@ -1,28 +1,7 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4 - -I find it a bug in DWARF and gdb behaves correctly according to it. From the -current DWARF's point of view the is a function call which you skip by "next". - -If you hide any /usr/lib/debug such as using: -gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44' -and use "step" command instead of "next" there it will work. -(You need to hide debuginfo from libgomp as you would step into libgomp sources -to maintain the threads for execution.) - -There should be some DWARF extension for it, currently tried to detect -substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not -consider such sub-function as a skippable by "next". - -Another problem is that with "set scheduler-locking" being "off" (default -upstream) or "step" (default in F/RHEL) the simultaneous execution of the -threads is inconvenient. Setting it to "on" will lockup the debugging as the -threads need to get synchronized at some point. This is a more general -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 -@@ -6499,6 +6499,16 @@ process_event_stop_test (struct execution_control_state *ecs) +@@ -6453,6 +6453,16 @@ process_event_stop_test (struct execution_control_state *ecs) if (ecs->event_thread->control.step_over_calls == STEP_OVER_ALL) { @@ -30,16 +9,16 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c + struct minimal_symbol *stopf = lookup_minimal_symbol_by_pc (stop_pc).minsym; + + if ((stop_fn == NULL -+ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL) ++ || strstr (stop_fn->linkage_name (), ".omp_fn.") == NULL) + /* gcc-4.7.2-9.fc19.x86_64 uses a new format. */ + && (stopf == NULL -+ || strstr (MSYMBOL_LINKAGE_NAME (stopf), "._omp_fn.") == NULL)) ++ || strstr (stopf->linkage_name (), "._omp_fn.") == NULL)) +{ /* ".omp_fn." */ + /* We're doing a "next". Normal (forward) execution: set a breakpoint at the -@@ -6532,6 +6542,7 @@ process_event_stop_test (struct execution_control_state *ecs) +@@ -6486,6 +6496,7 @@ process_event_stop_test (struct execution_control_state *ecs) keep_going (ecs); return; @@ -120,4 +99,3 @@ new file mode 100644 + end do + print *, "success" + end - diff --git a/gdb-bz541866-rwatch-before-run.patch b/gdb-bz541866-rwatch-before-run.patch deleted file mode 100644 index 51a711829c10c45573f556e76007ac8a395d9f59..0000000000000000000000000000000000000000 --- a/gdb-bz541866-rwatch-before-run.patch +++ /dev/null @@ -1,167 +0,0 @@ -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -8773,7 +8773,7 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch, - int enabled, int internal, unsigned flags, - int display_canonical) - { -- int i; -+ int i ATTRIBUTE_UNUSED; - - if (type == bp_hardware_breakpoint) - { -@@ -14271,7 +14271,7 @@ enable_breakpoint_disp (struct breakpoint *bpt, enum bpdisp disposition, - - if (bpt->type == bp_hardware_breakpoint) - { -- int i; -+ int i ATTRIBUTE_UNUSED; - i = hw_breakpoint_used_count (); - target_resources_ok = - target_can_use_hardware_watchpoint (bp_hardware_breakpoint, -diff --git a/gdb/config/i386/nm-linux.h b/gdb/config/i386/nm-linux.h -new file mode 100644 ---- /dev/null -+++ b/gdb/config/i386/nm-linux.h -@@ -0,0 +1,28 @@ -+/* Native support for GNU/Linux i386. -+ -+ Copyright 2010 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 NM_LINUX_H -+#define NM_LINUX_H -+ -+#include "config/nm-linux.h" -+ -+/* Red Hat backward compatibility with gdb-6.8. */ -+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1 -+ -+#endif /* NM_LINUX64_H */ -diff --git a/gdb/config/i386/nm-linux64.h b/gdb/config/i386/nm-linux64.h -new file mode 100644 ---- /dev/null -+++ b/gdb/config/i386/nm-linux64.h -@@ -0,0 +1,28 @@ -+/* Native support for GNU/Linux amd64. -+ -+ Copyright 2010 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 NM_LINUX64_H -+#define NM_LINUX64_H -+ -+#include "config/nm-linux.h" -+ -+/* Red Hat backward compatibility with gdb-6.8. */ -+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1 -+ -+#endif /* NM_LINUX64_H */ -diff --git a/gdb/configure.nat b/gdb/configure.nat ---- a/gdb/configure.nat -+++ b/gdb/configure.nat -@@ -245,6 +245,7 @@ case ${gdb_host} in - ;; - i386) - # Host: Intel 386 running GNU/Linux. -+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux.h" - NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \ - i386-linux-nat.o x86-linux-nat.o nat/linux-btrace.o \ - nat/x86-linux.o nat/x86-linux-dregs.o" -@@ -301,6 +302,7 @@ case ${gdb_host} in - case ${gdb_host_cpu} in - i386) - # Host: GNU/Linux x86-64 -+ NAT_FILE="${srcdir}/config/${gdb_host_cpu}/nm-linux64.h" - NATDEPFILES="${NATDEPFILES} x86-nat.o nat/x86-dregs.o \ - amd64-nat.o amd64-linux-nat.o x86-linux-nat.o \ - nat/linux-btrace.o \ -diff --git a/gdb/target.h b/gdb/target.h ---- a/gdb/target.h -+++ b/gdb/target.h -@@ -1971,9 +1971,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. */ - -+#ifndef target_can_use_hardware_watchpoint - #define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \ - (current_top_target ()->can_use_hw_breakpoint) ( \ - TYPE, CNT, OTHERTYPE) -+#endif - - /* Returns the number of debug registers needed to watch the given - memory region, or zero if not supported. */ -diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp -@@ -0,0 +1,40 @@ -+# Copyright 2009, 2010 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 . -+ -+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set. -+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] -+ && ![istarget "ia64-*-*"]) -+ || [target_info exists gdb,no_hardware_watchpoints]} then { -+ verbose "Skipping watchpoint-hw-before-run test." -+ return -+} -+ -+set test watchpoint-hw-before-run -+set srcfile watchpoint-hw-hit-once.c -+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } { -+ return -1 -+} -+ -+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee" -+ -+# `runto_main' or `runto main' would delete the watchpoint created above. -+ -+if { [gdb_start_cmd] < 0 } { -+ untested start -+ return -1 -+} -+gdb_test "" "main .* at .*" "start" -+ -+gdb_test "continue" "Continuing.\r\n\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*" - diff --git a/gdb-bz568248-oom-is-error.patch b/gdb-bz568248-oom-is-error.patch deleted file mode 100644 index 9ee832ac17a3908a94d403dd1d58ef4954c0305a..0000000000000000000000000000000000000000 --- a/gdb-bz568248-oom-is-error.patch +++ /dev/null @@ -1,64 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-06/msg00005.html - -Hi, - -unfortunately I see this problem reproducible only with the -archer-jankratochvil-vla branch (VLA = Variable Length Arrays - char[var]). -OTOH this branch I hopefully submit in some form for FSF GDB later. - -In this case (a general problem but tested for example on Fedora 13 i686): - -int -main (int argc, char **argv) -{ - char a[argc]; - return a[0]; -} - -(gdb) start -(gdb) print a -../../gdb/utils.c:1251: internal-error: virtual memory exhausted: can't allocate 4294951689 bytes. - -It is apparently because boundary for the variable `a' is not initialized -there. Users notice it due to Eclipse-CDT trying to automatically display all -the local variables on each step. - -Apparentl no regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. -But is anone aware of the reasons to use internal_error there? -I find simple error as a perfectly reasonable there. -(history only tracks it since the initial import) - -IIRC this idea has been discussed with Tom Tromey, not sure of its origin. - -I understand it may be offtopic for FSF GDB but from some GDB crashes I am not -sure if it can happen only due to the VLA variables. - -Thanks, -Jan - -gdb/ -2010-06-01 Jan Kratochvil - Tom Tromey - - * utils.c (nomem): Change internal_error to error. - -diff --git a/gdb/utils.c b/gdb/utils.c ---- a/gdb/utils.c -+++ b/gdb/utils.c -@@ -721,13 +721,11 @@ malloc_failure (long size) - { - if (size > 0) - { -- internal_error (__FILE__, __LINE__, -- _("virtual memory exhausted: can't allocate %ld bytes."), -- size); -+ error (_("virtual memory exhausted: can't allocate %ld bytes."), size); - } - else - { -- internal_error (__FILE__, __LINE__, _("virtual memory exhausted.")); -+ error (_("virtual memory exhausted.")); - } - } - - diff --git a/gdb-bz601887-dwarf4-rh-test.patch b/gdb-bz601887-dwarf4-rh-test.patch index 561b3b87d83712393c2a125e072fbc1f36a74a49..ebf5edae94ab5ce22ecde0335929b1606d139007 100644 --- a/gdb-bz601887-dwarf4-rh-test.patch +++ b/gdb-bz601887-dwarf4-rh-test.patch @@ -244,4 +244,3 @@ new file mode 100644 +clean_restart $executable + +gdb_test "ptype main" {type = int \(void\)} - diff --git a/gdb-bz634108-solib_address.patch b/gdb-bz634108-solib_address.patch index 7292be43e12a478ea9ecf41fdc8855e4ff8b757e..691573db8199e2b29b6289809f4808133761e2e9 100644 --- a/gdb-bz634108-solib_address.patch +++ b/gdb-bz634108-solib_address.patch @@ -1,7 +1,3 @@ -Fix gdb.solib_address (fix by Phil Muldoon). - -s/solib_address/solib_name/ during upstreaming. - diff --git a/gdb/testsuite/gdb.python/rh634108-solib_address.exp b/gdb/testsuite/gdb.python/rh634108-solib_address.exp new file mode 100644 --- /dev/null @@ -31,4 +27,3 @@ new file mode 100644 +if { [skip_python_tests] } { continue } + +gdb_test "python print gdb.solib_name(-1)" "None" "gdb.solib_name exists" - diff --git a/gdb-ccache-workaround.patch b/gdb-ccache-workaround.patch index 816d18e05b90cb3cda5143959f31193c9d83d122..1860870dac13c3620aaac2458e5872b0c70ac5de 100644 --- a/gdb-ccache-workaround.patch +++ b/gdb-ccache-workaround.patch @@ -16,4 +16,3 @@ diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.e # Generate the intermediate object file. This is required by Darwin to # have access to the .debug_macinfo section. if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \ - diff --git a/gdb-container-rh-pkg.patch b/gdb-container-rh-pkg.patch index ed2ee2e7a3342f9dda85b5ededa48a9c02f64808..730b9ddecbe7daff45ab3577b2cb9874b5ecb39d 100644 --- a/gdb-container-rh-pkg.patch +++ b/gdb-container-rh-pkg.patch @@ -1,7 +1,7 @@ diff --git a/gdb/remote.c b/gdb/remote.c --- a/gdb/remote.c +++ b/gdb/remote.c -@@ -13966,7 +13966,17 @@ remote_target::pid_to_exec_file (int pid) +@@ -13916,7 +13916,17 @@ remote_target::pid_to_exec_file (int pid) char *annex = NULL; if (packet_support (PACKET_qXfer_exec_file) != PACKET_ENABLE) @@ -20,4 +20,3 @@ diff --git a/gdb/remote.c b/gdb/remote.c inf = find_inferior_pid (pid); if (inf == NULL) - diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch index 6e5e0533210fec72cca2510ec431f160a9bfdd46..798a8c2a0d25373dbb432ffb4bc94f43f230b1be 100644 --- a/gdb-core-open-vdso-warning.patch +++ b/gdb-core-open-vdso-warning.patch @@ -1,12 +1,3 @@ -http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html -Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. - -[ New patch variant. ] - -commit 7d760051ffb8a23cdc51342d4e6243fbc462f73f -Author: Ulrich Weigand -Date: Wed Sep 25 11:52:50 2013 +0000 - diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp --- a/gdb/testsuite/gdb.base/solib-symbol.exp +++ b/gdb/testsuite/gdb.base/solib-symbol.exp @@ -18,7 +9,7 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so if [get_compiler_info] { return -1 -@@ -72,8 +73,26 @@ gdb_test "br foo2" \ +@@ -71,8 +72,26 @@ gdb_test "br foo2" \ "Breakpoint.*: foo2. .2 locations..*" \ "foo2 in mdlib" @@ -47,4 +38,3 @@ diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/so +gdb_run_cmd +gdb_test "" "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\nBreakpoint \[0-9\]+, main .*" \ + "warning for missing libraries" - diff --git a/gdb-detect-invalid-length-field-in-debug-frame-FDE-header.patch b/gdb-detect-invalid-length-field-in-debug-frame-FDE-header.patch deleted file mode 100644 index b8d2ffee3c65b41ece450f755b09e1b47c48a7ae..0000000000000000000000000000000000000000 --- a/gdb-detect-invalid-length-field-in-debug-frame-FDE-header.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 723adb650a31859d7cc45832cb8adca0206455ed Mon Sep 17 00:00:00 2001 -From: Sandra Loosemore -Date: Thu, 25 Apr 2019 07:27:02 -0700 -Subject: [PATCH] Detect invalid length field in debug frame FDE header. - -GDB was failing to catch cases where a corrupt ELF or core file -contained an invalid length value in a Dwarf debug frame FDE header. -It was checking for buffer overflow but not cases where the length was -negative or caused pointer wrap-around. - -In addition to the additional validity check, this patch cleans up the -multiple signed/unsigned conversions on the length field so that an -unsigned representation is used consistently throughout. - -This patch fixes CVE-2017-9778 and PR gdb/21600. - -2019-04-25 Sandra Loosemore - Kang Li - - PR gdb/21600 - - * dwarf2-frame.c (read_initial_length): Be consistent about using - unsigned representation of length. - (decode_frame_entry_1): Likewise. Check for wraparound of - end pointer as well as buffer overflow. ---- - gdb/dwarf2-frame.c | 14 +++++++------- - 1 files changed, 7 insertions(+), 7 deletions(-) - -diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c -index e2bf61b..b697afa 100644 ---- a/gdb/dwarf2-frame.c -+++ b/gdb/dwarf2-frame.c -@@ -1487,7 +1487,7 @@ static ULONGEST - read_initial_length (bfd *abfd, const gdb_byte *buf, - unsigned int *bytes_read_ptr) - { -- LONGEST result; -+ ULONGEST result; - - result = bfd_get_32 (abfd, buf); - if (result == 0xffffffff) -@@ -1788,7 +1788,7 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, - { - struct gdbarch *gdbarch = get_objfile_arch (unit->objfile); - const gdb_byte *buf, *end; -- LONGEST length; -+ ULONGEST length; - unsigned int bytes_read; - int dwarf64_p; - ULONGEST cie_id; -@@ -1799,15 +1799,15 @@ decode_frame_entry_1 (struct comp_unit *unit, const gdb_byte *start, - buf = start; - length = read_initial_length (unit->abfd, buf, &bytes_read); - buf += bytes_read; -- end = buf + length; -- -- /* Are we still within the section? */ -- if (end > unit->dwarf_frame_buffer + unit->dwarf_frame_size) -- return NULL; -+ end = buf + (size_t) length; - - if (length == 0) - return end; - -+ /* Are we still within the section? */ -+ if (end <= buf || end > unit->dwarf_frame_buffer + unit->dwarf_frame_size) -+ return NULL; -+ - /* Distinguish between 32 and 64-bit encoded frame info. */ - dwarf64_p = (bytes_read == 12); - --- -2.9.3 - diff --git a/gdb-dts-rhel6-python-compat.patch b/gdb-dts-rhel6-python-compat.patch index 0d3e083a18719053425a895aa3a5e0237732f2dd..90a1c66cfc78d24c901414a110eac4199b63c366 100644 --- a/gdb-dts-rhel6-python-compat.patch +++ b/gdb-dts-rhel6-python-compat.patch @@ -1,5 +1,3 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=1020004 - diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in @@ -305,4 +303,3 @@ new file mode 100644 + pair[1].describe (sys.stdout, full) + +FilteringBacktrace() - diff --git a/gdb-fedora-libncursesw.patch b/gdb-fedora-libncursesw.patch index db2803b78a2f4c448981816227a01af7b7d291a4..a0f32776de9634294358486be4c1190ab18eaff1 100644 --- a/gdb-fedora-libncursesw.patch +++ b/gdb-fedora-libncursesw.patch @@ -1,10 +1,7 @@ -Fedora: Force libncursesw over libncurses to match the includes. -https://bugzilla.redhat.com/show_bug.cgi?id=1270534 - diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -9418,6 +9418,7 @@ if test x"$prefer_curses" = xyes; then +@@ -9375,6 +9375,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. @@ -12,7 +9,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 : -@@ -9442,7 +9443,7 @@ return waddstr (); +@@ -9399,7 +9400,7 @@ return waddstr (); return 0; } _ACEOF @@ -21,7 +18,7 @@ diff --git a/gdb/configure b/gdb/configure if test -z "$ac_lib"; then ac_res="none required" else -@@ -9516,6 +9517,7 @@ case $host_os in +@@ -9473,6 +9474,7 @@ case $host_os in esac # These are the libraries checked by Readline. @@ -29,7 +26,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 : -@@ -9540,7 +9542,7 @@ return tgetent (); +@@ -9497,7 +9499,7 @@ return tgetent (); return 0; } _ACEOF @@ -41,7 +38,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 -@@ -743,7 +743,8 @@ if test x"$prefer_curses" = xyes; then +@@ -717,7 +717,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. @@ -51,7 +48,7 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac if test "$ac_cv_search_waddstr" != no; then curses_found=yes -@@ -785,7 +786,8 @@ case $host_os in +@@ -759,7 +760,8 @@ case $host_os in esac # These are the libraries checked by Readline. @@ -61,4 +58,3 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac if test "$ac_cv_search_tgetent" = no; then CONFIG_OBS="$CONFIG_OBS stub-termcap.o" - diff --git a/gdb-follow-child-stale-parent.patch b/gdb-follow-child-stale-parent.patch deleted file mode 100644 index e5b10103317f88c370a610779e01599df0258cdd..0000000000000000000000000000000000000000 --- a/gdb-follow-child-stale-parent.patch +++ /dev/null @@ -1,29 +0,0 @@ -Problem occurs with python and its get_current_arch () as it selects -selected_frame and current_frame while still inferior_ptid is valid for the -original parent. But since this place it is already attached and later -unwinders try to access it, breaking: - -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork - -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork - -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork - -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork - -PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish - +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork - +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork - +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork - +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork - +FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish - -diff --git a/gdb/infrun.c b/gdb/infrun.c ---- a/gdb/infrun.c -+++ b/gdb/infrun.c -@@ -754,6 +754,9 @@ follow_fork (void) - } - else - { -+ /* Possibly referenced PARENT is no longer valid. */ -+ reinit_frame_cache (); -+ - /* This pending follow fork event is now handled, one way - or another. The previous selected thread may be gone - from the lists by now, but if it is still around, need - diff --git a/gdb-fortran-frame-string.patch b/gdb-fortran-frame-string.patch index 17b2a121274b2df4b8d5cf28fdfc2b4ebd87efb8..fc91c97851ff4536e19f432417639d934083dafb 100644 --- a/gdb-fortran-frame-string.patch +++ b/gdb-fortran-frame-string.patch @@ -1,25 +1,3 @@ -http://sourceware.org/ml/gdb-patches/2014-07/msg00709.html - -Hi, - -for Fortran it fixes displaying normal strings also in frames/backtraces: - -(gdb) frame --> - -The patch is simple and I do not see why it should not be this way. - -For C/C++ TYPE_CODE_STRING is not used. I am not aware of Pascal but that -language is currently not really much supported in GDB anyway. - -This was a part of my archer/jankratochvil/vla branch but it is not a part of -the Intel VLA patchset as it in fact is completely unrelated to "VLA". - -No regressions on {x86_64,x86_64-m32,i686}-fedora22pre-linux-gnu. - -Thanks, -Jan - diff --git a/gdb/testsuite/gdb.fortran/fortran-frame-string.exp b/gdb/testsuite/gdb.fortran/fortran-frame-string.exp new file mode 100644 --- /dev/null @@ -94,4 +72,3 @@ new file mode 100644 + program main + call f ('foo') + end - diff --git a/gdb-glibc-strstr-workaround.patch b/gdb-glibc-strstr-workaround.patch index 005ee119e64abc7dd0ad2ea66e2a74f7857a94b2..5b9fbaac84eaa5bca194cc5f80541c7a8d4e74b6 100644 --- a/gdb-glibc-strstr-workaround.patch +++ b/gdb-glibc-strstr-workaround.patch @@ -118,4 +118,3 @@ new file mode 100644 + +gdb_test {print strstr("abc","b")} { = 0x[0-9a-f]+ "bc"} +gdb_test {print strstr("def","e")} { = 0x[0-9a-f]+ "ef"} - diff --git a/gdb-gnat-dwarf-crash-3of3.patch b/gdb-gnat-dwarf-crash-3of3.patch index c947062f65bf4e8f38e930bf50ce72b3e01755ed..08d63298c5bc1c96d22e25d3b27640a9cd027f90 100644 --- a/gdb-gnat-dwarf-crash-3of3.patch +++ b/gdb-gnat-dwarf-crash-3of3.patch @@ -1,40 +1,7 @@ -http://sourceware.org/ml/gdb-patches/2014-02/msg00731.html - ---6TrnltStXW4iwmi0 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -Hi, - -PR 16581: - GDB crash on inherit_abstract_dies infinite recursion - https://sourceware.org/bugzilla/show_bug.cgi?id=16581 - -fixed crash from an infinite recursion. But in rare cases the new code can -now gdb_assert() due to weird DWARF file. - -I do not yet fully understand why the DWARF is as it is but just GDB should -never crash due to invalid DWARF anyway. The "invalid" DWARF I see only in -Fedora GCC build, not in FSF GCC build, more info at: - https://bugzilla.redhat.com/show_bug.cgi?id=1069382 - http://people.redhat.com/jkratoch/gcc-debuginfo-4.8.2-7.fc20.x86_64-gnatbind.debug - -Thanks, -Jan - ---6TrnltStXW4iwmi0 -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename="complaint.patch" - -gdb/ -2014-02-24 Jan Kratochvil - - * dwarf2read.c (process_die): Change gdb_assert to complaint. - diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -10588,6 +10588,13 @@ private: +@@ -10657,6 +10657,13 @@ private: static void process_die (struct die_info *die, struct dwarf2_cu *cu) { @@ -51,8 +18,8 @@ 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 -@@ -609,6 +609,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \ - target_pid_to_str (process_ptid)); +@@ -601,6 +601,13 @@ holding the child stopped. Try \"set detach-on-fork\" or \ + target_pid_to_str (process_ptid).c_str ()); } +#ifdef NEED_DETACH_SIGSTOP @@ -68,7 +35,7 @@ diff --git a/gdb/infrun.c b/gdb/infrun.c diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c -@@ -192,6 +192,12 @@ struct linux_nat_target *linux_target; +@@ -189,6 +189,12 @@ struct linux_nat_target *linux_target; /* Does the current host support PTRACE_GETREGSET? */ enum tribool have_ptrace_getregset = TRIBOOL_UNKNOWN; @@ -81,7 +48,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c static unsigned int debug_linux_nat; static void show_debug_linux_nat (struct ui_file *file, int from_tty, -@@ -1037,6 +1043,9 @@ linux_nat_post_attach_wait (ptid_t ptid, int *signalled) +@@ -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"); @@ -91,7 +58,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 / -@@ -1369,6 +1378,25 @@ get_detach_signal (struct lwp_info *lp) +@@ -1361,6 +1370,25 @@ get_detach_signal (struct lwp_info *lp) return gdb_signal_to_host (signo); } @@ -117,7 +84,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c return 0; } -@@ -1517,6 +1545,10 @@ linux_nat_target::detach (inferior *inf, int from_tty) +@@ -1509,6 +1537,10 @@ linux_nat_target::detach (inferior *inf, int from_tty) detach_one_lwp (main_lwp, &signo); detach_success (inf); @@ -128,7 +95,7 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c } } -@@ -1775,6 +1807,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) +@@ -1766,6 +1798,16 @@ linux_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo) return; } @@ -143,9 +110,9 @@ diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c + +#endif if (resume_many) - iterate_over_lwps (ptid, linux_nat_resume_callback, lp); - -@@ -3763,6 +3805,10 @@ linux_nat_target::mourn_inferior () + iterate_over_lwps (ptid, [=] (struct lwp_info *info) + { +@@ -3770,6 +3812,10 @@ linux_nat_target::mourn_inferior () /* Let the arch-specific native code know this process is gone. */ linux_target->low_forget_process (pid); @@ -226,4 +193,3 @@ diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.th set test "$threadtype: attach2 to stopped, after setting file" gdb_test_multiple "attach $testpid" "$test" { - diff --git a/gdb-jit-reader-multilib.patch b/gdb-jit-reader-multilib.patch index 5b55ac86905969a7e9f1182434bb2861cf3620f5..af690e392caf81ca098f5ef7c1cfd37cd53b6543 100644 --- a/gdb-jit-reader-multilib.patch +++ b/gdb-jit-reader-multilib.patch @@ -1,7 +1,7 @@ diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -9705,10 +9705,12 @@ _ACEOF +@@ -9694,10 +9694,12 @@ _ACEOF @@ -20,7 +20,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 -@@ -820,10 +820,12 @@ AC_CHECK_SIZEOF(unsigned long long) +@@ -808,10 +808,12 @@ AC_CHECK_SIZEOF(unsigned long long) AC_CHECK_SIZEOF(unsigned long) AC_CHECK_SIZEOF(unsigned __int128) @@ -36,4 +36,3 @@ diff --git a/gdb/configure.ac b/gdb/configure.ac elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then TARGET_PTR="unsigned __int128" else - diff --git a/gdb-libexec-add-index.patch b/gdb-libexec-add-index.patch index a527706a75e2fcbd15eeff230630504245258f25..a48671eef36541e51d9e77073f085e8c07699317 100644 --- a/gdb-libexec-add-index.patch +++ b/gdb-libexec-add-index.patch @@ -1,16 +1,24 @@ diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh --- a/gdb/contrib/gdb-add-index.sh +++ b/gdb/contrib/gdb-add-index.sh -@@ -21,6 +21,11 @@ - GDB=${GDB:=gdb} +@@ -22,6 +22,20 @@ GDB=${GDB:=gdb} OBJCOPY=${OBJCOPY:=objcopy} + READELF=${READELF:=readelf} +GDB2=/usr/libexec/gdb +if test -x $GDB2 && ! which $GDB &>/dev/null; then + GDB=$GDB2 +fi ++ ++# We default to using /usr/bin/gdb.minimal if it's present. See ++# https://bugzilla.redhat.com/show_bug.cgi?id=1695015 and ++# https://fedoraproject.org/wiki/Changes/Minimal_GDB_in_buildroot for ++# explanations. ++GDB3=/usr/bin/gdb.minimal ++if test -x $GDB3; then ++ GDB=$GDB3 ++fi + myname="${0##*/}" dwarf5="" - diff --git a/gdb-lineno-makeup-test.patch b/gdb-lineno-makeup-test.patch index 5f2ed2fc1338afae20368e8a1d78f00ef0ead64d..0a4df7a53e71d13612de7c80f6c846bcfe1c0bed 100644 --- a/gdb-lineno-makeup-test.patch +++ b/gdb-lineno-makeup-test.patch @@ -1,11 +1,3 @@ -New testcase for: -https://bugzilla.redhat.com/show_bug.cgi?id=466222 - (for the first / customer recommended fix) -and the upstream fix: -http://sourceware.org/ml/gdb-patches/2006-11/msg00253.html - [rfc] Do not make up line information -http://sourceware.org/ml/gdb-cvs/2006-11/msg00127.html - diff --git a/gdb/testsuite/gdb.base/lineno-makeup-func.c b/gdb/testsuite/gdb.base/lineno-makeup-func.c new file mode 100644 --- /dev/null @@ -155,4 +147,3 @@ new file mode 100644 + fail $test + } +} - diff --git a/gdb-linux_perf-bundle.patch b/gdb-linux_perf-bundle.patch index 5a2d3de281718ee294d0a33fc28e7120ce44b074..1a9a8ca7b63dbb72a411359082df8617758f35c5 100644 --- a/gdb-linux_perf-bundle.patch +++ b/gdb-linux_perf-bundle.patch @@ -1,7 +1,7 @@ diff --git a/gdb/configure b/gdb/configure --- a/gdb/configure +++ b/gdb/configure -@@ -12137,7 +12137,7 @@ else +@@ -11905,7 +11905,7 @@ else #include #ifndef PERF_ATTR_SIZE_VER5 @@ -13,7 +13,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 -@@ -1500,7 +1500,7 @@ else +@@ -1414,7 +1414,7 @@ else AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include #ifndef PERF_ATTR_SIZE_VER5 @@ -48,7 +48,7 @@ diff --git a/gdb/gdb.c b/gdb/gdb.c diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h --- a/gdb/nat/linux-btrace.h +++ b/gdb/nat/linux-btrace.h -@@ -28,6 +28,177 @@ +@@ -27,6 +27,177 @@ # include #endif @@ -226,4 +226,3 @@ diff --git a/gdb/nat/linux-btrace.h b/gdb/nat/linux-btrace.h struct target_ops; #if HAVE_LINUX_PERF_EVENT_H - diff --git a/gdb-moribund-utrace-workaround.patch b/gdb-moribund-utrace-workaround.patch index 6f8e69b570667e5442c1420d1d38131b56c142dd..8f23f01cb6867069294da785a2952272f8feee4e 100644 --- a/gdb-moribund-utrace-workaround.patch +++ b/gdb-moribund-utrace-workaround.patch @@ -1,12 +1,7 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=590623 -http://sources.redhat.com/bugzilla/show_bug.cgi?id=11593 - -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 -@@ -11929,6 +11929,8 @@ update_global_location_list (enum ugll_insert_mode insert_mode) +@@ -11904,6 +11904,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); @@ -15,4 +10,3 @@ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c old_loc->owner = NULL; moribund_locations.push_back (old_loc); - diff --git a/gdb-opcodes-clflushopt-test.patch b/gdb-opcodes-clflushopt-test.patch index d7de1500fb0c3d969410790f9c8f211cafcc188f..2bad272dabd9744af4014232a96ac9fcba403e7b 100644 --- a/gdb-opcodes-clflushopt-test.patch +++ b/gdb-opcodes-clflushopt-test.patch @@ -52,4 +52,3 @@ new file mode 100644 +} + +gdb_test "disas _start" "Dump of assembler code for function _start:\r\n *0x\[0-9a-f\]+ <\[+\]0>:\tclflushopt \\(%edi\\)\r\nEnd of assembler dump\\." "clflushopt" - diff --git a/gdb-physname-pr11734-test.patch b/gdb-physname-pr11734-test.patch index c5c258a0353179e6db051b3320889419fed8b459..3cc05382708ed25e5f13923f0b74dcd1f88350d0 100644 --- a/gdb-physname-pr11734-test.patch +++ b/gdb-physname-pr11734-test.patch @@ -1,5 +1,3 @@ -http://sourceware.org/ml/gdb-patches/2010-12/msg00263.html - diff --git a/gdb/testsuite/gdb.cp/pr11734-1.cc b/gdb/testsuite/gdb.cp/pr11734-1.cc new file mode 100644 --- /dev/null @@ -224,4 +222,3 @@ new file mode 100644 + void foo (char *); +}; + - diff --git a/gdb-physname-pr12273-test.patch b/gdb-physname-pr12273-test.patch index 82b3f0996c97a70e0c0952b196cca53a3702f40d..a419749d6cede21cfdeca957466f661bc65ae9c4 100644 --- a/gdb-physname-pr12273-test.patch +++ b/gdb-physname-pr12273-test.patch @@ -1,5 +1,3 @@ -http://sourceware.org/ml/gdb-patches/2010-12/msg00264.html - diff --git a/gdb/testsuite/gdb.cp/pr12273.cc b/gdb/testsuite/gdb.cp/pr12273.cc new file mode 100644 --- /dev/null @@ -93,4 +91,3 @@ new file mode 100644 +} + +gdb_exit - diff --git a/gdb-ppc-power7-test.patch b/gdb-ppc-power7-test.patch index 260d5104f89d5f3a0fa134568c4a3e78bc6096f9..7293aba529018c5750c71bc117d974a0fa0e818a 100644 --- a/gdb-ppc-power7-test.patch +++ b/gdb-ppc-power7-test.patch @@ -293,4 +293,3 @@ new file mode 100644 + .long 0xedc07834 /* 194: frsqrtes f14,f15 */ + .long 0xedc07835 /* 198: frsqrtes. f14,f15 */ + .long 0x7c43271e /* 19c: isel r2,r3,r4,28 */ - diff --git a/gdb-readline62-ask-more-rh.patch b/gdb-readline62-ask-more-rh.patch deleted file mode 100644 index c7d4165d14df9182c480479b34686b3fa57306f9..0000000000000000000000000000000000000000 --- a/gdb-readline62-ask-more-rh.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/gdb/event-top.c b/gdb/event-top.c ---- a/gdb/event-top.c -+++ b/gdb/event-top.c -@@ -1179,6 +1179,13 @@ gdb_setup_readline (int editing) - { - struct ui *ui = current_ui; - -+#ifdef NEED_RL_STATE_FEDORA_GDB -+ /* 6.2 regression: no longed asks for --more-- -+ gdb.base/readline-ask.exp -+ https://bugzilla.redhat.com/show_bug.cgi?id=701131 */ -+ RL_SETSTATE (RL_STATE_FEDORA_GDB); -+#endif -+ - /* This function is a noop for the sync case. The assumption is - that the sync setup is ALL done in gdb_init, and we would only - mess it up here. The sync stuff should really go away over - diff --git a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch index 7d87a56a3bed585536b7045b05d6fd9f89601a01..9ceeba0a383b8bf623b1271870ce420ad83d13ae 100644 --- a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +++ b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch @@ -73,4 +73,3 @@ new file mode 100644 + ".*warning: Unable to find dynamic linker breakpoint function.*" \ + "set solib-absolute-prefix" +gdb_test "bt" "__kernel_vsyscall.*" "backtrace with __kernel_vsyscall" - diff --git a/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch b/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch index 2761f72111c8b6a9b9e353888723cab557207d3f..4c33bab960dad7c366dff6f987437762dc30456e 100644 --- a/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch +++ b/gdb-rhbz1007614-memleak-infpy_read_memory-test.patch @@ -1,25 +1,3 @@ -Original message by Tom Tromey: - - - Message-ID: <871uoc1va3.fsf@fleche.redhat.com> - -Comment from Sergio Durigan Junior: - - In order to correctly test this patch, I wrote a testcase based on Jan - Kratochvil's . The - testcase, which can be seen below, tests GDB in order to see if the - amount of memory being leaked is minimal, as requested in the bugzilla. - It is hard to define what "minimum" is, so I ran the testcase on all - supported RHEL architectures and came up with an average. - -commit cc0265cdda9dc7e8665e8bfcf5b4477489daf27c -Author: Tom Tromey -Date: Wed Mar 28 17:38:08 2012 +0000 - - * python/py-inferior.c (infpy_read_memory): Remove cleanups and - explicitly free 'buffer' on exit paths. Decref 'membuf_object' - before returning. - diff --git a/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c b/gdb/testsuite/gdb.python/py-gdb-rhbz1007614-memleak-infpy_read_memory.c new file mode 100644 --- /dev/null @@ -160,4 +138,3 @@ new file mode 100644 + print "Hello, World!" + +HelloWorld () - diff --git a/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch b/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch index 49b870796f5d8bbebf46fd2bb6da66138fc5ad61..8e21c80c451b04b46d5cef6ddfc7bbeb24bba449 100644 --- a/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch +++ b/gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch @@ -1,7 +1,3 @@ -These testcases have been created by compiling glibc-2.17-78 on -RHEL-7.1 s390x/ppc64 boxes, and then taking the "select.o" file -present at $builddir/misc/select.o. - diff --git a/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp b/gdb/testsuite/gdb.arch/ppc64-prologue-skip.exp new file mode 100644 --- /dev/null @@ -224,4 +220,3 @@ new file mode 100644 +L````(`````$````%````````````````````/`````$````%`````````$@` +` +end - diff --git a/gdb-rhbz1149205-catch-syscall-after-fork-test.patch b/gdb-rhbz1149205-catch-syscall-after-fork-test.patch index 0bba7e09bb5a9709c5654fa8059a64445187aa88..3f64ab3eb08fe81d5e4e03a40e02a111f0df1622 100644 --- a/gdb-rhbz1149205-catch-syscall-after-fork-test.patch +++ b/gdb-rhbz1149205-catch-syscall-after-fork-test.patch @@ -1,38 +1,3 @@ -URL: -Message-ID: <1368136582.30058.7.camel@soleil> - - From: Philippe Waroquiers - To: gdb-patches at sourceware dot org - Subject: RFA: fix gdb_assert caused by 'catch signal ...' and fork - Date: Thu, 09 May 2013 23:56:22 +0200 - - The attached patch fixes a gdb_assert caused by the combination of catch - signal and fork: - break-catch-sig.c:152: internal-error: signal_catchpoint_remove_location: Assertion `signal_catch_counts[iter] > 0' failed. - - The problem is that the signal_catch_counts is decremented by detach_breakpoints. - The fix consists in not detaching breakpoint locations of type bp_loc_other. - The patch introduces a new test. - -Comments by Sergio Durigan Junior: - - I addded a specific testcase for this patch, which tests exactly the - issue that the customer is facing. This patch does not solve the - whole problem of catching a syscall and forking (for more details, - see , - specifically comment #3), but it solves the issue reported by the - customer. - - I also removed the original testcase of this patch, because it - relied on "catch signal", which is a command that is not implemented - in this version of GDB. - -commit bd9673a4ded96ea5c108601501c8e59003ea1be6 -Author: Philippe Waroquiers -Date: Tue May 21 18:47:05 2013 +0000 - - Fix internal error caused by interaction between catch signal and fork - diff --git a/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c b/gdb/testsuite/gdb.base/gdb-rhbz1149205-catch-syscall-fork.c new file mode 100644 --- /dev/null @@ -112,4 +77,3 @@ new file mode 100644 +gdb_test "continue" \ + "Continuing\.\r\n.*\r\nCatchpoint $decimal \\\(call to syscall .?chdir.?.*" \ + "continue from catch syscall after fork" - diff --git a/gdb-rhbz1156192-recursive-dlopen-test.patch b/gdb-rhbz1156192-recursive-dlopen-test.patch index ca00141152bad8f5647ac28bd234665d7958d4d3..1bf48e0eb87e3062c4591376df4a721ba5159b16 100644 --- a/gdb-rhbz1156192-recursive-dlopen-test.patch +++ b/gdb-rhbz1156192-recursive-dlopen-test.patch @@ -339,4 +339,3 @@ new file mode 100644 +} + +test_stop_on_solib_events - diff --git a/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch b/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch index 5e7caef332cc136a7f2e7ea33d3a020f40b65635..7cc191d19224a097e52b7c90017160a27b4eeac3 100644 --- a/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch +++ b/gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch @@ -1,14 +1,3 @@ -Comments from Sergio Durigan Junior: - - The "proper" fix for this whole problem would be to backport the - "ambiguous linespec" patch series. However, it is really not - recommended to do that for RHEL GDB, because the patch series is too - big and could introduce unwanted regressions. Instead, what we - chose to do was to replace the gdb_assert call by a warning (which - allows the user to continue the debugging session), and tell the - user that, although more than one location was found for his/her - breakpoint, only one will be used. - diff --git a/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc b/gdb/testsuite/gdb.cp/gdb-rhbz1186476-internal-error-unqualified-name-re-set-main.cc new file mode 100644 --- /dev/null @@ -123,4 +112,3 @@ new file mode 100644 +gdb_test "run" + +gdb_test "info break" " in C::C\\(\\) at .* in C::C\\(int\\) at .*" - diff --git a/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch index 7b2e547bbdacbbcb7b5c2474dbfc7a26d09c5501..2b981d42d3dee0cfecbf5b612cdd577d6574da0f 100644 --- a/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +++ b/gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch @@ -94,4 +94,3 @@ new file mode 100644 +setup_xfail "powerpc*-*-*" + +gdb_continue_to_end - diff --git a/gdb-rhbz1325795-framefilters-test.patch b/gdb-rhbz1325795-framefilters-test.patch index fb643bb067b71bb8c6745a036dc16e90fd33dc69..72fedd4008be674e41d1d54d98ab3b3803517c78 100644 --- a/gdb-rhbz1325795-framefilters-test.patch +++ b/gdb-rhbz1325795-framefilters-test.patch @@ -166,4 +166,3 @@ new file mode 100644 + return frame_iter + +FrameFilter() - diff --git a/gdb-rhbz1350436-type-printers-error.patch b/gdb-rhbz1350436-type-printers-error.patch index 0eae4dfe4500fc50bcd0b9219b25f1f768893ec8..0f5aa353f5c25bc0e1253ac6373c0b6b17e94d0e 100644 --- a/gdb-rhbz1350436-type-printers-error.patch +++ b/gdb-rhbz1350436-type-printers-error.patch @@ -1,9 +1,3 @@ -Typo in Python support breaks info type-printers command -https://bugzilla.redhat.com/show_bug.cgi?id=1350436 - -[testsuite patch] PR python/17136: 'info type-printers' causes an exception when there are per-objfile printers -https://sourceware.org/ml/gdb-patches/2016-06/msg00455.html - diff --git a/gdb/testsuite/gdb.python/py-typeprint.cc b/gdb/testsuite/gdb.python/py-typeprint.cc --- a/gdb/testsuite/gdb.python/py-typeprint.cc +++ b/gdb/testsuite/gdb.python/py-typeprint.cc @@ -71,4 +65,3 @@ diff --git a/gdb/testsuite/gdb.python/py-typeprint.py b/gdb/testsuite/gdb.python + +import gdb.types +gdb.types.register_type_printer(gdb.objfiles()[0], OtherTypePrinter()) - diff --git a/gdb-rhbz1371380-gcore-elf-headers.patch b/gdb-rhbz1371380-gcore-elf-headers.patch deleted file mode 100644 index 562a4021110a5c9c64cbd9c94bcd02cb10fe0be6..0000000000000000000000000000000000000000 --- a/gdb-rhbz1371380-gcore-elf-headers.patch +++ /dev/null @@ -1,454 +0,0 @@ -Implement dump of mappings with ELF headers by gcore - -This patch has a long story, but it all started back in 2015, with -commit df8411da087dc05481926f4c4a82deabc5bc3859 ("Implement support -for checking /proc/PID/coredump_filter"). The purpose of that commit -was to bring GDB's corefile generation closer to what the Linux kernel -does. However, back then, I did not implement the full support for -the dumping of memory mappings containing ELF headers (like mappings -of DSOs or executables). These mappings were being dumped most of -time, though, because the default value of /proc/PID/coredump_filter -is 0x33, which would cause anonymous private mappings (DSOs/executable -code mappings have this type) to be dumped. Well, until something -happened on binutils... - -A while ago, I noticed something strange was happening with one of our -local testcases on Fedora GDB: it was failing due to some strange -build-id problem. On Fedora GDB, we (unfortunately) carry a bunch of -"local" patches, and some of these patches actually extend upstream's -build-id support in order to generate more useful information for the -user of a Fedora system (for example, when the user loads a corefile -into GDB, we detect whether the executable that generated that -corefile is present, and if it's not we issue a warning suggesting -that it should be installed, while also providing the build-id of the -executable). A while ago, Fedora GDB stopped printing those warnings. - -I wanted to investigate this right away, and spent some time trying to -determine what was going on, but other things happened and I got -sidetracked. Meanwhile, the bug started to be noticed by some of our -users, and its priority started changing. Then, someone on IRC also -mentioned the problem, and when I tried helping him, I noticed he -wasn't running Fedora. Hm... So maybe the bug was *also* present -upstream. - -After "some" time investigating, and with a lot of help from Keith and -others, I was finally able to determine that yes, the bug is also -present upstream, and that even though it started with a change in ld, -it is indeed a GDB issue. - -So, as I said, the problem started with binutils, more specifically -after the following commit was pushed: - - commit f6aec96dce1ddbd8961a3aa8a2925db2021719bb - Author: H.J. Lu - Date: Tue Feb 27 11:34:20 2018 -0800 - - ld: Add --enable-separate-code - -This commit makes ld use "-z separate-code" by default on x86-64 -machines. What this means is that code pages and data pages are now -separated in the binary, which is confusing GDB when it tries to decide -what to dump. - -BTW, Fedora 28 binutils doesn't have this code, which means that -Fedora 28 GDB doesn't have the problem. From Fedora 29 on, binutils -was rebased and incorporated the commit above, which started causing -Fedora GDB to fail. - -Anyway, the first thing I tried was to pass "-z max-page-size" and -specify a bigger page size (I saw a patch that did this and was -proposed to Linux, so I thought it might help). Obviously, this -didn't work, because the real "problem" is that ld will always use -separate pages for code and data. So I decided to look into how GDB -dumped the pages, and that's where I found the real issue. - -What happens is that, because of "-z separate-code", the first two pages -of the ELF binary are (from /proc/PID/smaps): - - 00400000-00401000 r--p 00000000 fc:01 799548 /file - Size: 4 kB - KernelPageSize: 4 kB - MMUPageSize: 4 kB - Rss: 4 kB - Pss: 4 kB - Shared_Clean: 0 kB - Shared_Dirty: 0 kB - Private_Clean: 4 kB - Private_Dirty: 0 kB - Referenced: 4 kB - Anonymous: 0 kB - LazyFree: 0 kB - AnonHugePages: 0 kB - ShmemPmdMapped: 0 kB - Shared_Hugetlb: 0 kB - Private_Hugetlb: 0 kB - Swap: 0 kB - SwapPss: 0 kB - Locked: 0 kB - THPeligible: 0 - VmFlags: rd mr mw me dw sd - 00401000-00402000 r-xp 00001000 fc:01 799548 /file - Size: 4 kB - KernelPageSize: 4 kB - MMUPageSize: 4 kB - Rss: 4 kB - Pss: 4 kB - Shared_Clean: 0 kB - Shared_Dirty: 0 kB - Private_Clean: 0 kB - Private_Dirty: 4 kB - Referenced: 4 kB - Anonymous: 4 kB - LazyFree: 0 kB - AnonHugePages: 0 kB - ShmemPmdMapped: 0 kB - Shared_Hugetlb: 0 kB - Private_Hugetlb: 0 kB - Swap: 0 kB - SwapPss: 0 kB - Locked: 0 kB - THPeligible: 0 - VmFlags: rd ex mr mw me dw sd - -Whereas before, we had only one: - - 00400000-00401000 r-xp 00000000 fc:01 798593 /file - Size: 4 kB - KernelPageSize: 4 kB - MMUPageSize: 4 kB - Rss: 4 kB - Pss: 4 kB - Shared_Clean: 0 kB - Shared_Dirty: 0 kB - Private_Clean: 0 kB - Private_Dirty: 4 kB - Referenced: 4 kB - Anonymous: 4 kB - LazyFree: 0 kB - AnonHugePages: 0 kB - ShmemPmdMapped: 0 kB - Shared_Hugetlb: 0 kB - Private_Hugetlb: 0 kB - Swap: 0 kB - SwapPss: 0 kB - Locked: 0 kB - THPeligible: 0 - VmFlags: rd ex mr mw me dw sd - -Notice how we have "Anonymous" data mapped into the page. This will be -important. - -So, the way GDB decides which pages it should dump has been revamped -by my patch in 2015, and now it takes the contents of -/proc/PID/coredump_filter into account. The default value for Linux -is 0x33, which means: - - Dump anonymous private, anonymous shared, ELF headers and HugeTLB - private pages. - -Or: - - filter_flags filterflags = (COREFILTER_ANON_PRIVATE - | COREFILTER_ANON_SHARED - | COREFILTER_ELF_HEADERS - | COREFILTER_HUGETLB_PRIVATE); - -Now, it is important to keep in mind that GDB doesn't always have *all* -of the necessary information to exactly determine the type of a page, so -the whole algorithm is based on heuristics (you can take a look at -linux-tdep.c:dump_mapping_p and -linux-tdep.c:linux_find_memory_regions_full for more info). - -Before the patch to make ld use "-z separate-code", the (single) page -containing data and code was being flagged as an anonymous (due to the -non-zero "Anonymous:" field) private (due to the "r-xp" permission), -which means that it was being dumped into the corefile. That's why it -was working fine. - -Now, as you can imagine, when "-z separate-code" is used, the *data* -page (which is where the ELF notes are, including the build-id one) now -doesn't have any "Anonymous:" mapping, so the heuristic is flagging it -as file-backed private, which is *not* dumped by default. - -The next question I had to answer was: how come a corefile generated by -the Linux kernel was correct? Well, the answer is that GDB, unlike -Linux, doesn't actually implement the COREFILTER_ELF_HEADERS support. -On Linux, even though the data page is also treated as a file-backed -private mapping, it is also checked to see if there are any ELF headers -in the page, and then, because we *do* have ELF headers there, it is -dumped. - -So, after more time trying to think of ways to fix this, I was able to -implement an algorithm that reads the first few bytes of the memory -mapping being processed, and checks to see if the ELF magic code is -present. This is basically what Linux does as well, except that, if -it finds the ELF magic code, it just dumps one page to the corefile, -whereas GDB will dump the whole mapping. But I don't think that's a -big issue, to be honest. - -It's also important to explain that we *only* perform the ELF magic -code check if: - - - The algorithm has decided *not* to dump the mapping so far, and; - - The mapping is private, and; - - The mapping's offset is zero, and; - - The user has requested us to dump mappings with ELF headers. - -IOW, we're not going to blindly check every mapping. - -As for the testcase, I struggled even more trying to write it. Since -our build-id support on upstream GDB is not very extensive, it's not -really possible to determine whether a corefile contains build-id -information or not just by using GDB. So, after thinking a lot about -the problem, I decided to rely on an external tool, eu-unstrip, in -order to verify whether the dump was successful. I verified the test -here on my machine, and everything seems to work as expected (i.e., it -fails without the patch, and works with the patch applied). We are -working hard to upstream our "local" Fedora GDB patches, and we intend -to submit our build-id extension patches "soon", so hopefully we'll be -able to use GDB itself to perform this verification. - -I built and regtested this on the BuildBot, and no problems were -found. - -gdb/ChangeLog: -2019-04-25 Sergio Durigan Junior - - PR corefiles/11608 - PR corefiles/18187 - * linux-tdep.c (dump_mapping_p): Add new parameters ADDR and - OFFSET. Verify if current mapping contains an ELF header. - (linux_find_memory_regions_full): Adjust call to - dump_mapping_p. - -gdb/testsuite/ChangeLog: -2019-04-25 Sergio Durigan Junior - - PR corefiles/11608 - PR corefiles/18187 - * gdb.base/coredump-filter-build-id.exp: New file. - -diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c ---- a/gdb/linux-tdep.c -+++ b/gdb/linux-tdep.c -@@ -591,8 +591,8 @@ mapping_is_anonymous_p (const char *filename) - } - - /* Return 0 if the memory mapping (which is related to FILTERFLAGS, V, -- MAYBE_PRIVATE_P, and MAPPING_ANONYMOUS_P) should not be dumped, or -- greater than 0 if it should. -+ MAYBE_PRIVATE_P, MAPPING_ANONYMOUS_P, ADDR and OFFSET) should not -+ be dumped, or greater than 0 if it should. - - In a nutshell, this is the logic that we follow in order to decide - if a mapping should be dumped or not. -@@ -630,12 +630,17 @@ mapping_is_anonymous_p (const char *filename) - see 'p' in the permission flags, then we assume that the mapping - is private, even though the presence of the 's' flag there would - mean VM_MAYSHARE, which means the mapping could still be private. -- This should work OK enough, however. */ -+ This should work OK enough, however. -+ -+ - Even if, at the end, we decided that we should not dump the -+ mapping, we still have to check if it is something like an ELF -+ header (of a DSO or an executable, for example). If it is, and -+ if the user is interested in dump it, then we should dump it. */ - - static int - dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, - int maybe_private_p, int mapping_anon_p, int mapping_file_p, -- const char *filename) -+ const char *filename, ULONGEST addr, ULONGEST offset) - { - /* Initially, we trust in what we received from our caller. This - value may not be very precise (i.e., it was probably gathered -@@ -645,6 +650,7 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, - (assuming that the version of the Linux kernel being used - supports it, of course). */ - int private_p = maybe_private_p; -+ int dump_p; - - /* We always dump vDSO and vsyscall mappings, because it's likely that - there'll be no file to read the contents from at core load time. -@@ -685,13 +691,13 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, - /* This is a special situation. It can happen when we see a - mapping that is file-backed, but that contains anonymous - pages. */ -- return ((filterflags & COREFILTER_ANON_PRIVATE) != 0 -- || (filterflags & COREFILTER_MAPPED_PRIVATE) != 0); -+ dump_p = ((filterflags & COREFILTER_ANON_PRIVATE) != 0 -+ || (filterflags & COREFILTER_MAPPED_PRIVATE) != 0); - } - else if (mapping_anon_p) -- return (filterflags & COREFILTER_ANON_PRIVATE) != 0; -+ dump_p = (filterflags & COREFILTER_ANON_PRIVATE) != 0; - else -- return (filterflags & COREFILTER_MAPPED_PRIVATE) != 0; -+ dump_p = (filterflags & COREFILTER_MAPPED_PRIVATE) != 0; - } - else - { -@@ -700,14 +706,55 @@ dump_mapping_p (filter_flags filterflags, const struct smaps_vmflags *v, - /* This is a special situation. It can happen when we see a - mapping that is file-backed, but that contains anonymous - pages. */ -- return ((filterflags & COREFILTER_ANON_SHARED) != 0 -- || (filterflags & COREFILTER_MAPPED_SHARED) != 0); -+ dump_p = ((filterflags & COREFILTER_ANON_SHARED) != 0 -+ || (filterflags & COREFILTER_MAPPED_SHARED) != 0); - } - else if (mapping_anon_p) -- return (filterflags & COREFILTER_ANON_SHARED) != 0; -+ dump_p = (filterflags & COREFILTER_ANON_SHARED) != 0; - else -- return (filterflags & COREFILTER_MAPPED_SHARED) != 0; -+ dump_p = (filterflags & COREFILTER_MAPPED_SHARED) != 0; - } -+ -+ /* Even if we decided that we shouldn't dump this mapping, we still -+ have to check whether (a) the user wants us to dump mappings -+ containing an ELF header, and (b) the mapping in question -+ contains an ELF header. If (a) and (b) are true, then we should -+ dump this mapping. -+ -+ A mapping contains an ELF header if it is a private mapping, its -+ offset is zero, and its first word is ELFMAG. */ -+ if (!dump_p && private_p && offset == 0 -+ && (filterflags & COREFILTER_ELF_HEADERS) != 0) -+ { -+ /* Let's check if we have an ELF header. */ -+ gdb::unique_xmalloc_ptr header; -+ int errcode; -+ -+ /* Useful define specifying the size of the ELF magical -+ header. */ -+#ifndef SELFMAG -+#define SELFMAG 4 -+#endif -+ -+ /* Read the first SELFMAG bytes and check if it is ELFMAG. */ -+ if (target_read_string (addr, &header, SELFMAG, &errcode) == SELFMAG -+ && errcode == 0) -+ { -+ const char *h = header.get (); -+ -+ /* The EI_MAG* and ELFMAG* constants come from -+ . */ -+ if (h[EI_MAG0] == ELFMAG0 && h[EI_MAG1] == ELFMAG1 -+ && h[EI_MAG2] == ELFMAG2 && h[EI_MAG3] == ELFMAG3) -+ { -+ /* This mapping contains an ELF header, so we -+ should dump it. */ -+ dump_p = 1; -+ } -+ } -+ } -+ -+ return dump_p; - } - - /* Implement the "info proc" command. */ -@@ -1311,7 +1358,7 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch, - if (has_anonymous) - should_dump_p = dump_mapping_p (filterflags, &v, priv, - mapping_anon_p, mapping_file_p, -- filename); -+ filename, addr, offset); - else - { - /* Older Linux kernels did not support the "Anonymous:" counter. -diff --git a/gdb/testsuite/gdb.base/coredump-filter-build-id.exp b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/coredump-filter-build-id.exp -@@ -0,0 +1,69 @@ -+# Copyright 2019 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 whether GDB's gcore/generate-core-file command can dump memory -+# mappings with ELF headers, containing a build-id note. -+# -+# Due to the fact that we don't have an easy way to process a corefile -+# and look for specific notes using GDB/dejagnu, we rely on an -+# external tool, eu-unstrip, to verify if the corefile contains -+# build-ids. -+ -+standard_testfile "normal.c" -+ -+# This test is Linux x86_64 only. -+if { ![istarget *-*-linux*] } { -+ untested "$testfile.exp" -+ return -1 -+} -+if { ![istarget "x86_64-*-*"] || ![is_lp64_target] } { -+ untested "$testfile.exp" -+ return -1 -+} -+ -+if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { -+ return -1 -+} -+ -+if { ![runto_main] } { -+ untested "could not run to main" -+ return -1 -+} -+ -+# First we need to generate a corefile. -+set corefilename "[standard_output_file gcore.test]" -+if { ![gdb_gcore_cmd "$corefilename" "save corefile"] } { -+ verbose -log "Could not save corefile" -+ untested "$testfile.exp" -+ return -1 -+} -+ -+# Determine if GDB dumped the mapping containing the build-id. This -+# is done by invoking an external program (eu-unstrip). -+if { [catch "exec [gdb_find_eu-unstrip] -n --core $corefilename" output] == 0 } { -+ set line [lindex [split $output "\n"] 0] -+ set test "gcore dumped mapping with build-id" -+ -+ verbose -log "First line of eu-unstrip: $line" -+ -+ if { [regexp "^${hex}\\+${hex} \[a-f0-9\]+@${hex}.*[string_to_regexp $binfile]$" $line] } { -+ pass "$test" -+ } else { -+ fail "$test" -+ } -+} else { -+ verbose -log "Could not execute eu-unstrip program" -+ untested "$testfile.exp" -+} -diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp ---- a/gdb/testsuite/lib/future.exp -+++ b/gdb/testsuite/lib/future.exp -@@ -162,6 +162,16 @@ proc gdb_find_readelf {} { - return $readelf - } - -+proc gdb_find_eu-unstrip {} { -+ global EU_UNSTRIP_FOR_TARGET -+ if [info exists EU_UNSTRIP_FOR_TARGET] { -+ set eu_unstrip $EU_UNSTRIP_FOR_TARGET -+ } else { -+ set eu_unstrip [transform eu-unstrip] -+ } -+ return $eu_unstrip -+} -+ - proc gdb_default_target_compile {source destfile type options} { - global target_triplet - global tool_root_dir - diff --git a/gdb-rhbz1398387-tab-crash-test.patch b/gdb-rhbz1398387-tab-crash-test.patch index 1546bfe04387d26fffe144e4dafb473302aa2019..835b2312a1cfc19cecc77b6adadb37671d044bf3 100644 --- a/gdb-rhbz1398387-tab-crash-test.patch +++ b/gdb-rhbz1398387-tab-crash-test.patch @@ -444,4 +444,3 @@ new file mode 100644 +clean_restart ${debugfile} + +gdb_test "complete p si" "complete p si\r\np size_of_encoded_value" - diff --git a/gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch b/gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch deleted file mode 100644 index 18a9924a624fa63dc1990d45659fab9ce8ae16b6..0000000000000000000000000000000000000000 --- a/gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch +++ /dev/null @@ -1,76 +0,0 @@ -Stop the BFD library from issuing a warning message when processing allocated sections in debuginfo files that lie outside of any loadable segment. - - PR 24717 - * elf.c (is_debuginfo_file): New function. - (assign_file_positions_for_non_load_sections): Do not warn about - allocated sections outside of loadable segments if they are found - in a debuginfo file. - * elf-bfd.h (is_debuginfo_file): Prototype. - -diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h ---- a/bfd/elf-bfd.h -+++ b/bfd/elf-bfd.h -@@ -2751,6 +2751,8 @@ extern bfd_vma elf64_r_sym (bfd_vma); - extern bfd_vma elf32_r_info (bfd_vma, bfd_vma); - extern bfd_vma elf32_r_sym (bfd_vma); - -+extern bfd_boolean is_debuginfo_file (bfd *); -+ - /* Large common section. */ - extern asection _bfd_elf_large_com_section; - -diff --git a/bfd/elf.c b/bfd/elf.c ---- a/bfd/elf.c -+++ b/bfd/elf.c -@@ -5800,6 +5800,35 @@ assign_file_positions_for_load_sections (bfd *abfd, - return TRUE; - } - -+/* Determine if a bfd is a debuginfo file. Unfortunately there -+ is no defined method for detecting such files, so we have to -+ use heuristics instead. */ -+ -+bfd_boolean -+is_debuginfo_file (bfd *abfd) -+{ -+ if (abfd == NULL || bfd_get_flavour (abfd) != bfd_target_elf_flavour) -+ return FALSE; -+ -+ Elf_Internal_Shdr **start_headers = elf_elfsections (abfd); -+ Elf_Internal_Shdr **end_headers = start_headers + elf_numsections (abfd); -+ Elf_Internal_Shdr **headerp; -+ -+ for (headerp = start_headers; headerp < end_headers; headerp ++) -+ { -+ Elf_Internal_Shdr *header = * headerp; -+ -+ /* Debuginfo files do not have any allocated SHT_PROGBITS sections. -+ The only allocated sections are SHT_NOBITS or SHT_NOTES. */ -+ if ((header->sh_flags & SHF_ALLOC) == SHF_ALLOC -+ && header->sh_type != SHT_NOBITS -+ && header->sh_type != SHT_NOTE) -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ - /* Assign file positions for the other sections. */ - - static bfd_boolean -@@ -5833,7 +5862,13 @@ assign_file_positions_for_non_load_sections (bfd *abfd, - BFD_ASSERT (hdr->sh_offset == hdr->bfd_section->filepos); - else if ((hdr->sh_flags & SHF_ALLOC) != 0) - { -- if (hdr->sh_size != 0) -+ if (hdr->sh_size != 0 -+ /* PR 24717 - debuginfo files are known to be not strictly -+ compliant with the ELF standard. In particular they often -+ have .note.gnu.property sections that are outside of any -+ loadable segment. This is not a problem for such files, -+ so do not warn about them. */ -+ && ! is_debuginfo_file (abfd)) - _bfd_error_handler - /* xgettext:c-format */ - (_("%pB: warning: allocated section `%s' not in segment"), - diff --git a/gdb-rhbz1553104-s390x-arch12-test.patch b/gdb-rhbz1553104-s390x-arch12-test.patch index d4484483817abe9a0122b2d7077755f0024f80cf..bcfd342d7c4e0dd3734506d5653f2c365d898a76 100644 --- a/gdb-rhbz1553104-s390x-arch12-test.patch +++ b/gdb-rhbz1553104-s390x-arch12-test.patch @@ -71,4 +71,3 @@ new file mode 100644 +H`````````2@`````````#@````````````````````$````````````` +` +end - diff --git a/gdb-rhbz1704406-disable-style-log-output-1of3.patch b/gdb-rhbz1704406-disable-style-log-output-1of3.patch deleted file mode 100644 index 35b1b289e887e3c2a595ad465a08b2eb6621f840..0000000000000000000000000000000000000000 --- a/gdb-rhbz1704406-disable-style-log-output-1of3.patch +++ /dev/null @@ -1,81 +0,0 @@ -Add "style" proc to the test suite - -This adds a "style" helper proc to the test suite, and updates -existing style tests to use it. Thanks to Sergio for the idea. - -Tested on x86-64 Fedora 29. - -gdb/testsuite/ChangeLog -2019-05-22 Tom Tromey - - * gdb.base/info-shared.exp (check_info_shared): Use "style". - * gdb.base/style.exp: Use "style". - * lib/gdb-utils.exp (style): New proc. - -diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp ---- a/gdb/testsuite/gdb.base/style.exp -+++ b/gdb/testsuite/gdb.base/style.exp -@@ -41,10 +41,10 @@ save_vars { env(TERM) } { - - gdb_test_no_output "set style enabled on" - -- set main_expr "\033\\\[33mmain\033\\\[m" -- set base_file_expr "\033\\\[32m.*style\\.c\033\\\[m" -+ set main_expr [style main function] -+ set base_file_expr [style ".*style\\.c" file] - set file_expr "$base_file_expr:\[0-9\]" -- set arg_expr "\033\\\[36marg.\033\\\[m" -+ set arg_expr [style "arg." variable] - - gdb_test "frame" \ - "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*" -@@ -58,7 +58,7 @@ save_vars { env(TERM) } { - - gdb_test "break main" "file $base_file_expr.*" - -- gdb_test "print &main" " = .* \033\\\[34m$hex\033\\\[m <$main_expr>" -+ gdb_test "print &main" " = .* [style $hex address] <$main_expr>" - - # Regression test for a bug where line-wrapping would occur at the - # wrong spot with styling. There were different bugs at different -@@ -86,11 +86,12 @@ save_vars { env(TERM) } { - gdb_exit - gdb_spawn - -- gdb_test "" "\033\\\[35;1mGNU gdb.*\033\\\[m.*" \ -+ set vers [style "GNU gdb.*" "35;1"] -+ gdb_test "" "${vers}.*" \ - "version is styled" - - set quoted [string_to_regexp $binfile] - gdb_test "file $binfile" \ -- "Reading symbols from \033\\\[32m${quoted}\033\\\[m..." \ -+ "Reading symbols from [style $quoted file]..." \ - "filename is styled when loading symbol file" - } -diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp ---- a/gdb/testsuite/lib/gdb-utils.exp -+++ b/gdb/testsuite/lib/gdb-utils.exp -@@ -37,3 +37,21 @@ proc string_to_regexp {str} { - regsub -all {[]*+.|(){}^$\[\\]} $str {\\&} result - return $result - } -+ -+# Wrap STR in an ANSI terminal escape sequences -- one to set the -+# style to STYLE, and one to reset the style to the default. The -+# return value is suitable for use as a regular expression. -+ -+# STYLE can either be the payload part of an ANSI terminal sequence, -+# or a shorthand for one of the gdb standard styles: "file", -+# "function", "variable", or "address". -+ -+proc style {str style} { -+ switch -exact -- $style { -+ file { set style 32 } -+ function { set style 33 } -+ variable { set style 36 } -+ address { set style 34 } -+ } -+ return "\033\\\[${style}m${str}\033\\\[m" -+} - diff --git a/gdb-rhbz1704406-disable-style-log-output-2of3.patch b/gdb-rhbz1704406-disable-style-log-output-2of3.patch deleted file mode 100644 index ad1533270855634880fdfadc92d646575b614d82..0000000000000000000000000000000000000000 --- a/gdb-rhbz1704406-disable-style-log-output-2of3.patch +++ /dev/null @@ -1,187 +0,0 @@ -Do not emit style escape sequences to log file - -PR gdb/24502 requests that the "set logging" log file not contain -style escape sequences emitted by gdb. - -This seemed like a reasonable request to me, so this patch implements -filtering for the log file. - -This also updates a comment in ui-style.h that I noticed while writing -the patch. - -Tested on x86-64 Fedora 29. - -gdb/ChangeLog -2019-06-14 Tom Tromey - - PR gdb/24502: - * ui-style.h (skip_ansi_escape): Update comment. - * ui-file.h (class no_terminal_escape_file): New class. - * ui-file.c (no_terminal_escape_file::write) - (no_terminal_escape_file::puts): New methods. - * cli/cli-logging.c (handle_redirections): Use - no_terminal_escape_file. - -gdb/testsuite/ChangeLog -2019-06-14 Tom Tromey - - PR gdb/24502: - * gdb.base/style-logging.exp: New file. - -diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c ---- a/gdb/cli/cli-logging.c -+++ b/gdb/cli/cli-logging.c -@@ -117,7 +117,7 @@ handle_redirections (int from_tty) - return; - } - -- stdio_file_up log (new stdio_file ()); -+ stdio_file_up log (new no_terminal_escape_file ()); - if (!log->open (logging_filename, logging_overwrite ? "w" : "a")) - perror_with_name (_("set logging")); - -diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/style-logging.exp -@@ -0,0 +1,64 @@ -+# Copyright 2019 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 that logging does not style. -+ -+if {[is_remote host]} { -+ untested "does not work on remote host" -+ return 0 -+} -+ -+standard_testfile style.c -+ -+save_vars { env(TERM) } { -+ # We need an ANSI-capable terminal to get the output. -+ setenv TERM ansi -+ -+ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { -+ return -1 -+ } -+ -+ if {![runto_main]} { -+ fail "style tests failed" -+ return -+ } -+ -+ gdb_test_no_output "set style enabled on" -+ -+ set log_name [standard_output_file log.txt] -+ gdb_test_no_output "set logging file $log_name" -+ gdb_test_no_output "set logging overwrite on" -+ gdb_test "set logging on" "Copying output to .*" -+ -+ set main_expr [style main function] -+ set base_file_expr [style ".*style\\.c" file] -+ set file_expr "$base_file_expr:\[0-9\]" -+ set arg_expr [style "arg." variable] -+ gdb_test "frame" \ -+ "$main_expr.*$arg_expr.*$arg_expr.*$file_expr.*" -+ -+ gdb_test "set logging off" "Done logging to .*" -+ -+ set fd [open $log_name] -+ set data [read -nonewline $fd] -+ close $fd -+ -+ set testname "log is escape-free" -+ if {[regexp "\033" $data]} { -+ fail $testname -+ } else { -+ pass $testname -+ } -+} -diff --git a/gdb/ui-file.c b/gdb/ui-file.c ---- a/gdb/ui-file.c -+++ b/gdb/ui-file.c -@@ -332,3 +332,33 @@ tee_file::isatty () - { - return m_one->isatty (); - } -+ -+void -+no_terminal_escape_file::write (const char *buf, long length_buf) -+{ -+ std::string copy (buf, length_buf); -+ this->puts (copy.c_str ()); -+} -+ -+/* See ui-file.h. */ -+ -+void -+no_terminal_escape_file::puts (const char *buf) -+{ -+ while (*buf != '\0') -+ { -+ const char *esc = strchr (buf, '\033'); -+ if (esc == nullptr) -+ break; -+ -+ int n_read = 0; -+ if (!skip_ansi_escape (esc, &n_read)) -+ ++esc; -+ -+ this->stdio_file::write (buf, esc - buf); -+ buf = esc + n_read; -+ } -+ -+ if (*buf != '\0') -+ this->stdio_file::write (buf, strlen (buf)); -+} -diff --git a/gdb/ui-file.h b/gdb/ui-file.h ---- a/gdb/ui-file.h -+++ b/gdb/ui-file.h -@@ -264,4 +264,20 @@ private: - bool m_close_one, m_close_two; - }; - -+/* A ui_file implementation that filters out terminal escape -+ sequences. */ -+ -+class no_terminal_escape_file : public stdio_file -+{ -+public: -+ no_terminal_escape_file () -+ { -+ } -+ -+ /* Like the stdio_file methods, but these filter out terminal escape -+ sequences. */ -+ void write (const char *buf, long length_buf) override; -+ void puts (const char *linebuffer) override; -+}; -+ - #endif -diff --git a/gdb/ui-style.h b/gdb/ui-style.h ---- a/gdb/ui-style.h -+++ b/gdb/ui-style.h -@@ -233,8 +233,8 @@ private: - - /* Skip an ANSI escape sequence in BUF. BUF must begin with an ESC - character. Return true if an escape sequence was successfully -- skipped; false otherwise. In either case, N_READ is updated to -- reflect the number of chars read from BUF. */ -+ skipped; false otherwise. If an escape sequence was skipped, -+ N_READ is updated to reflect the number of chars read from BUF. */ - - extern bool skip_ansi_escape (const char *buf, int *n_read); - - diff --git a/gdb-rhbz1704406-disable-style-log-output-3of3.patch b/gdb-rhbz1704406-disable-style-log-output-3of3.patch deleted file mode 100644 index f2301021dcbf65ce37f454daa612398532848699..0000000000000000000000000000000000000000 --- a/gdb-rhbz1704406-disable-style-log-output-3of3.patch +++ /dev/null @@ -1,23 +0,0 @@ -gdb: Remove file path from test name - -Having paths in test names makes comparing sum files difficult, rename -a test to avoid paths in test names. - -gdb/testsuite/ChangeLog: - - * gdb.base/style-logging.exp: Remove path from test name. - -diff --git a/gdb/testsuite/gdb.base/style-logging.exp b/gdb/testsuite/gdb.base/style-logging.exp ---- a/gdb/testsuite/gdb.base/style-logging.exp -+++ b/gdb/testsuite/gdb.base/style-logging.exp -@@ -38,7 +38,8 @@ save_vars { env(TERM) } { - gdb_test_no_output "set style enabled on" - - set log_name [standard_output_file log.txt] -- gdb_test_no_output "set logging file $log_name" -+ gdb_test_no_output "set logging file $log_name" \ -+ "set logging filename" - gdb_test_no_output "set logging overwrite on" - gdb_test "set logging on" "Copying output to .*" - - diff --git a/gdb-rhbz1708192-parse_macro_definition-crash.patch b/gdb-rhbz1708192-parse_macro_definition-crash.patch deleted file mode 100644 index ca89553ff291db56cf08afd7d403a650ff25e7ae..0000000000000000000000000000000000000000 --- a/gdb-rhbz1708192-parse_macro_definition-crash.patch +++ /dev/null @@ -1,61 +0,0 @@ -Don't crash if dwarf_decode_macro_bytes's 'body' is NULL - -Hi, - -Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192 - https://bugzilla.redhat.com/show_bug.cgi?id=1708786 - -During the Fedora RPM build process, gdb-add-index is invoked to -extract the DWARF index from the binary, and GDB will segfault because -dwarf2read.c:parse_definition_macro's 'body' variable is NULL. - -The underlying problem is that Fedora's rpm-build's "debugedit" -program will silently corrupt .debug_macro strings when a binary is -compiled with -g3. This is being taken care of by Mark Wielaard, -here: - - https://bugzilla.redhat.com/show_bug.cgi?id=1708786 - -However, I still feel it's important to make GDB more resilient -against invalid DWARF input, so I'm proposing this rather simple patch -to catch the situation when "body == NULL" (i.e., it's probably been -corrupted) and issue a complaint. This is not a real fix to the -problem, of course, but at least GDB is able to finish without -segfaulting. - -OK for master? - -gdb/ChangeLog: -2019-05-15 Sergio Durigan Junior - - Ref.: https://bugzilla.redhat.com/show_bug.cgi?id=1708192 - * dwarf2read.c (dwarf_decode_macro_bytes): Check whether 'body' is - NULL, and complain if that's the case. - -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -24627,7 +24627,21 @@ dwarf_decode_macro_bytes (struct dwarf2_cu *cu, - is_define ? _("definition") : _("undefinition"), - line == 0 ? _("zero") : _("non-zero"), line, body); - -- if (is_define) -+ if (body == NULL) -+ { -+ /* Fedora's rpm-build's "debugedit" binary -+ corrupted .debug_macro sections. -+ -+ For more info, see -+ https://bugzilla.redhat.com/show_bug.cgi?id=1708786 */ -+ complaint (_("debug info gives %s invalid macro %s " -+ "without body (corrupted?) at line %d " -+ "on file %s"), -+ at_commandline ? _("command-line") : _("in-file"), -+ is_define ? _("definition") : _("undefinition"), -+ line, current_file->filename); -+ } -+ else if (is_define) - parse_macro_definition (current_file, line, body); - else - { - diff --git a/gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch b/gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch deleted file mode 100644 index 2c7ab3c92e528eb9cb12826b3f3cd200db657bc7..0000000000000000000000000000000000000000 --- a/gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch +++ /dev/null @@ -1,103 +0,0 @@ -Fix crash when using PYTHONMALLOC=debug (PR python/24742) - -This bug was originally reported against Fedora GDB: - - https://bugzilla.redhat.com/show_bug.cgi?id=1723564 - -The problem is that GDB will crash in the following scenario: - -- PYTHONMALLOC=debug or PYTHONDEVMODE=1 is set. - -- The Python debuginfo is installed. - -- GDB is used to debug Python. - -The crash looks like this: - - $ PYTHONMALLOC=debug gdb -args python3 -c pass - GNU gdb (GDB) Fedora 8.3-3.fc30 - Reading symbols from python3... - Reading symbols from /usr/lib/debug/usr/bin/python3.7m-3.7.3-3.fc30.x86_64.debug... - (gdb) run - Starting program: /usr/bin/python3 -c pass - Missing separate debuginfos, use: dnf debuginfo-install glibc-2.29-9.fc30.x86_64 - Debug memory block at address p=0x5603977bf330: API '' - 8098648152243306496 bytes originally requested - The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfb): - at p-7: 0x03 *** OUCH - at p-6: 0x00 *** OUCH - at p-5: 0x00 *** OUCH - at p-4: 0x00 *** OUCH - at p-3: 0x00 *** OUCH - at p-2: 0x00 *** OUCH - at p-1: 0x00 *** OUCH - Because memory is corrupted at the start, the count of bytes requested - may be bogus, and checking the trailing pad bytes may segfault. - The 8 pad bytes at tail=0x706483999ad1f330 are Segmentation fault (core dumped) - -It's hard to determine what happens, but after doing some -investigation and talking to Victor Stinner I found that GDB should -not use the Python memory allocation functions before the Python -interpreter is initialized (which makes sense). However, we do just -that on python/python.c:do_start_initialization: - - ... - progsize = strlen (progname.get ()); - progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t)); - ... - /* Note that Py_SetProgramName expects the string it is passed to - remain alive for the duration of the program's execution, so - it is not freed after this call. */ - Py_SetProgramName (progname_copy); - ... - Py_Initialize (); - PyEval_InitThreads (); - -Upon reading the Python 3 C API documentation, I -found (https://docs.python.org/3.5/c-api/memory.html): - - To avoid memory corruption, extension writers should never try to - operate on Python objects with the functions exported by the C - library: malloc(), calloc(), realloc() and free(). This will result in - mixed calls between the C allocator and the Python memory manager with - fatal consequences, because they implement different algorithms and - operate on different heaps. However, one may safely allocate and - release memory blocks with the C library allocator for individual - purposes[...] - -And Py_SetProgramName seems like a very simple call that doesn't need -a Python-allocated memory to work on. So I'm proposing this patch, -which simply replaces PyMem_Malloc by xmalloc. - -Testing this is more complicated. First, the crash is completely -non-deterministic; I was able to reproduce it 10 times in a row, and -then I wasn't able to reproduce it anymore. I found that if you -completely remove your build directory and rebuild GDB from scratch, -you can reproduce it again confidently. And with my patch, I -confirmed that the bug doesn't manifest even in this situation. - -No regressions found. - -OK to apply? - -gdb/ChangeLog: -2019-06-28 Sergio Durigan Junior - - PR python/24742 - https://bugzilla.redhat.com/show_bug.cgi?id=1723564 - * python/python.c (do_start_initialization): Use 'xmalloc' - instead of 'PyMem_Malloc'. - -diff --git a/gdb/python/python.c b/gdb/python/python.c ---- a/gdb/python/python.c -+++ b/gdb/python/python.c -@@ -1720,7 +1720,7 @@ do_start_initialization () - std::string oldloc = setlocale (LC_ALL, NULL); - setlocale (LC_ALL, ""); - progsize = strlen (progname.get ()); -- progname_copy = (wchar_t *) PyMem_Malloc ((progsize + 1) * sizeof (wchar_t)); -+ progname_copy = (wchar_t *) xmalloc ((progsize + 1) * sizeof (wchar_t)); - if (!progname_copy) - { - fprintf (stderr, "out of memory\n"); - diff --git a/gdb-rhbz1818011-bfd-gcc10-error.patch b/gdb-rhbz1818011-bfd-gcc10-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..01740ab9fd8bc270cf2ce03e4b9ee8100a8057f7 --- /dev/null +++ b/gdb-rhbz1818011-bfd-gcc10-error.patch @@ -0,0 +1,12 @@ +diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h +--- a/bfd/elf-bfd.h ++++ b/bfd/elf-bfd.h +@@ -1937,7 +1937,7 @@ struct elf_obj_tdata + struct sdt_note *sdt_note_head; + + Elf_Internal_Shdr **group_sect_ptr; +- int num_group; ++ unsigned int num_group; + + /* Index into group_sect_ptr, updated by setup_group when finding a + section's group. Used to optimize subsequent group searches. */ diff --git a/gdb-rhbz1822715-fix-python-deprecation.patch b/gdb-rhbz1822715-fix-python-deprecation.patch new file mode 100644 index 0000000000000000000000000000000000000000..e0527262219ff81f1a18e5a7e105bb1a068ecedd --- /dev/null +++ b/gdb-rhbz1822715-fix-python-deprecation.patch @@ -0,0 +1,16 @@ +diff --git a/gdb/python/python.c b/gdb/python/python.c +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -1618,7 +1618,12 @@ do_start_initialization () + #endif + + Py_Initialize (); ++#if PY_VERSION_HEX < 0x03090000 ++ /* PyEval_InitThreads became deprecated in Python 3.9 and will ++ be removed in Python 3.11. Prior to Python 3.7, this call was ++ required to initialize the GIL. */ + PyEval_InitThreads (); ++#endif + + #ifdef IS_PY3K + gdb_module = PyImport_ImportModule ("_gdb"); diff --git a/gdb-rhbz1829702-fix-python39.patch b/gdb-rhbz1829702-fix-python39.patch new file mode 100644 index 0000000000000000000000000000000000000000..ca072052922c46e20332ca88b1fefda15214659a --- /dev/null +++ b/gdb-rhbz1829702-fix-python39.patch @@ -0,0 +1,94 @@ +diff --git a/gdb/python/python.c b/gdb/python/python.c +--- a/gdb/python/python.c ++++ b/gdb/python/python.c +@@ -234,6 +234,30 @@ gdbpy_enter::~gdbpy_enter () + PyGILState_Release (m_state); + } + ++/* A helper class to save and restore the GIL, but without touching ++ the other globals that are handled by gdbpy_enter. */ ++ ++class gdbpy_gil ++{ ++public: ++ ++ gdbpy_gil () ++ : m_state (PyGILState_Ensure ()) ++ { ++ } ++ ++ ~gdbpy_gil () ++ { ++ PyGILState_Release (m_state); ++ } ++ ++ DISABLE_COPY_AND_ASSIGN (gdbpy_gil); ++ ++private: ++ ++ PyGILState_STATE m_state; ++}; ++ + /* Set the quit flag. */ + + static void +@@ -247,6 +271,10 @@ gdbpy_set_quit_flag (const struct extension_language_defn *extlang) + static int + gdbpy_check_quit_flag (const struct extension_language_defn *extlang) + { ++ if (!gdb_python_initialized) ++ return 0; ++ ++ gdbpy_gil gil; + return PyOS_InterruptOccurred (); + } + +@@ -924,30 +952,6 @@ gdbpy_source_script (const struct extension_language_defn *extlang, + + /* Posting and handling events. */ + +-/* A helper class to save and restore the GIL, but without touching +- the other globals that are handled by gdbpy_enter. */ +- +-class gdbpy_gil +-{ +-public: +- +- gdbpy_gil () +- : m_state (PyGILState_Ensure ()) +- { +- } +- +- ~gdbpy_gil () +- { +- PyGILState_Release (m_state); +- } +- +- DISABLE_COPY_AND_ASSIGN (gdbpy_gil); +- +-private: +- +- PyGILState_STATE m_state; +-}; +- + /* A single event. */ + struct gdbpy_event + { +@@ -1548,6 +1552,7 @@ finalize_python (void *ignore) + + Py_Finalize (); + ++ gdb_python_initialized = false; + restore_active_ext_lang (previous_active); + } + +@@ -1720,8 +1725,7 @@ do_start_initialization () + return false; + + /* Release the GIL while gdb runs. */ +- PyThreadState_Swap (NULL); +- PyEval_ReleaseLock (); ++ PyEval_SaveThread (); + + make_final_cleanup (finalize_python, NULL); + diff --git a/gdb-rhbz1838777-debuginfod.patch b/gdb-rhbz1838777-debuginfod.patch new file mode 100644 index 0000000000000000000000000000000000000000..299227848f74cd22da0bfd36a60edee24735addc --- /dev/null +++ b/gdb-rhbz1838777-debuginfod.patch @@ -0,0 +1,1128 @@ +diff --git a/config/debuginfod.m4 b/config/debuginfod.m4 +new file mode 100644 +--- /dev/null ++++ b/config/debuginfod.m4 +@@ -0,0 +1,38 @@ ++dnl Copyright (C) 1997-2019 Free Software Foundation, Inc. ++dnl This file is free software, distributed under the terms of the GNU ++dnl General Public License. As a special exception to the GNU General ++dnl Public License, this file may be distributed as part of a program ++dnl that contains a configuration script generated by Autoconf, under ++dnl the same distribution terms as the rest of that program. ++ ++AC_DEFUN([AC_DEBUGINFOD], ++[ ++# Enable debuginfod ++AC_ARG_WITH([debuginfod], ++ AC_HELP_STRING([--with-debuginfod], ++ [Enable debuginfo lookups with debuginfod (auto/yes/no)]), ++ [], [with_debuginfod=auto]) ++AC_MSG_CHECKING([whether to use debuginfod]) ++AC_MSG_RESULT([$with_debuginfod]) ++ ++if test "${with_debuginfod}" = no; then ++ AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.]) ++else ++ AC_CHECK_LIB([debuginfod], [debuginfod_begin], [have_debuginfod_lib=yes]) ++ AC_CHECK_DECL([debuginfod_begin], [have_debuginfod_h=yes], [], ++ [#include ]) ++ if test "x$have_debuginfod_lib" = "xyes" -a \ ++ "x$have_debuginfod_h" = "xyes"; then ++ AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], ++ [Define to 1 if debuginfod is enabled.]) ++ AC_SUBST([LIBDEBUGINFOD], ["-ldebuginfod"]) ++ else ++ AC_SUBST([LIBDEBUGINFOD], []) ++ if test "$with_debuginfod" = yes; then ++ AC_MSG_ERROR([debuginfod is missing or unusable]) ++ else ++ AC_MSG_WARN([debuginfod is missing or unusable; some features may be unavailable.]) ++ fi ++ fi ++fi ++]) +diff --git a/gdb/Makefile.in b/gdb/Makefile.in +--- a/gdb/Makefile.in ++++ b/gdb/Makefile.in +@@ -612,7 +612,8 @@ CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(LIBCTF) $(ZLIB) \ + @LIBS@ @GUILE_LIBS@ @PYTHON_LIBS@ \ + $(LIBEXPAT) $(LIBLZMA) $(LIBBABELTRACE) $(LIBIPT) \ + $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) $(LIBICONV) $(LIBMPFR) \ +- $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) ++ $(SRCHIGH_LIBS) $(LIBXXHASH) $(PTHREAD_LIBS) \ ++ @LIBDEBUGINFOD@ + CDEPS = $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) $(LIBCTF) \ + $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) + +@@ -1016,6 +1017,7 @@ COMMON_SFILES = \ + dbxread.c \ + dcache.c \ + debug.c \ ++ debuginfod-support.c \ + dictionary.c \ + disasm.c \ + disasm-selftests.c \ +diff --git a/gdb/NEWS b/gdb/NEWS +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -932,6 +932,20 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd* + manual for a further description of this feature. + + ++* GDB now supports debuginfod, an HTTP server for distributing ELF/DWARF ++ debugging information as well as source code. ++ ++ When built with debuginfod, GDB can automatically query debuginfod ++ servers for the separate debug files and source code of the executable ++ being debugged. ++ ++ To build GDB with debuginfod, pass --with-debuginfod to configure (this ++ requires libdebuginfod, the debuginfod client library). ++ ++ debuginfod is distributed with elfutils, starting with version 0.178. ++ ++ You can get the latest version from https://sourceware.org/elfutils. ++ + * New features in the GDB remote stub, GDBserver + + ** GDBserver is now able to start inferior processes with a +diff --git a/gdb/README b/gdb/README +--- a/gdb/README ++++ b/gdb/README +@@ -432,6 +432,15 @@ more obscure GDB `configure' options are not listed here. + Use the curses library instead of the termcap library, for + text-mode terminal operations. + ++`--with-debuginfod' ++ Build GDB with libdebuginfod, the debuginfod client library. Used ++ to automatically fetch source files and separate debug files from ++ debuginfod servers using the associated executable's build ID. ++ Enabled by default if libdebuginfod is installed and found at ++ configure time. debuginfod is packaged with elfutils, starting ++ with version 0.178. You can get the latest version from ++ 'https://sourceware.org/elfutils/'. ++ + `--with-libunwind-ia64' + Use the libunwind library for unwinding function call stack on ia64 + target platforms. +diff --git a/gdb/config.in b/gdb/config.in +--- a/gdb/config.in ++++ b/gdb/config.in +@@ -230,6 +230,9 @@ + /* Define if you have the babeltrace library. */ + #undef HAVE_LIBBABELTRACE + ++/* Define to 1 if debuginfod is enabled. */ ++#undef HAVE_LIBDEBUGINFOD ++ + /* Define if you have the expat library. */ + #undef HAVE_LIBEXPAT + +diff --git a/gdb/configure b/gdb/configure +--- a/gdb/configure ++++ b/gdb/configure +@@ -758,6 +758,7 @@ REPORT_BUGS_TEXI + REPORT_BUGS_TO + PKGVERSION + CODESIGN_CERT ++LIBDEBUGINFOD + HAVE_NATIVE_GCORE_TARGET + TARGET_OBS + subdirs +@@ -875,6 +876,7 @@ enable_64_bit_bfd + enable_gdbmi + enable_tui + enable_gdbtk ++with_debuginfod + with_libunwind_ia64 + with_curses + enable_profiling +@@ -1611,6 +1613,8 @@ Optional Packages: + do not restrict auto-loaded files locations + --with-rpm query rpm database for missing debuginfos (yes/no, + def. auto=librpm.so) ++ --with-debuginfod Enable debuginfo lookups with debuginfod ++ (auto/yes/no) + --with-libunwind-ia64 use libunwind frame unwinding for ia64 targets + --with-curses use the curses library instead of the termcap + library +@@ -2271,6 +2275,52 @@ rm -f conftest.val + + } # ac_fn_c_compute_int + ++# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES ++# --------------------------------------------- ++# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR ++# accordingly. ++ac_fn_c_check_decl () ++{ ++ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack ++ as_decl_name=`echo $2|sed 's/ *(.*//'` ++ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 ++$as_echo_n "checking whether $as_decl_name is declared... " >&6; } ++if eval \${$3+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++$4 ++int ++main () ++{ ++#ifndef $as_decl_name ++#ifdef __cplusplus ++ (void) $as_decl_use; ++#else ++ (void) $as_decl_name; ++#endif ++#endif ++ ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_compile "$LINENO"; then : ++ eval "$3=yes" ++else ++ eval "$3=no" ++fi ++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ++fi ++eval ac_res=\$$3 ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 ++$as_echo "$ac_res" >&6; } ++ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno ++ ++} # ac_fn_c_check_decl ++ + # ac_fn_c_check_func LINENO FUNC VAR + # ---------------------------------- + # Tests whether FUNC exists, setting the cache variable VAR accordingly +@@ -2449,52 +2499,6 @@ $as_echo "$ac_res" >&6; } + + } # ac_fn_c_check_type + +-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +-# --------------------------------------------- +-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +-# accordingly. +-ac_fn_c_check_decl () +-{ +- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack +- as_decl_name=`echo $2|sed 's/ *(.*//'` +- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` +- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +-$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +-if eval \${$3+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-$4 +-int +-main () +-{ +-#ifndef $as_decl_name +-#ifdef __cplusplus +- (void) $as_decl_use; +-#else +- (void) $as_decl_name; +-#endif +-#endif +- +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_compile "$LINENO"; then : +- eval "$3=yes" +-else +- eval "$3=no" +-fi +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +-fi +-eval ac_res=\$$3 +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +-$as_echo "$ac_res" >&6; } +- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno +- +-} # ac_fn_c_check_decl +- + # ac_fn_cxx_try_link LINENO + # ------------------------- + # Try to link conftest.$ac_ext, and return whether this succeeded. +@@ -6658,8 +6662,8 @@ $as_echo_n "checking specific librpm version... " >&6; } + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +-as_fn_error "cannot run test program while cross compiling +-See \`config.log' for more details." "$LINENO" 5; } ++as_fn_error $? "cannot run test program while cross compiling ++See \`config.log' for more details" "$LINENO" 5; } + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +@@ -6830,7 +6834,7 @@ $as_echo "#define HAVE_LIBRPM 1" >>confdefs.h + $as_echo "no" >&6; } + LIBS="$save_LIBS" + if $DLOPEN_REQUIRE; then +- as_fn_error "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 ++ as_fn_error $? "Specific name $LIBRPM was requested but it could not be opened." "$LINENO" 5 + fi + + +@@ -6845,7 +6849,7 @@ if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 + $as_echo_n "checking for $ac_word... " >&6; } +-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : ++if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 + else + case $PKG_CONFIG in +@@ -6859,7 +6863,7 @@ do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do +- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 +@@ -6888,7 +6892,7 @@ if test -z "$ac_cv_path_PKG_CONFIG"; then + set dummy pkg-config; ac_word=$2 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 + $as_echo_n "checking for $ac_word... " >&6; } +-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : ++if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 + else + case $ac_pt_PKG_CONFIG in +@@ -6902,7 +6906,7 @@ do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do +- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ++ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 +@@ -7086,7 +7090,7 @@ $as_echo "#define HAVE_LIBRPM 1" >>confdefs.h + LIBS="$LIBS $RPM_LIBS" + else + if $RPM_REQUIRE; then +- as_fn_error "$RPM_PKG_ERRORS" "$LINENO" 5 ++ as_fn_error $? "$RPM_PKG_ERRORS" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $RPM_PKG_ERRORS" >&5 + $as_echo "$as_me: WARNING: $RPM_PKG_ERRORS" >&2;} +@@ -7332,8 +7336,92 @@ $as_echo "$as_me: WARNING: gdbtk isn't supported on $host; disabling" >&2;} + enable_gdbtk=no ;; + esac + +-# Libunwind support for ia64. ++# Handle optional debuginfod support ++ ++# Enable debuginfod ++ ++# Check whether --with-debuginfod was given. ++if test "${with_debuginfod+set}" = set; then : ++ withval=$with_debuginfod; ++else ++ with_debuginfod=auto ++fi ++ ++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use debuginfod" >&5 ++$as_echo_n "checking whether to use debuginfod... " >&6; } ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_debuginfod" >&5 ++$as_echo "$with_debuginfod" >&6; } ++ ++if test "${with_debuginfod}" = no; then ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod support disabled; some features may be unavailable." >&5 ++$as_echo "$as_me: WARNING: debuginfod support disabled; some features may be unavailable." >&2;} ++else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for debuginfod_begin in -ldebuginfod" >&5 ++$as_echo_n "checking for debuginfod_begin in -ldebuginfod... " >&6; } ++if ${ac_cv_lib_debuginfod_debuginfod_begin+:} false; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ac_check_lib_save_LIBS=$LIBS ++LIBS="-ldebuginfod $LIBS" ++cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char debuginfod_begin (); ++int ++main () ++{ ++return debuginfod_begin (); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_lib_debuginfod_debuginfod_begin=yes ++else ++ ac_cv_lib_debuginfod_debuginfod_begin=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++LIBS=$ac_check_lib_save_LIBS ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_debuginfod_debuginfod_begin" >&5 ++$as_echo "$ac_cv_lib_debuginfod_debuginfod_begin" >&6; } ++if test "x$ac_cv_lib_debuginfod_debuginfod_begin" = xyes; then : ++ have_debuginfod_lib=yes ++fi ++ ++ ac_fn_c_check_decl "$LINENO" "debuginfod_begin" "ac_cv_have_decl_debuginfod_begin" "#include ++" ++if test "x$ac_cv_have_decl_debuginfod_begin" = xyes; then : ++ have_debuginfod_h=yes ++fi ++ ++ if test "x$have_debuginfod_lib" = "xyes" -a \ ++ "x$have_debuginfod_h" = "xyes"; then ++ ++$as_echo "#define HAVE_LIBDEBUGINFOD 1" >>confdefs.h ++ ++ LIBDEBUGINFOD="-ldebuginfod" + ++ else ++ ++ if test "$with_debuginfod" = yes; then ++ as_fn_error $? "debuginfod is missing or unusable" "$LINENO" 5 ++ else ++ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&5 ++$as_echo "$as_me: WARNING: debuginfod is missing or unusable; some features may be unavailable." >&2;} ++ fi ++ fi ++fi ++ ++ ++# Libunwind support for ia64. + + # Check whether --with-libunwind-ia64 was given. + if test "${with_libunwind_ia64+set}" = set; then : +@@ -16441,7 +16529,7 @@ _ACEOF + for ac_header in selinux/selinux.h + do : + ac_fn_c_check_header_mongrel "$LINENO" "selinux/selinux.h" "ac_cv_header_selinux_selinux_h" "$ac_includes_default" +-if test "x$ac_cv_header_selinux_selinux_h" = x""yes; then : ++if test "x$ac_cv_header_selinux_selinux_h" = xyes; then : + cat >>confdefs.h <<_ACEOF + #define HAVE_SELINUX_SELINUX_H 1 + _ACEOF +@@ -16452,7 +16540,7 @@ done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_get_boolean_active in -lselinux" >&5 + $as_echo_n "checking for security_get_boolean_active in -lselinux... " >&6; } +-if test "${ac_cv_lib_selinux_security_get_boolean_active+set}" = set; then : ++if ${ac_cv_lib_selinux_security_get_boolean_active+:} false; then : + $as_echo_n "(cached) " >&6 + else + ac_check_lib_save_LIBS=$LIBS +@@ -16486,7 +16574,7 @@ LIBS=$ac_check_lib_save_LIBS + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_selinux_security_get_boolean_active" >&5 + $as_echo "$ac_cv_lib_selinux_security_get_boolean_active" >&6; } +-if test "x$ac_cv_lib_selinux_security_get_boolean_active" = x""yes; then : ++if test "x$ac_cv_lib_selinux_security_get_boolean_active" = xyes; then : + cat >>confdefs.h <<_ACEOF + #define HAVE_LIBSELINUX 1 + _ACEOF +diff --git a/gdb/configure.ac b/gdb/configure.ac +--- a/gdb/configure.ac ++++ b/gdb/configure.ac +@@ -18,6 +18,8 @@ dnl along with this program. If not, see . + + dnl Process this file with autoconf to produce a configure script. + ++m4_include(../config/debuginfod.m4) ++ + AC_INIT(main.c) + AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h]) + AM_MAINTAINER_MODE +@@ -516,8 +518,10 @@ case $host_os in + enable_gdbtk=no ;; + esac + +-# Libunwind support for ia64. ++# Handle optional debuginfod support ++AC_DEBUGINFOD + ++# Libunwind support for ia64. + AC_ARG_WITH(libunwind-ia64, + AS_HELP_STRING([--with-libunwind-ia64], + [use libunwind frame unwinding for ia64 targets]),, +diff --git a/gdb/debuginfod-support.c b/gdb/debuginfod-support.c +new file mode 100644 +--- /dev/null ++++ b/gdb/debuginfod-support.c +@@ -0,0 +1,155 @@ ++/* debuginfod utilities for GDB. ++ Copyright (C) 2020 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 ++#include "cli/cli-style.h" ++#include "gdbsupport/scoped_fd.h" ++#include "debuginfod-support.h" ++ ++#ifndef HAVE_LIBDEBUGINFOD ++scoped_fd ++debuginfod_source_query (const unsigned char *build_id, ++ int build_id_len, ++ const char *srcpath, ++ gdb::unique_xmalloc_ptr *destname) ++{ ++ return scoped_fd (-ENOSYS); ++} ++ ++scoped_fd ++debuginfod_debuginfo_query (const unsigned char *build_id, ++ int build_id_len, ++ const char *filename, ++ gdb::unique_xmalloc_ptr *destname) ++{ ++ return scoped_fd (-ENOSYS); ++} ++#else ++#include ++ ++/* TODO: Use debuginfod API extensions instead of these globals. */ ++static std::string desc; ++static std::string fname; ++static bool has_printed; ++ ++static int ++progressfn (debuginfod_client *c, long cur, long total) ++{ ++ if (check_quit_flag ()) ++ { ++ printf_filtered ("Cancelling download of %s %ps...\n", ++ desc.c_str (), ++ styled_string (file_name_style.style (), fname.c_str ())); ++ return 1; ++ } ++ ++ if (!has_printed && total != 0) ++ { ++ /* Print this message only once. */ ++ has_printed = true; ++ printf_filtered ("Downloading %s %ps...\n", ++ desc.c_str (), ++ styled_string (file_name_style.style (), fname.c_str ())); ++ } ++ ++ return 0; ++} ++ ++static debuginfod_client * ++debuginfod_init () ++{ ++ debuginfod_client *c = debuginfod_begin (); ++ ++ if (c != nullptr) ++ debuginfod_set_progressfn (c, progressfn); ++ ++ return c; ++} ++ ++/* See debuginfod-support.h */ ++ ++scoped_fd ++debuginfod_source_query (const unsigned char *build_id, ++ int build_id_len, ++ const char *srcpath, ++ gdb::unique_xmalloc_ptr *destname) ++{ ++ if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL) ++ return scoped_fd (-ENOSYS); ++ ++ debuginfod_client *c = debuginfod_init (); ++ ++ if (c == nullptr) ++ return scoped_fd (-ENOMEM); ++ ++ desc = std::string ("source file"); ++ fname = std::string (srcpath); ++ has_printed = false; ++ ++ scoped_fd fd (debuginfod_find_source (c, ++ build_id, ++ build_id_len, ++ srcpath, ++ nullptr)); ++ ++ /* TODO: Add 'set debug debuginfod' command to control when error messages are shown. */ ++ if (fd.get () < 0 && fd.get () != -ENOENT) ++ printf_filtered (_("Download failed: %s. Continuing without source file %ps.\n"), ++ safe_strerror (-fd.get ()), ++ styled_string (file_name_style.style (), srcpath)); ++ else ++ destname->reset (xstrdup (srcpath)); ++ ++ debuginfod_end (c); ++ return fd; ++} ++ ++/* See debuginfod-support.h */ ++ ++scoped_fd ++debuginfod_debuginfo_query (const unsigned char *build_id, ++ int build_id_len, ++ const char *filename, ++ gdb::unique_xmalloc_ptr *destname) ++{ ++ if (getenv (DEBUGINFOD_URLS_ENV_VAR) == NULL) ++ return scoped_fd (-ENOSYS); ++ ++ debuginfod_client *c = debuginfod_init (); ++ ++ if (c == nullptr) ++ return scoped_fd (-ENOMEM); ++ ++ desc = std::string ("separate debug info for"); ++ fname = std::string (filename); ++ has_printed = false; ++ char *dname = nullptr; ++ ++ scoped_fd fd (debuginfod_find_debuginfo (c, build_id, build_id_len, &dname)); ++ ++ if (fd.get () < 0 && fd.get () != -ENOENT) ++ printf_filtered (_("Download failed: %s. Continuing without debug info for %ps.\n"), ++ safe_strerror (-fd.get ()), ++ styled_string (file_name_style.style (), filename)); ++ ++ destname->reset (dname); ++ debuginfod_end (c); ++ return fd; ++} ++#endif +diff --git a/gdb/debuginfod-support.h b/gdb/debuginfod-support.h +new file mode 100644 +--- /dev/null ++++ b/gdb/debuginfod-support.h +@@ -0,0 +1,62 @@ ++/* debuginfod utilities for GDB. ++ Copyright (C) 2020 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 DEBUGINFOD_SUPPORT_H ++#define DEBUGINFOD_SUPPORT_H ++ ++/* Query debuginfod servers for a source file associated with an ++ executable with BUILD_ID. BUILD_ID can be given as a binary blob or ++ a null-terminated string. If given as a binary blob, BUILD_ID_LEN ++ should be the number of bytes. If given as a null-terminated string, ++ BUILD_ID_LEN should be 0. ++ ++ SRC_PATH should be the source file's absolute path that includes the ++ compilation directory of the CU associated with the source file. ++ For example if a CU's compilation directory is `/my/build` and the ++ source file path is `/my/source/foo.c`, then SRC_PATH should be ++ `/my/build/../source/foo.c`. ++ ++ If the file is successfully retrieved, its path on the local machine ++ is stored in DESTNAME. If GDB is not built with debuginfod, this ++ function returns -ENOSYS. */ ++ ++extern scoped_fd ++debuginfod_source_query (const unsigned char *build_id, ++ int build_id_len, ++ const char *src_path, ++ gdb::unique_xmalloc_ptr *destname); ++ ++/* Query debuginfod servers for a debug info file with BUILD_ID. ++ BUILD_ID can be given as a binary blob or a null-terminated string. ++ If given as a binary blob, BUILD_ID_LEN should be the number of bytes. ++ If given as a null-terminated string, BUILD_ID_LEN should be 0. ++ ++ FILENAME should be the name or path of the main binary associated with ++ the separate debug info. It is used for printing messages to the user. ++ ++ If the file is successfully retrieved, its path on the local machine ++ is stored in DESTNAME. If GDB is not built with debuginfod, this ++ function returns -ENOSYS. */ ++ ++extern scoped_fd ++debuginfod_debuginfo_query (const unsigned char *build_id, ++ int build_id_len, ++ const char *filename, ++ gdb::unique_xmalloc_ptr *destname); ++ ++#endif /* DEBUGINFOD_SUPPORT_H */ +diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo +--- a/gdb/doc/gdb.texinfo ++++ b/gdb/doc/gdb.texinfo +@@ -37726,6 +37726,14 @@ supported). + Use the curses library instead of the termcap library, for text-mode + terminal operations. + ++@item --with-debuginfod ++Build @value{GDBN} with libdebuginfod, the debuginfod client library. ++Used to automatically fetch source files and separate debug files from ++debuginfod servers using the associated executable's build ID. Enabled ++by default if libdebuginfod is installed and found at configure time. ++debuginfod is packaged with elfutils, starting with version 0.178. You ++can get the latest version from `https://sourceware.org/elfutils/'. ++ + @item --with-libunwind-ia64 + Use the libunwind library for unwinding function call stack on ia64 + target platforms. See http://www.nongnu.org/libunwind/index.html for +diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c +--- a/gdb/dwarf2read.c ++++ b/gdb/dwarf2read.c +@@ -77,6 +77,7 @@ + #include "gdbsupport/selftest.h" + #include "rust-lang.h" + #include "gdbsupport/pathstuff.h" ++#include "debuginfod-support.h" + + /* When == 1, print basic high level tracing messages. + When > 1, be more verbose. +@@ -2717,6 +2718,29 @@ dwarf2_get_dwz_file (struct dwarf2_per_objfile *dwarf2_per_objfile) + dwz_bfd.reset (nullptr); + } + ++ if (dwz_bfd == nullptr) ++ { ++ gdb::unique_xmalloc_ptr alt_filename; ++ const char *origname = dwarf2_per_objfile->objfile->original_name; ++ ++ scoped_fd fd (debuginfod_debuginfo_query (buildid, ++ buildid_len, ++ origname, ++ &alt_filename)); ++ ++ if (fd.get () >= 0) ++ { ++ /* File successfully retrieved from server. */ ++ dwz_bfd = gdb_bfd_open (alt_filename.get (), gnutarget, -1); ++ ++ if (dwz_bfd == nullptr) ++ warning (_("File \"%s\" from debuginfod cannot be opened as bfd"), ++ alt_filename.get ()); ++ else if (!build_id_verify (dwz_bfd.get (), buildid_len, buildid)) ++ dwz_bfd.reset (nullptr); ++ } ++ } ++ + if (dwz_bfd == NULL) + dwz_bfd = build_id_to_debug_bfd (buildid_len, buildid, NULL); + +diff --git a/gdb/elfread.c b/gdb/elfread.c +--- a/gdb/elfread.c ++++ b/gdb/elfread.c +@@ -49,6 +49,8 @@ + #include "mdebugread.h" + #include "ctfread.h" + #include "gdbsupport/gdb_string_view.h" ++#include "gdbsupport/scoped_fd.h" ++#include "debuginfod-support.h" + + /* Forward declarations. */ + extern const struct sym_fns elf_sym_fns_gdb_index; +@@ -1313,12 +1315,42 @@ elf_symfile_read (struct objfile *objfile, symfile_add_flags symfile_flags) + symbol_file_add_separate (debug_bfd.get (), debugfile.c_str (), + symfile_flags, objfile); + } +- /* Check if any separate debug info has been extracted out. */ +- else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") +- != NULL) +- debug_print_missing (objfile_name (objfile), build_id_filename.get ()); + else +- has_dwarf2 = false; ++ { ++ has_dwarf2 = false; ++ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (objfile->obfd); ++ ++ if (build_id != nullptr) ++ { ++ gdb::unique_xmalloc_ptr symfile_path; ++ scoped_fd fd (debuginfod_debuginfo_query (build_id->data, ++ build_id->size, ++ objfile->original_name, ++ &symfile_path)); ++ ++ if (fd.get () >= 0) ++ { ++ /* File successfully retrieved from server. */ ++ gdb_bfd_ref_ptr debug_bfd (symfile_bfd_open (symfile_path.get ())); ++ ++ if (debug_bfd == nullptr) ++ warning (_("File \"%s\" from debuginfod cannot be opened as bfd"), ++ objfile->original_name); ++ else if (build_id_verify (debug_bfd.get (), build_id->size, build_id->data)) ++ { ++ symbol_file_add_separate (debug_bfd.get (), symfile_path.get (), ++ symfile_flags, objfile); ++ has_dwarf2 = true; ++ } ++ } ++ } ++ /* Check if any separate debug info has been extracted out. */ ++ else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") ++ != NULL) ++ debug_print_missing (objfile_name (objfile), build_id_filename.get ()); ++ else ++ has_dwarf2 = false; ++ } + } + + /* Read the CTF section only if there is no DWARF info. */ +diff --git a/gdb/source.c b/gdb/source.c +--- a/gdb/source.c ++++ b/gdb/source.c +@@ -47,6 +47,8 @@ + #include "gdbsupport/pathstuff.h" + #include "source-cache.h" + #include "cli/cli-style.h" ++#include "build-id.h" ++#include "debuginfod-support.h" + + #define OPEN_MODE (O_RDONLY | O_BINARY) + #define FDOPEN_MODE FOPEN_RB +@@ -1122,6 +1124,34 @@ open_source_file (struct symtab *s) + s->fullname = NULL; + scoped_fd fd = find_and_open_source (s->filename, SYMTAB_DIRNAME (s), + &fullname); ++ ++ if (fd.get () < 0) ++ { ++ if (SYMTAB_COMPUNIT (s) != nullptr) ++ { ++ const objfile *ofp = COMPUNIT_OBJFILE (SYMTAB_COMPUNIT (s)); ++ ++ std::string srcpath; ++ if (IS_ABSOLUTE_PATH (s->filename)) ++ srcpath = s->filename; ++ else if (SYMTAB_DIRNAME (s) != nullptr) ++ { ++ srcpath = SYMTAB_DIRNAME (s); ++ srcpath += SLASH_STRING; ++ srcpath += s->filename; ++ } ++ ++ const struct bfd_build_id *build_id = build_id_bfd_shdr_get (ofp->obfd); ++ ++ /* Query debuginfod for the source file. */ ++ if (build_id != nullptr) ++ fd = debuginfod_source_query (build_id->data, ++ build_id->size, ++ srcpath.c_str (), ++ &fullname); ++ } ++ } ++ + s->fullname = fullname.release (); + return fd; + } +diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +@@ -0,0 +1,215 @@ ++# Copyright 2020 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 debuginfod functionality ++ ++standard_testfile main.c ++ ++load_lib dwarf.exp ++ ++if { [which debuginfod] == 0 } { ++ untested "cannot find debuginfod" ++ return -1 ++} ++ ++if { [which curl] == 0 } { ++ untested "cannot find curl" ++ return -1 ++} ++ ++# Skip testing if gdb was not configured with debuginfod ++if { [string first "with-debuginfod" \ ++ [eval exec $GDB $INTERNAL_GDBFLAGS --configuration]] == -1 } { ++ untested "gdb not configured with debuginfod" ++ return -1 ++} ++ ++set cache [standard_output_file ".client_cache"] ++set db [standard_output_file ".debuginfod.db"] ++ ++# Delete any preexisting test files ++file delete -force $cache ++file delete -force $db ++ ++set sourcetmp [standard_output_file tmp-${srcfile}] ++set outputdir [standard_output_file {}] ++ ++# Make a copy source file that we can move around ++if { [catch {file copy -force ${srcdir}/${subdir}/${srcfile} \ ++ [standard_output_file ${sourcetmp}]}] != 0 } { ++ error "create temporary file" ++ return -1 ++} ++ ++if { [gdb_compile "$sourcetmp" "$binfile" executable {debug}] != "" } { ++ fail "compile" ++ return -1 ++} ++ ++setenv DEBUGINFOD_URLS "" ++setenv DEBUGINFOD_TIMEOUT 30 ++setenv DEBUGINFOD_CACHE_PATH $cache ++ ++# Test that gdb cannot find source without debuginfod ++clean_restart $binfile ++gdb_test_no_output "set substitute-path $outputdir /dev/null" ++gdb_test "list" ".*No such file or directory.*" ++ ++# Strip symbols into separate file and move it so gdb cannot find it without debuginfod ++if { [gdb_gnu_strip_debug $binfile ""] != 0 } { ++ fail "strip debuginfo" ++ return -1 ++} ++ ++set debugdir [standard_output_file "debug"] ++set debuginfo [standard_output_file "fetch_src_and_symbols.debug"] ++ ++file mkdir $debugdir ++file rename -force $debuginfo $debugdir ++ ++# Test that gdb cannot find symbols without debuginfod ++clean_restart $binfile ++gdb_test "file" ".*No symbol file.*" ++ ++# Write some assembly that just has a .gnu_debugaltlink section. ++# Copied from testsuite/gdb.dwarf2/dwzbuildid.exp. ++proc write_just_debugaltlink {filename dwzname buildid} { ++ set asm_file [standard_output_file $filename] ++ ++ Dwarf::assemble $asm_file { ++ upvar dwzname dwzname ++ upvar buildid buildid ++ ++ gnu_debugaltlink $dwzname $buildid ++ ++ # Only the DWARF reader checks .gnu_debugaltlink, so make sure ++ # there is a bit of DWARF in here. ++ cu {} { ++ compile_unit {{language @DW_LANG_C}} { ++ } ++ } ++ } ++} ++ ++# Write some DWARF that also sets the buildid. ++# Copied from testsuite/gdb.dwarf2/dwzbuildid.exp. ++proc write_dwarf_file {filename buildid {value 99}} { ++ set asm_file [standard_output_file $filename] ++ ++ Dwarf::assemble $asm_file { ++ declare_labels int_label int_label2 ++ ++ upvar buildid buildid ++ upvar value value ++ ++ build_id $buildid ++ ++ cu {} { ++ compile_unit {{language @DW_LANG_C}} { ++ int_label2: base_type { ++ {name int} ++ {byte_size 4 sdata} ++ {encoding @DW_ATE_signed} ++ } ++ ++ constant { ++ {name the_int} ++ {type :$int_label2} ++ {const_value $value data1} ++ } ++ } ++ } ++ } ++} ++ ++set buildid "01234567890abcdef0123456" ++ ++write_just_debugaltlink ${binfile}_has_altlink.S ${binfile}_dwz.o $buildid ++write_dwarf_file ${binfile}_dwz.S $buildid ++ ++if {[gdb_compile ${binfile}_has_altlink.S ${binfile}_alt.o object nodebug] != ""} { ++ fail "compile main with altlink" ++ return -1 ++} ++ ++if {[gdb_compile ${binfile}_dwz.S ${binfile}_dwz.o object nodebug] != ""} { ++ fail "compile altlink" ++ return -1 ++} ++ ++file rename -force ${binfile}_dwz.o $debugdir ++ ++# Test that gdb cannot find dwz without debuginfod. ++clean_restart ++gdb_test "file ${binfile}_alt.o" ".*could not find '.gnu_debugaltlink'.*" ++ ++# Find an unused port ++set port 7999 ++set found 0 ++while { ! $found } { ++ incr port ++ if { $port == 65536 } { ++ fail "no available ports" ++ return -1 ++ } ++ ++ spawn debuginfod -vvvv -d $db -p $port -F $debugdir ++ expect { ++ "started http server on IPv4 IPv6 port=$port" { set found 1 } ++ "failed to bind to port" { kill_wait_spawned_process $spawn_id } ++ timeout { ++ fail "find port timeout" ++ return -1 ++ } ++ } ++} ++ ++set metrics [list "ready 1" \ ++ "thread_work_total{role=\"traverse\"} 1" \ ++ "thread_work_pending{role=\"scan\"} 0" \ ++ "thread_busy{role=\"scan\"} 0"] ++ ++# Check server metrics to confirm init has completed. ++foreach m $metrics { ++ set timelim 20 ++ while { $timelim != 0 } { ++ sleep 0.5 ++ catch {exec curl -s http://127.0.0.1:$port/metrics} got ++ ++ if { [regexp $m $got] } { ++ break ++ } ++ ++ incr timelim -1 ++ } ++ ++ if { $timelim == 0 } { ++ fail "server init timeout" ++ return -1 ++ } ++} ++ ++# Point the client to the server ++setenv DEBUGINFOD_URLS http://127.0.0.1:$port ++ ++# gdb should now find the symbol and source files ++clean_restart $binfile ++gdb_test_no_output "set substitute-path $outputdir /dev/null" ++gdb_test "br main" "Breakpoint 1 at.*file.*" ++gdb_test "l" ".*This program is distributed in the hope.*" ++ ++# gdb should now find the debugaltlink file ++clean_restart ++gdb_test "file ${binfile}_alt.o" ".*Reading symbols from ${binfile}_alt.o\.\.\.*" +diff --git a/gdb/testsuite/gdb.debuginfod/main.c b/gdb/testsuite/gdb.debuginfod/main.c +new file mode 100644 +--- /dev/null ++++ b/gdb/testsuite/gdb.debuginfod/main.c +@@ -0,0 +1,25 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2020 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 . */ ++ ++/* Dummy main function. */ ++ ++int ++main() ++{ ++ asm ("main_label: .globl main_label"); ++ return 0; ++} +diff --git a/gdb/top.c b/gdb/top.c +--- a/gdb/top.c ++++ b/gdb/top.c +@@ -1513,6 +1513,17 @@ This GDB was configured as follows:\n\ + --without-python\n\ + ")); + #endif ++ ++#if HAVE_LIBDEBUGINFOD ++ fprintf_filtered (stream, _("\ ++ --with-debuginfod\n\ ++")); ++#else ++ fprintf_filtered (stream, _("\ ++ --without-debuginfod\n\ ++")); ++#endif ++ + #if HAVE_GUILE + fprintf_filtered (stream, _("\ + --with-guile\n\ diff --git a/gdb-rhbz1844458-use-fputX_unfiltered.patch b/gdb-rhbz1844458-use-fputX_unfiltered.patch new file mode 100644 index 0000000000000000000000000000000000000000..c27d3b988689a27ab4bff25831f8a7c26e88e912 --- /dev/null +++ b/gdb-rhbz1844458-use-fputX_unfiltered.patch @@ -0,0 +1,57 @@ +diff --git a/gdb/utils.c b/gdb/utils.c +--- a/gdb/utils.c ++++ b/gdb/utils.c +@@ -1783,7 +1783,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, + newline -- if chars_per_line is right, we + probably just overflowed anyway; if it's wrong, + let us keep going. */ +- fputc_unfiltered ('\n', stream); ++ /* XXX: The ideal thing would be to call ++ 'stream->putc' here, but we can't because it ++ currently calls 'fputc_unfiltered', which ends up ++ calling us, which generates an infinite ++ recursion. */ ++ stream->puts ("\n"); + } + else + { +@@ -1828,7 +1833,12 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream, + wrap_here ((char *) 0); /* Spit out chars, cancel + further wraps. */ + lines_printed++; +- fputc_unfiltered ('\n', stream); ++ /* XXX: The ideal thing would be to call ++ 'stream->putc' here, but we can't because it ++ currently calls 'fputc_unfiltered', which ends up ++ calling us, which generates an infinite ++ recursion. */ ++ stream->puts ("\n"); + lineptr++; + } + } +@@ -1923,10 +1933,7 @@ fputs_highlighted (const char *str, const compiled_regex &highlight, + int + putchar_unfiltered (int c) + { +- char buf = c; +- +- ui_file_write (gdb_stdout, &buf, 1); +- return c; ++ return fputc_unfiltered (c, gdb_stdout); + } + + /* Write character C to gdb_stdout using GDB's paging mechanism and return C. +@@ -1941,9 +1948,11 @@ putchar_filtered (int c) + int + fputc_unfiltered (int c, struct ui_file *stream) + { +- char buf = c; ++ char buf[2]; + +- ui_file_write (stream, &buf, 1); ++ buf[0] = c; ++ buf[1] = 0; ++ fputs_unfiltered (buf, stream); + return c; + } + diff --git a/gdb-rhbz795424-bitpos-20of25.patch b/gdb-rhbz795424-bitpos-20of25.patch deleted file mode 100644 index 42359e482d0c4502237e402d5077e1783936399b..0000000000000000000000000000000000000000 --- a/gdb-rhbz795424-bitpos-20of25.patch +++ /dev/null @@ -1,3427 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-09/msg00631.html - ---MP_/yp5f+W_ED2JtUlSyBi8xujr -Content-Type: text/plain; charset=US-ASCII -Content-Transfer-Encoding: 7bit -Content-Disposition: inline - -Hi, - -This is patch 1/4, which implements the bulk of the changes in type -length and bitpos/type offset. I have verified that there are no -regressions resulting from this patch by running the testsuite on -Fedora 16 x86_64. Patch and changelog attached. - -Regards, -Siddhesh - ---MP_/yp5f+W_ED2JtUlSyBi8xujr -Content-Type: text/plain -Content-Transfer-Encoding: quoted-printable -Content-Disposition: attachment; filename=ChangeLog-main - -gdb/ChangeLog - -2012-08-05 Siddhesh Poyarekar - - * ada-lang.c (fat_pntr_bounds_bitpos): Return LONGEST. - (fat_pntr_data_bitpos): Likewise. - (desc_bound_bitpos): Likewise. - (constrained_packed_array_type): Expand ELT_BITS parameter to - LONGEST. - (move_bits): Expand parameters SRC_OFFSET and N to LONGEST. - (cond_offset_host): Expand parameter OFFSET to LONGEST. - (cond_offset_target): Likewise. - (ada_type_of_array): Expand ARRAY_BITSIZE to LONGEST. - (decode_constrained_packed_array_type): Expand BITS to LONGEST. - (decode_constrained_packed_array): Expand BIT_POS to LONGEST. - (ada_value_primitive_packed_val): Expand parameter OFFSET to - LONGEST. Expand TARG, NTARG and NEW_OFFSET to LONGEST. - (ada_value_assign): Expand FROM_SIZE to LONGEST. - (value_assign_to_component): Expand BITS to LONGEST. - (ensure_lval): Expand LEN to LONGEST. - (value_pointer): Expand LEN to ULONGEST. - (value_tag_from_contents_and_address): Expand TAG_BYTE_OFFSET to - LONGEST. - (ada_value_primitive_field): Expand parameter OFFSET to LONGEST. - Expand bit_pos to LONGEST. - (find_struct_field): Expand parameters OFFSET and BYTE_OFFSET_P to - LONGEST. Expand BIT_POS and FLD_OFFSET to LONGEST. - (ada_search_struct_field): Expand parameter OFFSET to LONGEST. - Expand VAR_OFFSET to LONGEST. - (ada_index_struct_field): Expand parameters INDEX and OFFSET to - LONGEST. - (ada_index_struct_field_1): Expand parameters INDEX_P and OFFSET - to LONGEST. - (ada_value_struct_elt): Expand BYTE_OFFSET to LONGEST. - (align_value): Return ULONGEST. Expand parameter OFF and - ALIGNMENT to ULONGEST. - (ada_template_to_fixed_record_type_1): Expand OFF, BIT_LEN and - fld_bit_len to LONGEST. Expand FIELD_OFFSET to LONGEST. Use - pulongest function to print TYPE_LENGTH. - (to_fixed_array_type): Expand LEN to LONGEST. - * ada-lang.h (ada_val_print): Expand parameter EMBEDDED_OFFSET to - LONGEST. - (ada_printstr): Expand parameter LENGTH to ULONGEST. - (ada_value_primitive_packed_val): Expand parameter OFFSET to - LONGEST. - * ada-typeprint.c (ada_print_type): Use pulongest to print - TYPE_LENGTH. - * ada-valprint.c (val_print_packed_array_elements): Expand ELTLEN - to ULONGEST. - (char_at): Expand parameter I to LONGEST. - (printstr): Expand parameter LENGTH, I, REP1, REPS to ULONGEST. - Use pulongest to format print REPS. - (ada_printstr): Expand parameter LENGTH to LONGEST. - (ada_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. - (ada_val_print_array): Expand ELTLEN, LEN to ULONGEST and TEMP_LEN - to LONGEST. - (ada_val_print_1): Expand parameter OFFSET to LONGEST. - (print_variant_part): Expand parameters OFFSET and OUTER_OFFSET to - LONGEST. - (print_field_values): Likewise. Expand BIT_POS to LONGEST. - * annotate.c (annotate_array_section_begin): Expand parameter - IDX to LONGEST. Use plongest to format-print IDX. - (annotate_elt_rep): Expand parameter REPCOUNT to ULONGEST. Use - plongest to format-print REPCOUNT. - * annotate.h: Likewise. - * arm-linux-nat.c (arm_linux_region_ok_for_hw_watchpoint): - Expand parameter parameter LEN to LONGEST. - * ax-gdb.c (gen_left_shift): Expand parameter DISTANCE to LONGEST. - (gen_offset): Expand parameter OFFSET to LONGEST. - (gen_bitfield_ref): Expand parameters START, END to LONGEST. - Expand BOUND_START, BOUND_END, OFFSET to LONGEST. - (gen_primitive_field): Expand parameter OFFSET to LONGEST. - (gen_struct_ref_recursive): Likewise. - * ax-general.c (ax_trace_quick): Expand parameter N to LONGEST. - * ax.h (ax_trace_quick): Likewise. - * breakpoint.c (breakpoint_address_match_range): Expand parameter - LEN1 to LONGEST. - (can_use_hardware_watchpoint): Expand LEN to LONGEST. - * breakpoint.h (struct bp_target_info): Expand member LENGTH to - LONGEST. - (struct bp_location): Likewise. - * c-lang.c (c_printstr): Expand parameter LENGTH to ULONGEST. - (evaluate_subexp_c): Expand ELEMENT_SIZE, I to LONGEST. - * c-lang.h (c_val_print): Expand parameter EMBEDDED_OFFSET to - LONGEST. - (c_printstr): Expand parameter LENGTH to ULONGEST. - (cp_print_value_fields): Expand parameter OFFSET to LONGEST. - (cp_print_value_fields_rtti): Likewise. - * c-typeprint.c (c_type_print_varspec_suffix): Remove cast down to - int and use plongest to print LONGEST. - * c-valprint.c (c_val_print): Expand parameter EMBEDDED_OFFSET to - LONGEST. Expand OFFSET to LONGEST, ELTLEN to ULONGEST. - (c_value_print): Expand TOP to LONGEST. - * cp-abi.c (baseclass_offset): Return LONGEST. Expand parameter - EMBEDDED_OFFSET to LONGEST. Expand RES to LONGEST. - (value_virtual_fn_field): Expand parameter OFFSET to LONGEST. - (value_rtti_type): Expand parameter TOP to point to LONGEST. - * cp-abi.h (value_virtual_fn_field): Expand OFFSET to LONGEST. - (value_rtti_type): Expand TOP to point to LONGEST. - (baseclass_offset): Return LONGEST. Expand parameter - EMBEDDED_OFFSET to LONGEST. - (struct cp_abi_ops): Expand parameter OFFSET for VIRTUAL_FN_FIELD - to LONGEST. Expand parameter TOP to point to LONGEST in - VALUE_RTTI_TYPE. Return LONGEST from BASECLASS_OFFSET and expand - parameter EMBEDDED_OFFSET to LONGEST. - * cp-valprint.c (cp_print_value_fields): Expand parameter OFFSET - to LONGEST. Expand I_OFFSET to LONGEST. - (cp_print_value_fields_rtti): Expand parameter OFFSET to - LONGEST. Expand TOP to LONGEST. - (cp_print_value): Expand parameter OFFSET to LONGEST. Expand - THISOFFSET, BOFFSET to LONGEST. - * d-lang.h (d_val_print): Expand parameter EMBEDDED_OFFSET to - LONGEST. - * d-valprint.c (dynamic_array_type): Likewise. - (d_val_print): Likewise. - * doublest.c (floatformat_from_length): Expand parameter LEN to - LONGEST. Use plongest to format string for LONGEST. - * dwarf2loc.c (copy_bitwise): Expand parameters DEST_OFFSET_BITS, - BIT_COUNT to ULONGEST. Rename parameter SOURCE_OFFSET_BITS to - SOURCE_OFFSET and expand to ULONGEST. New variable - SOURCE_OFFSET_BITS. - (read_pieced_value): Expand OFFSET, DEST_OFFSET_BITS, - SOURCE_OFFSET_BITS, SOURCE_OFFSET to LONGEST. Expand TYPE_LEN, - THIS_SIZE, THIS_SIZE_BITS to ULONGEST. - (write_pieced_value): Likewise. - (check_pieced_value_bits): Expand parameters BIT_OFFSET and - BIT_LENGTH to LONGEST. Expand THIS_SIZE_BITS to ULONGEST. - (check_pieced_value_validity): Expand parameters BIT_OFFSET and - BIT_LENGTH to LONGEST. - (check_pieced_synthetic_pointer): Likewise. - (indirect_pieced_value): Expand BIT_LENGTH, BYTE_OFFSET and - BIT_OFFSET to LONGEST. - (dwarf2_evaluate_loc_desc_full): Expand N to ULONGEST. - * dwarf2read.c (dwarf2_const_value_length_mismatch_complaint): - Expand parameters ARG2 and ARG3 to LONGEST. Use plongest to - print ARG2 and ARG3. - (dwarf2_add_field): Expand ANONYMOUS_SIZE, BIT_OFFSET to - LONGEST. - * eval.c (evaluate_struct_tuple): Expand BITPOS to LONGEST. - (init_array_element): Expand ELEMENT_SIZE to LONGEST. - (binop_promote): Expand PROMOTED_LEN1, PROMOTED_LEN2, RESULT_LEN - to ULONGEST. - (evaluate_subexp_standard): Expand MEM_OFFSET, TOP, ELEMENT_SIZE - to LONGEST. - * f-lang.c (f_printstr): Expand parameter LENGTH to ULONGEST. - * f-lang.h (f_val_print): Expand parameter EMBEDDED_OFFSET to - LONGEST. - * f-valprint.c (f77_array_offset_tbl): Make LONGEST. - (f77_create_arrayprint_offset_tbl): Expand ELTLEN to LONGEST. - (f77_print_array_1): Expand parameter EMBEDDED_OFFSET to - LONGEST. Expand I to LONGEST. - (f77_print_array): Expand parameter EMBEDDED_OFFSET to LONGEST. - (f_val_print): Likewise. Expand OFFSET to LONGEST. - * findvar.c (default_value_from_register): Expand LEN to LONGEST. - (read_frame_register_value): Expand OFFSET, REG_OFFSET, LEN, - REG_LEN to LONGEST. - * frame.c (get_frame_register_bytes): Expand parameter LEN to - LONGEST. - * frame.h (get_frame_register_bytes): Likewise. - * gdbtypes.c (init_type): Expand parameter LENGTH to LONGEST. - (is_unique_ancestor_worker): Expand parameters OFFSET, - EMBEDDED_OFFSET to LONGEST. Expand THIS_OFFSET to LONGEST. - (is_unique_ancestor): Expand OFFSET to LONGEST. - (recursive_dump_type): Use pulongest to format print TYPE_LENGTH. - Use plongest to format print TYPE_FIELD_BITPOS. - (arch_type): Expand parameter LENGTH to LONGEST. - * gdbtypes.h (struct type.main_type.fld_bnds.fields): Expand - member BITPOS to LONGEST. - (struct type): Expand member LENGTH to ULONGEST. - (init_type): Expand parameter LENGTH to LONGEST. - (arch_type): Likewise. - * gnu-v2-abi.c (gnuv2_virtual_fn_field): Expand parameter OFFSET - to LONGEST. - (gnuv2_value_rtti_type): Expand parameter TOP to point to LONGEST. - (gnuv2_baseclass_offset): Return LONGEST. Expand parameter - EMBEDDED_OFFSET to LONGEST. Expand FIELD_OFFSET, BOFFSET, - FIELD_LENGTH to LONGEST. - * gnu-v3-abi.c (build_gdb_vtable_type): Expand OFFSET to LONGEST. - (vtable_address_point_offset): Return LONGEST. - (gnuv3_rtti_type): Expand parameter TOP_P to point to LONGEST. - (gnuv3_virtual_fn_field): Expand parameter OFFSET to LONGEST. - (gnuv3_baseclass_offset): Return LONGEST. Expand parameter - EMBEDDED_OFSET to LONGEST. Expand CUR_BASE_OFFSET, BASE_OFFSET to - LONGEST. - (gnuv3_find_method_in): Expand POS to LONGEST. - * go-lang.h (go_val_print): Expand parameter EMBEDDED_OFFSET to - LONGEST. - * go-valprint.c (print_go_string): Likewise. - (go_val_print): Likewise. - * i386-nat.c (i386_handle_nonaligned_watchpoint): Expand - parameter LEN to LONGEST. - (i386_region_ok_for_watchpoint): Likewise. - * inf-ttrace.c (inf_ttrace_region_ok_for_hw_watchpoint): Expand - parameter LEN to LONGEST. - * jv-lang.c (java_link_class_type): Expand BOFFSET to LONGEST. - (java_printstr): Expand parameter LENGTH to ULONGEST. - * jv-lang.h (java_val_print): Expand parameter EMBEDDED_OFFSET to - LONGEST. - * jv-valprint.c (java_print_value_fields): Expand parameter OFFSET - to LONGEST. - (java_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. - * language.c (unk_lang_printstr): Expand parameter LENGTH to - ULONGEST. - (unk_lang_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. - * language.h (language_defn): Expand parameter LENGTH of - LA_PRINTSTR to ULONGEST. Expand parameter EMBEDDED_OFFSET of - LA_VAL_PRINT to LONGEST. - * m2-lang.c (m2_printstr): Expand parameter LENGTH to ULONGEST. - Expand I, REP1, REPS to ULONGEST. Use pulongest to format print - REPS. - * m2-lang.h (m2_val_print): Expand parameter embedded_offset to - LONGEST. - * m2-typeprint.c (m2_array): New variable VAL. Use pulongest to - * format print VAL. - (m2_enum): expand LASTVAL to LONGEST. - * m2-valprint.c (m2_print_long_set): Expand parameter - EMBEDDED_OFFSET to LONGEST. - (m2_print_unbounded_array): Likewise. - (m2_print_array_contents): Likewise. - (m2_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. - Expand I, LEN, TEMP_LEN to ULONGEST. - * memrange.c (mem_ranges_overlap): Expand parameters LEN1, LEN2 to - LONGEST. - * memrange.h (struct mem_range): Expand member LENGTH to LONGEST. - (mem_ranges_overlap): Expand parameters LEN1, LEN2 to LONGEST. - * mips-linux-nat.c (mips_linux_region_ok_for_hw_watchpoint): - Expand parameter LEN to LONGEST. - * objc-lang.c (objc_printstr): Expand parameter LENGTH to - ULONGEST. Expand I, REP1, REPS to ULONGEST. use pulongest to - format print REPS. - * opencl-lang.c (lookup_opencl_vector_type): Expand parameter - EL_LENGTH to ULONGEST. Expand LENGTH to ULONGEST. - (lval_func_read): Expand OFFSET, N, I, J and ELSIZE to LONGEST. - (lval_func_write): Likewise. - (lval_func_check_validity): Expand parameter LENGTH to LONGEST. - Expand ELSIZE, START, END, I, STARTREST, ENDREST, COMP_OFFSET, - COMP_LENGTH to LONGEST. - (lval_func_check_any_valid): Expand ELSIZE to LONGEST. - (lval_func_check_synthetic_pointer): Expand parameters OFFSET and - LENGTH to LONGEST. Expand ELSIZE, START, END, I, STARTREST, - ENDREST, COMP_LENGTH, COMP_OFFSET to LONGEST. - * p-lang.c (is_pascal_string_type): Expand parameters LENGTH_POS, - STRING_POS, LENGTH_SIZE to point to LONGEST. - (pascal_printstr): Expand parameter LENGTH to ULONGEST. Expand - I, REP1, REPS to ULONGEST. Use pulongest to format print REPS. - * p-lang.h (pascal_val_print): Expand parameter EMBEDDED_OFFSET - to LONGEST. - (is_pascal_string_type): Expand parameters LENGTH_POS, STRING_POS, - LENGTH_SIZE to point to LONGEST. - (pascal_printstr): Expand parameter LENGTH to ULONGEST. - (pascal_object_print_value_fields): Expand parameter OFFSET to - LONGEST. - * p-valprint.c (pascal_val_print): Expand parameter - EMBEDDED_OFFSET to LONGEST. Expand ELTLEN to ULONGEST. Expand - LENGTH_SIZE, LENGTH_POS, STRING_POS to LONGEST. - (pascal_object_print_value_fields): Expand parameter OFFSET to - LONGEST. - (pascal_object_print_value): Likewise. Expand BOFFSET, - THISOFFSET to LONGEST. - * ppc-linux-nat.c (ppc_linux_region_ok_for_hw_watchpoint): - Expand parameter LEN to point to LONGEST. - * printcmd.c (print_formatted): Expand LEN to LONGEST. - (print_scalar_formatted): Likewise. - * procfs.c (procfs_region_ok_for_hw_watchpoint): Expand - parameter LEN to LONGEST. - * python/py-prettyprint.c (apply_val_pretty_printer): Expand - parameter EMBEDDED_OFFSET to LONGEST. - * python/python.h (apply_val_pretty_printer): Likewise. - * regcache.c (regcache_xfer_part): Expand parameter OFFSET to - LONGEST. - (regcache_raw_read_part): Likewise. - (regcache_raw_write_part): Likewise. - (regcache_cooked_read_part): Likewise. - (regcache_cooked_write_part): Likewise. - * regcache.h (regcache_raw_read_part): Likewise. - (regcache_raw_write_part): Likewise. - (regcache_cooked_read_part): Likewise. - (regcache_cooked_write_part): Likewise. - * remote.c (remote_region_ok_for_hw_watchpoint): Expand - parameter LEN to LONGEST. - * s390-nat.c (s390_region_ok_for_hw_watchpoint): Expand - parameter LEN to LONGEST. - * spu-multiarch.c (spu_region_ok_for_hw_watchpoint): Expand - parameter len to LONGEST. - * stack.c (print_frame_nameless_args): Expand parameter START to - LONGEST. - (print_frame_args): Expand HIGHEST_OFFSET, CURRENT_OFFSET, - ARG_SIZE, START to LONGEST. - * symmisc.c (print_symbol): Expand I to ULONGEST. Use pulongest - to format print TYPE_LENGTH. - * target.c (default_region_ok_for_hw_watchpoint): Expand parameter - LEN to LONGEST. - (debug_to_region_ok_for_hw_watchpoint): Likewise. - * target.h (struct target_ops): Expand parameter LEN to LONGEST - for TO_REGION_OK_FOR_HW_WATCHPOINT. - * tracepoint.c (add_memrange): Expand parameter LEN to LONGEST. - Use plongest to format print LEN. - (collect_symbol): Expand LEN to ULONGEST. Use pulongest to - format print LEN. - (scope_info): Expand J to LONGEST. Use pulongest to format - print TYPE_LENGTH. - * typeprint.c (whatis_exp): Expand TOP to LONGEST. - * valarith.c (value_subscripted_rvalue): Expand parameters INDEX - and LOWERBOUND to LONGEST. Expand ELT_SIZE, ELT_OFFS to ULONGEST. - (value_concat): expand INVAL1LEN and INVAL2LEN to ssize_t. - (value_logical_not): Expand LEN to LONGEST. - (value_strcmp): Expand LEN1, LEN2, I, LEN to LONGEST. - * valops.c (value_allocate_space_in_inferior): Expand parameter - LEN to LONGEST. - (value_cast_structs): Expand TOP to LONGEST. - (value_cast): Expand ELEMENT_LENGTH to ULONGEST. Expand - VAL_LENGTH to LONGEST. - (dynamic_cast_check_1): Expand parameter EMBEDDED_OFFSET to - LONGEST. Expand OFFSET to LONGEST. - (dynamic_cast_check_2): Likewise. - (value_dynamic_cast): Expand TOP to LONGEST. - (read_value_memory): Expand EMBEDDED_OFFSET to LONGEST. - (value_assign): Expand CHANGED_LEN, OFFSET to LONGEST. - (value_array): Expand TYPELENGTH to ULONGEST. - (update_search_result): Expand parameters LAST_BOFFSET, BOFFSET - to LONGEST. - (do_search_struct_field): Expand parameter OFFSET, LAST_BOFFSET - to LONGEST. Expand NEW_OFFSET, BOFFSET to LONGEST. - (search_struct_field): Expand parameter OFFSET to LONGEST. - Expand BOFFSET to LONGEST. - (search_struct_method): Expand parameter OFFSET to LONGEST. - Expand BASE_OFFSET, THIS_OFFSET to LONGEST. - (find_method_list): Expand parameters OFFSET, BOFFSET to - LONGEST. Expand BASE_OFFSET to LONGEST. - (value_find_oload_method_list): Expand parameter BOFFSET to point - to LONGEST. - (find_overload_match): Expand BOFFSET to LONGEST. - (value_struct_elt_for_reference): Expand parameter OFFSET to - LONGEST. Remove unneeded cast. Expand BASE_OFFSET to LONGEST. - (value_rtti_indirect_type): Expand parameter TOP to point to - LONGEST. - (value_full_object): Expand parameter XTOP to LONGEST. Expand - TOP to LONGEST. - * valprint.c (valprint_check_validity): Expand parameter - EMBEDDED_OFFSET to LONGEST. - (generic_val_print): Likewise. - (val_print): Likewise. - (val_print_scalar_formatted): Likewise. - (print_hex_chars): Expand parameter LEN to ULONGEST. - (val_print_array_elements): Expand parameter EMBEDDED_OFFSET to - LONGEST, I to ULONGEST. Expand LEN, ELTLEN, REP1, REPS to - ULONGEST. Use pulongest to format print REPS. - (generic_printstr): Expand parameter LENGTH to ULONGEST. - * valprint.h (val_print_array_elements): Expand parameter - EMBEDDED_OFFSET to LONGEST. - (val_print_scalar_formatted): Likewise. - (print_hex_chars): Expand parameter LEN to ULONGEST. - (generic_val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. - (generic_printstr): Expand parameter LENGTH to ULONGEST. - * value.c (struct range): Expand members OFFSET, LENGTH to - LONGEST. - (ranges_overlap): Expand parameters OFFSET1, OFFSET2, LEN1 AND - LEN2 to LONGEST. - (range_contain): Expand parameter OFFSET, LENGTH to LONGEST. - (struct value): Expand members OFFSET, EMBEDDED_OFFSET, - POINTED_TO_OFFSET to LONGEST. - (value_bytes_available): Expand parameters OFFSET, LENGTH to - LONGEST. - (mark_value_bytes_unavailable): Likewise. - (find_first_range_overlap): Likewise. - (value_available_contents_eq): Expand parameters OFFSET1, OFFSET2 - and LENGTH to LONGEST. - (value_offset): Return LONGEST. - (set_value_offset): Expand parameter OFFSET to LONGEST. - (value_contents_copy_raw): Expand parameters SRC_OFFSET, - DST_OFFSET, LENGTH to ssize_t. - (value_contents_copy): Likewise. - (value_bits_valid): Expand parameters OFFSET, LENGTH to LONGEST. - (value_bits_synthetic_pointer): Likewise. - (value_embedded_offset): Return LONGEST. - (set_value_embedded_offset): Expand parameter VAL to LONGEST. - (value_pointed_to_offset): Return LONGEST. - (set_value_pointed_to_offset): Expand parameter VAL to LONGEST. - (set_internalvar_component): Expand parameter OFFSET to LONGEST. - (value_primitive_field): Likewise. Expand BITPOS, BOFFSET, - CONTAINER_BITSIZE to LONGEST. - (value_fn_field): Expand parameter OFFSET to LONGEST. - (unpack_value_bits_as_long_1): Expand parameters EMBEDDED_OFFSET, - BITPOS to LONGEST. Expand READ_OFFSET to LONGEST. - (unpack_value_bits_as_long): Expand parameter EMBEDED_OFFSET to - LONGEST. - (unpack_value_field_as_long_1): Likewise. Expand BITPOS to - LONGEST. - (unpack_value_field_as_long): Expand parameter EMBEDDED_OFFSET to - LONGEST. - (value_field_bitfield): Likewise. - (modify_field): Expand parameter BITPOS to LONGEST. Expand - BYTESIZE to LONGEST. - * value.h (value_offset): Return LONGEST. - (set_value_offset): Expand parameter OFFSET to LONGEST. - (value_pointed_to_offset): Return LONGEST. - (set_value_pointed_to_offset): Expand parameter VAL to LONGEST. - (value_embedded_offset): Return LONGEST. - (set_value_embedded_offset): Expand parameter VAL to LONGEST. - (struct lval_funcs): Expand parameters OFFSET and LENGTH to - LONGEST for CHECK_VALIDITY. Likewise for CHECK_SYNTHETIC_POINTER. - (valprint_check_validity): Expand parameter EMBEDDED_OFFSET to - LONGEST. - (value_bits_valid): Expand parameters OFFSET, LENGTH to LONGEST. - (value_bits_synthetic_pointer): Likewise. - (value_bytes_available): Likewise. - (mark_value_bytes_unavailable): Likewise. - (value_available_contents_eq): Fix comment. Expand parameters - OFFSET1, OFFSET2, LENGTH to LONGEST. - (read_value_memory): Expand parameter EMBEDDED_OFFSET to - LONGEST. - (unpack_value_bits_as_long): Expand parameter EMBEDDED_OFFSET to - LONGEST. - (unpack_value_field_as_long): Likewise. - (value_field_bitfield): Likewise. - (value_contents_copy_raw): Expand parameters SRC_OFFSET, - DST_OFFSET, LENGTH to LONGEST. - (value_contents_copy): Likewise. - (value_primitive_field): Expand parameter OFFSET to LONGEST. - (value_rtti_indirect_type): Expand parameter TOP to point to - LONGEST. - (value_full_object): Expand parameter XTOP to LONGEST. - (set_internalvar_component): Expand parameter OFFSET to LONGEST. - (value_fn_field): Expand parameter OFFSET to LONGEST. - (modify_field): Expand parameter BITPOS to LONGEST. - (val_print): Expand parameter EMBEDDED_OFFSET to LONGEST. - (value_allocate_space_in_inferior): Expand parameter LEN to - LONGEST. - -gdb/testsuite/ChangeLog: - -2012-08-05 Siddhesh Poyarekar - - * gdb.base/longest-types.exp: Add test case to get offset of - BUF2. - ---MP_/yp5f+W_ED2JtUlSyBi8xujr -Content-Type: text/x-patch -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; filename=bitpos-main.patch - -diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c ---- a/gdb/aarch64-linux-nat.c -+++ b/gdb/aarch64-linux-nat.c -@@ -808,7 +808,7 @@ aarch64_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len, - /* Implement the "region_ok_for_hw_watchpoint" target_ops method. */ - - int --aarch64_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+aarch64_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - return aarch64_linux_region_ok_for_watchpoint (addr, len); - } -diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c ---- a/gdb/ada-lang.c -+++ b/gdb/ada-lang.c -@@ -78,7 +78,7 @@ static struct type *desc_bounds_type (struct type *); - - static struct value *desc_bounds (struct value *); - --static int fat_pntr_bounds_bitpos (struct type *); -+static LONGEST fat_pntr_bounds_bitpos (struct type *); - - static int fat_pntr_bounds_bitsize (struct type *); - -@@ -86,13 +86,13 @@ static struct type *desc_data_target_type (struct type *); - - static struct value *desc_data (struct value *); - --static int fat_pntr_data_bitpos (struct type *); -+static LONGEST fat_pntr_data_bitpos (struct type *); - - static int fat_pntr_data_bitsize (struct type *); - - static struct value *desc_one_bound (struct value *, int, int); - --static int desc_bound_bitpos (struct type *, int, int); -+static LONGEST desc_bound_bitpos (struct type *, int, int); - - static int desc_bound_bitsize (struct type *, int, int); - -@@ -175,7 +175,7 @@ static struct type *static_unwrap_type (struct type *type); - - static struct value *unwrap_value (struct value *); - --static struct type *constrained_packed_array_type (struct type *, long *); -+static struct type *constrained_packed_array_type (struct type *, LONGEST *); - - static struct type *decode_constrained_packed_array_type (struct type *); - -@@ -214,14 +214,14 @@ static struct value *value_val_atr (struct type *, struct value *); - static struct symbol *standard_lookup (const char *, const struct block *, - domain_enum); - --static struct value *ada_search_struct_field (const char *, struct value *, int, -+static struct value *ada_search_struct_field (const char *, struct value *, LONGEST, - struct type *); - --static struct value *ada_value_primitive_field (struct value *, int, int, -+static struct value *ada_value_primitive_field (struct value *, LONGEST, int, - struct type *); - --static int find_struct_field (const char *, struct type *, int, -- struct type **, int *, int *, int *, int *); -+static int find_struct_field (const char *, struct type *, LONGEST, -+ struct type **, LONGEST *, int *, int *, int *); - - static int ada_resolve_function (struct block_symbol *, int, - struct value **, int, const char *, -@@ -232,7 +232,7 @@ static int ada_is_direct_array_type (struct type *); - static void ada_language_arch_info (struct gdbarch *, - struct language_arch_info *); - --static struct value *ada_index_struct_field (int, struct value *, int, -+static struct value *ada_index_struct_field (LONGEST, struct value *, LONGEST, - struct type *); - - static struct value *assign_aggregate (struct value *, struct value *, -@@ -701,7 +701,7 @@ coerce_unspec_val_to_type (struct value *val, struct type *type) - } - - static const gdb_byte * --cond_offset_host (const gdb_byte *valaddr, long offset) -+cond_offset_host (const gdb_byte *valaddr, LONGEST offset) - { - if (valaddr == NULL) - return NULL; -@@ -710,7 +710,7 @@ cond_offset_host (const gdb_byte *valaddr, long offset) - } - - static CORE_ADDR --cond_offset_target (CORE_ADDR address, long offset) -+cond_offset_target (CORE_ADDR address, LONGEST offset) - { - if (address == 0) - return 0; -@@ -1752,7 +1752,7 @@ desc_bounds (struct value *arr) - /* If TYPE is the type of an array-descriptor (fat pointer), the bit - position of the field containing the address of the bounds data. */ - --static int -+static LONGEST - fat_pntr_bounds_bitpos (struct type *type) - { - return TYPE_FIELD_BITPOS (desc_base_type (type), 1); -@@ -1818,7 +1818,7 @@ desc_data (struct value *arr) - /* If TYPE is the type of an array-descriptor (fat pointer), the bit - position of the field containing the address of the data. */ - --static int -+static LONGEST - fat_pntr_data_bitpos (struct type *type) - { - return TYPE_FIELD_BITPOS (desc_base_type (type), 0); -@@ -1853,7 +1853,7 @@ desc_one_bound (struct value *bounds, int i, int which) - of the Ith lower bound stored in it, if WHICH is 0, and the Ith upper - bound, if WHICH is 1. The first bound is I=1. */ - --static int -+static LONGEST - desc_bound_bitpos (struct type *type, int i, int which) - { - return TYPE_FIELD_BITPOS (desc_base_type (type), 2 * i + which - 2); -@@ -2043,7 +2043,7 @@ ada_type_of_array (struct value *arr, int bounds) - zero, and does not need to be recomputed. */ - if (lo < hi) - { -- int array_bitsize = -+ LONGEST array_bitsize = - (hi - lo + 1) * TYPE_FIELD_BITSIZE (elt_type, 0); - - TYPE_LENGTH (array_type) = (array_bitsize + 7) / 8; -@@ -2203,7 +2203,7 @@ decode_packed_array_bitsize (struct type *type) - the length is arbitrary. */ - - static struct type * --constrained_packed_array_type (struct type *type, long *elt_bits) -+constrained_packed_array_type (struct type *type, LONGEST *elt_bits) - { - struct type *new_elt_type; - struct type *new_type; -@@ -2257,7 +2257,7 @@ decode_constrained_packed_array_type (struct type *type) - char *name; - const char *tail; - struct type *shadow_type; -- long bits; -+ LONGEST bits; - - if (!raw_name) - raw_name = ada_type_name (desc_base_type (type)); -@@ -2328,7 +2328,8 @@ decode_constrained_packed_array (struct value *arr) - array with no wrapper. In order to interpret the value through - the (left-justified) packed array type we just built, we must - first left-justify it. */ -- int bit_size, bit_pos; -+ int bit_size; -+ LONGEST bit_pos; - ULONGEST mod; - - mod = ada_modulus (value_type (arr)) - 1; -@@ -2556,7 +2557,7 @@ ada_unpack_from_contents (const gdb_byte *src, int bit_offset, int bit_size, - - struct value * - ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, -- long offset, int bit_offset, int bit_size, -+ LONGEST offset, int bit_offset, int bit_size, - struct type *type) - { - struct value *v; -@@ -2626,7 +2627,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr, - - if (obj != NULL) - { -- long new_offset = offset; -+ LONGEST new_offset = offset; - - set_value_component_location (v, obj); - set_value_bitpos (v, bit_offset + value_bitpos (obj)); -@@ -2696,7 +2697,7 @@ ada_value_assign (struct value *toval, struct value *fromval) - { - int len = (value_bitpos (toval) - + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; -- int from_size; -+ LONGEST from_size; - gdb_byte *buffer = (gdb_byte *) alloca (len); - struct value *val; - CORE_ADDR to_addr = value_address (toval); -@@ -2747,7 +2748,7 @@ value_assign_to_component (struct value *container, struct value *component, - (LONGEST) (value_address (component) - value_address (container)); - int bit_offset_in_container = - value_bitpos (component) - value_bitpos (container); -- int bits; -+ LONGEST bits; - - val = value_cast (value_type (component), val); - -@@ -4445,7 +4446,7 @@ ensure_lval (struct value *val) - if (VALUE_LVAL (val) == not_lval - || VALUE_LVAL (val) == lval_internalvar) - { -- int len = TYPE_LENGTH (ada_check_typedef (value_type (val))); -+ LONGEST len = TYPE_LENGTH (ada_check_typedef (value_type (val))); - const CORE_ADDR addr = - value_as_long (value_allocate_space_in_inferior (len)); - -@@ -4529,7 +4530,7 @@ static CORE_ADDR - value_pointer (struct value *value, struct type *type) - { - struct gdbarch *gdbarch = get_type_arch (type); -- unsigned len = TYPE_LENGTH (type); -+ ULONGEST len = TYPE_LENGTH (type); - gdb_byte *buf = (gdb_byte *) alloca (len); - CORE_ADDR addr; - -@@ -6642,7 +6643,7 @@ value_tag_from_contents_and_address (struct type *type, - const gdb_byte *valaddr, - CORE_ADDR address) - { -- int tag_byte_offset; -+ LONGEST tag_byte_offset; - struct type *tag_type; - - if (find_struct_field ("_tag", type, 0, &tag_type, &tag_byte_offset, -@@ -7135,7 +7136,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 * --ada_value_primitive_field (struct value *arg1, int offset, int fieldno, -+ada_value_primitive_field (struct value *arg1, LONGEST offset, int fieldno, - struct type *arg_type) - { - struct type *type; -@@ -7147,7 +7148,7 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, - - if (TYPE_FIELD_BITSIZE (arg_type, fieldno) != 0) - { -- int bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno); -+ LONGEST bit_pos = TYPE_FIELD_BITPOS (arg_type, fieldno); - int bit_size = TYPE_FIELD_BITSIZE (arg_type, fieldno); - - return ada_value_primitive_packed_val (arg1, value_contents (arg1), -@@ -7224,9 +7225,9 @@ ada_value_primitive_field (struct value *arg1, int offset, int fieldno, - Returns 1 if found, 0 otherwise. */ - - static int --find_struct_field (const char *name, struct type *type, int offset, -+find_struct_field (const char *name, struct type *type, LONGEST offset, - struct type **field_type_p, -- int *byte_offset_p, int *bit_offset_p, int *bit_size_p, -+ LONGEST *byte_offset_p, int *bit_offset_p, int *bit_size_p, - int *index_p) - { - int i; -@@ -7245,8 +7246,8 @@ find_struct_field (const char *name, struct type *type, int offset, - - for (i = 0; i < TYPE_NFIELDS (type); i += 1) - { -- int bit_pos = TYPE_FIELD_BITPOS (type, i); -- int fld_offset = offset + bit_pos / 8; -+ LONGEST bit_pos = TYPE_FIELD_BITPOS (type, i); -+ LONGEST fld_offset = offset + bit_pos / 8; - const char *t_field_name = TYPE_FIELD_NAME (type, i); - - if (t_field_name == NULL) -@@ -7348,7 +7349,7 @@ num_visible_fields (struct type *type) - long explanation in find_struct_field's function documentation. */ - - static struct value * --ada_search_struct_field (const char *name, struct value *arg, int offset, -+ada_search_struct_field (const char *name, struct value *arg, LONGEST offset, - struct type *type) - { - int i; -@@ -7396,7 +7397,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)); -- int var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; -+ LONGEST var_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; - - for (j = 0; j < TYPE_NFIELDS (field_type); j += 1) - { -@@ -7428,8 +7429,8 @@ ada_search_struct_field (const char *name, struct value *arg, int offset, - return NULL; - } - --static struct value *ada_index_struct_field_1 (int *, struct value *, -- int, struct type *); -+static struct value *ada_index_struct_field_1 (LONGEST *, struct value *, -+ LONGEST, struct type *); - - - /* Return field #INDEX in ARG, where the index is that returned by -@@ -7438,7 +7439,7 @@ static struct value *ada_index_struct_field_1 (int *, struct value *, - * If found, return value, else return NULL. */ - - static struct value * --ada_index_struct_field (int index, struct value *arg, int offset, -+ada_index_struct_field (LONGEST index, struct value *arg, LONGEST offset, - struct type *type) - { - return ada_index_struct_field_1 (&index, arg, offset, type); -@@ -7450,7 +7451,7 @@ ada_index_struct_field (int index, struct value *arg, int offset, - * *INDEX_P. */ - - static struct value * --ada_index_struct_field_1 (int *index_p, struct value *arg, int offset, -+ada_index_struct_field_1 (LONGEST *index_p, struct value *arg, LONGEST offset, - struct type *type) - { - int i; -@@ -7541,7 +7542,8 @@ ada_value_struct_elt (struct value *arg, const char *name, int no_err) - v = ada_search_struct_field (name, arg, 0, t); - else - { -- int bit_offset, bit_size, byte_offset; -+ int bit_offset, bit_size; -+ LONGEST byte_offset; - struct type *field_type; - CORE_ADDR address; - -@@ -7890,8 +7892,8 @@ ada_coerce_ref (struct value *val0) - /* Return OFF rounded upward if necessary to a multiple of - ALIGNMENT (a power of 2). */ - --static unsigned int --align_value (unsigned int off, unsigned int alignment) -+static ULONGEST -+align_value (ULONGEST off, ULONGEST alignment) - { - return (off + alignment - 1) & ~(alignment - 1); - } -@@ -8281,10 +8283,9 @@ ada_template_to_fixed_record_type_1 (struct type *type, - struct value *mark = value_mark (); - struct value *dval; - struct type *rtype; -- int nfields, bit_len; -+ int nfields; - int variant_field; -- long off; -- int fld_bit_len; -+ LONGEST off, bit_len, fld_bit_len; - int f; - - /* Compute the number of fields in this record type that are going -@@ -8361,7 +8362,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, - that follow this one. */ - if (ada_is_aligner_type (field_type)) - { -- long field_offset = TYPE_FIELD_BITPOS (field_type, f); -+ LONGEST field_offset = TYPE_FIELD_BITPOS (field_type, f); - - field_valaddr = cond_offset_host (field_valaddr, field_offset); - field_address = cond_offset_target (field_address, field_offset); -@@ -8497,11 +8498,11 @@ ada_template_to_fixed_record_type_1 (struct type *type, - if (TYPE_LENGTH (type) <= 0) - { - if (TYPE_NAME (rtype)) -- warning (_("Invalid type size for `%s' detected: %d."), -- TYPE_NAME (rtype), TYPE_LENGTH (type)); -+ warning (_("Invalid type size for `%s' detected: %s."), -+ TYPE_NAME (rtype), pulongest (TYPE_LENGTH (type))); - else -- warning (_("Invalid type size for detected: %d."), -- TYPE_LENGTH (type)); -+ warning (_("Invalid type size for detected: %s."), -+ pulongest (TYPE_LENGTH (type))); - } - else - { -@@ -8965,7 +8966,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. */ -- int len = TYPE_LENGTH (result) / TYPE_LENGTH (TYPE_TARGET_TYPE (result)); -+ LONGEST len = (TYPE_LENGTH (result) -+ / TYPE_LENGTH (TYPE_TARGET_TYPE (result))); - int elt_bitsize = TYPE_FIELD_BITSIZE (type0, 0); - - TYPE_FIELD_BITSIZE (result, 0) = TYPE_FIELD_BITSIZE (type0, 0); -diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h ---- a/gdb/ada-lang.h -+++ b/gdb/ada-lang.h -@@ -173,7 +173,7 @@ extern void ada_print_type (struct type *, const char *, struct ui_file *, int, - extern void ada_print_typedef (struct type *type, struct symbol *new_symbol, - struct ui_file *stream); - --extern void ada_val_print (struct type *, int, CORE_ADDR, -+extern void ada_val_print (struct type *, LONGEST, CORE_ADDR, - struct ui_file *, int, - struct value *, - const struct value_print_options *); -@@ -188,7 +188,7 @@ extern void ada_emit_char (int, struct type *, struct ui_file *, int, int); - extern void ada_printchar (int, struct type *, struct ui_file *); - - extern void ada_printstr (struct ui_file *, struct type *, const gdb_byte *, -- unsigned int, const char *, int, -+ ULONGEST, const char *, int, - const struct value_print_options *); - - struct value *ada_convert_actual (struct value *actual, -@@ -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 *, -- long, int, int, -+ LONGEST, int, int, - struct type *); - - extern struct type *ada_coerce_to_simple_array_type (struct type *); -diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c ---- a/gdb/ada-typeprint.c -+++ b/gdb/ada-typeprint.c -@@ -895,8 +895,8 @@ ada_print_type (struct type *type0, const char *varstring, - const char *name = ada_type_name (type); - - if (!ada_is_range_type_name (name)) -- fprintf_filtered (stream, _("<%d-byte integer>"), -- TYPE_LENGTH (type)); -+ fprintf_filtered (stream, _("<%s-byte integer>"), -+ pulongest (TYPE_LENGTH (type))); - else - { - fprintf_filtered (stream, "range "); -@@ -917,7 +917,8 @@ ada_print_type (struct type *type0, const char *varstring, - } - break; - case TYPE_CODE_FLT: -- fprintf_filtered (stream, _("<%d-byte float>"), TYPE_LENGTH (type)); -+ fprintf_filtered (stream, _("<%s-byte float>"), -+ pulongest (TYPE_LENGTH (type))); - break; - case TYPE_CODE_ENUM: - if (show < 0) -diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c ---- a/gdb/ada-valprint.c -+++ b/gdb/ada-valprint.c -@@ -34,11 +34,11 @@ - #include "target-float.h" - - static int print_field_values (struct type *, const gdb_byte *, -- int, -+ LONGEST, - struct ui_file *, int, - struct value *, - const struct value_print_options *, -- int, struct type *, int, -+ int, struct type *, LONGEST, - const struct language_defn *); - - -@@ -316,7 +316,7 @@ ada_emit_char (int c, struct type *type, struct ui_file *stream, - of a character. */ - - static int --char_at (const gdb_byte *string, int i, int type_len, -+char_at (const gdb_byte *string, LONGEST i, int type_len, - enum bfd_endian byte_order) - { - if (type_len == 1) -@@ -476,11 +476,11 @@ ada_print_scalar (struct type *type, LONGEST val, struct ui_file *stream) - - static void - printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string, -- unsigned int length, int force_ellipses, int type_len, -+ ULONGEST length, int force_ellipses, int type_len, - const struct value_print_options *options) - { - enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (elttype)); -- unsigned int i; -+ ULONGEST i; - unsigned int things_printed = 0; - int in_quotes = 0; - int need_comma = 0; -@@ -495,9 +495,9 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string, - { - /* Position of the character we are examining - to see whether it is repeated. */ -- unsigned int rep1; -+ ULONGEST rep1; - /* Number of repetitions we have detected so far. */ -- unsigned int reps; -+ ULONGEST reps; - - QUIT; - -@@ -528,7 +528,8 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string, - ada_emit_char (char_at (string, i, type_len, byte_order), - elttype, stream, '\'', type_len); - fputs_filtered ("'", stream); -- fprintf_filtered (stream, _(" "), reps); -+ fprintf_filtered (stream, _(" "), -+ pulongest (reps)); - i = rep1 - 1; - things_printed += options->repeat_count_threshold; - need_comma = 1; -@@ -556,7 +557,7 @@ printstr (struct ui_file *stream, struct type *elttype, const gdb_byte *string, - - void - ada_printstr (struct ui_file *stream, struct type *type, -- const gdb_byte *string, unsigned int length, -+ const gdb_byte *string, ULONGEST length, - const char *encoding, int force_ellipses, - const struct value_print_options *options) - { -@@ -566,12 +567,12 @@ ada_printstr (struct ui_file *stream, struct type *type, - - static int - print_variant_part (struct type *type, int field_num, -- const gdb_byte *valaddr, int offset, -+ const gdb_byte *valaddr, LONGEST offset, - struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options, - int comma_needed, -- struct type *outer_type, int outer_offset, -+ struct type *outer_type, LONGEST outer_offset, - const struct language_defn *language) - { - struct type *var_type = TYPE_FIELD_TYPE (type, field_num); -@@ -607,11 +608,11 @@ print_variant_part (struct type *type, int field_num, - - static int - print_field_values (struct type *type, const gdb_byte *valaddr, -- int offset, struct ui_file *stream, int recurse, -+ LONGEST offset, struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options, - int comma_needed, -- struct type *outer_type, int outer_offset, -+ struct type *outer_type, LONGEST outer_offset, - const struct language_defn *language) - { - int i, len; -@@ -677,7 +678,7 @@ print_field_values (struct type *type, const gdb_byte *valaddr, - else - { - struct value *v; -- int bit_pos = TYPE_FIELD_BITPOS (type, i); -+ LONGEST bit_pos = TYPE_FIELD_BITPOS (type, i); - int bit_size = TYPE_FIELD_BITSIZE (type, i); - struct value_print_options opts; - -@@ -722,8 +723,8 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr, - { - enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); - struct type *elttype = TYPE_TARGET_TYPE (type); -- unsigned int eltlen; -- unsigned int len; -+ ULONGEST eltlen; -+ ULONGEST len; - - /* We know that ELTTYPE cannot possibly be null, because we assume - that we're called only when TYPE is a string-like type. -@@ -742,7 +743,7 @@ ada_val_print_string (struct type *type, const gdb_byte *valaddr, - elements up to it. */ - if (options->stop_print_at_null) - { -- int temp_len; -+ LONGEST temp_len; - - /* Look for a NULL char. */ - for (temp_len = 0; -@@ -1115,7 +1116,7 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr, - - static void - ada_val_print_1 (struct type *type, -- int offset, CORE_ADDR address, -+ LONGEST offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *original_value, - const struct value_print_options *options, -@@ -1199,7 +1200,7 @@ ada_val_print_1 (struct type *type, - - void - ada_val_print (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options) -diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c ---- a/gdb/amd64-tdep.c -+++ b/gdb/amd64-tdep.c -@@ -732,7 +732,7 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function, - gdb_byte *readbuf, const gdb_byte *writebuf) - { - enum amd64_reg_class theclass[2]; -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - static int integer_regnum[] = { AMD64_RAX_REGNUM, AMD64_RDX_REGNUM }; - static int sse_regnum[] = { AMD64_XMM0_REGNUM, AMD64_XMM1_REGNUM }; - int integer_reg = 0; -@@ -849,10 +849,10 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function, - gdb_assert (regnum != -1); - - if (readbuf) -- regcache->raw_read_part (regnum, offset, std::min (len, 8), -+ regcache->raw_read_part (regnum, offset, std::min (len, (LONGEST) 8), - readbuf + i * 8); - if (writebuf) -- regcache->raw_write_part (regnum, offset, std::min (len, 8), -+ regcache->raw_write_part (regnum, offset, std::min (len, (LONGEST) 8), - writebuf + i * 8); - } - -diff --git a/gdb/annotate.c b/gdb/annotate.c ---- a/gdb/annotate.c -+++ b/gdb/annotate.c -@@ -531,21 +531,21 @@ annotate_frame_end (void) - } - - void --annotate_array_section_begin (int idx, struct type *elttype) -+annotate_array_section_begin (LONGEST idx, struct type *elttype) - { - if (annotation_level == 2) - { -- printf_filtered (("\n\032\032array-section-begin %d "), idx); -+ printf_filtered (("\n\032\032array-section-begin %s "), plongest (idx)); - print_value_flags (elttype); - printf_filtered (("\n")); - } - } - - void --annotate_elt_rep (unsigned int repcount) -+annotate_elt_rep (ULONGEST repcount) - { - if (annotation_level == 2) -- printf_filtered (("\n\032\032elt-rep %u\n"), repcount); -+ printf_filtered (("\n\032\032elt-rep %s\n"), pulongest (repcount)); - } - - void -diff --git a/gdb/annotate.h b/gdb/annotate.h ---- a/gdb/annotate.h -+++ b/gdb/annotate.h -@@ -105,8 +105,8 @@ extern void annotate_frame_source_end (void); - extern void annotate_frame_where (void); - extern void annotate_frame_end (void); - --extern void annotate_array_section_begin (int, struct type *); --extern void annotate_elt_rep (unsigned int); -+extern void annotate_array_section_begin (LONGEST, struct type *); -+extern void annotate_elt_rep (ULONGEST); - extern void annotate_elt_rep_end (void); - extern void annotate_elt (void); - extern void annotate_array_section_end (void); -diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c ---- a/gdb/arch-utils.c -+++ b/gdb/arch-utils.c -@@ -227,7 +227,7 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch, - - const struct floatformat ** - default_floatformat_for_type (struct gdbarch *gdbarch, -- const char *name, int len) -+ const char *name, LONGEST len) - { - const struct floatformat **format = NULL; - -diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h ---- a/gdb/arch-utils.h -+++ b/gdb/arch-utils.h -@@ -131,7 +131,7 @@ extern gdbarch_virtual_frame_pointer_ftype legacy_virtual_frame_pointer; - /* Default implementation of gdbarch_floatformat_for_type. */ - extern const struct floatformat ** - default_floatformat_for_type (struct gdbarch *gdbarch, -- const char *name, int len); -+ const char *name, LONGEST len); - - extern CORE_ADDR generic_skip_trampoline_code (struct frame_info *frame, - CORE_ADDR pc); -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 -@@ -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 --arm_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+arm_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - const struct arm_linux_hwbp_cap *cap = arm_linux_get_hwbp_cap (); - CORE_ADDR max_wp_length, aligned_addr; -diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c ---- a/gdb/ax-gdb.c -+++ b/gdb/ax-gdb.c -@@ -82,12 +82,12 @@ static void gen_traced_pop (struct agent_expr *, struct axs_value *); - static void gen_sign_extend (struct agent_expr *, struct type *); - static void gen_extend (struct agent_expr *, struct type *); - static void gen_fetch (struct agent_expr *, struct type *); --static void gen_left_shift (struct agent_expr *, int); -+static void gen_left_shift (struct agent_expr *, LONGEST); - - - static void gen_frame_args_address (struct agent_expr *); - static void gen_frame_locals_address (struct agent_expr *); --static void gen_offset (struct agent_expr *ax, int offset); -+static void gen_offset (struct agent_expr *ax, LONGEST offset); - static void gen_sym_offset (struct agent_expr *, struct symbol *); - static void gen_var_ref (struct agent_expr *ax, struct axs_value *value, - struct symbol *var); -@@ -132,13 +132,13 @@ static void gen_complement (struct agent_expr *ax, struct axs_value *value); - static void gen_deref (struct axs_value *); - static void gen_address_of (struct axs_value *); - static void gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value, -- struct type *type, int start, int end); -+ struct type *type, LONGEST start, LONGEST end); - static void gen_primitive_field (struct agent_expr *ax, - struct axs_value *value, -- int offset, int fieldno, struct type *type); -+ LONGEST offset, int fieldno, struct type *type); - static int gen_struct_ref_recursive (struct agent_expr *ax, - struct axs_value *value, -- const char *field, int offset, -+ const char *field, LONGEST offset, - struct type *type); - static void gen_struct_ref (struct agent_expr *ax, - struct axs_value *value, -@@ -529,7 +529,7 @@ gen_fetch (struct agent_expr *ax, struct type *type) - right shift it by -DISTANCE bits if DISTANCE < 0. This generates - unsigned (logical) right shifts. */ - static void --gen_left_shift (struct agent_expr *ax, int distance) -+gen_left_shift (struct agent_expr *ax, LONGEST distance) - { - if (distance > 0) - { -@@ -583,7 +583,7 @@ gen_frame_locals_address (struct agent_expr *ax) - programming in ML, it would be clearer why these are the same - thing. */ - static void --gen_offset (struct agent_expr *ax, int offset) -+gen_offset (struct agent_expr *ax, LONGEST offset) - { - /* It would suffice to simply push the offset and add it, but this - makes it easier to read positive and negative offsets in the -@@ -1254,7 +1254,7 @@ gen_address_of (struct axs_value *value) - structure. */ - static void - gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value, -- struct type *type, int start, int end) -+ struct type *type, LONGEST start, LONGEST end) - { - /* Note that ops[i] fetches 8 << i bits. */ - static enum agent_op ops[] -@@ -1289,13 +1289,13 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value, - - /* The first and one-after-last bits in the field, but rounded down - and up to byte boundaries. */ -- int bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT; -- int bound_end = (((end + TARGET_CHAR_BIT - 1) -- / TARGET_CHAR_BIT) -- * TARGET_CHAR_BIT); -+ LONGEST bound_start = (start / TARGET_CHAR_BIT) * TARGET_CHAR_BIT; -+ LONGEST bound_end = (((end + TARGET_CHAR_BIT - 1) -+ / TARGET_CHAR_BIT) -+ * TARGET_CHAR_BIT); - - /* current bit offset within the structure */ -- int offset; -+ LONGEST offset; - - /* The index in ops of the opcode we're considering. */ - int op; -@@ -1413,7 +1413,7 @@ gen_bitfield_ref (struct agent_expr *ax, struct axs_value *value, - - static void - gen_primitive_field (struct agent_expr *ax, struct axs_value *value, -- int offset, int fieldno, struct type *type) -+ LONGEST offset, int fieldno, struct type *type) - { - /* Is this a bitfield? */ - if (TYPE_FIELD_PACKED (type, fieldno)) -@@ -1437,7 +1437,7 @@ gen_primitive_field (struct agent_expr *ax, struct axs_value *value, - - static int - gen_struct_ref_recursive (struct agent_expr *ax, struct axs_value *value, -- const char *field, int offset, struct type *type) -+ const char *field, LONGEST offset, struct type *type) - { - int i, rslt; - int nbases = TYPE_N_BASECLASSES (type); -diff --git a/gdb/ax-general.c b/gdb/ax-general.c ---- a/gdb/ax-general.c -+++ b/gdb/ax-general.c -@@ -177,7 +177,7 @@ ax_zero_ext (struct agent_expr *x, int n) - - /* Append a trace_quick instruction to EXPR, to record N bytes. */ - void --ax_trace_quick (struct agent_expr *x, int n) -+ax_trace_quick (struct agent_expr *x, LONGEST n) - { - /* N must fit in a byte. */ - if (n < 0 || n > 255) -diff --git a/gdb/ax.h b/gdb/ax.h ---- a/gdb/ax.h -+++ b/gdb/ax.h -@@ -193,7 +193,7 @@ extern void ax_ext (struct agent_expr *EXPR, int N); - extern void ax_zero_ext (struct agent_expr *EXPR, int N); - - /* Append a trace_quick instruction to EXPR, to record N bytes. */ --extern void ax_trace_quick (struct agent_expr *EXPR, int N); -+extern void ax_trace_quick (struct agent_expr *EXPR, LONGEST N); - - /* Append a goto op to EXPR. OP is the actual op (must be aop_goto or - aop_if_goto). We assume we don't know the target offset yet, -diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c ---- a/gdb/breakpoint.c -+++ b/gdb/breakpoint.c -@@ -2056,9 +2056,9 @@ should_be_inserted (struct bp_location *bl) - { - fprintf_unfiltered (gdb_stdlog, - "infrun: stepping past non-steppable watchpoint. " -- "skipping watchpoint at %s:%d\n", -+ "skipping watchpoint at %s:%s\n", - paddress (bl->gdbarch, bl->address), -- bl->length); -+ plongest (bl->length)); - } - return 0; - } -@@ -6793,7 +6793,7 @@ breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1, - static int - breakpoint_address_match_range (const address_space *aspace1, - CORE_ADDR addr1, -- int len1, const address_space *aspace2, -+ LONGEST len1, const address_space *aspace2, - CORE_ADDR addr2) - { - return ((gdbarch_has_global_breakpoints (target_gdbarch ()) -@@ -10859,7 +10859,7 @@ can_use_hardware_watchpoint (const std::vector &vals) - && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) - { - CORE_ADDR vaddr = value_address (v); -- int len; -+ LONGEST len; - int num_regs; - - len = (target_exact_watchpoints -diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h ---- a/gdb/breakpoint.h -+++ b/gdb/breakpoint.h -@@ -252,7 +252,7 @@ struct bp_target_info - - /* If this is a ranged breakpoint, then this field contains the - length of the range that will be watched for execution. */ -- int length; -+ LONGEST length; - - /* If the breakpoint lives in memory and reading that memory would - give back the breakpoint, instead of the original contents, then -@@ -417,7 +417,7 @@ public: - /* For hardware watchpoints, the size of the memory region being - watched. For hardware ranged breakpoints, the size of the - breakpoint range. */ -- int length = 0; -+ LONGEST length = 0; - - /* Type of hardware watchpoint. */ - target_hw_bp_type watchpoint_type {}; -diff --git a/gdb/c-lang.c b/gdb/c-lang.c ---- a/gdb/c-lang.c -+++ b/gdb/c-lang.c -@@ -185,7 +185,7 @@ c_printchar (int c, struct type *type, struct ui_file *stream) - - void - c_printstr (struct ui_file *stream, struct type *type, -- const gdb_byte *string, unsigned int length, -+ const gdb_byte *string, ULONGEST length, - const char *user_encoding, int force_ellipses, - const struct value_print_options *options) - { -@@ -664,7 +664,7 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp, - } - else - { -- int i; -+ LONGEST i; - - /* Write the terminating character. */ - for (i = 0; i < TYPE_LENGTH (type); ++i) -@@ -673,7 +673,7 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp, - if (satisfy_expected) - { - LONGEST low_bound, high_bound; -- int element_size = TYPE_LENGTH (type); -+ LONGEST element_size = TYPE_LENGTH (type); - - if (get_discrete_bounds (TYPE_INDEX_TYPE (expect_type), - &low_bound, &high_bound) < 0) -diff --git a/gdb/c-lang.h b/gdb/c-lang.h ---- a/gdb/c-lang.h -+++ b/gdb/c-lang.h -@@ -82,7 +82,7 @@ extern void c_print_typedef (struct type *, - struct ui_file *); - - extern void c_val_print (struct type *, -- int, CORE_ADDR, -+ LONGEST, CORE_ADDR, - struct ui_file *, int, - struct value *, - const struct value_print_options *); -@@ -102,7 +102,7 @@ extern void c_printchar (int, struct type *, struct ui_file *); - extern void c_printstr (struct ui_file * stream, - struct type *elttype, - const gdb_byte *string, -- unsigned int length, -+ ULONGEST length, - const char *user_encoding, - int force_ellipses, - const struct value_print_options *options); -diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c ---- a/gdb/c-valprint.c -+++ b/gdb/c-valprint.c -@@ -247,7 +247,7 @@ c_val_print_array (struct type *type, const gdb_byte *valaddr, - if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0) - { - LONGEST low_bound, high_bound; -- int eltlen, len; -+ LONGEST eltlen, len; - struct gdbarch *gdbarch = get_type_arch (type); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - unsigned int i = 0; /* Number of characters printed. */ -@@ -321,8 +321,8 @@ c_val_print_array (struct type *type, const gdb_byte *valaddr, - if (cp_is_vtbl_ptr_type (elttype)) - { - i = 1; -- fprintf_filtered (stream, _("%d vtable entries"), -- len - 1); -+ fprintf_filtered (stream, _("%s vtable entries"), -+ plongest (len - 1)); - } - else - { -@@ -399,7 +399,7 @@ c_val_print_struct (struct type *type, const gdb_byte *valaddr, - -fvtable_thunks. (Otherwise, look under - TYPE_CODE_PTR.) */ - struct gdbarch *gdbarch = get_type_arch (type); -- int offset = (embedded_offset -+ LONGEST offset = (embedded_offset - + TYPE_FIELD_BITPOS (type, - VTBL_FNADDR_OFFSET) / 8); - struct type *field_type = TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET); -@@ -498,7 +498,7 @@ c_val_print_memberptr (struct type *type, const gdb_byte *valaddr, - - void - c_val_print (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *original_value, - const struct value_print_options *options) -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 -@@ -270,11 +270,11 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch, - - default: - fprintf_unfiltered (stream, -- " unsigned char %s[%d]" -+ " unsigned char %s[%s]" - " __attribute__((__aligned__(" - "__BIGGEST_ALIGNMENT__)))", - regname.c_str (), -- TYPE_LENGTH (regtype)); -+ pulongest (TYPE_LENGTH (regtype))); - } - fputs_unfiltered (";\n", stream); - } -diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c ---- a/gdb/cp-abi.c -+++ b/gdb/cp-abi.c -@@ -64,12 +64,12 @@ is_operator_name (const char *name) - return (*current_cp_abi.is_operator_name) (name); - } - --int -+LONGEST - baseclass_offset (struct type *type, int index, const gdb_byte *valaddr, - LONGEST embedded_offset, CORE_ADDR address, - const struct value *val) - { -- int res = 0; -+ LONGEST res = 0; - - gdb_assert (current_cp_abi.baseclass_offset != NULL); - -@@ -96,7 +96,7 @@ baseclass_offset (struct type *type, int index, const gdb_byte *valaddr, - struct value * - value_virtual_fn_field (struct value **arg1p, - struct fn_field *f, int j, -- struct type *type, int offset) -+ struct type *type, LONGEST offset) - { - if ((current_cp_abi.virtual_fn_field) == NULL) - return NULL; -diff --git a/gdb/cp-abi.h b/gdb/cp-abi.h ---- a/gdb/cp-abi.h -+++ b/gdb/cp-abi.h -@@ -108,7 +108,7 @@ extern struct value *value_virtual_fn_field (struct value **valuep, - struct fn_field *f, - int j, - struct type *type, -- int offset); -+ LONGEST offset); - - - /* Try to find the run-time type of VALUE, using C++ run-time type -@@ -144,11 +144,11 @@ extern struct type *value_rtti_type (struct value *value, - contents of VAL. The result is the offset of the baseclass value - relative to (the address of)(ARG) + OFFSET. */ - --extern int baseclass_offset (struct type *type, -- int index, const gdb_byte *valaddr, -- LONGEST embedded_offset, -- CORE_ADDR address, -- const struct value *val); -+extern LONGEST baseclass_offset (struct type *type, -+ int index, const gdb_byte *valaddr, -+ LONGEST embedded_offset, -+ CORE_ADDR address, -+ const struct value *val); - - /* Describe the target of a pointer to method. CONTENTS is the byte - pattern representing the pointer to method. TYPE is the pointer to -@@ -226,12 +226,12 @@ struct cp_abi_ops - struct value *(*virtual_fn_field) (struct value **arg1p, - struct fn_field * f, - int j, struct type * type, -- int offset); -+ LONGEST offset); - struct type *(*rtti_type) (struct value *v, int *full, - LONGEST *top, int *using_enc); -- int (*baseclass_offset) (struct type *type, int index, -- const bfd_byte *valaddr, LONGEST embedded_offset, -- CORE_ADDR address, const struct value *val); -+ LONGEST (*baseclass_offset) (struct type *type, int index, -+ const bfd_byte *valaddr, LONGEST embedded_offset, -+ CORE_ADDR address, const struct value *val); - void (*print_method_ptr) (const gdb_byte *contents, - struct type *type, - struct ui_file *stream); -diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c ---- a/gdb/cp-valprint.c -+++ b/gdb/cp-valprint.c -@@ -335,7 +335,7 @@ cp_print_value_fields (struct type *type, struct type *real_type, - } - else if (i == vptr_fieldno && type == vptr_basetype) - { -- int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; -+ LONGEST i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; - struct type *i_type = TYPE_FIELD_TYPE (type, i); - - if (valprint_check_validity (stream, i_type, i_offset, val)) -diff --git a/gdb/d-lang.h b/gdb/d-lang.h ---- a/gdb/d-lang.h -+++ b/gdb/d-lang.h -@@ -79,7 +79,7 @@ extern struct block_symbol d_lookup_nested_symbol (struct type *, const char *, - /* Defined in d-valprint.c */ - - extern void d_val_print (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options); -diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c ---- a/gdb/d-valprint.c -+++ b/gdb/d-valprint.c -@@ -73,7 +73,7 @@ dynamic_array_type (struct type *type, - - /* Implements the la_val_print routine for language D. */ - void --d_val_print (struct type *type, int embedded_offset, -+d_val_print (struct type *type, LONGEST embedded_offset, - CORE_ADDR address, struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options) -diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c ---- a/gdb/dwarf2loc.c -+++ b/gdb/dwarf2loc.c -@@ -1625,7 +1625,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]; -- size_t this_size_bits, this_size; -+ ULONGEST this_size_bits, this_size; - - this_size_bits = p->size - bits_to_skip; - if (this_size_bits > max_offset - offset) -@@ -1872,7 +1872,7 @@ write_pieced_value (struct value *to, struct value *from) - - static int - check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, -- int bit_length) -+ LONGEST bit_length) - { - struct piece_closure *c - = (struct piece_closure *) value_computed_closure (value); -@@ -1885,7 +1885,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]; -- size_t this_size_bits = p->size; -+ ULONGEST this_size_bits = p->size; - - if (bit_offset > 0) - { -@@ -1989,8 +1989,8 @@ indirect_pieced_value (struct value *value) - = (struct piece_closure *) value_computed_closure (value); - struct type *type; - struct frame_info *frame; -- int i, bit_length; -- LONGEST bit_offset; -+ int i; -+ LONGEST bit_length, bit_offset; - struct dwarf_expr_piece *piece = NULL; - LONGEST byte_offset; - enum bfd_endian byte_order; -@@ -2007,7 +2007,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]; -- size_t this_size_bits = p->size; -+ ULONGEST this_size_bits = p->size; - - if (bit_offset > 0) - { -@@ -2296,9 +2296,9 @@ if (frame != NULL) select_frame (frame); - case DWARF_VALUE_STACK: - { - struct value *value = ctx.fetch (0); -- size_t n = TYPE_LENGTH (value_type (value)); -- size_t len = TYPE_LENGTH (subobj_type); -- size_t max = TYPE_LENGTH (type); -+ ULONGEST n = TYPE_LENGTH (value_type (value)); -+ ULONGEST len = TYPE_LENGTH (subobj_type); -+ ULONGEST max = TYPE_LENGTH (type); - struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile); - - if (subobj_byte_offset + len > max) -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -2065,11 +2065,11 @@ dwarf2_complex_location_expr_complaint (void) - } - - static void --dwarf2_const_value_length_mismatch_complaint (const char *arg1, int arg2, -- int arg3) -+dwarf2_const_value_length_mismatch_complaint (const char *arg1, LONGEST arg2, -+ LONGEST arg3) - { -- complaint (_("const value length mismatch for '%s', got %d, expected %d"), -- arg1, arg2, arg3); -+ complaint (_("const value length mismatch for '%s', got %s, expected %s"), -+ arg1, plongest (arg2), plongest (arg3)); - } - - static void -@@ -15104,8 +15104,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. */ -- int anonymous_size; -- int bit_offset = DW_UNSND (attr); -+ LONGEST anonymous_size; -+ LONGEST bit_offset = DW_UNSND (attr); - - attr = dwarf2_attr (die, DW_AT_byte_size, cu); - if (attr) -diff --git a/gdb/eval.c b/gdb/eval.c ---- a/gdb/eval.c -+++ b/gdb/eval.c -@@ -295,7 +295,8 @@ evaluate_struct_tuple (struct value *struct_val, - while (--nargs >= 0) - { - struct value *val = NULL; -- int bitpos, bitsize; -+ LONGEST bitpos; -+ int bitsize; - bfd_byte *addr; - - fieldno++; -@@ -356,7 +357,7 @@ init_array_element (struct value *array, struct value *element, - enum noside noside, LONGEST low_bound, LONGEST high_bound) - { - LONGEST index; -- int element_size = TYPE_LENGTH (value_type (element)); -+ LONGEST element_size = TYPE_LENGTH (value_type (element)); - - if (exp->elts[*pos].opcode == BINOP_COMMA) - { -@@ -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); -- unsigned int promoted_len1 = TYPE_LENGTH (type1); -- unsigned int promoted_len2 = TYPE_LENGTH (type2); -+ ULONGEST promoted_len1 = TYPE_LENGTH (type1); -+ ULONGEST promoted_len2 = TYPE_LENGTH (type2); - int is_unsigned1 = TYPE_UNSIGNED (type1); - int is_unsigned2 = TYPE_UNSIGNED (type2); -- unsigned int result_len; -+ ULONGEST result_len; - int unsigned_operation; - - /* Determine type length and signedness after promotion for -@@ -1553,7 +1554,7 @@ evaluate_subexp_standard (struct type *expect_type, - struct value **argvec; - int code; - int ix; -- long mem_offset; -+ LONGEST mem_offset; - struct type **arg_types; - - pc = (*pos)++; -@@ -1738,7 +1739,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); -- int element_size = TYPE_LENGTH (check_typedef (element_type)); -+ LONGEST element_size = TYPE_LENGTH (check_typedef (element_type)); - LONGEST low_bound, high_bound, index; - - if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) -diff --git a/gdb/f-lang.c b/gdb/f-lang.c ---- a/gdb/f-lang.c -+++ b/gdb/f-lang.c -@@ -101,7 +101,7 @@ f_printchar (int c, struct type *type, struct ui_file *stream) - - static void - f_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, -- unsigned int length, const char *encoding, int force_ellipses, -+ ULONGEST length, const char *encoding, int force_ellipses, - const struct value_print_options *options) - { - const char *type_encoding = f_get_encoding (type); -diff --git a/gdb/f-lang.h b/gdb/f-lang.h ---- a/gdb/f-lang.h -+++ b/gdb/f-lang.h -@@ -31,7 +31,7 @@ extern int f_parse (struct parser_state *); - extern void f_print_type (struct type *, const char *, struct ui_file *, int, - int, const struct type_print_options *); - --extern void f_val_print (struct type *, int, CORE_ADDR, -+extern void f_val_print (struct type *, LONGEST, CORE_ADDR, - struct ui_file *, int, - struct value *, - const struct value_print_options *); -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c -@@ -36,7 +36,7 @@ - - static void f77_get_dynamic_length_of_aggregate (struct type *); - --int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; -+LONGEST f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; - - /* Array which holds offsets to be applied to get a row's elements - for a given array. Array also holds the size of each subarray. */ -@@ -71,8 +71,8 @@ f77_get_upperbound (struct type *type) - static void - f77_get_dynamic_length_of_aggregate (struct type *type) - { -- int upper_bound = -1; -- int lower_bound = 1; -+ LONGEST upper_bound = -1; -+ LONGEST lower_bound = 1; - - /* Recursively go all the way down into a possibly multi-dimensional - F77 array and get the bounds. For simple arrays, this is pretty -@@ -104,7 +104,7 @@ f77_get_dynamic_length_of_aggregate (struct type *type) - static void - f77_print_array_1 (int nss, int ndimensions, struct type *type, - const gdb_byte *valaddr, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - const struct value *val, - const struct value_print_options *options, -@@ -113,7 +113,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, - struct type *range_type = TYPE_INDEX_TYPE (check_typedef (type)); - CORE_ADDR addr = address + embedded_offset; - LONGEST lowerbound, upperbound; -- int i; -+ LONGEST i; - - get_discrete_bounds (range_type, &lowerbound, &upperbound); - -@@ -175,7 +175,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, - - static void - f77_print_array (struct type *type, const gdb_byte *valaddr, -- int embedded_offset, -+ LONGEST embedded_offset, - CORE_ADDR address, struct ui_file *stream, - int recurse, - const struct value *val, -@@ -214,7 +214,7 @@ static const struct generic_val_print_decorations f_decorations = - function; they are identical. */ - - void --f_val_print (struct type *type, int embedded_offset, -+f_val_print (struct type *type, LONGEST embedded_offset, - CORE_ADDR address, struct ui_file *stream, int recurse, - struct value *original_value, - const struct value_print_options *options) -diff --git a/gdb/findvar.c b/gdb/findvar.c ---- a/gdb/findvar.c -+++ b/gdb/findvar.c -@@ -821,7 +821,7 @@ struct value * - default_value_from_register (struct gdbarch *gdbarch, struct type *type, - int regnum, struct frame_id frame_id) - { -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - 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) - LONGEST offset = 0; - LONGEST reg_offset = value_offset (value); - int regnum = VALUE_REGNUM (value); -- int len = type_length_units (check_typedef (value_type (value))); -+ LONGEST len = type_length_units (check_typedef (value_type (value))); - - gdb_assert (VALUE_LVAL (value) == lval_register); - -@@ -880,7 +880,7 @@ read_frame_register_value (struct value *value, struct frame_info *frame) - while (len > 0) - { - struct value *regval = get_frame_register_value (frame, regnum); -- int reg_len = type_length_units (value_type (regval)) - reg_offset; -+ LONGEST reg_len = type_length_units (value_type (regval)) - reg_offset; - - /* If the register length is larger than the number of bytes - remaining to copy, then only copy the appropriate bytes. */ -diff --git a/gdb/frame.c b/gdb/frame.c ---- a/gdb/frame.c -+++ b/gdb/frame.c -@@ -1393,7 +1393,7 @@ deprecated_frame_register_read (struct frame_info *frame, int regnum, - - int - get_frame_register_bytes (struct frame_info *frame, int regnum, -- CORE_ADDR offset, int len, gdb_byte *myaddr, -+ CORE_ADDR offset, LONGEST len, gdb_byte *myaddr, - int *optimizedp, int *unavailablep) - { - struct gdbarch *gdbarch = get_frame_arch (frame); -@@ -1422,7 +1422,7 @@ get_frame_register_bytes (struct frame_info *frame, int regnum, - } - if (len > maxsize) - error (_("Bad debug information detected: " -- "Attempt to read %d bytes from registers."), len); -+ "Attempt to read %s bytes from registers."), plongest (len)); - - /* Copy the data. */ - while (len > 0) -diff --git a/gdb/frame.h b/gdb/frame.h ---- a/gdb/frame.h -+++ b/gdb/frame.h -@@ -620,7 +620,7 @@ extern void put_frame_register (struct frame_info *frame, int regnum, - contents are optimized out or unavailable, set *OPTIMIZEDP, - *UNAVAILABLEP accordingly. */ - extern int get_frame_register_bytes (struct frame_info *frame, int regnum, -- CORE_ADDR offset, int len, -+ CORE_ADDR offset, LONGEST len, - gdb_byte *myaddr, - int *optimizedp, int *unavailablep); - -diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c ---- a/gdb/gdbarch.c -+++ b/gdb/gdbarch.c -@@ -1795,7 +1795,7 @@ set_gdbarch_wchar_signed (struct gdbarch *gdbarch, - } - - const struct floatformat ** --gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name, int length) -+gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name, LONGEST length) - { - gdb_assert (gdbarch != NULL); - gdb_assert (gdbarch->floatformat_for_type != NULL); -diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h ---- a/gdb/gdbarch.h -+++ b/gdb/gdbarch.h -@@ -218,8 +218,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. */ - --typedef const struct floatformat ** (gdbarch_floatformat_for_type_ftype) (struct gdbarch *gdbarch, const char *name, int length); --extern const struct floatformat ** gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name, int length); -+typedef const struct floatformat ** (gdbarch_floatformat_for_type_ftype) (struct gdbarch *gdbarch, const char *name, LONGEST length); -+extern const struct floatformat ** gdbarch_floatformat_for_type (struct gdbarch *gdbarch, const char *name, LONGEST length); - extern void set_gdbarch_floatformat_for_type (struct gdbarch *gdbarch, gdbarch_floatformat_for_type_ftype *floatformat_for_type); - - /* For most targets, a pointer on the target and its representation as an -diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh ---- a/gdb/gdbarch.sh -+++ b/gdb/gdbarch.sh -@@ -385,7 +385,7 @@ v;int;wchar_signed;;;1;-1;1 - # Returns the floating-point format to be used for values of length LENGTH. - # NAME, if non-NULL, is the type name, which may be used to distinguish - # different target formats of the same length. --m;const struct floatformat **;floatformat_for_type;const char *name, int length;name, length;0;default_floatformat_for_type;;0 -+m;const struct floatformat **;floatformat_for_type;const char *name, LONGEST length;name, length;0;default_floatformat_for_type;;0 - - # For most targets, a pointer on the target and its representation as an - # address in GDB have the same size and "look the same". For such a -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c -@@ -2889,7 +2889,7 @@ floatformat_from_type (const struct type *type) - least as long as OBJFILE. */ - - struct type * --init_type (struct objfile *objfile, enum type_code code, int bit, -+init_type (struct objfile *objfile, enum type_code code, LONGEST bit, - const char *name) - { - struct type *type; -@@ -3340,8 +3340,8 @@ is_public_ancestor (struct type *base, struct type *dclass) - - static int - is_unique_ancestor_worker (struct type *base, struct type *dclass, -- int *offset, -- const gdb_byte *valaddr, int embedded_offset, -+ LONGEST *offset, -+ const gdb_byte *valaddr, LONGEST embedded_offset, - CORE_ADDR address, struct value *val) - { - int i, count = 0; -@@ -3352,7 +3352,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; -- int this_offset; -+ LONGEST this_offset; - - iter = check_typedef (TYPE_BASECLASS (dclass, i)); - -@@ -3393,7 +3393,7 @@ is_unique_ancestor_worker (struct type *base, struct type *dclass, - int - is_unique_ancestor (struct type *base, struct value *val) - { -- int offset = -1; -+ LONGEST offset = -1; - - return is_unique_ancestor_worker (base, value_type (val), &offset, - value_contents_for_printing (val), -@@ -4620,7 +4620,7 @@ recursive_dump_type (struct type *type, int spaces) - break; - } - puts_filtered ("\n"); -- printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type)); -+ printfi_filtered (spaces, "length %s\n", pulongest (TYPE_LENGTH (type))); - if (TYPE_OBJFILE_OWNED (type)) - { - printfi_filtered (spaces, "objfile "); -@@ -5065,7 +5065,7 @@ copy_type (const struct type *type) - - struct type * - arch_type (struct gdbarch *gdbarch, -- enum type_code code, int bit, const char *name) -+ enum type_code code, LONGEST bit, const char *name) - { - struct type *type; - -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -864,7 +864,7 @@ struct type - type_length_units function should be used in order to get the length - expressed in target addressable memory units. */ - -- unsigned int length; -+ ULONGEST length; - - /* * Core type, shared by a group of qualified types. */ - -@@ -1787,7 +1787,7 @@ extern unsigned int type_length_units (struct type *type); - - /* * Helper function to construct objfile-owned types. */ - --extern struct type *init_type (struct objfile *, enum type_code, int, -+extern struct type *init_type (struct objfile *, enum type_code, LONGEST, - const char *); - extern struct type *init_integer_type (struct objfile *, int, int, - const char *); -@@ -1804,7 +1804,7 @@ extern struct type *init_pointer_type (struct objfile *, int, const char *, - struct type *); - - /* Helper functions to construct architecture-owned types. */ --extern struct type *arch_type (struct gdbarch *, enum type_code, int, -+extern struct type *arch_type (struct gdbarch *, enum type_code, LONGEST, - const char *); - extern struct type *arch_integer_type (struct gdbarch *, int, int, - const char *); -diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c ---- a/gdb/gnu-v2-abi.c -+++ b/gdb/gnu-v2-abi.c -@@ -82,7 +82,7 @@ gnuv2_is_operator_name (const char *name) - TYPE is the type in which F is located. */ - static struct value * - gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, -- struct type * type, int offset) -+ struct type *type, LONGEST offset) - { - struct value *arg1 = *arg1p; - struct type *type1 = check_typedef (value_type (arg1)); -@@ -338,7 +338,7 @@ vb_match (struct type *type, int index, struct type *basetype) - target). The result is the offset of the baseclass value relative - to (the address of)(ARG) + OFFSET. */ - --static int -+static LONGEST - gnuv2_baseclass_offset (struct type *type, int index, - const bfd_byte *valaddr, LONGEST embedded_offset, - CORE_ADDR address, const struct value *val) -@@ -358,8 +358,7 @@ gnuv2_baseclass_offset (struct type *type, int index, - if (vb_match (type, i, basetype)) - { - struct type *field_type; -- LONGEST field_offset; -- int field_length; -+ LONGEST field_offset, field_length; - CORE_ADDR addr; - - field_type = check_typedef (TYPE_FIELD_TYPE (type, i)); -@@ -383,7 +382,7 @@ gnuv2_baseclass_offset (struct type *type, int index, - /* Don't go through baseclass_offset, as that wraps - exceptions, thus, inner exceptions would be wrapped more - than once. */ -- int boffset = -+ LONGEST boffset = - gnuv2_baseclass_offset (type, i, valaddr, - embedded_offset, address, val); - -diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c ---- a/gdb/gnu-v3-abi.c -+++ b/gdb/gnu-v3-abi.c -@@ -109,7 +109,7 @@ build_gdb_vtable_type (struct gdbarch *arch) - { - struct type *t; - struct field *field_list, *field; -- int offset; -+ LONGEST offset; - - struct type *void_ptr_type - = builtin_type (arch)->builtin_data_ptr; -@@ -185,7 +185,7 @@ vtable_ptrdiff_type (struct gdbarch *gdbarch) - /* Return the offset from the start of the imaginary `struct - gdb_gnu_v3_abi_vtable' object to the vtable's "address point" - (i.e., where objects' virtual table pointers point). */ --static int -+static LONGEST - vtable_address_point_offset (struct gdbarch *gdbarch) - { - struct type *vtable_type -@@ -409,7 +409,7 @@ gnuv3_get_virtual_fn (struct gdbarch *gdbarch, struct value *container, - static struct value * - gnuv3_virtual_fn_field (struct value **value_p, - struct fn_field *f, int j, -- struct type *vfn_base, int offset) -+ struct type *vfn_base, LONGEST offset) - { - struct type *values_type = check_typedef (value_type (*value_p)); - struct gdbarch *gdbarch; -@@ -439,7 +439,7 @@ gnuv3_virtual_fn_field (struct value **value_p, - - -1 is returned on error. */ - --static int -+static LONGEST - gnuv3_baseclass_offset (struct type *type, int index, - const bfd_byte *valaddr, LONGEST embedded_offset, - CORE_ADDR address, const struct value *val) -@@ -448,7 +448,7 @@ gnuv3_baseclass_offset (struct type *type, int index, - struct type *ptr_type; - struct value *vtable; - struct value *vbase_array; -- long int cur_base_offset, base_offset; -+ LONGEST cur_base_offset, base_offset; - - /* Determine architecture. */ - gdbarch = get_type_arch (type); -@@ -471,7 +471,7 @@ gnuv3_baseclass_offset (struct type *type, int index, - cur_base_offset = cur_base_offset + vtable_address_point_offset (gdbarch); - if ((- cur_base_offset) % TYPE_LENGTH (ptr_type) != 0) - error (_("Misaligned vbase offset.")); -- cur_base_offset = cur_base_offset / ((int) TYPE_LENGTH (ptr_type)); -+ cur_base_offset = cur_base_offset / ((LONGEST) TYPE_LENGTH (ptr_type)); - - vtable = gnuv3_get_vtable (gdbarch, type, address + embedded_offset); - gdb_assert (vtable != NULL); -@@ -515,7 +515,7 @@ gnuv3_find_method_in (struct type *domain, CORE_ADDR voffset, - we're out of luck. */ - for (i = 0; i < TYPE_N_BASECLASSES (domain); i++) - { -- int pos; -+ LONGEST pos; - struct type *basetype; - - if (BASETYPE_VIA_VIRTUAL (domain, i)) -diff --git a/gdb/go-lang.h b/gdb/go-lang.h ---- a/gdb/go-lang.h -+++ b/gdb/go-lang.h -@@ -83,7 +83,7 @@ extern void go_print_type (struct type *type, const char *varstring, - /* Defined in go-valprint.c. */ - - extern void go_val_print (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options); -diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c ---- a/gdb/go-valprint.c -+++ b/gdb/go-valprint.c -@@ -86,7 +86,7 @@ print_go_string (struct type *type, - /* Implements the la_val_print routine for language Go. */ - - void --go_val_print (struct type *type, int embedded_offset, -+go_val_print (struct type *type, LONGEST embedded_offset, - CORE_ADDR address, struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options) -diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c ---- a/gdb/i386-tdep.c -+++ b/gdb/i386-tdep.c -@@ -8156,7 +8156,7 @@ i386_fast_tracepoint_valid_at (struct gdbarch *gdbarch, CORE_ADDR addr, - - const struct floatformat ** - i386_floatformat_for_type (struct gdbarch *gdbarch, -- const char *name, int len) -+ const char *name, LONGEST len) - { - if (len == 128 && name) - if (strcmp (name, "__float128") == 0 -diff --git a/gdb/language.c b/gdb/language.c ---- a/gdb/language.c -+++ b/gdb/language.c -@@ -765,7 +765,7 @@ unk_lang_printchar (int c, struct type *type, struct ui_file *stream) - - static void - unk_lang_printstr (struct ui_file *stream, struct type *type, -- const gdb_byte *string, unsigned int length, -+ const gdb_byte *string, ULONGEST length, - const char *encoding, int force_ellipses, - const struct value_print_options *options) - { -@@ -784,7 +784,7 @@ unk_lang_print_type (struct type *type, const char *varstring, - - static void - unk_lang_val_print (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options) -diff --git a/gdb/language.h b/gdb/language.h ---- a/gdb/language.h -+++ b/gdb/language.h -@@ -184,7 +184,7 @@ struct language_defn - struct ui_file * stream); - - void (*la_printstr) (struct ui_file * stream, struct type *elttype, -- const gdb_byte *string, unsigned int length, -+ const gdb_byte *string, ULONGEST length, - const char *encoding, int force_ellipses, - const struct value_print_options *); - -@@ -222,7 +222,7 @@ struct language_defn - printing. */ - - void (*la_val_print) (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options); -diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c ---- a/gdb/m2-lang.c -+++ b/gdb/m2-lang.c -@@ -103,10 +103,10 @@ m2_printchar (int c, struct type *type, struct ui_file *stream) - - static void - m2_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, -- unsigned int length, const char *encoding, int force_ellipses, -+ ULONGEST length, const char *encoding, int force_ellipses, - const struct value_print_options *options) - { -- unsigned int i; -+ ULONGEST i; - unsigned int things_printed = 0; - int in_quotes = 0; - int need_comma = 0; -@@ -121,9 +121,9 @@ m2_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, - { - /* Position of the character we are examining - to see whether it is repeated. */ -- unsigned int rep1; -+ ULONGEST rep1; - /* Number of repetitions we have detected so far. */ -- unsigned int reps; -+ ULONGEST reps; - - QUIT; - -@@ -149,7 +149,7 @@ m2_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, - in_quotes = 0; - } - m2_printchar (string[i], type, stream); -- fprintf_filtered (stream, " ", reps); -+ fprintf_filtered (stream, " ", pulongest (reps)); - i = rep1 - 1; - things_printed += options->repeat_count_threshold; - need_comma = 1; -diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h ---- a/gdb/m2-lang.h -+++ b/gdb/m2-lang.h -@@ -35,7 +35,7 @@ extern void m2_print_typedef (struct type *, struct symbol *, - extern int m2_is_long_set (struct type *type); - extern int m2_is_unbounded_array (struct type *type); - --extern void m2_val_print (struct type *, int, CORE_ADDR, -+extern void m2_val_print (struct type *, LONGEST, CORE_ADDR, - struct ui_file *, int, - struct value *, - const struct value_print_options *); -diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c ---- a/gdb/m2-typeprint.c -+++ b/gdb/m2-typeprint.c -@@ -234,9 +234,12 @@ static void m2_array (struct type *type, struct ui_file *stream, - m2_print_bounds (TYPE_INDEX_TYPE (type), stream, show, -1, 1); - } - else -- fprintf_filtered (stream, "%d", -- (TYPE_LENGTH (type) -- / TYPE_LENGTH (TYPE_TARGET_TYPE (type)))); -+ { -+ ULONGEST val = (TYPE_LENGTH (type) -+ / TYPE_LENGTH (TYPE_TARGET_TYPE (type))); -+ -+ fprintf_filtered (stream, "%s", pulongest (val)); -+ } - } - fprintf_filtered (stream, "] OF "); - m2_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level, flags); -diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c ---- a/gdb/m2-valprint.c -+++ b/gdb/m2-valprint.c -@@ -35,7 +35,7 @@ static int print_unpacked_pointer (struct type *type, - struct ui_file *stream); - static void - m2_print_array_contents (struct type *type, const gdb_byte *valaddr, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options, -@@ -67,7 +67,7 @@ get_long_set_bounds (struct type *type, LONGEST *low, LONGEST *high) - - static void - m2_print_long_set (struct type *type, const gdb_byte *valaddr, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream) - { - int empty_set = 1; -@@ -158,7 +158,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr, - - static void - m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - const struct value_print_options *options) - { -@@ -260,7 +260,7 @@ print_variable_at_address (struct type *type, - - static void - m2_print_array_contents (struct type *type, const gdb_byte *valaddr, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options, -@@ -308,12 +308,12 @@ static const struct generic_val_print_decorations m2_decorations = - function; they are identical. */ - - void --m2_val_print (struct type *type, int embedded_offset, -+m2_val_print (struct type *type, LONGEST embedded_offset, - CORE_ADDR address, struct ui_file *stream, int recurse, - struct value *original_value, - const struct value_print_options *options) - { -- unsigned len; -+ ULONGEST len; - struct type *elttype; - CORE_ADDR addr; - const gdb_byte *valaddr = value_contents_for_printing (original_value); -@@ -339,7 +339,7 @@ m2_val_print (struct type *type, int embedded_offset, - elements up to it. */ - if (options->stop_print_at_null) - { -- unsigned int temp_len; -+ ULONGEST temp_len; - - /* Look for a NULL char. */ - for (temp_len = 0; -@@ -415,7 +415,7 @@ m2_val_print (struct type *type, int embedded_offset, - { - struct type *range = elttype; - LONGEST low_bound, high_bound; -- int i; -+ LONGEST i; - int need_comma = 0; - - fputs_filtered ("{", stream); -diff --git a/gdb/memrange.c b/gdb/memrange.c ---- a/gdb/memrange.c -+++ b/gdb/memrange.c -@@ -22,8 +22,8 @@ - #include - - int --mem_ranges_overlap (CORE_ADDR start1, int len1, -- CORE_ADDR start2, int len2) -+mem_ranges_overlap (CORE_ADDR start1, LONGEST len1, -+ CORE_ADDR start2, LONGEST len2) - { - ULONGEST h, l; - -diff --git a/gdb/memrange.h b/gdb/memrange.h ---- a/gdb/memrange.h -+++ b/gdb/memrange.h -@@ -28,7 +28,7 @@ struct mem_range - { - mem_range () = default; - -- mem_range (CORE_ADDR start_, int length_) -+ mem_range (CORE_ADDR start_, LONGEST length_) - : start (start_), length (length_) - {} - -@@ -47,14 +47,14 @@ struct mem_range - CORE_ADDR start; - - /* Length of the range. */ -- int length; -+ LONGEST length; - }; - - /* Returns true if the ranges defined by [start1, start1+len1) and - [start2, start2+len2) overlap. */ - --extern int mem_ranges_overlap (CORE_ADDR start1, int len1, -- CORE_ADDR start2, int len2); -+extern int mem_ranges_overlap (CORE_ADDR start1, LONGEST len1, -+ CORE_ADDR start2, LONGEST len2); - - /* Returns true if ADDR is in RANGE. */ - -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 -@@ -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 --mips_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+mips_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - struct pt_watch_regs dummy_regs; - int i; -diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c ---- a/gdb/nat/x86-dregs.c -+++ b/gdb/nat/x86-dregs.c -@@ -380,7 +380,7 @@ x86_remove_aligned_watchpoint (struct x86_debug_reg_state *state, - - static int - x86_handle_nonaligned_watchpoint (struct x86_debug_reg_state *state, -- x86_wp_op_t what, CORE_ADDR addr, int len, -+ x86_wp_op_t what, CORE_ADDR addr, LONGEST len, - enum target_hw_bp_type type) - { - int retval = 0; -@@ -548,7 +548,7 @@ x86_dr_remove_watchpoint (struct x86_debug_reg_state *state, - - int - x86_dr_region_ok_for_watchpoint (struct x86_debug_reg_state *state, -- CORE_ADDR addr, int len) -+ CORE_ADDR addr, LONGEST len) - { - int nregs; - -diff --git a/gdb/nat/x86-dregs.h b/gdb/nat/x86-dregs.h ---- a/gdb/nat/x86-dregs.h -+++ b/gdb/nat/x86-dregs.h -@@ -117,7 +117,7 @@ extern int x86_dr_remove_watchpoint (struct x86_debug_reg_state *state, - /* Return non-zero if we can watch a memory region that starts at - address ADDR and whose length is LEN bytes. */ - extern int x86_dr_region_ok_for_watchpoint (struct x86_debug_reg_state *state, -- CORE_ADDR addr, int len); -+ CORE_ADDR addr, LONGEST len); - - /* If the inferior has some break/watchpoint that triggered, set the - address associated with that break/watchpoint and return true. -diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c ---- a/gdb/opencl-lang.c -+++ b/gdb/opencl-lang.c -@@ -76,11 +76,11 @@ builtin_opencl_type (struct gdbarch *gdbarch) - - static struct type * - lookup_opencl_vector_type (struct gdbarch *gdbarch, enum type_code code, -- unsigned int el_length, unsigned int flag_unsigned, -+ ULONGEST el_length, unsigned int flag_unsigned, - int n) - { - int i; -- unsigned int length; -+ ULONGEST length; - struct type *type = NULL; - struct type **types = builtin_opencl_type (gdbarch); - -@@ -172,7 +172,7 @@ lval_func_read (struct value *v) - struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val))); - LONGEST offset = value_offset (v); - LONGEST elsize = TYPE_LENGTH (eltype); -- int n, i, j = 0; -+ LONGEST n, i, j = 0; - LONGEST lowb = 0; - LONGEST highb = 0; - -@@ -201,7 +201,7 @@ lval_func_write (struct value *v, struct value *fromval) - struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val))); - LONGEST offset = value_offset (v); - LONGEST elsize = TYPE_LENGTH (eltype); -- int n, i, j = 0; -+ LONGEST n, i, j = 0; - LONGEST lowb = 0; - LONGEST highb = 0; - -@@ -241,17 +241,17 @@ lval_func_write (struct value *v, struct value *fromval) - - static int - lval_func_check_synthetic_pointer (const struct value *v, -- LONGEST offset, int length) -+ LONGEST offset, LONGEST length) - { - struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); - /* Size of the target type in bits. */ -- int elsize = -+ LONGEST elsize = - TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; -- int startrest = offset % elsize; -- int start = offset / elsize; -- int endrest = (offset + length) % elsize; -- int end = (offset + length) / elsize; -- int i; -+ LONGEST startrest = offset % elsize; -+ LONGEST start = offset / elsize; -+ LONGEST endrest = (offset + length) % elsize; -+ LONGEST end = (offset + length) / elsize; -+ LONGEST i; - - if (endrest) - end++; -@@ -261,8 +261,8 @@ lval_func_check_synthetic_pointer (const struct value *v, - - for (i = start; i < end; i++) - { -- int comp_offset = (i == start) ? startrest : 0; -- int comp_length = (i == end) ? endrest : elsize; -+ LONGEST comp_offset = (i == start) ? startrest : 0; -+ LONGEST comp_length = (i == end) ? endrest : elsize; - - if (!value_bits_synthetic_pointer (c->val, - c->indices[i] * elsize + comp_offset, -diff --git a/gdb/p-lang.c b/gdb/p-lang.c ---- a/gdb/p-lang.c -+++ b/gdb/p-lang.c -@@ -93,8 +93,8 @@ pascal_main_name (void) - are not multiple of TARGET_CHAR_BIT then the results are wrong - but this does not happen for Free Pascal nor for GPC. */ - int --is_pascal_string_type (struct type *type,int *length_pos, -- int *length_size, int *string_pos, -+is_pascal_string_type (struct type *type, LONGEST *length_pos, -+ LONGEST *length_size, LONGEST *string_pos, - struct type **char_type, - const char **arrayname) - { -@@ -214,12 +214,12 @@ pascal_printchar (int c, struct type *type, struct ui_file *stream) - - void - pascal_printstr (struct ui_file *stream, struct type *type, -- const gdb_byte *string, unsigned int length, -+ const gdb_byte *string, ULONGEST length, - const char *encoding, int force_ellipses, - const struct value_print_options *options) - { - enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); -- unsigned int i; -+ ULONGEST i; - unsigned int things_printed = 0; - int in_quotes = 0; - int need_comma = 0; -@@ -247,9 +247,9 @@ pascal_printstr (struct ui_file *stream, struct type *type, - { - /* Position of the character we are examining - to see whether it is repeated. */ -- unsigned int rep1; -+ ULONGEST rep1; - /* Number of repetitions we have detected so far. */ -- unsigned int reps; -+ ULONGEST reps; - unsigned long int current_char; - - QUIT; -@@ -281,7 +281,7 @@ pascal_printstr (struct ui_file *stream, struct type *type, - in_quotes = 0; - } - pascal_printchar (current_char, type, stream); -- fprintf_filtered (stream, " ", reps); -+ fprintf_filtered (stream, " ", pulongest (reps)); - i = rep1 - 1; - things_printed += options->repeat_count_threshold; - need_comma = 1; -diff --git a/gdb/p-lang.h b/gdb/p-lang.h ---- a/gdb/p-lang.h -+++ b/gdb/p-lang.h -@@ -37,7 +37,7 @@ extern void pascal_print_type (struct type *, const char *, struct ui_file *, - extern void pascal_print_typedef (struct type *, struct symbol *, - struct ui_file *); - --extern void pascal_val_print (struct type *, int, -+extern void pascal_val_print (struct type *, LONGEST, - CORE_ADDR, struct ui_file *, int, - struct value *, - const struct value_print_options *); -@@ -51,13 +51,13 @@ extern void pascal_type_print_method_args (const char *, const char *, - /* These are in p-lang.c: */ - - extern int -- is_pascal_string_type (struct type *, int *, int *, int *, -+ is_pascal_string_type (struct type *, LONGEST *, LONGEST *, LONGEST *, - struct type **, const char **); - - extern void pascal_printchar (int, struct type *, struct ui_file *); - - extern void pascal_printstr (struct ui_file *, struct type *, const gdb_byte *, -- unsigned int, const char *, int, -+ ULONGEST, const char *, int, - const struct value_print_options *); - - extern struct type **const pascal_builtin_types[]; -diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c ---- a/gdb/p-valprint.c -+++ b/gdb/p-valprint.c -@@ -60,7 +60,7 @@ static const struct generic_val_print_decorations p_decorations = - - void - pascal_val_print (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *original_value, - const struct value_print_options *options) -@@ -70,8 +70,8 @@ pascal_val_print (struct type *type, - unsigned int i = 0; /* Number of characters printed */ - unsigned len; - struct type *elttype; -- unsigned eltlen; -- int length_pos, length_size, string_pos; -+ ULONGEST eltlen; -+ LONGEST length_pos, length_size, string_pos; - struct type *char_type; - CORE_ADDR addr; - int want_space = 0; -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 -@@ -1716,7 +1716,7 @@ ppc_linux_nat_target::can_use_hw_breakpoint (enum bptype type, int cnt, int ot) - } - - int --ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+ppc_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - /* Handle sub-8-byte quantities. */ - if (len <= 0) -diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c ---- a/gdb/ppc-linux-tdep.c -+++ b/gdb/ppc-linux-tdep.c -@@ -2263,7 +2263,7 @@ ppc_init_linux_record_tdep (struct linux_record_tdep *record_tdep, - - const struct floatformat ** - ppc_floatformat_for_type (struct gdbarch *gdbarch, -- const char *name, int len) -+ const char *name, LONGEST len) - { - if (len == 128 && name) - { -diff --git a/gdb/printcmd.c b/gdb/printcmd.c ---- a/gdb/printcmd.c -+++ b/gdb/printcmd.c -@@ -276,7 +276,7 @@ print_formatted (struct value *val, int size, - struct ui_file *stream) - { - struct type *type = check_typedef (value_type (val)); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - - if (VALUE_LVAL (val) == lval_memory) - next_address = value_address (val) + len; -@@ -352,7 +352,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type, - int size, struct ui_file *stream) - { - struct gdbarch *gdbarch = get_type_arch (type); -- unsigned int len = TYPE_LENGTH (type); -+ ULONGEST len = TYPE_LENGTH (type); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - - /* String printing should go through val_print_scalar_formatted. */ -diff --git a/gdb/procfs.c b/gdb/procfs.c ---- a/gdb/procfs.c -+++ b/gdb/procfs.c -@@ -3374,7 +3374,7 @@ procfs_target::remove_watchpoint (CORE_ADDR addr, int len, - } - - int --procfs_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+procfs_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - /* The man page for proc(4) on Solaris 2.6 and up says that the - system can support "thousands" of hardware watchpoints, but gives -diff --git a/gdb/regcache.c b/gdb/regcache.c ---- a/gdb/regcache.c -+++ b/gdb/regcache.c -@@ -763,7 +763,7 @@ regcache::cooked_write (int regnum, const gdb_byte *buf) - /* See regcache.h. */ - - enum register_status --readable_regcache::read_part (int regnum, int offset, int len, -+readable_regcache::read_part (int regnum, LONGEST offset, LONGEST len, - gdb_byte *out, bool is_raw) - { - int reg_size = register_size (arch (), regnum); -@@ -830,7 +830,7 @@ reg_buffer::raw_collect_part (int regnum, int offset, int len, - /* See regcache.h. */ - - enum register_status --regcache::write_part (int regnum, int offset, int len, -+regcache::write_part (int regnum, LONGEST offset, LONGEST len, - const gdb_byte *in, bool is_raw) - { - int reg_size = register_size (arch (), regnum); -@@ -901,7 +901,7 @@ reg_buffer::raw_supply_part (int regnum, int offset, int len, - } - - enum register_status --readable_regcache::raw_read_part (int regnum, int offset, int len, -+readable_regcache::raw_read_part (int regnum, int offset, LONGEST len, - gdb_byte *buf) - { - assert_regnum (regnum); -@@ -911,7 +911,7 @@ readable_regcache::raw_read_part (int regnum, int offset, int len, - /* See regcache.h. */ - - void --regcache::raw_write_part (int regnum, int offset, int len, -+regcache::raw_write_part (int regnum, int offset, LONGEST len, - const gdb_byte *buf) - { - assert_regnum (regnum); -@@ -921,7 +921,7 @@ regcache::raw_write_part (int regnum, int offset, int len, - /* See regcache.h. */ - - enum register_status --readable_regcache::cooked_read_part (int regnum, int offset, int len, -+readable_regcache::cooked_read_part (int regnum, LONGEST offset, LONGEST len, - gdb_byte *buf) - { - gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers); -@@ -931,7 +931,7 @@ readable_regcache::cooked_read_part (int regnum, int offset, int len, - /* See regcache.h. */ - - void --regcache::cooked_write_part (int regnum, int offset, int len, -+regcache::cooked_write_part (int regnum, LONGEST offset, LONGEST len, - const gdb_byte *buf) - { - gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers); -diff --git a/gdb/regcache.h b/gdb/regcache.h ---- a/gdb/regcache.h -+++ b/gdb/regcache.h -@@ -273,8 +273,8 @@ public: - enum register_status raw_read (int regnum, T *val); - - /* Partial transfer of raw registers. Return the status of the register. */ -- enum register_status raw_read_part (int regnum, int offset, int len, -- gdb_byte *buf); -+ enum register_status raw_read_part (int regnum, int offset, -+ LONGEST len, gdb_byte *buf); - - /* Make certain that the register REGNUM is up-to-date. */ - virtual void raw_update (int regnum) = 0; -@@ -286,8 +286,8 @@ public: - enum register_status cooked_read (int regnum, T *val); - - /* Partial transfer of a cooked register. */ -- enum register_status cooked_read_part (int regnum, int offset, int len, -- gdb_byte *buf); -+ enum register_status cooked_read_part (int regnum, LONGEST offset, -+ LONGEST len, gdb_byte *buf); - - /* Read register REGNUM from the regcache and return a new value. This - will call mark_value_bytes_unavailable as appropriate. */ -@@ -297,7 +297,7 @@ protected: - - /* Perform a partial register transfer using a read, modify, write - operation. Will fail if register is currently invalid. */ -- enum register_status read_part (int regnum, int offset, int len, -+ enum register_status read_part (int regnum, LONGEST offset, LONGEST len, - gdb_byte *out, bool is_raw); - }; - -@@ -355,11 +355,12 @@ public: - - /* Partial transfer of raw registers. Perform read, modify, write style - operations. */ -- void raw_write_part (int regnum, int offset, int len, const gdb_byte *buf); -+ void raw_write_part (int regnum, int offset, LONGEST len, -+ const gdb_byte *buf); - - /* Partial transfer of a cooked register. Perform read, modify, write style - operations. */ -- void cooked_write_part (int regnum, int offset, int len, -+ void cooked_write_part (int regnum, LONGEST offset, LONGEST len, - const gdb_byte *buf); - - void supply_regset (const struct regset *regset, -@@ -410,7 +411,7 @@ private: - - /* Perform a partial register transfer using a read, modify, write - operation. */ -- enum register_status write_part (int regnum, int offset, int len, -+ enum register_status write_part (int regnum, LONGEST offset, LONGEST len, - const gdb_byte *in, bool is_raw); - - /* The address space of this register cache (for registers where it -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -458,7 +458,7 @@ public: - - int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override; - -- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; -+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override; - - int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, - struct expression *) override; -@@ -10406,7 +10406,7 @@ int remote_hw_watchpoint_length_limit = -1; - int remote_hw_breakpoint_limit = -1; - - int --remote_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+remote_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - if (remote_hw_watchpoint_length_limit == 0) - return 0; -diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c ---- a/gdb/rust-lang.c -+++ b/gdb/rust-lang.c -@@ -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, -- const gdb_byte *string, unsigned int length, -+ const gdb_byte *string, ULONGEST length, - const char *user_encoding, int force_ellipses, - const struct value_print_options *options) - { -@@ -517,7 +517,7 @@ static const struct generic_val_print_decorations rust_decorations = - /* la_val_print implementation for Rust. */ - - static void --rust_val_print (struct type *type, int embedded_offset, -+rust_val_print (struct type *type, LONGEST embedded_offset, - CORE_ADDR address, struct ui_file *stream, int recurse, - struct value *val, - const struct value_print_options *options) -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 -@@ -951,7 +951,8 @@ s390_linux_nat_target::remove_hw_breakpoint (struct gdbarch *gdbarch, - } - - int --s390_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int cnt) -+s390_linux_nat_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, -+ LONGEST cnt) - { - return 1; - } -diff --git a/gdb/spu-multiarch.c b/gdb/spu-multiarch.c ---- a/gdb/spu-multiarch.c -+++ b/gdb/spu-multiarch.c -@@ -65,7 +65,7 @@ struct spu_multiarch_target final : public target_ops - const gdb_byte *pattern, ULONGEST pattern_len, - CORE_ADDR *found_addrp) override; - -- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; -+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override; - - struct gdbarch *thread_architecture (ptid_t) override; - }; -@@ -162,7 +162,7 @@ spu_multiarch_target::thread_architecture (ptid_t ptid) - /* Override the to_region_ok_for_hw_watchpoint routine. */ - - int --spu_multiarch_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+spu_multiarch_target::region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - /* We cannot watch SPU local store. */ - if (SPUADDR_SPU (addr) != -1) -diff --git a/gdb/stack.c b/gdb/stack.c ---- a/gdb/stack.c -+++ b/gdb/stack.c -@@ -194,7 +194,7 @@ print_stack_frame (struct frame_info *frame, int print_level, - argument (not just the first nameless argument). */ - - static void --print_frame_nameless_args (struct frame_info *frame, long start, int num, -+print_frame_nameless_args (struct frame_info *frame, LONGEST start, int num, - int first, struct ui_file *stream) - { - struct gdbarch *gdbarch = get_frame_arch (frame); -@@ -544,7 +544,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame, - /* Offset of next stack argument beyond the one we have seen that is - at the highest offset, or -1 if we haven't come to a stack - argument yet. */ -- long highest_offset = -1; -+ LONGEST highest_offset = -1; - /* Number of ints of arguments that we have printed so far. */ - int args_printed = 0; - /* True if we should print arguments, false otherwise. */ -@@ -573,8 +573,8 @@ print_frame_args (struct symbol *func, struct frame_info *frame, - case LOC_ARG: - case LOC_REF_ARG: - { -- long current_offset = SYMBOL_VALUE (sym); -- int arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym)); -+ LONGEST current_offset = SYMBOL_VALUE (sym); -+ LONGEST arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym)); - - /* Compute address of next argument by adding the size of - this argument and rounding to an int boundary. */ -@@ -709,7 +709,7 @@ print_frame_args (struct symbol *func, struct frame_info *frame, - enough about the stack to find them. */ - if (num != -1) - { -- long start; -+ LONGEST start; - - if (highest_offset == -1) - start = gdbarch_frame_args_skip (get_frame_arch (frame)); -diff --git a/gdb/symmisc.c b/gdb/symmisc.c ---- a/gdb/symmisc.c -+++ b/gdb/symmisc.c -@@ -587,11 +587,11 @@ print_symbol (struct gdbarch *gdbarch, struct symbol *symbol, - - case LOC_CONST_BYTES: - { -- unsigned i; -+ ULONGEST i; - struct type *type = check_typedef (SYMBOL_TYPE (symbol)); - -- fprintf_filtered (outfile, "const %u hex bytes:", -- TYPE_LENGTH (type)); -+ fprintf_filtered (outfile, "const %s hex bytes:", -+ pulongest (TYPE_LENGTH (type))); - for (i = 0; i < TYPE_LENGTH (type); i++) - fprintf_filtered (outfile, " %02x", - (unsigned) SYMBOL_VALUE_BYTES (symbol)[i]); -diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c ---- a/gdb/target-delegates.c -+++ b/gdb/target-delegates.c -@@ -38,7 +38,7 @@ struct dummy_target : public target_ops - bool 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; -+ int region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) override; - 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; -@@ -205,7 +205,7 @@ struct debug_target : public target_ops - bool 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; -+ int region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) override; - 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; -@@ -1071,19 +1071,19 @@ debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int - } - - int --target_ops::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) -+target_ops::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) - { - return this->beneath ()->region_ok_for_hw_watchpoint (arg0, arg1); - } - - int --dummy_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) -+dummy_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) - { - return default_region_ok_for_hw_watchpoint (this, arg0, arg1); - } - - int --debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, int arg1) -+debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) - { - int result; - fprintf_unfiltered (gdb_stdlog, "-> %s->region_ok_for_hw_watchpoint (...)\n", this->beneath ()->shortname ()); -@@ -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); -- target_debug_print_int (arg1); -+ target_debug_print_LONGEST (arg1); - fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_int (result); - fputs_unfiltered ("\n", gdb_stdlog); -diff --git a/gdb/target.c b/gdb/target.c ---- a/gdb/target.c -+++ b/gdb/target.c -@@ -58,7 +58,7 @@ static int default_watchpoint_addr_within_range (struct target_ops *, - CORE_ADDR, CORE_ADDR, int); - - static int default_region_ok_for_hw_watchpoint (struct target_ops *, -- CORE_ADDR, int); -+ CORE_ADDR, LONGEST); - - static void default_rcmd (struct target_ops *, const char *, struct ui_file *); - -@@ -3103,7 +3103,7 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename) - - static int - default_region_ok_for_hw_watchpoint (struct target_ops *self, -- CORE_ADDR addr, int len) -+ CORE_ADDR addr, LONGEST len) - { - return (len <= gdbarch_ptr_bit (target_gdbarch ()) / TARGET_CHAR_BIT); - } -diff --git a/gdb/target.h b/gdb/target.h ---- a/gdb/target.h -+++ b/gdb/target.h -@@ -566,7 +566,7 @@ struct target_ops - - /* Documentation of this routine is provided with the corresponding - target_* macro. */ -- virtual int region_ok_for_hw_watchpoint (CORE_ADDR, int) -+ virtual int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) - TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint); - - virtual bool can_accel_watchpoint_condition (CORE_ADDR, int, int, -diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c ---- a/gdb/tracepoint.c -+++ b/gdb/tracepoint.c -@@ -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, CORE_ADDR scope) -+ ULONGEST len, CORE_ADDR scope) - { - if (info_verbose) -- printf_filtered ("(%d,%s,%ld)\n", type, paddress (gdbarch, base), len); -+ printf_filtered ("(%d,%s,%s)\n", type, paddress (gdbarch, base), pulongest (len)); - - /* type: memrange_absolute == memory, other n == basereg */ - /* base: addr if memory, offset if reg relative. */ -@@ -916,7 +916,7 @@ collection_list::collect_symbol (struct symbol *sym, - CORE_ADDR scope, - int trace_string) - { -- unsigned long len; -+ ULONGEST len; - unsigned int reg; - bfd_signed_vma offset; - int treat_as_expr = 0; -@@ -937,8 +937,8 @@ collection_list::collect_symbol (struct symbol *sym, - offset = SYMBOL_VALUE_ADDRESS (sym); - if (info_verbose) - { -- printf_filtered ("LOC_STATIC %s: collect %ld bytes at %s.\n", -- SYMBOL_PRINT_NAME (sym), len, -+ printf_filtered ("LOC_STATIC %s: collect %s bytes at %s.\n", -+ SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset)); - } - /* A struct may be a C++ class with static fields, go to general -@@ -970,9 +970,9 @@ collection_list::collect_symbol (struct symbol *sym, - offset = frame_offset + SYMBOL_VALUE (sym); - if (info_verbose) - { -- printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset %s" -+ printf_filtered ("LOC_LOCAL %s: Collect %s bytes at offset %s" - " from frame ptr reg %d\n", -- SYMBOL_PRINT_NAME (sym), len, -+ SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } - add_memrange (gdbarch, reg, offset, len, scope); -@@ -982,9 +982,9 @@ collection_list::collect_symbol (struct symbol *sym, - offset = 0; - if (info_verbose) - { -- printf_filtered ("LOC_REGPARM_ADDR %s: Collect %ld bytes at offset %s" -+ printf_filtered ("LOC_REGPARM_ADDR %s: Collect %s bytes at offset %s" - " from reg %d\n", -- SYMBOL_PRINT_NAME (sym), len, -+ SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } - 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) - { -- printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset %s" -+ printf_filtered ("LOC_LOCAL %s: Collect %s bytes at offset %s" - " from frame ptr reg %d\n", -- SYMBOL_PRINT_NAME (sym), len, -+ SYMBOL_PRINT_NAME (sym), pulongest (len), - paddress (gdbarch, offset), reg); - } - 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; -- int j, count = 0; -+ int count = 0; -+ LONGEST j; - struct gdbarch *gdbarch; - int regno; - const char *args = args_in; -@@ -2636,8 +2637,11 @@ info_scope_command (const char *args_in, int from_tty) - } - } - if (SYMBOL_TYPE (sym)) -- printf_filtered (", length %d.\n", -- TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym)))); -+ { -+ ULONGEST len = TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym))); -+ -+ printf_filtered (", length %s.\n", pulongest (len)); -+ } - } - if (BLOCK_FUNCTION (block)) - break; -diff --git a/gdb/tracepoint.h b/gdb/tracepoint.h ---- a/gdb/tracepoint.h -+++ b/gdb/tracepoint.h -@@ -269,7 +269,7 @@ public: - CORE_ADDR scope); - void add_memrange (struct gdbarch *gdbarch, - int type, bfd_signed_vma base, -- 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, -diff --git a/gdb/typeprint.c b/gdb/typeprint.c ---- a/gdb/typeprint.c -+++ b/gdb/typeprint.c -@@ -120,7 +120,8 @@ print_offset_data::update (struct type *type, unsigned int field_idx, - { - /* Since union fields don't have the concept of offsets, we just - print their sizes. */ -- fprintf_filtered (stream, "/* %4u */", TYPE_LENGTH (ftype)); -+ fprintf_filtered (stream, "/* %4s */", -+ pulongest (TYPE_LENGTH (ftype))); - return; - } - -@@ -183,8 +184,8 @@ print_offset_data::finish (struct type *type, int level, - - fputs_filtered ("\n", stream); - print_spaces_filtered (level + 4 + print_offset_data::indentation, stream); -- fprintf_filtered (stream, "/* total size (bytes): %4u */\n", -- TYPE_LENGTH (type)); -+ fprintf_filtered (stream, "/* total size (bytes): %4s */\n", -+ pulongest (TYPE_LENGTH (type))); - } - - -diff --git a/gdb/valarith.c b/gdb/valarith.c ---- a/gdb/valarith.c -+++ b/gdb/valarith.c -@@ -182,7 +182,7 @@ value_subscript (struct value *array, LONGEST index) - to doubles, but no longer does. */ - - struct value * --value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) -+value_subscripted_rvalue (struct value *array, LONGEST index, LONGEST lowerbound) - { - struct type *array_type = check_typedef (value_type (array)); - struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (array_type)); -@@ -656,7 +656,7 @@ value_concat (struct value *arg1, struct value *arg2) - struct value *inval1; - struct value *inval2; - struct value *outval = NULL; -- int inval1len, inval2len; -+ ssize_t inval1len, inval2len; - int count, idx; - char inchar; - struct type *type1 = check_typedef (value_type (arg1)); -@@ -1416,7 +1416,7 @@ value_binop (struct value *arg1, struct value *arg2, enum exp_opcode op) - int - value_logical_not (struct value *arg1) - { -- int len; -+ LONGEST len; - const gdb_byte *p; - struct type *type1; - -@@ -1444,11 +1444,11 @@ value_logical_not (struct value *arg1) - static int - value_strcmp (struct value *arg1, struct value *arg2) - { -- int len1 = TYPE_LENGTH (value_type (arg1)); -- int len2 = TYPE_LENGTH (value_type (arg2)); -+ LONGEST len1 = TYPE_LENGTH (value_type (arg1)); -+ LONGEST len2 = TYPE_LENGTH (value_type (arg2)); - const gdb_byte *s1 = value_contents (arg1); - const gdb_byte *s2 = value_contents (arg2); -- int i, len = len1 < len2 ? len1 : len2; -+ LONGEST i, len = len1 < len2 ? len1 : len2; - - for (i = 0; i < len; i++) - { -diff --git a/gdb/valops.c b/gdb/valops.c ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -81,7 +81,7 @@ static enum oload_classification classify_oload_match - (const badness_vector &, int, int); - - static struct value *value_struct_elt_for_reference (struct type *, -- int, struct type *, -+ LONGEST, struct type *, - const char *, - struct type *, - int, enum noside); -@@ -171,7 +171,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p) - space. */ - - struct value * --value_allocate_space_in_inferior (int len) -+value_allocate_space_in_inferior (LONGEST len) - { - struct objfile *objf; - struct value *val = find_function_in_inferior ("malloc", &objf); -@@ -386,12 +386,12 @@ value_cast (struct type *type, struct value *arg2) - if (code1 == TYPE_CODE_ARRAY) - { - struct type *element_type = TYPE_TARGET_TYPE (type); -- unsigned element_length = TYPE_LENGTH (check_typedef (element_type)); -+ ULONGEST element_length = TYPE_LENGTH (check_typedef (element_type)); - - if (element_length > 0 && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) - { - struct type *range_type = TYPE_INDEX_TYPE (type); -- int val_length = TYPE_LENGTH (type2); -+ LONGEST val_length = TYPE_LENGTH (type2); - LONGEST low_bound, high_bound, new_length; - - if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) -@@ -1043,7 +1043,7 @@ value_assign (struct value *toval, struct value *fromval) - { - const gdb_byte *dest_buffer; - CORE_ADDR changed_addr; -- int changed_len; -+ LONGEST changed_len; - gdb_byte buffer[sizeof (LONGEST)]; - - if (value_bitsize (toval)) -@@ -3335,7 +3335,7 @@ get_baseclass_offset (struct type *vt, struct type *cls, - the form "DOMAIN::NAME". */ - - static struct value * --value_struct_elt_for_reference (struct type *domain, int offset, -+value_struct_elt_for_reference (struct type *domain, LONGEST offset, - struct type *curtype, const char *name, - struct type *intype, - int want_address, -@@ -3369,7 +3369,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), -- offset + (LONGEST) (TYPE_FIELD_BITPOS (t, i) >> 3)); -+ offset + (TYPE_FIELD_BITPOS (t, i) >> 3)); - else if (noside != EVAL_NORMAL) - return allocate_value (TYPE_FIELD_TYPE (t, i)); - else -@@ -3548,7 +3548,7 @@ value_struct_elt_for_reference (struct type *domain, int offset, - for (i = TYPE_N_BASECLASSES (t) - 1; i >= 0; i--) - { - struct value *v; -- int base_offset; -+ LONGEST base_offset; - - if (BASETYPE_VIA_VIRTUAL (t, i)) - base_offset = 0; -@@ -3697,7 +3697,7 @@ value_rtti_indirect_type (struct value *v, int *full, - struct value * - value_full_object (struct value *argp, - struct type *rtype, -- int xfull, int xtop, -+ int xfull, LONGEST xtop, - int xusing_enc) - { - struct type *real_type; -diff --git a/gdb/valprint.c b/gdb/valprint.c ---- a/gdb/valprint.c -+++ b/gdb/valprint.c -@@ -879,7 +879,7 @@ generic_val_print_complex (struct type *type, - - void - generic_val_print (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *original_value, - const struct value_print_options *options, -@@ -1774,7 +1774,7 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr, - - void - print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr, -- unsigned len, enum bfd_endian byte_order, -+ ULONGEST len, enum bfd_endian byte_order, - bool zero_pad) - { - const gdb_byte *p; -@@ -1927,17 +1927,17 @@ val_print_array_elements (struct type *type, - int recurse, - struct value *val, - const struct value_print_options *options, -- unsigned int i) -+ ULONGEST i) - { - unsigned int things_printed = 0; -- unsigned len; -+ ULONGEST len; - struct type *elttype, *index_type, *base_index_type; -- unsigned eltlen; -+ ULONGEST eltlen; - /* Position of the array element we are examining to see - whether it is repeated. */ -- unsigned int rep1; -+ ULONGEST rep1; - /* Number of repetitions we have detected so far. */ -- unsigned int reps; -+ ULONGEST reps; - LONGEST low_bound, high_bound; - LONGEST low_pos, high_pos; - -@@ -2027,7 +2027,7 @@ val_print_array_elements (struct type *type, - address, stream, recurse + 1, val, options, - current_language); - annotate_elt_rep (reps); -- fprintf_filtered (stream, " ", reps); -+ fprintf_filtered (stream, " ", pulongest (reps)); - annotate_elt_rep_end (); - - i = rep1 - 1; -@@ -2669,7 +2669,7 @@ print_converted_chars_to_obstack (struct obstack *obstack, - - void - generic_printstr (struct ui_file *stream, struct type *type, -- const gdb_byte *string, unsigned int length, -+ const gdb_byte *string, ULONGEST length, - const char *encoding, int force_ellipses, - int quote_char, int c_style_terminator, - const struct value_print_options *options) -diff --git a/gdb/valprint.h b/gdb/valprint.h ---- a/gdb/valprint.h -+++ b/gdb/valprint.h -@@ -119,7 +119,7 @@ extern void val_print_array_elements (struct type *, LONGEST, - CORE_ADDR, struct ui_file *, int, - struct value *, - const struct value_print_options *, -- unsigned int); -+ ULONGEST); - - extern void val_print_scalar_formatted (struct type *, - LONGEST, -@@ -138,7 +138,7 @@ extern void print_decimal_chars (struct ui_file *, const gdb_byte *, - unsigned int, bool, enum bfd_endian); - - extern void print_hex_chars (struct ui_file *, const gdb_byte *, -- unsigned int, enum bfd_endian, bool); -+ ULONGEST, enum bfd_endian, bool); - - extern void print_char_chars (struct ui_file *, struct type *, - const gdb_byte *, unsigned int, enum bfd_endian); -@@ -192,7 +192,7 @@ struct generic_val_print_decorations - - - extern void generic_val_print (struct type *type, -- int embedded_offset, CORE_ADDR address, -+ LONGEST embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - struct value *original_value, - const struct value_print_options *options, -@@ -202,7 +202,7 @@ extern void generic_emit_char (int c, struct type *type, struct ui_file *stream, - int quoter, const char *encoding); - - extern void generic_printstr (struct ui_file *stream, struct type *type, -- const gdb_byte *string, unsigned int length, -+ const gdb_byte *string, ULONGEST length, - const char *encoding, int force_ellipses, - int quote_char, int c_style_terminator, - const struct value_print_options *options); -diff --git a/gdb/value.c b/gdb/value.c ---- a/gdb/value.c -+++ b/gdb/value.c -@@ -383,7 +383,8 @@ value_bytes_available (const struct value *value, - } - - int --value_bits_any_optimized_out (const struct value *value, int bit_offset, int bit_length) -+value_bits_any_optimized_out (const struct value *value, LONGEST bit_offset, -+ LONGEST bit_length) - { - gdb_assert (!value->lazy); - -@@ -831,8 +832,8 @@ find_first_range_overlap_and_match (struct ranges_and_idx *rp1, - Return true if the available bits match. */ - - static bool --value_contents_bits_eq (const struct value *val1, int offset1, -- const struct value *val2, int offset2, -+value_contents_bits_eq (const struct value *val1, LONGEST offset1, -+ const struct value *val2, LONGEST offset2, - int length) - { - /* Each array element corresponds to a ranges source (unavailable, -@@ -1423,7 +1424,8 @@ value_optimized_out (struct value *value) - the following LENGTH bytes. */ - - void --mark_value_bytes_optimized_out (struct value *value, int offset, int length) -+mark_value_bytes_optimized_out (struct value *value, LONGEST offset, -+ LONGEST length) - { - mark_value_bits_optimized_out (value, - offset * TARGET_CHAR_BIT, -diff --git a/gdb/value.h b/gdb/value.h ---- a/gdb/value.h -+++ b/gdb/value.h -@@ -274,7 +274,7 @@ struct lval_funcs - /* If non-NULL, this is used to determine whether the indicated bits - of VALUE are a synthetic pointer. */ - int (*check_synthetic_pointer) (const struct value *value, -- LONGEST offset, int length); -+ LONGEST offset, LONGEST length); - - /* Return a duplicate of VALUE's closure, for use in a new value. - This may simply return the same closure, if VALUE's is -@@ -405,7 +405,8 @@ extern int value_optimized_out (struct value *value); - otherwise. */ - - extern int value_bits_any_optimized_out (const struct value *value, -- int bit_offset, int bit_length); -+ LONGEST bit_offset, -+ LONGEST bit_length); - - /* Like value_optimized_out, but return true iff the whole value is - optimized out. */ -@@ -415,7 +416,7 @@ extern int value_entirely_optimized_out (struct value *value); - LENGTH bytes as optimized out. */ - - extern void mark_value_bytes_optimized_out (struct value *value, -- int offset, int length); -+ LONGEST offset, LONGEST length); - - /* Mark VALUE's content bits starting at OFFSET and extending for - LENGTH bits as optimized out. */ -@@ -849,12 +850,11 @@ extern struct value *value_primitive_field (struct value *arg1, LONGEST offset, - int fieldno, - struct type *arg_type); - -- - extern struct type *value_rtti_indirect_type (struct value *, int *, LONGEST *, - int *); - - extern struct value *value_full_object (struct value *, struct type *, int, -- int, int); -+ LONGEST, int); - - extern struct value *value_cast_pointers (struct type *, struct value *, int); - -@@ -1147,10 +1147,11 @@ extern struct value *value_literal_complex (struct value *, struct value *, - extern struct value *find_function_in_inferior (const char *, - struct objfile **); - --extern struct value *value_allocate_space_in_inferior (int); -+extern struct value *value_allocate_space_in_inferior (LONGEST); - - extern struct value *value_subscripted_rvalue (struct value *array, -- LONGEST index, int lowerbound); -+ LONGEST index, -+ LONGEST lowerbound); - - /* User function handler. */ - -diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c ---- a/gdb/x86-nat.c -+++ b/gdb/x86-nat.c -@@ -173,7 +173,7 @@ x86_remove_watchpoint (CORE_ADDR addr, int len, - address ADDR and whose length is LEN bytes. */ - - int --x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) -+x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) - { - struct x86_debug_reg_state *state - = x86_debug_reg_state (inferior_ptid.pid ()); -diff --git a/gdb/x86-nat.h b/gdb/x86-nat.h ---- a/gdb/x86-nat.h -+++ b/gdb/x86-nat.h -@@ -49,7 +49,7 @@ extern void x86_forget_process (pid_t pid); - definitions. */ - - extern int x86_can_use_hw_breakpoint (enum bptype type, int cnt, int othertype); --extern int x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len); -+extern int x86_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len); - 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, -@@ -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); } - -- int region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) override -+ int region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) override - { return x86_region_ok_for_hw_watchpoint (addr, len); } - - int insert_watchpoint (CORE_ADDR addr, int len, - diff --git a/gdb-rhbz795424-bitpos-21of25.patch b/gdb-rhbz795424-bitpos-21of25.patch deleted file mode 100644 index b3a0afaed9c94beebc2e2f220a446cd93b11e26e..0000000000000000000000000000000000000000 --- a/gdb-rhbz795424-bitpos-21of25.patch +++ /dev/null @@ -1,173 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-09/msg00632.html - ---MP_/PnL6l3LUsXWpZ/olqawWlzb -Content-Type: text/plain; charset=US-ASCII -Content-Transfer-Encoding: 7bit -Content-Disposition: inline - -Hi, - -This is part two of the bitpos expansion patch. This implements checks -in some places in the code to ensure that a type size in ULONGEST is -small enough to fit into host memory. Tested for regressions on x86_64 -Fedora 16. - -Regards, -Siddhesh - ---MP_/PnL6l3LUsXWpZ/olqawWlzb -Content-Type: text/plain -Content-Transfer-Encoding: quoted-printable -Content-Disposition: attachment; filename=ChangeLog-ensure_sizet - -gdb/ChangeLog - - * alpha-tdep.c (alpha_push_dummy_call) Check for underflow in - SP. - * cp-valprint (cp_print_value): Ensure BASECLASS fits into - size_t. - * dwarf2loc.c (read_pieced_value): Ensure that THIS_SIZE fits - into size_t. - (write_pieced_value): Likewise. - * findcmd.c (parse_find_args): Ensure PATTERN_BUF_SIZE fits into - size_t. - * p-valprint (pascal_object_print_value): Ensure BASECLASS fits - into size_t. - * utils.c (ulongest_fits_host_or_error): New function to find if - a ULONGEST number fits into size_t. - * utils.h: Declare ulongest_fits_host_or_error. - * valops.c (search_struct_method): Ensure BASECLASS fits into - size_t. - * value.c (allocate_value_lazy): Ensure TYPE fits into size_t. - (allocate_value_contents): Likewise. - (set_value_enclosing_type): Ensure NEW_ENCL_TYPE fits into - size_t. - * vax-tdep.c (vax_return_value): Ensure that TYPE fits into - size_t. - ---MP_/PnL6l3LUsXWpZ/olqawWlzb -Content-Type: text/x-patch -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; filename=bitpos-ensure-size_t.patch - -diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c ---- a/gdb/alpha-tdep.c -+++ b/gdb/alpha-tdep.c -@@ -414,6 +414,13 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - accumulate_size = 0; - else - accumulate_size -= sizeof(arg_reg_buffer); -+ -+ /* Check for underflow. */ -+ if (sp - accumulate_size > sp) -+ error (_("Insufficient memory in GDB host for arguments, " -+ "need %s bytes, but less than %s bytes available."), -+ plongest (accumulate_size), plongest (CORE_ADDR_MAX - sp)); -+ - sp -= accumulate_size; - - /* Keep sp aligned to a multiple of 16 as the ABI requires. */ -diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c ---- a/gdb/cp-valprint.c -+++ b/gdb/cp-valprint.c -@@ -529,6 +529,7 @@ cp_print_value (struct type *type, struct type *real_type, - if ((boffset + offset) < 0 - || (boffset + offset) >= TYPE_LENGTH (real_type)) - { -+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); - gdb::byte_vector buf (TYPE_LENGTH (baseclass)); - - if (target_read_memory (address + boffset, buf.data (), -diff --git a/gdb/defs.h b/gdb/defs.h ---- a/gdb/defs.h -+++ b/gdb/defs.h -@@ -669,4 +669,6 @@ DEF_ENUM_FLAGS_TYPE (enum user_selected_what_flag, user_selected_what); - - #include "utils.h" - -+extern void ulongest_fits_host_or_error (ULONGEST num); -+ - #endif /* #ifndef DEFS_H */ -diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c ---- a/gdb/p-valprint.c -+++ b/gdb/p-valprint.c -@@ -775,6 +775,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr, - - if (boffset < 0 || boffset >= TYPE_LENGTH (type)) - { -+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); - buf.resize (TYPE_LENGTH (baseclass)); - - base_valaddr = buf.data (); -diff --git a/gdb/utils.c b/gdb/utils.c ---- a/gdb/utils.c -+++ b/gdb/utils.c -@@ -2957,6 +2957,17 @@ string_to_core_addr (const char *my_string) - return addr; - } - -+/* Ensure that the input NUM is not larger than the maximum capacity of the -+ host system. We choose SIZE_MAX / 8 as a conservative estimate of the size -+ of a resource that a system may allocate. */ -+void -+ulongest_fits_host_or_error (ULONGEST num) -+{ -+ if (num > SIZE_MAX / 8) -+ error (_("Insufficient memory in host GDB for object of size %s bytes, " -+ "maximum allowed %s bytes."), pulongest (num), -+ pulongest (SIZE_MAX / 8)); -+} - #if GDB_SELF_TEST - - static void -diff --git a/gdb/valops.c b/gdb/valops.c ---- a/gdb/valops.c -+++ b/gdb/valops.c -@@ -2064,6 +2064,7 @@ search_struct_method (const char *name, struct value **arg1p, - { - CORE_ADDR address; - -+ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); - gdb::byte_vector tmp (TYPE_LENGTH (baseclass)); - address = value_address (*arg1p); - -diff --git a/gdb/value.c b/gdb/value.c ---- a/gdb/value.c -+++ b/gdb/value.c -@@ -933,6 +933,7 @@ allocate_value_lazy (struct type *type) - description correctly. */ - check_typedef (type); - -+ ulongest_fits_host_or_error (TYPE_LENGTH (type)); - val = new struct value (type); - - /* Values start out on the all_values chain. */ -@@ -1015,6 +1016,8 @@ check_type_length_before_alloc (const struct type *type) - static void - allocate_value_contents (struct value *val) - { -+ ulongest_fits_host_or_error (TYPE_LENGTH (val->enclosing_type)); -+ - if (!val->contents) - { - check_type_length_before_alloc (val->enclosing_type); -@@ -2874,6 +2877,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); -+ ulongest_fits_host_or_error (TYPE_LENGTH (new_encl_type)); - val->contents - .reset ((gdb_byte *) xrealloc (val->contents.release (), - TYPE_LENGTH (new_encl_type))); -diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c ---- a/gdb/vax-tdep.c -+++ b/gdb/vax-tdep.c -@@ -219,6 +219,7 @@ vax_return_value (struct gdbarch *gdbarch, struct value *function, - ULONGEST addr; - - regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr); -+ ulongest_fits_host_or_error (TYPE_LENGTH (type)); - read_memory (addr, readbuf, len); - } - - diff --git a/gdb-rhbz795424-bitpos-22of25.patch b/gdb-rhbz795424-bitpos-22of25.patch deleted file mode 100644 index ce5ac57dd2695daa0d3373b46ef23e351416a92b..0000000000000000000000000000000000000000 --- a/gdb-rhbz795424-bitpos-22of25.patch +++ /dev/null @@ -1,550 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-09/msg00629.html - ---MP_/6HRlH6vpyqtSy4CYyMrX6b2 -Content-Type: text/plain; charset=US-ASCII -Content-Transfer-Encoding: 7bit -Content-Disposition: inline - -Hi, - -This is part three of the bitpos expansion change. Some architectures -allow arbitrary length watchpoints and combined with the fact that type -lengths could be large enough, we need LONGEST for watchpoint lengths. -It is architecture dependent however, whether the LONGEST is needed or -not. This patch updates the signatures of watchpoint insertion and -removal functions of all architectures (to comply with the function -signatures in the callback struct), but expands types only in -architectures that need it. Tested on Fedora 16 x86_64. - -Regards, -Siddhesh ---MP_/6HRlH6vpyqtSy4CYyMrX6b2 -Content-Type: text/plain -Content-Transfer-Encoding: quoted-printable -Content-Disposition: attachment; filename=ChangeLog-wp - -gdb/ChangeLog: - - * arm-linux-nat.c (arm_linux_insert_watchpoint): Expand - parameter LEN to LONGEST. - (arm_linux_remove_watchpoint): Likewise. - (arm_linux_watchpoint_addr_within_range): Expand parameter - LENGTH to LONGEST. - * i386-nat.c (i386_insert_watchpoint): Expand parameter LEN to - LONGEST. - (i386_remove_watchpoint): Likewise. - * ia64-linux-nat.c (ia64_linux_insert_watchpoint): Likewise. - (ia64_linux_remove_watchpoint): Likewise. - * inf-ttrace.c (inf_ttrace_insert_watchpoint): Likewise. - Expand NUM_PAGES, PAGE to LONGEST. - (inf_ttrace_remove_watchpoint): Likewise. - * mips-linux-nat.c (mips_linux_insert_watchpoint): Expand - parameter LEN to LONGEST. - (mips_linux_remove_watchpoint): Likewise. - * nto-procfs.c (procfs_remove_hw_watchpoint): Likewise. - (procfs_insert_hw_watchpoint): Likewise. - * ppc-linux-nat.c (calculate_dvc): Likewise. Expand I, - NUM_BYTE_ENABLE to LONGEST. - (check_condition): Expand parameter LEN to point to LONGEST. - (ppc_linux_can_accel_watchpoint_condition): Expand parameter - LEN to LONGEST. - (create_watchpoint_request): Likewise. - (ppc_linux_insert_watchpoint): Likewise. - (ppc_linux_remove_watchpoint): Likewise. - (ppc_linux_watchpoint_addr_within_range): Expand parameter - LENGTH to LONGEST. - * procfs.c (proc_set_watchpoint): Expand parameter LEN to - LONGEST. - (procfs_set_watchpoint): Likewise. - (procfs_insert_watchpoint): Likewise. - (procfs_remove_watchpoint): Likewise. - * remote-m32r-sdi.c (m32r_insert_watchpoint): Likewise. Use - plongest to format print LEN. - (m32r_remove_watchpoint): Likewise. - * remote-mips.c (mips_insert_watchpoint): Expand parameter LEN - to LONGEST. - (mips_remove_watchpoint): Likewise. - * remote.c (remote_insert_watchpoint): Likewise. - Use phex_nz to format print LEN. - (remote_remove_watchpoint): Likewise. - (remote_watchpoint_addr_within_range): Expand parameter LENGTH - to LONGEST. - * s390-linux-nat.c (s390_insert_watchpoint): Expand parameter LEN to - LONGEST. - (s390_remove_watchpoint): Likewise. - * target.c (update_current_target): Expand parameter LEN for - callbacks to TO_INSERT_WATCHPOINT, TO_REMOVE_WATCHPOINT, - TO_CAN_ACCEL_WATCHPOINT_CONDITION, to LONGEST. - (default_watchpoint_addr_within_range): Expand parameter - LENGTH to LONGEST. - (debug_to_can_accel_watchpoint_condition): Expand parameter LEN - to LONGEST. Use plongest to format print LEN. - (debug_to_watchpoint_addr_within_range): Expand parameter LENGTH - to LONGEST. Use plongest to format print LENGTH. - (debug_to_insert_watchpoint): Expand parameter LEN to LONGEST. - Use plongest to format print LEN. - (debug_to_remove_watchpoint): Likewise. - * target.h (struct target_ops): Expand parameter LEN of - TO_REMOVE_WATCHPOINT, TO_INSERT_WATCHPOINT, - TO_WATCHPOINT_ADDR_WITHIN_RANGE and - TO_CAN_ACCEL_WATCHPOINT_CONDITION to LONGEST. - ---MP_/6HRlH6vpyqtSy4CYyMrX6b2 -Content-Type: text/x-patch -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; filename=bitpos-wp.patch - -diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c ---- a/gdb/aarch64-linux-nat.c -+++ b/gdb/aarch64-linux-nat.c -@@ -63,14 +63,14 @@ public: - int can_use_hw_breakpoint (enum bptype, int, int) override; - int insert_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override; - int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override; -- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; -+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override; - int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, - struct expression *) override; - int remove_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, - struct expression *) override; - bool stopped_by_watchpoint () override; - bool stopped_data_address (CORE_ADDR *) override; -- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; -+ bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override; - - int can_do_single_step () override; - -@@ -887,7 +887,8 @@ aarch64_linux_nat_target::stopped_by_watchpoint () - - bool - aarch64_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, -- CORE_ADDR start, int length) -+ CORE_ADDR start, -+ LONGEST length) - { - return start <= addr && start + length - 1 >= addr; - } -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 -@@ -80,7 +80,7 @@ public: - - int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) override; - -- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; -+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override; - - int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, - struct expression *) override; -@@ -91,7 +91,7 @@ public: - - bool stopped_data_address (CORE_ADDR *) override; - -- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; -+ bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override; - - const struct target_desc *read_description () override; - -@@ -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, -- int length) -+ LONGEST length) - { - return start <= addr && start + length - 1 >= addr; - } -diff --git a/gdb/nat/aarch64-linux-hw-point.c b/gdb/nat/aarch64-linux-hw-point.c ---- a/gdb/nat/aarch64-linux-hw-point.c -+++ b/gdb/nat/aarch64-linux-hw-point.c -@@ -137,7 +137,7 @@ aarch64_point_encode_ctrl_reg (enum target_hw_bp_type type, int offset, int len) - Return 0 for any non-compliant ADDR and/or LEN; return 1 otherwise. */ - - static int --aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len) -+aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, LONGEST len) - { - unsigned int alignment = 0; - -@@ -212,9 +212,10 @@ aarch64_point_is_aligned (int is_watchpoint, CORE_ADDR addr, int len) - an address within the latter. */ - - static void --aarch64_align_watchpoint (CORE_ADDR addr, int len, CORE_ADDR *aligned_addr_p, -+aarch64_align_watchpoint (CORE_ADDR addr, LONGEST len, -+ CORE_ADDR *aligned_addr_p, - int *aligned_offset_p, int *aligned_len_p, -- CORE_ADDR *next_addr_p, int *next_len_p, -+ CORE_ADDR *next_addr_p, LONGEST *next_len_p, - CORE_ADDR *next_addr_orig_p) - { - int aligned_len; -@@ -611,7 +612,7 @@ aarch64_handle_aligned_watchpoint (enum target_hw_bp_type type, - - static int - aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type, -- CORE_ADDR addr, int len, int is_insert, -+ CORE_ADDR addr, LONGEST len, int is_insert, - struct aarch64_debug_reg_state *state) - { - CORE_ADDR addr_orig = addr; -@@ -641,12 +642,12 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type, - " " - "addr_orig: %s\n" - " " -- "next_addr: %s, next_len: %d\n" -+ "next_addr: %s, next_len: %s\n" - " " - "addr_orig_next: %s\n", - is_insert, core_addr_to_string_nz (aligned_addr), - aligned_len, core_addr_to_string_nz (addr_orig), -- core_addr_to_string_nz (addr), len, -+ core_addr_to_string_nz (addr), plongest (len), - core_addr_to_string_nz (addr_orig_next)); - - addr_orig = addr_orig_next; -@@ -660,7 +661,7 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type, - - int - aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr, -- int len, int is_insert, -+ LONGEST len, int is_insert, - struct aarch64_debug_reg_state *state) - { - if (aarch64_point_is_aligned (1 /* is_watchpoint */ , addr, len)) -@@ -742,14 +743,14 @@ aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state, - void - aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, - const char *func, CORE_ADDR addr, -- int len, enum target_hw_bp_type type) -+ LONGEST len, enum target_hw_bp_type type) - { - int i; - - debug_printf ("%s", func); - if (addr || len) -- debug_printf (" (addr=0x%08lx, len=%d, type=%s)", -- (unsigned long) addr, len, -+ debug_printf (" (addr=0x%08lx, len=%s, type=%s)", -+ (unsigned long) addr, plongest (len), - type == hw_write ? "hw-write-watchpoint" - : (type == hw_read ? "hw-read-watchpoint" - : (type == hw_access ? "hw-access-watchpoint" -@@ -832,7 +833,7 @@ aarch64_linux_get_debug_reg_capacity (int tid) - ADDR and whose length is LEN in bytes. */ - - int --aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, int len) -+aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len) - { - CORE_ADDR aligned_addr; - -diff --git a/gdb/nat/aarch64-linux-hw-point.h b/gdb/nat/aarch64-linux-hw-point.h ---- a/gdb/nat/aarch64-linux-hw-point.h -+++ b/gdb/nat/aarch64-linux-hw-point.h -@@ -176,7 +176,7 @@ int aarch64_handle_breakpoint (enum target_hw_bp_type type, CORE_ADDR addr, - int len, int is_insert, - struct aarch64_debug_reg_state *state); - int aarch64_handle_watchpoint (enum target_hw_bp_type type, CORE_ADDR addr, -- int len, int is_insert, -+ LONGEST len, int is_insert, - struct aarch64_debug_reg_state *state); - - void aarch64_linux_set_debug_regs (struct aarch64_debug_reg_state *state, -@@ -189,12 +189,12 @@ bool aarch64_linux_any_set_debug_regs_state (aarch64_debug_reg_state *state, - - void aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, - const char *func, CORE_ADDR addr, -- int len, enum target_hw_bp_type type); -+ LONGEST len, enum target_hw_bp_type type); - - void aarch64_linux_get_debug_reg_capacity (int tid); - - struct aarch64_debug_reg_state *aarch64_get_debug_reg_state (pid_t pid); - --int aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, int len); -+int aarch64_linux_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len); - - #endif /* NAT_AARCH64_LINUX_HW_POINT_H */ -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 -@@ -284,7 +284,7 @@ struct ppc_linux_nat_target final : public linux_nat_target - int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) - override; - -- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; -+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override; - - int insert_watchpoint (CORE_ADDR, int, enum target_hw_bp_type, - struct expression *) override; -@@ -302,9 +302,9 @@ struct ppc_linux_nat_target final : public linux_nat_target - - bool stopped_data_address (CORE_ADDR *) override; - -- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; -+ bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override; - -- bool can_accel_watchpoint_condition (CORE_ADDR, int, int, struct expression *) -+ bool can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int, struct expression *) - override; - - int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) override; -@@ -2065,11 +2065,11 @@ can_use_watchpoint_cond_accel (void) - CONDITION_VALUE will hold the value which should be put in the - DVC register. */ - static void --calculate_dvc (CORE_ADDR addr, int len, CORE_ADDR data_value, -+calculate_dvc (CORE_ADDR addr, LONGEST len, CORE_ADDR data_value, - uint32_t *condition_mode, uint64_t *condition_value) - { -- int i, num_byte_enable, align_offset, num_bytes_off_dvc, -- rightmost_enabled_byte; -+ LONGEST i, num_byte_enable; -+ int align_offset, num_bytes_off_dvc, rightmost_enabled_byte; - CORE_ADDR addr_end_data, addr_end_dvc; - - /* The DVC register compares bytes within fixed-length windows which -@@ -2157,7 +2157,7 @@ num_memory_accesses (const std::vector &chain) - of the constant. */ - static int - check_condition (CORE_ADDR watch_addr, struct expression *cond, -- CORE_ADDR *data_value, int *len) -+ CORE_ADDR *data_value, LONGEST *len) - { - int pc = 1, num_accesses_left, num_accesses_right; - struct value *left_val, *right_val; -@@ -2208,7 +2208,8 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond, - the condition expression, thus only triggering the watchpoint when it is - true. */ - bool --ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, int len, -+ppc_linux_nat_target::can_accel_watchpoint_condition (CORE_ADDR addr, -+ LONGEST len, - int rw, - struct expression *cond) - { -@@ -2226,7 +2227,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, -- int len, enum target_hw_bp_type type, -+ LONGEST len, enum target_hw_bp_type type, - struct expression *cond, int insert) - { - if (len == 1 -@@ -2492,7 +2493,7 @@ ppc_linux_nat_target::stopped_by_watchpoint () - bool - ppc_linux_nat_target::watchpoint_addr_within_range (CORE_ADDR addr, - CORE_ADDR start, -- int length) -+ LONGEST length) - { - int mask; - -diff --git a/gdb/procfs.c b/gdb/procfs.c ---- a/gdb/procfs.c -+++ b/gdb/procfs.c -@@ -1546,7 +1546,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr) - } - - static int --proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, int len, int wflags) -+proc_set_watchpoint (procinfo *pi, CORE_ADDR addr, LONGEST len, int wflags) - { - struct { - procfs_ctl_t cmd; -@@ -3238,7 +3238,7 @@ procfs_target::pid_to_exec_file (int pid) - /* Insert a watchpoint. */ - - static int --procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, int len, int rwflag, -+procfs_set_watchpoint (ptid_t ptid, CORE_ADDR addr, LONGEST len, int rwflag, - int after) - { - int pflags = 0; -diff --git a/gdb/remote.c b/gdb/remote.c ---- a/gdb/remote.c -+++ b/gdb/remote.c -@@ -450,7 +450,7 @@ public: - - bool stopped_data_address (CORE_ADDR *) override; - -- bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) override; -+ bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) override; - - int can_use_hw_breakpoint (enum bptype, int, int) override; - -@@ -10335,7 +10335,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, - p = strchr (rs->buf.data (), '\0'); - addr = remote_address_masked (addr); - p += hexnumstr (p, (ULONGEST) addr); -- xsnprintf (p, endbuf - p, ",%x", len); -+ xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len))); - - putpkt (rs->buf); - getpkt (&rs->buf, 0); -@@ -10355,7 +10355,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, - - bool - remote_target::watchpoint_addr_within_range (CORE_ADDR addr, -- CORE_ADDR start, int length) -+ CORE_ADDR start, LONGEST length) - { - CORE_ADDR diff = remote_address_masked (addr - start); - -@@ -10384,7 +10384,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len, - p = strchr (rs->buf.data (), '\0'); - addr = remote_address_masked (addr); - p += hexnumstr (p, (ULONGEST) addr); -- xsnprintf (p, endbuf - p, ",%x", len); -+ xsnprintf (p, endbuf - p, ",%s", phex_nz (len, sizeof (len))); - putpkt (rs->buf); - getpkt (&rs->buf, 0); - -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 -@@ -121,7 +121,7 @@ public: - override; - int remove_hw_breakpoint (struct gdbarch *, struct bp_target_info *) - override; -- int region_ok_for_hw_watchpoint (CORE_ADDR, int) override; -+ int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) override; - 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 -@@ -37,9 +37,9 @@ struct dummy_target : public target_ops - bool stopped_by_watchpoint () override; - bool 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; -+ bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override; - int region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) override; -- bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; -+ bool can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST 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; - bool supports_terminal_ours () override; -@@ -204,9 +204,9 @@ struct debug_target : public target_ops - bool stopped_by_watchpoint () override; - bool 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; -+ bool watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) override; - int region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) override; -- bool can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) override; -+ bool can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST 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; - bool supports_terminal_ours () override; -@@ -1041,19 +1041,19 @@ debug_target::stopped_data_address (CORE_ADDR *arg0) - } - - bool --target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) -+target_ops::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) - { - return this->beneath ()->watchpoint_addr_within_range (arg0, arg1, arg2); - } - - bool --dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) -+dummy_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) - { - return default_watchpoint_addr_within_range (this, arg0, arg1, arg2); - } - - bool --debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, int arg2) -+debug_target::watchpoint_addr_within_range (CORE_ADDR arg0, CORE_ADDR arg1, LONGEST arg2) - { - bool result; - fprintf_unfiltered (gdb_stdlog, "-> %s->watchpoint_addr_within_range (...)\n", this->beneath ()->shortname ()); -@@ -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); -- target_debug_print_int (arg2); -+ target_debug_print_LONGEST (arg2); - fputs_unfiltered (") = ", gdb_stdlog); - target_debug_print_bool (result); - fputs_unfiltered ("\n", gdb_stdlog); -@@ -1099,19 +1099,19 @@ debug_target::region_ok_for_hw_watchpoint (CORE_ADDR arg0, LONGEST arg1) - } - - bool --target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) -+target_ops::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3) - { - return this->beneath ()->can_accel_watchpoint_condition (arg0, arg1, arg2, arg3); - } - - bool --dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) -+dummy_target::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3) - { - return false; - } - - bool --debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, int arg1, int arg2, struct expression *arg3) -+debug_target::can_accel_watchpoint_condition (CORE_ADDR arg0, LONGEST arg1, int arg2, struct expression *arg3) - { - bool result; - fprintf_unfiltered (gdb_stdlog, "-> %s->can_accel_watchpoint_condition (...)\n", this->beneath ()->shortname ()); -@@ -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); -- target_debug_print_int (arg1); -+ target_debug_print_LONGEST (arg1); - fputs_unfiltered (", ", gdb_stdlog); - target_debug_print_int (arg2); - fputs_unfiltered (", ", gdb_stdlog); -diff --git a/gdb/target.c b/gdb/target.c ---- a/gdb/target.c -+++ b/gdb/target.c -@@ -55,7 +55,7 @@ static void generic_tls_error (void) ATTRIBUTE_NORETURN; - static void default_terminal_info (struct target_ops *, const char *, int); - - static int default_watchpoint_addr_within_range (struct target_ops *, -- CORE_ADDR, CORE_ADDR, int); -+ CORE_ADDR, CORE_ADDR, LONGEST); - - static int default_region_ok_for_hw_watchpoint (struct target_ops *, - CORE_ADDR, LONGEST); -@@ -3111,7 +3111,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, -- CORE_ADDR start, int length) -+ CORE_ADDR start, LONGEST length) - { - return addr >= start && addr < start + length; - } -diff --git a/gdb/target.h b/gdb/target.h ---- a/gdb/target.h -+++ b/gdb/target.h -@@ -561,7 +561,7 @@ struct target_ops - TARGET_DEFAULT_RETURN (false); - virtual bool stopped_data_address (CORE_ADDR *) - TARGET_DEFAULT_RETURN (false); -- virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, int) -+ virtual bool watchpoint_addr_within_range (CORE_ADDR, CORE_ADDR, LONGEST) - TARGET_DEFAULT_FUNC (default_watchpoint_addr_within_range); - - /* Documentation of this routine is provided with the corresponding -@@ -569,7 +569,7 @@ struct target_ops - virtual int region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST) - TARGET_DEFAULT_FUNC (default_region_ok_for_hw_watchpoint); - -- virtual bool can_accel_watchpoint_condition (CORE_ADDR, int, int, -+ virtual bool can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int, - struct expression *) - TARGET_DEFAULT_RETURN (false); - virtual int masked_watch_num_registers (CORE_ADDR, CORE_ADDR) - diff --git a/gdb-rhbz795424-bitpos-23of25.patch b/gdb-rhbz795424-bitpos-23of25.patch deleted file mode 100644 index 72b23f4765ec0a489becab992a2c04286e115b4e..0000000000000000000000000000000000000000 --- a/gdb-rhbz795424-bitpos-23of25.patch +++ /dev/null @@ -1,1240 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-09/msg00630.html - ---MP_/X_WjDOvz/B_fvlsrmCwRdxe -Content-Type: text/plain; charset=US-ASCII -Content-Transfer-Encoding: 7bit -Content-Disposition: inline - -Hi, - -This is the last part of the bitpos change. This patch does the same -thing that patch 1/4 does, except that it does so in the *-tdep files -wherever necessary. I separated these changes mainly because they are -related and can be reviewed independently. Tested on Fedora 16 x86_64. - -Regards, -Siddhesh - ---MP_/X_WjDOvz/B_fvlsrmCwRdxe -Content-Type: text/plain -Content-Transfer-Encoding: quoted-printable -Content-Disposition: attachment; filename=ChangeLog-tdep - -gdb/ChangeLog - - * alpha-tdep.c (alpha_push_dummy_call): Expand ACCUMULATE_SIZE, - REQUIRED_ARG_REGS, OFFSET, LEN, TLEN to ssize_t. - (struct alpha_arg): Expand members LEN, OFFSET to ssize_t. - * amd64-tdep.c (amd64_push_arguments): Expand NUM_ELEMENTS, - ELEMENT and LEN to LONGEST. - (amd64_return_value): Expand LEN to LONGEST. - * amd64-windows-tdep.c (amd64_windows_return_value): Expand LEN - to LONGEST. - * arm-tdep.c (arm_vfp_cprc_sub_candidate): Return LONGEST. - Expand COUNT, SUB_COUNT to LONGEST. - (arm_vfp_call_candidate): Expand C to LONGEST. - (arm_push_dummy_call): Expand LEN to LONGEST. - * avr-tdep.c (struct stack_item): Expand member LEN to ssize_t. - (push_stack_item): Expand parameter LEN to ssize_t. - (avr_push_dummy_call): Expand LAST_REGNUM, J, LEN to ssize_t. - * bfin-tdep.c (bfin_push_dummy_call): Expand TOTAL_LEN, - CONTAINER_LEN to ssize_t. - * cris-tdep.c (struct stack_item): Expand member LEN to ssize_t. - (push_stack_item): Expand parameter LEN to ssize_t. - (cris_push_dummy_call): Expand LEN, REG_DEMAND, I to ssize_t. - * h8300-tdep.c (h8300_push_dummy_call): Expand STACK_ALLOC, - STACK_OFFSET to LONGEST. Expand LEN, PADDED_LEN, OFFSET to - ssize_t. - * hppa-tdep.c (hppa64_push_dummy_call): Expand LEN to LONGEST. - (hppa64_return_value): Likewise. - * i386-darwin-tdep.c (i386_darwin_push_dummy_call): Expand - ARGS_SPACE to LONGEST. - * i386-tdep.c (i386_push_dummy_call): Expand ARG_SPACE, - ARG_SPACE_USED, LEN to LONGEST. - (i386_reg_struct_return_p): Expand LEN to LONGEST. - (i386_convert_register_p): Likewise. - (i386_register_to_value): Likewise. - (i386_value_to_register): Likewise. - * ia64-tdep.c (ia64_push_dummy_call): Expand ARGOFFSET, LEN, - NSLOTS, MEMSLOTS to LONGEST. - * iq2000-tdep.c (iq2000_push_dummy_call): Expand TYPELEN, - STACKSPACE to LONGEST. - * m32r-tdep.c (m32r_push_dummy_call): Expand LEN to LONGEST. - * m68k-tdep.c (m68k_reg_struct_return_p): Expand LEN to LONGEST. - (m68k_push_dummy_call): Expand LEN, CONTAINER_LEN, OFFSET to - LONGEST. - * m88k-tdep.c (m88k_store_arguments): Expand NUM_STACK_WORDS, - LEN, STACK_WORD to LONGEST. - * mep-tdep.c (push_large_arguments): Expand ARG_LEN to ULONGEST. - * microblaze-tdep.c (microblaze_store_return_value): Expand LEN to - LONGEST. - * mips-tdep.c (mips_xfer_register): Expand parameter BUF_OFFSET to - LONGEST. Use plongest to format print BUF_OFFSET. - (mips_eabi_push_dummy_call): Expand LEN to LONGEST. Use plongest - to format print LEN. - (mips_n32n64_fp_arg_chunk_p): Expand parameter OFFSET to LONGEST. - Expand POS to LONGEST. - (mips_n32n64_push_dummy_call): Expand LEN to LONGEST. - (mips_n32n64_return_value): Expand OFFSET to LONGEST. Use - plongest to format print OFFSET. - (mips_o32_push_dummy_call): Expand LEN to LONGEST. Use plongest - to format print LEN. - (mips_o64_push_dummy_call): Expand LEN, STACK_OFFSET to LONGEST. - Use plongest to format print LEN. - * mn10300-tdep.c (mn10300_push_dummy_call): Expand LEN to - LONGEST. - * mt-tdep.c (mt_push_dummy_call): Expand STACK_DEST, TYPELEN to - LONGEST. - * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call): Expand - ARGSPACE, ARGOFFSET, STRUCTOFFSET, LEN, to LONGEST. - (ppc64_sysv_abi_push_dummy_call): Expand BYTE, LEN to ssize_t. - * rl78-tdep.c (rl78_push_dummy_call): Expand LEN, CONTAINER_LEN - to LONGEST. - * rs6000-aix-tdep.c (rs6000_push_dummy_call): Expand ARGBYTES, - LEN to LONGEST. - (ran_out_of_registers_for_arguments): Expand SPACE, JJ to - LONGEST. - * s390-linux-tdep.c (s390_value_from_register): Expand LEN to LONGEST. - (is_power_of_two): Expand parameter N to ULONGEST. - (s390_push_dummy_call): Expand LENGTH to ULONGEST. - * score-tdep.c (score_push_dummy_call): Expand ARGLEN to - LONGEST. - * sh-tdep.c (sh_use_struct_convention) Expand len to LONGEST. - (sh_justify_value_in_reg): Expand parameter LEN to LONGEST. - (sh_push_dummy_call_fpu): Expand LEN to LONGEST. Expand REG_SIZE - to ssize_t. - (sh_push_dummy_call_nofpu): Likewise. - * sh64-tdep.c (sh64_push_dummy_call): Expand STACK_OFFSET, - STACK_ALLOC, LEN to LONGEST. - * sparc-tdep.c (sparc32_store_arguments): Expand LEN to LONGEST. - * sparc64-tdep.c (sparc64_store_floating_fields): Expand - parameter BITPOS to LONGEST. Expand SUBPOS to LONGEST. - (sparc64_extract_floating_fields): Likewise. - (sparc64_store_arguments): Expand LEN to LONGEST. - * spu-tdep.c (spu_push_dummy_call): Expand N_REGS, LEN to LONGEST. - (spu_value_from_register): Expand LEN to LONGEST. - * tic6x-tdep.c (tic6x_push_dummy_call): Expand REFERENCES_OFFST, - LEN to LONGEST. Expand LEN to ssize_t. Use plongest to format - print LEN. - * tilegx-tdep.c (tilegx_push_dummy_call): Expand TYPELEN, - SLACKLEN, ALIGNLEN to LONGEST. - * v850-tdep.c (v850_push_dummy_call): Expand LEN to LONGEST. - * vax-tdep.c (vax_store_arguments): Expand COUNT, LEN to LONGEST. - (vax_return_value): Expand LEN to LONGEST. - * xstormy16-tdep.c (xstormy16_push_dummy_call): Expand J, TYPELEN - to LONGEST. - * xtensa-tdep.c (xtensa_store_return_value): Print LEN instead of - TYPE_LENGTH.. - (struct argument_info): Expoand member LENGTH to ssize_t. - (struct argument_info.u): Expand member OFFSET to ssize_t. - (xtensa_push_dummy_call): Expand SIZE, ONSTACK_SIZE to LONGEST. - Expand N to ssize_t. Use pulongest to format print TYPE_LENGTH. - ---MP_/X_WjDOvz/B_fvlsrmCwRdxe -Content-Type: text/x-patch -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; filename=bitpos-tdep.patch - -diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c ---- a/gdb/alpha-tdep.c -+++ b/gdb/alpha-tdep.c -@@ -300,17 +300,17 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - { - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int i; -- int accumulate_size = (return_method == return_method_struct) ? 8 : 0; -+ ssize_t accumulate_size = (return_method == return_method_struct) ? 8 : 0; - struct alpha_arg - { - const gdb_byte *contents; -- int len; -- int offset; -+ ssize_t len; -+ ssize_t offset; - }; - struct alpha_arg *alpha_args = XALLOCAVEC (struct alpha_arg, nargs); - struct alpha_arg *m_arg; - gdb_byte arg_reg_buffer[ALPHA_REGISTER_SIZE * ALPHA_NUM_ARG_REGS]; -- int required_arg_regs; -+ ssize_t required_arg_regs; - CORE_ADDR func_addr = find_function_addr (function, NULL); - - /* The ABI places the address of the called function in T12. */ -@@ -430,8 +430,8 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - for (i = nargs; m_arg--, --i >= 0;) - { - const gdb_byte *contents = m_arg->contents; -- int offset = m_arg->offset; -- int len = m_arg->len; -+ ssize_t offset = m_arg->offset; -+ ssize_t len = m_arg->len; - - /* Copy the bytes destined for registers into arg_reg_buffer. */ - if (offset < sizeof(arg_reg_buffer)) -@@ -443,7 +443,7 @@ alpha_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - } - else - { -- int tlen = sizeof(arg_reg_buffer) - offset; -+ ssize_t tlen = sizeof(arg_reg_buffer) - offset; - memcpy (arg_reg_buffer + offset, contents, tlen); - offset += tlen; - contents += tlen; -diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c ---- a/gdb/amd64-tdep.c -+++ b/gdb/amd64-tdep.c -@@ -883,8 +883,8 @@ amd64_push_arguments (struct regcache *regcache, int nargs, struct value **args, - }; - struct value **stack_args = XALLOCAVEC (struct value *, nargs); - int num_stack_args = 0; -- int num_elements = 0; -- int element = 0; -+ LONGEST num_elements = 0; -+ LONGEST element = 0; - int integer_reg = 0; - int sse_reg = 0; - int i; -@@ -896,7 +896,7 @@ if (return_method == return_method_struct) - for (i = 0; i < nargs; i++) - { - struct type *type = value_type (args[i]); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - enum amd64_reg_class theclass[2]; - int needed_integer_regs = 0; - int needed_sse_regs = 0; -@@ -960,7 +960,7 @@ if (return_method == return_method_struct) - - gdb_assert (regnum != -1); - memset (buf, 0, sizeof buf); -- memcpy (buf, valbuf + j * 8, std::min (len, 8)); -+ memcpy (buf, valbuf + j * 8, std::min (len, (LONGEST) 8)); - regcache->raw_write_part (regnum, offset, 8, buf); - } - } -diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c ---- a/gdb/amd64-windows-tdep.c -+++ b/gdb/amd64-windows-tdep.c -@@ -291,7 +291,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function, - struct type *type, struct regcache *regcache, - gdb_byte *readbuf, const gdb_byte *writebuf) - { -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - int regnum = -1; - - /* See if our value is returned through a register. If it is, then -diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c ---- a/gdb/arm-tdep.c -+++ b/gdb/arm-tdep.c -@@ -3472,7 +3472,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc_base_type b) - array). Vector types are not currently supported, matching the - generic AAPCS support. */ - --static int -+static LONGEST - arm_vfp_cprc_sub_candidate (struct type *t, - enum arm_vfp_cprc_base_type *base_type) - { -@@ -3555,7 +3555,7 @@ arm_vfp_cprc_sub_candidate (struct type *t, - } - else - { -- int count; -+ LONGEST count; - unsigned unitlen; - - count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t), -@@ -3578,12 +3578,12 @@ arm_vfp_cprc_sub_candidate (struct type *t, - - case TYPE_CODE_STRUCT: - { -- int count = 0; -+ LONGEST count = 0; - unsigned unitlen; - int i; - for (i = 0; i < TYPE_NFIELDS (t); i++) - { -- int sub_count = 0; -+ LONGEST sub_count = 0; - - if (!field_is_static (&TYPE_FIELD (t, i))) - sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), -@@ -3607,13 +3607,15 @@ arm_vfp_cprc_sub_candidate (struct type *t, - - case TYPE_CODE_UNION: - { -- int count = 0; -+ LONGEST count = 0; - unsigned unitlen; - int i; - for (i = 0; i < TYPE_NFIELDS (t); i++) - { -- int sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), -- base_type); -+ LONGEST sub_count; -+ -+ sub_count = arm_vfp_cprc_sub_candidate (TYPE_FIELD_TYPE (t, i), -+ base_type); - if (sub_count == -1) - return -1; - count = (count > sub_count ? count : sub_count); -@@ -3649,7 +3651,7 @@ arm_vfp_call_candidate (struct type *t, enum arm_vfp_cprc_base_type *base_type, - int *count) - { - enum arm_vfp_cprc_base_type b = VFP_CPRC_UNKNOWN; -- int c = arm_vfp_cprc_sub_candidate (t, &b); -+ LONGEST c = arm_vfp_cprc_sub_candidate (t, &b); - if (c <= 0 || c > 4) - return 0; - *base_type = b; -@@ -3731,7 +3733,7 @@ arm_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - for (argnum = 0; argnum < nargs; argnum++) - { -- int len; -+ LONGEST len; - struct type *arg_type; - struct type *target_type; - enum type_code typecode; -diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c ---- a/gdb/avr-tdep.c -+++ b/gdb/avr-tdep.c -@@ -1192,13 +1192,13 @@ avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame) - - struct stack_item - { -- int len; -+ ssize_t len; - struct stack_item *prev; - gdb_byte *data; - }; - - static struct stack_item * --push_stack_item (struct stack_item *prev, const bfd_byte *contents, int len) -+push_stack_item (struct stack_item *prev, const bfd_byte *contents, ssize_t len) - { - struct stack_item *si; - si = XNEW (struct stack_item); -@@ -1287,12 +1287,12 @@ avr_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - for (i = 0; i < nargs; i++) - { -- int last_regnum; -- int j; -+ ssize_t last_regnum; -+ ssize_t j; - struct value *arg = args[i]; - struct type *type = check_typedef (value_type (arg)); - const bfd_byte *contents = value_contents (arg); -- int len = TYPE_LENGTH (type); -+ ssize_t len = TYPE_LENGTH (type); - - /* Calculate the potential last register needed. - E.g. For length 2, registers regnum and regnum-1 (say 25 and 24) -diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c ---- a/gdb/bfin-tdep.c -+++ b/gdb/bfin-tdep.c -@@ -504,7 +504,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch, - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int i; - long reg_r0, reg_r1, reg_r2; -- int total_len = 0; -+ ssize_t total_len = 0; - - for (i = nargs - 1; i >= 0; i--) - { -@@ -526,7 +526,7 @@ bfin_push_dummy_call (struct gdbarch *gdbarch, - { - struct type *value_type = value_enclosing_type (args[i]); - struct type *arg_type = check_typedef (value_type); -- 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); -diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c ---- a/gdb/cris-tdep.c -+++ b/gdb/cris-tdep.c -@@ -663,13 +663,13 @@ static CORE_ADDR cris_unwind_sp (struct gdbarch *gdbarch, - - struct stack_item - { -- int len; -+ ssize_t len; - struct stack_item *prev; - gdb_byte *data; - }; - - static struct stack_item * --push_stack_item (struct stack_item *prev, const gdb_byte *contents, int len) -+push_stack_item (struct stack_item *prev, const gdb_byte *contents, ssize_t len) - { - struct stack_item *si = XNEW (struct stack_item); - si->data = (gdb_byte *) xmalloc (len); -@@ -832,13 +832,13 @@ cris_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - for (argnum = 0; argnum < nargs; argnum++) - { -- int len; -+ ssize_t len; - const gdb_byte *val; -- int reg_demand; -- int i; -+ ssize_t reg_demand; -+ ssize_t i; - -- len = TYPE_LENGTH (value_type (args[argnum])); - val = value_contents (args[argnum]); -+ len = TYPE_LENGTH (value_type (args[argnum])); - - /* How may registers worth of storage do we need for this argument? */ - reg_demand = (len / 4) + (len % 4 != 0 ? 1 : 0); -diff --git a/gdb/h8300-tdep.c b/gdb/h8300-tdep.c ---- a/gdb/h8300-tdep.c -+++ b/gdb/h8300-tdep.c -@@ -638,7 +638,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - CORE_ADDR struct_addr) - { - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -- int stack_alloc = 0, stack_offset = 0; -+ LONGEST stack_alloc = 0, stack_offset = 0; - int wordsize = BINWORD (gdbarch); - int reg = E_ARG0_REGNUM; - int argument; -@@ -664,11 +664,11 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - for (argument = 0; argument < nargs; argument++) - { - struct type *type = value_type (args[argument]); -- int len = TYPE_LENGTH (type); -+ ssize_t len = TYPE_LENGTH (type); - char *contents = (char *) value_contents (args[argument]); - - /* Pad the argument appropriately. */ -- int padded_len = align_up (len, wordsize); -+ ssize_t padded_len = align_up (len, wordsize); - /* Use std::vector here to get zero initialization. */ - std::vector padded (padded_len); - -@@ -697,7 +697,7 @@ h8300_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - /* Heavens to Betsy --- it's really going in registers! - Note that on the h8/300s, there are gaps between the - registers in the register file. */ -- int offset; -+ ssize_t offset; - - for (offset = 0; offset < padded_len; offset += wordsize) - { -diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c ---- a/gdb/hppa-tdep.c -+++ b/gdb/hppa-tdep.c -@@ -985,7 +985,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - { - struct value *arg = args[i]; - struct type *type = value_type (arg); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - const bfd_byte *valbuf; - bfd_byte fptrbuf[8]; - int regnum; -@@ -1178,7 +1178,7 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function, - struct type *type, struct regcache *regcache, - gdb_byte *readbuf, const gdb_byte *writebuf) - { -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - int regnum, offset; - - if (len > 16) -diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c ---- a/gdb/i386-darwin-tdep.c -+++ b/gdb/i386-darwin-tdep.c -@@ -167,7 +167,7 @@ i386_darwin_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - for (write_pass = 0; write_pass < 2; write_pass++) - { -- int args_space = 0; -+ LONGEST args_space = 0; - int num_m128 = 0; - - if (return_method == return_method_struct) -diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c ---- a/gdb/i386-tdep.c -+++ b/gdb/i386-tdep.c -@@ -2679,7 +2679,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - gdb_byte buf[4]; - int i; - int write_pass; -- int args_space = 0; -+ LONGEST args_space = 0; - - /* BND registers can be in arbitrary values at the moment of the - inferior call. This can cause boundary violations that are not -@@ -2694,7 +2694,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - for (write_pass = 0; write_pass < 2; write_pass++) - { -- int args_space_used = 0; -+ LONGEST args_space_used = 0; - - if (return_method == return_method_struct) - { -@@ -2711,7 +2711,7 @@ i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - for (i = 0; i < nargs; i++) - { -- int len = TYPE_LENGTH (value_enclosing_type (args[i])); -+ LONGEST len = TYPE_LENGTH (value_enclosing_type (args[i])); - - if (write_pass) - { -@@ -2918,7 +2918,7 @@ i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum type_code code = TYPE_CODE (type); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - - gdb_assert (code == TYPE_CODE_STRUCT - || code == TYPE_CODE_UNION -@@ -3704,7 +3704,7 @@ static int - i386_convert_register_p (struct gdbarch *gdbarch, - int regnum, struct type *type) - { -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - - /* Values may be spread across multiple registers. Most debugging - formats aren't expressive enough to specify the locations, so -@@ -3737,7 +3737,7 @@ i386_register_to_value (struct frame_info *frame, int regnum, - int *optimizedp, int *unavailablep) - { - struct gdbarch *gdbarch = get_frame_arch (frame); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - - if (i386_fp_regnum_p (gdbarch, regnum)) - return i387_register_to_value (frame, regnum, type, to, -@@ -3773,7 +3773,7 @@ static void - i386_value_to_register (struct frame_info *frame, int regnum, - struct type *type, const gdb_byte *from) - { -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - - if (i386_fp_regnum_p (get_frame_arch (frame), regnum)) - { -diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c ---- a/gdb/iq2000-tdep.c -+++ b/gdb/iq2000-tdep.c -@@ -652,8 +652,9 @@ iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - const bfd_byte *val; - bfd_byte buf[4]; - struct type *type; -- int i, argreg, typelen, slacklen; -- int stackspace = 0; -+ int i, argreg, slacklen; -+ LONGEST typelen; -+ LONGEST stackspace = 0; - /* Used to copy struct arguments into the stack. */ - CORE_ADDR struct_ptr; - -diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c ---- a/gdb/m32r-tdep.c -+++ b/gdb/m32r-tdep.c -@@ -671,7 +671,7 @@ m32r_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - CORE_ADDR regval; - gdb_byte *val; - gdb_byte valbuf[M32R_ARG_REGISTER_SIZE]; -- int len; -+ LONGEST len; - - /* First force sp to a 4-byte alignment. */ - sp = sp & ~3; -diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c ---- a/gdb/m68k-tdep.c -+++ b/gdb/m68k-tdep.c -@@ -372,7 +372,7 @@ m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum type_code code = TYPE_CODE (type); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - - gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION - || code == TYPE_CODE_COMPLEX); -@@ -505,9 +505,9 @@ m68k_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - for (i = nargs - 1; i >= 0; i--) - { - struct type *value_type = value_enclosing_type (args[i]); -- int len = TYPE_LENGTH (value_type); -- int container_len = (len + 3) & ~3; -- int offset; -+ LONGEST len = TYPE_LENGTH (value_type); -+ LONGEST container_len = (len + 3) & ~3; -+ LONGEST offset; - - /* Non-scalars bigger than 4 bytes are left aligned, others are - right aligned. */ -diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c ---- a/gdb/mep-tdep.c -+++ b/gdb/mep-tdep.c -@@ -2238,7 +2238,7 @@ push_large_arguments (CORE_ADDR sp, int argc, struct value **argv, - - for (i = 0; i < argc; i++) - { -- unsigned arg_len = TYPE_LENGTH (value_type (argv[i])); -+ ULONGEST arg_len = TYPE_LENGTH (value_type (argv[i])); - - if (arg_len > MEP_GPR_SIZE) - { -diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c ---- a/gdb/mips-tdep.c -+++ b/gdb/mips-tdep.c -@@ -489,7 +489,7 @@ static void - mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache, - int reg_num, int length, - enum bfd_endian endian, gdb_byte *in, -- const gdb_byte *out, int buf_offset) -+ const gdb_byte *out, LONGEST buf_offset) - { - int reg_offset = 0; - -@@ -512,8 +512,8 @@ mips_xfer_register (struct gdbarch *gdbarch, struct regcache *regcache, - } - if (mips_debug) - fprintf_unfiltered (gdb_stderr, -- "xfer $%d, reg offset %d, buf offset %d, length %d, ", -- reg_num, reg_offset, buf_offset, length); -+ "xfer $%d, reg offset %d, buf offset %s, length %d, ", -+ reg_num, reg_offset, plongest (buf_offset), length); - if (mips_debug && out != NULL) - { - int i; -@@ -4563,13 +4563,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)); -- int len = TYPE_LENGTH (arg_type); -+ LONGEST len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); - - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, -- "mips_eabi_push_dummy_call: %d len=%d type=%d", -- argnum + 1, len, (int) typecode); -+ "mips_eabi_push_dummy_call: %d len=%s type=%d", -+ argnum + 1, plongest (len), (int) typecode); - - /* The EABI passes structures that do not fit in a register by - reference. */ -@@ -4839,7 +4839,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, -- int offset) -+ LONGEST offset) - { - int i; - -@@ -4854,7 +4854,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, - - for (i = 0; i < TYPE_NFIELDS (arg_type); i++) - { -- int pos; -+ LONGEST pos; - struct type *field_type; - - /* We're only looking at normal fields. */ -@@ -4897,7 +4897,8 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - int argreg; - int float_argreg; - int argnum; -- int arg_space = 0; -+ ULONGEST arg_space = 0; -+ LONGEST len = 0; - int stack_offset = 0; - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR func_addr = find_function_addr (function, NULL); -@@ -4926,9 +4927,9 @@ mips_n32n64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, -- "mips_n32n64_push_dummy_call: sp=%s allocated %ld\n", -+ "mips_n32n64_push_dummy_call: sp=%s allocated %s\n", - paddress (gdbarch, sp), -- (long) align_up (arg_space, 16)); -+ pulongest (align_up (arg_space, 16))); - - /* Initialize the integer and float register pointers. */ - argreg = MIPS_A0_REGNUM; -@@ -5249,11 +5250,11 @@ mips_n32n64_return_value (struct gdbarch *gdbarch, struct value *function, - : MIPS_V0_REGNUM); - field < TYPE_NFIELDS (type); field++, regnum += 2) - { -- int offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field]) -- / TARGET_CHAR_BIT); -+ LONGEST offset = (FIELD_BITPOS (TYPE_FIELDS (type)[field]) -+ / TARGET_CHAR_BIT); - if (mips_debug) -- fprintf_unfiltered (gdb_stderr, "Return float struct+%d\n", -- offset); -+ fprintf_unfiltered (gdb_stderr, "Return float struct+%s\n", -+ plongest (offset)); - if (TYPE_LENGTH (TYPE_FIELD_TYPE (type, field)) == 16) - { - /* A 16-byte long double field goes in two consecutive -@@ -5295,8 +5296,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) -- fprintf_unfiltered (gdb_stderr, "Return struct+%d:%d in $%d\n", -- offset, xfer, regnum); -+ fprintf_unfiltered (gdb_stderr, "Return struct+%s:%d in $%d\n", -+ plongest (offset), xfer, regnum); - mips_xfer_register (gdbarch, regcache, - gdbarch_num_regs (gdbarch) + regnum, - xfer, BFD_ENDIAN_UNKNOWN, readbuf, writebuf, -@@ -5355,7 +5356,8 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - int argreg; - int float_argreg; - int argnum; -- int arg_space = 0; -+ ULONGEST arg_space = 0; -+ LONGEST len = 0; - int stack_offset = 0; - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR func_addr = find_function_addr (function, NULL); -@@ -5392,9 +5394,9 @@ mips_o32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, -- "mips_o32_push_dummy_call: sp=%s allocated %ld\n", -+ "mips_o32_push_dummy_call: sp=%s allocated %s\n", - paddress (gdbarch, sp), -- (long) align_up (arg_space, 16)); -+ pulongest (align_up (arg_space, 16))); - - /* Initialize the integer and float register pointers. */ - argreg = MIPS_A0_REGNUM; -@@ -5420,13 +5422,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)); -- int len = TYPE_LENGTH (arg_type); -+ LONGEST len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); - - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, -- "mips_o32_push_dummy_call: %d len=%d type=%d", -- argnum + 1, len, (int) typecode); -+ "mips_o32_push_dummy_call: %d len=%s type=%d", -+ argnum + 1, plongest (len), (int) typecode); - - val = value_contents (arg); - -@@ -5880,8 +5882,8 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - int argreg; - int float_argreg; - int argnum; -- int arg_space = 0; -- int stack_offset = 0; -+ ULONGEST arg_space = 0; -+ LONGEST stack_offset = 0; - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR func_addr = find_function_addr (function, NULL); - -@@ -5914,9 +5916,9 @@ mips_o64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, -- "mips_o64_push_dummy_call: sp=%s allocated %ld\n", -+ "mips_o64_push_dummy_call: sp=%s allocated %s\n", - paddress (gdbarch, sp), -- (long) align_up (arg_space, 16)); -+ pulongest (align_up (arg_space, 16))); - - /* Initialize the integer and float register pointers. */ - argreg = MIPS_A0_REGNUM; -@@ -5942,13 +5944,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)); -- int len = TYPE_LENGTH (arg_type); -+ LONGEST len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); - - if (mips_debug) - fprintf_unfiltered (gdb_stdlog, -- "mips_o64_push_dummy_call: %d len=%d type=%d", -- argnum + 1, len, (int) typecode); -+ "mips_o64_push_dummy_call: %d len=%s type=%d", -+ argnum + 1, plongest (len), (int) typecode); - - val = value_contents (arg); - -diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c ---- a/gdb/mn10300-tdep.c -+++ b/gdb/mn10300-tdep.c -@@ -1197,7 +1197,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch, - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - const int push_size = register_size (gdbarch, E_PC_REGNUM); - int regs_used; -- int len, arg_len; -+ LONGEST len, arg_len; - int stack_offset = 0; - int argnum; - const gdb_byte *val; -diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c ---- a/gdb/ppc-sysv-tdep.c -+++ b/gdb/ppc-sysv-tdep.c -@@ -69,7 +69,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int opencl_abi = ppc_sysv_use_opencl_abi (value_type (function)); - ULONGEST saved_sp; -- int argspace = 0; /* 0 is an initial wrong guess. */ -+ LONGEST argspace = 0; /* 0 is an initial wrong guess. */ - int write_pass; - - gdb_assert (tdep->wordsize == 4); -@@ -100,9 +100,9 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - /* Next available vector register for vector arguments. */ - int vreg = 2; - /* Arguments start above the "LR save word" and "Back chain". */ -- int argoffset = 2 * tdep->wordsize; -+ LONGEST argoffset = 2 * tdep->wordsize; - /* Structures start after the arguments. */ -- int structoffset = argoffset + argspace; -+ LONGEST structoffset = argoffset + argspace; - - /* If the function is returning a `struct', then the first word - (which will be passed in r3) is used for struct return -@@ -121,7 +121,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - { - struct value *arg = args[argno]; - struct type *type = check_typedef (value_type (arg)); -- int len = TYPE_LENGTH (type); -+ ssize_t len = TYPE_LENGTH (type); - const bfd_byte *val = value_contents (arg); - - if (TYPE_CODE (type) == TYPE_CODE_FLT && len <= 8 -@@ -1247,11 +1247,11 @@ struct ppc64_sysv_argpos - - static void - ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, -- const bfd_byte *val, int len, int align, -+ const bfd_byte *val, ssize_t len, int align, - struct ppc64_sysv_argpos *argpos) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -- int offset = 0; -+ LONGEST offset = 0; - - /* Enforce alignment of stack location, if requested. */ - if (align > tdep->wordsize) -@@ -1288,7 +1288,7 @@ ppc64_sysv_abi_push_val (struct gdbarch *gdbarch, - { - if (argpos->regcache && argpos->greg <= 10) - argpos->regcache->cooked_write_part -- (tdep->ppc_gp0_regnum + argpos->greg, offset, len, val); -+ (tdep->ppc_gp0_regnum + argpos->greg, offset, (LONGEST) len, val); - argpos->greg++; - } - } -@@ -1347,7 +1347,7 @@ ppc64_sysv_abi_push_freg (struct gdbarch *gdbarch, - if (argpos->regcache && argpos->freg <= 13) - { - int regnum = tdep->ppc_fp0_regnum + argpos->freg; -- int offset = 0; -+ LONGEST offset = 0; - - if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) - offset = 8 - TYPE_LENGTH (type); -@@ -1797,7 +1797,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, - && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT) - { - int regnum = tdep->ppc_fp0_regnum + 1 + index; -- int offset = 0; -+ LONGEST offset = 0; - - if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) - offset = 8 - TYPE_LENGTH (valtype); -@@ -1873,7 +1873,7 @@ ppc64_sysv_abi_return_value_base (struct gdbarch *gdbarch, struct type *valtype, - && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)) - { - int regnum = tdep->ppc_gp0_regnum + 3 + index; -- int offset = 0; -+ LONGEST offset = 0; - - if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) - offset = 8 - TYPE_LENGTH (valtype); -@@ -1981,7 +1981,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function, - && TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1) - { - int regnum = tdep->ppc_gp0_regnum + 3; -- int offset = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype)); -+ LONGEST offset -+ = (register_size (gdbarch, regnum) - TYPE_LENGTH (valtype)); - - if (writebuf != NULL) - regcache->cooked_write_part (regnum, offset, TYPE_LENGTH (valtype), -diff --git a/gdb/rl78-tdep.c b/gdb/rl78-tdep.c ---- a/gdb/rl78-tdep.c -+++ b/gdb/rl78-tdep.c -@@ -1347,8 +1347,8 @@ rl78_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - for (i = nargs - 1; i >= 0; i--) - { - struct type *value_type = value_enclosing_type (args[i]); -- int len = TYPE_LENGTH (value_type); -- int container_len = (len + 1) & ~1; -+ LONGEST len = TYPE_LENGTH (value_type); -+ LONGEST container_len = (len + 1) & ~1; - - sp -= container_len; - write_memory (rl78_make_data_address (sp), -diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c ---- a/gdb/rs6000-aix-tdep.c -+++ b/gdb/rs6000-aix-tdep.c -@@ -291,9 +291,9 @@ rs6000_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int ii; -- int len = 0; -+ LONGEST len = 0; - int argno; /* current argument number */ -- int argbytes; /* current argument byte */ -+ LONGEST argbytes; /* current argument byte */ - gdb_byte tmp_buffer[50]; - int f_argno = 0; /* current floating point argno */ - int wordsize = gdbarch_tdep (gdbarch)->wordsize; -@@ -421,7 +421,7 @@ ran_out_of_registers_for_arguments: - - if ((argno < nargs) || argbytes) - { -- int space = 0, jj; -+ LONGEST space = 0, jj; - - if (argbytes) - { -diff --git a/gdb/score-tdep.c b/gdb/score-tdep.c ---- a/gdb/score-tdep.c -+++ b/gdb/score-tdep.c -@@ -517,7 +517,7 @@ score_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int argnum; - int argreg; -- int arglen = 0; -+ LONGEST arglen = 0; - CORE_ADDR stack_offset = 0; - CORE_ADDR addr = 0; - -diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c ---- a/gdb/sh-tdep.c -+++ b/gdb/sh-tdep.c -@@ -812,7 +812,7 @@ sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc) - static int - sh_use_struct_convention (int renesas_abi, struct type *type) - { -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - int nelem = TYPE_NFIELDS (type); - - /* The Renesas ABI returns aggregate types always on stack. */ -@@ -914,7 +914,7 @@ sh_frame_align (struct gdbarch *ignore, CORE_ADDR sp) - - /* Helper function to justify value in register according to endianess. */ - static const gdb_byte * --sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, int len) -+sh_justify_value_in_reg (struct gdbarch *gdbarch, struct value *val, LONGEST len) - { - static gdb_byte valbuf[4]; - -@@ -1074,7 +1074,8 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch, - struct type *type; - CORE_ADDR regval; - const gdb_byte *val; -- int len, reg_size = 0; -+ LONGEST len; -+ int reg_size = 0; - int pass_on_stack = 0; - int treat_as_flt; - int last_reg_arg = INT_MAX; -@@ -1216,7 +1217,8 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch, - struct type *type; - CORE_ADDR regval; - const gdb_byte *val; -- int len, reg_size = 0; -+ LONGEST len; -+ int reg_size = 0; - int pass_on_stack = 0; - int last_reg_arg = INT_MAX; - -diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c ---- a/gdb/sparc64-tdep.c -+++ b/gdb/sparc64-tdep.c -@@ -1206,7 +1206,7 @@ sparc64_16_byte_align_p (struct type *type) - - static void - sparc64_store_floating_fields (struct regcache *regcache, struct type *type, -- const gdb_byte *valbuf, int element, int bitpos) -+ const gdb_byte *valbuf, int element, LONGEST bitpos) - { - struct gdbarch *gdbarch = regcache->arch (); - int len = TYPE_LENGTH (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)); -- int subpos = bitpos + TYPE_FIELD_BITPOS (type, i); -+ LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i); - - sparc64_store_floating_fields (regcache, subtype, valbuf, - element, subpos); -@@ -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, -- gdb_byte *valbuf, int bitpos) -+ gdb_byte *valbuf, LONGEST bitpos) - { - struct gdbarch *gdbarch = regcache->arch (); - -@@ -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)); -- int subpos = bitpos + TYPE_FIELD_BITPOS (type, i); -+ LONGEST subpos = bitpos + TYPE_FIELD_BITPOS (type, i); - - sparc64_extract_floating_fields (regcache, subtype, valbuf, subpos); - } -@@ -1388,7 +1388,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, - for (i = 0; i < nargs; i++) - { - struct type *type = value_type (args[i]); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - - if (sparc64_structure_or_union_p (type) - || (sparc64_complex_floating_p (type) && len == 32)) -@@ -1488,7 +1488,7 @@ sparc64_store_arguments (struct regcache *regcache, int nargs, - { - const gdb_byte *valbuf = value_contents (args[i]); - struct type *type = value_type (args[i]); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - int regnum = -1; - gdb_byte buf[16]; - -diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c ---- a/gdb/spu-tdep.c -+++ b/gdb/spu-tdep.c -@@ -1432,7 +1432,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - struct value *arg = args[i]; - struct type *type = check_typedef (value_type (arg)); - const gdb_byte *contents = value_contents (arg); -- int n_regs = align_up (TYPE_LENGTH (type), 16) / 16; -+ LONGEST n_regs = align_up (TYPE_LENGTH (type), 16) / 16; - - /* If the argument doesn't wholly fit into registers, it and - all subsequent arguments go to the stack. */ -@@ -1464,7 +1464,7 @@ spu_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - { - struct value *arg = args[i]; - struct type *type = check_typedef (value_type (arg)); -- int len = TYPE_LENGTH (type); -+ LONGEST len = TYPE_LENGTH (type); - int preferred_slot; - - if (spu_scalar_value_p (type)) -diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c ---- a/gdb/tic6x-tdep.c -+++ b/gdb/tic6x-tdep.c -@@ -881,7 +881,7 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - int argreg = 0; - int argnum; - int stack_offset = 4; -- int references_offset = 4; -+ LONGEST references_offset = 4; - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - struct type *func_type = value_type (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++) - { -- int len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4); -+ LONGEST len = align_up (TYPE_LENGTH (value_type (args[argnum])), 4); - if (argnum >= 10 - argreg) - references_offset += len; - stack_offset += len; -@@ -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)); -- int len = TYPE_LENGTH (arg_type); -+ ssize_t len = TYPE_LENGTH (arg_type); - enum type_code typecode = TYPE_CODE (arg_type); - - val = value_contents (arg); -@@ -1088,7 +1088,8 @@ tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - } - else - internal_error (__FILE__, __LINE__, -- _("unexpected length %d of arg %d"), len, argnum); -+ _("unexpected length %s of arg %d"), -+ plongest (len), argnum); - - addr = sp + stack_offset; - write_memory (addr, val, len); -diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c ---- a/gdb/tilegx-tdep.c -+++ b/gdb/tilegx-tdep.c -@@ -288,7 +288,7 @@ tilegx_push_dummy_call (struct gdbarch *gdbarch, - CORE_ADDR stack_dest = sp; - int argreg = TILEGX_R0_REGNUM; - int i, j; -- int typelen, slacklen; -+ LONGEST typelen, slacklen; - static const gdb_byte four_zero_words[16] = { 0 }; - - /* If struct_return is 1, then the struct return address will -diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c ---- a/gdb/v850-tdep.c -+++ b/gdb/v850-tdep.c -@@ -1019,7 +1019,8 @@ v850_push_dummy_call (struct gdbarch *gdbarch, - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - int argreg; - int argnum; -- int arg_space = 0; -+ ULONGEST arg_space = 0; -+ LONGEST len = 0; - int stack_offset; - - if (gdbarch_tdep (gdbarch)->abi == V850_ABI_RH850) -@@ -1047,7 +1048,7 @@ v850_push_dummy_call (struct gdbarch *gdbarch, - in four registers available. Loop thru args from first to last. */ - for (argnum = 0; argnum < nargs; argnum++) - { -- int len; -+ LONGEST len; - gdb_byte *val; - gdb_byte valbuf[v850_reg_size]; - -diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c ---- a/gdb/vax-tdep.c -+++ b/gdb/vax-tdep.c -@@ -110,7 +110,7 @@ vax_store_arguments (struct regcache *regcache, int nargs, - struct gdbarch *gdbarch = regcache->arch (); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - gdb_byte buf[4]; -- int count = 0; -+ LONGEST count = 0; - int i; - - /* We create an argument list on the stack, and make the argument -@@ -119,7 +119,7 @@ vax_store_arguments (struct regcache *regcache, int nargs, - /* Push arguments in reverse order. */ - for (i = nargs - 1; i >= 0; i--) - { -- int len = TYPE_LENGTH (value_enclosing_type (args[i])); -+ LONGEST len = TYPE_LENGTH (value_enclosing_type (args[i])); - - sp -= (len + 3) & ~3; - count += (len + 3) / 4; -diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c ---- a/gdb/xstormy16-tdep.c -+++ b/gdb/xstormy16-tdep.c -@@ -233,8 +233,10 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch, - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); - CORE_ADDR stack_dest = sp; - int argreg = E_1ST_ARG_REGNUM; -- int i, j; -- int typelen, slacklen; -+ int i, slacklen; -+ LONGEST j; -+ LONGEST typelen; -+ const gdb_byte *val; - gdb_byte buf[xstormy16_pc_size]; - - /* If returning a struct using target ABI method, then the struct return -diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c ---- a/gdb/xtensa-tdep.c -+++ b/gdb/xtensa-tdep.c -@@ -1615,8 +1615,7 @@ xtensa_store_return_value (struct type *type, - - if (len > (callsize > 8 ? 8 : 16)) - internal_error (__FILE__, __LINE__, -- _("unimplemented for this length: %d"), -- TYPE_LENGTH (type)); -+ _("unimplemented for this length: %d"), len); - areg = arreg_number (gdbarch, - gdbarch_tdep (gdbarch)->a0_base + 2 + callsize, wb); - -@@ -1689,18 +1688,19 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, - CORE_ADDR struct_addr) - { - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -- int size, onstack_size; -+ int i; -+ LONGEST size, onstack_size; - gdb_byte *buf = (gdb_byte *) alloca (16); - CORE_ADDR ra, ps; - struct argument_info - { - const bfd_byte *contents; -- int length; -+ ssize_t length; - int onstack; /* onstack == 0 => in reg */ - int align; /* alignment */ - union - { -- int offset; /* stack offset if on stack. */ -+ ssize_t offset; /* stack offset if on stack. */ - int regno; /* regno if in register. */ - } u; - }; -@@ -1723,9 +1723,10 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, - { - struct value *arg = args[i]; - struct type *arg_type = check_typedef (value_type (arg)); -- fprintf_unfiltered (gdb_stdlog, "%2d: %s %3d ", i, -- host_address_to_string (arg), -- TYPE_LENGTH (arg_type)); -+ const char *arg_type_len_s = pulongest (TYPE_LENGTH (arg_type)); -+ -+ fprintf_unfiltered (gdb_stdlog, "%2d: %s %s ", i, -+ host_address_to_string (arg), arg_type_len_s); - switch (TYPE_CODE (arg_type)) - { - case TYPE_CODE_INT: -@@ -1794,8 +1795,8 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, - info->align = TYPE_LENGTH (builtin_type (gdbarch)->builtin_long); - break; - } -- info->length = TYPE_LENGTH (arg_type); - info->contents = value_contents (arg); -+ info->length = TYPE_LENGTH (arg_type); - - /* Align size and onstack_size. */ - size = (size + info->align - 1) & ~(info->align - 1); -@@ -1840,7 +1841,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, - - if (info->onstack) - { -- int n = info->length; -+ ssize_t n = info->length; - CORE_ADDR offset = sp + info->u.offset; - - /* Odd-sized structs are aligned to the lower side of a memory -@@ -1856,7 +1857,7 @@ xtensa_push_dummy_call (struct gdbarch *gdbarch, - } - else - { -- int n = info->length; -+ ssize_t n = info->length; - const bfd_byte *cp = info->contents; - int r = info->u.regno; - - diff --git a/gdb-rhbz795424-bitpos-25of25-test.patch b/gdb-rhbz795424-bitpos-25of25-test.patch deleted file mode 100644 index 09858b416c8fb61e1d974702da9666dabce57f1e..0000000000000000000000000000000000000000 --- a/gdb-rhbz795424-bitpos-25of25-test.patch +++ /dev/null @@ -1,630 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-10/msg00231.html - -On Mon, 15 Oct 2012 15:25:55 +0200, Jan Kratochvil wrote: -> I have filed for it now: -> Invalid debug/ array bounds w/-fno-range-check and 32-bit target -> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54934 - -Therefore it looks as a valid gfortran FSF GCC HEAD bug so provided -a hand-patched .S file for i386; patched GDB PASSes with it. - -Thanks, -Jan - -2012-10-15 Siddhesh Poyarekar - Jan Kratochvil - - * gdb.fortran/array-bounds.exp: New test file. - * gdb.fortran/array-bounds.f: New test file. - * gdb.fortran/array-bounds.S: New test file. - -diff --git a/gdb/testsuite/gdb.fortran/array-bounds.S b/gdb/testsuite/gdb.fortran/array-bounds.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/array-bounds.S -@@ -0,0 +1,529 @@ -+/* Copyright 2012 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 . -+ -+ This file is part of the gdb testsuite. */ -+ -+ .file "array-bounds.f" -+ .text -+.Ltext0: -+ .type MAIN__, @function -+MAIN__: -+.LFB0: -+ .file 1 "gdb.fortran/array-bounds.f" -+ # gdb.fortran/array-bounds.f:16 -+ .loc 1 16 0 -+ .cfi_startproc -+# BLOCK 2 seq:0 -+# PRED: ENTRY (FALLTHRU) -+ pushl %ebp -+.LCFI0: -+ .cfi_def_cfa_offset 8 -+ .cfi_offset 5, -8 -+ movl %esp, %ebp -+.LCFI1: -+ .cfi_def_cfa_register 5 -+ subl $40, %esp -+.LBB2: -+# SUCC: 3 (FALLTHRU) -+ # gdb.fortran/array-bounds.f:18 -+ .loc 1 18 0 -+ movl $-1, %eax -+# BLOCK 3 seq:1 -+# PRED: 2 (FALLTHRU) 4 [100.0%] -+.L3: -+ # gdb.fortran/array-bounds.f:18 -+ .loc 1 18 0 is_stmt 0 discriminator 1 -+ testl %eax, %eax -+# SUCC: 5 4 (FALLTHRU) -+ jg .L2 -+# BLOCK 4 seq:2 -+# PRED: 3 (FALLTHRU) -+ # gdb.fortran/array-bounds.f:18 -+ .loc 1 18 0 discriminator 2 -+ leal 1(%eax), %ecx -+ movl .LC0, %edx -+ movl %edx, -16(%ebp,%ecx,4) -+ addl $1, %eax -+# SUCC: 3 [100.0%] -+ jmp .L3 -+# BLOCK 5 seq:3 -+# PRED: 3 -+.L2: -+.LBE2: -+ # gdb.fortran/array-bounds.f:19 -+ .loc 1 19 0 is_stmt 1 -+ movl -16(%ebp), %eax -+ movl -12(%ebp), %edx -+ movl %eax, -24(%ebp) -+ movl %edx, -20(%ebp) -+ # gdb.fortran/array-bounds.f:20 -+ .loc 1 20 0 -+ movl $0, 4(%esp) -+ movl $0, (%esp) -+# SUCC: -+ call _gfortran_stop_string -+ .cfi_endproc -+.LFE0: -+ .size MAIN__, .-MAIN__ -+ .globl main -+ .type main, @function -+main: -+.LFB1: -+ # gdb.fortran/array-bounds.f:21 -+ .loc 1 21 0 -+ .cfi_startproc -+# BLOCK 2 seq:0 -+# PRED: ENTRY (FALLTHRU) -+ pushl %ebp -+.LCFI2: -+ .cfi_def_cfa_offset 8 -+ .cfi_offset 5, -8 -+ movl %esp, %ebp -+.LCFI3: -+ .cfi_def_cfa_register 5 -+ andl $-16, %esp -+ subl $16, %esp -+ # gdb.fortran/array-bounds.f:21 -+ .loc 1 21 0 -+ movl 12(%ebp), %eax -+ movl %eax, 4(%esp) -+ movl 8(%ebp), %eax -+ movl %eax, (%esp) -+ call _gfortran_set_args -+ movl $options.1.1824, 4(%esp) -+ movl $7, (%esp) -+ call _gfortran_set_options -+ call MAIN__ -+ movl $0, %eax -+ leave -+.LCFI4: -+ .cfi_restore 5 -+ .cfi_def_cfa 4, 4 -+# SUCC: EXIT [100.0%] -+ ret -+ .cfi_endproc -+.LFE1: -+ .size main, .-main -+ .section .rodata -+ .align 4 -+ .type options.1.1824, @object -+ .size options.1.1824, 28 -+options.1.1824: -+ .long 68 -+ .long 1023 -+ .long 0 -+ .long 0 -+ .long 1 -+ .long 1 -+ .long 0 -+ .align 4 -+.LC0: -+ .long 1109917696 -+ .text -+.Letext0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .long 2f - 1f # Length of Compilation Unit Info -+1: -+ .value 0x2 # DWARF version number -+ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section -+ .byte 0x4 # Pointer Size (in bytes) -+dieb: .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) -+ .long .LASF5 # DW_AT_producer: "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude" -+ .byte 0xe # DW_AT_language -+ .byte 0x2 # DW_AT_identifier_case -+ .long .LASF6 # DW_AT_name: "gdb.fortran/array-bounds.f" -+ .long .LASF7 # DW_AT_comp_dir: "" -+ .long .Ltext0 # DW_AT_low_pc -+ .long .Letext0 # DW_AT_high_pc -+ .long .Ldebug_line0 # DW_AT_stmt_list -+die26: .uleb128 0x2 # (DIE (0x26) DW_TAG_subprogram) -+ .long .LASF8 # DW_AT_name: "MAIN__" -+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) -+ .byte 0x10 # DW_AT_decl_line -+ .long .LFB0 # DW_AT_low_pc -+ .long .LFE0 # DW_AT_high_pc -+ .long .LLST0 # DW_AT_frame_base -+ .byte 0x1 # DW_AT_GNU_all_tail_call_sites -+ .byte 0x1 # DW_AT_main_subprogram -+ .byte 0x2 # DW_AT_calling_convention -+ .long die66 - .Ldebug_info0 # DW_AT_sibling -+die40: .uleb128 0x3 # (DIE (0x40) DW_TAG_variable) -+ .ascii "bar\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) -+ .byte 0x11 # DW_AT_decl_line -+ .long die66 - .Ldebug_info0 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -24 -+die4e: .uleb128 0x3 # (DIE (0x4e) DW_TAG_variable) -+ .ascii "foo\0" # DW_AT_name -+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) -+ .byte 0x10 # DW_AT_decl_line -+ .long die88 - .Ldebug_info0 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -32 -+die5c: .uleb128 0x4 # (DIE (0x5c) DW_TAG_lexical_block) -+ .long .LBB2 # DW_AT_low_pc -+ .long .LBE2 # DW_AT_high_pc -+ .byte 0 # end of children of DIE 0x26 -+die66: .uleb128 0x5 # (DIE (0x66) DW_TAG_array_type) -+ .long die81 - .Ldebug_info0 # DW_AT_type -+ .long die7a - .Ldebug_info0 # DW_AT_sibling -+die6f: .uleb128 0x6 # (DIE (0x6f) DW_TAG_subrange_type) -+ .long die7a - .Ldebug_info0 # DW_AT_type -+#if 0 -+ .long 0xffffffff # DW_AT_lower_bound -+ .byte 0 # DW_AT_upper_bound -+#else -+ .quad 0xfffffffeffffffff # DW_AT_lower_bound -+ .quad 0xffffffff00000000 # DW_AT_upper_bound -+#endif -+ .byte 0 # end of children of DIE 0x66 -+die7a: .uleb128 0x7 # (DIE (0x7a) DW_TAG_base_type) -+#if 0 -+ .byte 0x4 # DW_AT_byte_size -+#else -+ .byte 0x8 # DW_AT_byte_size -+#endif -+ .byte 0x5 # DW_AT_encoding -+ .long .LASF0 # DW_AT_name: "integer(kind=4)" -+die81: .uleb128 0x7 # (DIE (0x81) DW_TAG_base_type) -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x4 # DW_AT_encoding -+ .long .LASF1 # DW_AT_name: "real(kind=4)" -+die88: .uleb128 0x5 # (DIE (0x88) DW_TAG_array_type) -+ .long die81 - .Ldebug_info0 # DW_AT_type -+ .long die99 - .Ldebug_info0 # DW_AT_sibling -+die91: .uleb128 0x8 # (DIE (0x91) DW_TAG_subrange_type) -+ .long die7a - .Ldebug_info0 # DW_AT_type -+#if 0 -+ .byte 0 # DW_AT_lower_bound -+ .byte 0x1 # DW_AT_upper_bound -+#else -+ .quad 0x100000000 # DW_AT_lower_bound -+ .quad 0x100000001 # DW_AT_upper_bound -+#endif -+ .byte 0 # end of children of DIE 0x88 -+die99: .uleb128 0x9 # (DIE (0x99) DW_TAG_subprogram) -+ .byte 0x1 # DW_AT_external -+ .long .LASF9 # DW_AT_name: "main" -+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) -+ .byte 0x15 # DW_AT_decl_line -+ .long die7a - .Ldebug_info0 # DW_AT_type -+ .long .LFB1 # DW_AT_low_pc -+ .long .LFE1 # DW_AT_high_pc -+ .long .LLST1 # DW_AT_frame_base -+ .byte 0x1 # DW_AT_GNU_all_tail_call_sites -+ .long died4 - .Ldebug_info0 # DW_AT_sibling -+dieb6: .uleb128 0xa # (DIE (0xb6) DW_TAG_formal_parameter) -+ .long .LASF2 # DW_AT_name: "argc" -+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) -+ .byte 0x15 # DW_AT_decl_line -+ .long died4 - .Ldebug_info0 # DW_AT_type -+ .byte 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 0 -+diec4: .uleb128 0xa # (DIE (0xc4) DW_TAG_formal_parameter) -+ .long .LASF3 # DW_AT_name: "argv" -+ .byte 0x1 # DW_AT_decl_file (gdb.fortran/array-bounds.f) -+ .byte 0x15 # DW_AT_decl_line -+ .long died9 - .Ldebug_info0 # DW_AT_type -+ .byte 0x3 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 4 -+ .byte 0x6 # DW_OP_deref -+ .byte 0 # end of children of DIE 0x99 -+died4: .uleb128 0xb # (DIE (0xd4) DW_TAG_const_type) -+ .long die7a - .Ldebug_info0 # DW_AT_type -+died9: .uleb128 0xc # (DIE (0xd9) DW_TAG_pointer_type) -+ .byte 0x4 # DW_AT_byte_size -+ .long diedf - .Ldebug_info0 # DW_AT_type -+diedf: .uleb128 0x7 # (DIE (0xdf) DW_TAG_base_type) -+ .byte 0x1 # DW_AT_byte_size -+ .byte 0x8 # DW_AT_encoding -+ .long .LASF4 # DW_AT_name: "character(kind=1)" -+ .byte 0 # end of children of DIE 0xb -+2: -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .uleb128 0x1 # (abbrev code) -+ .uleb128 0x11 # (TAG: DW_TAG_compile_unit) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x25 # (DW_AT_producer) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x13 # (DW_AT_language) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x42 # (DW_AT_identifier_case) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x1b # (DW_AT_comp_dir) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x10 # (DW_AT_stmt_list) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x2 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x6a # (DW_AT_main_subprogram) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x36 # (DW_AT_calling_convention) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x3 # (abbrev code) -+ .uleb128 0x34 # (TAG: DW_TAG_variable) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0x8 # (DW_FORM_string) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0xa # (DW_FORM_block1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x4 # (abbrev code) -+ .uleb128 0xb # (TAG: DW_TAG_lexical_block) -+ .byte 0 # DW_children_no -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x5 # (abbrev code) -+ .uleb128 0x1 # (TAG: DW_TAG_array_type) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x6 # (abbrev code) -+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type) -+ .byte 0 # DW_children_no -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+#if 0 -+ .uleb128 0x22 # (DW_AT_lower_bound) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .uleb128 0x2f # (DW_AT_upper_bound) -+ .uleb128 0xb # (DW_FORM_data1) -+#else -+ .uleb128 0x22 # (DW_AT_lower_bound) -+ .uleb128 0x7 # (DW_FORM_data8) -+ .uleb128 0x2f # (DW_AT_upper_bound) -+ .uleb128 0x7 # (DW_FORM_data8) -+#endif -+ .byte 0 -+ .byte 0 -+ .uleb128 0x7 # (abbrev code) -+ .uleb128 0x24 # (TAG: DW_TAG_base_type) -+ .byte 0 # DW_children_no -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3e # (DW_AT_encoding) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .byte 0 -+ .byte 0 -+ .uleb128 0x8 # (abbrev code) -+ .uleb128 0x21 # (TAG: DW_TAG_subrange_type) -+ .byte 0 # DW_children_no -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+#if 0 -+ .uleb128 0x22 # (DW_AT_lower_bound) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x2f # (DW_AT_upper_bound) -+ .uleb128 0xb # (DW_FORM_data1) -+#else -+ .uleb128 0x22 # (DW_AT_lower_bound) -+ .uleb128 0x7 # (DW_FORM_data8) -+ .uleb128 0x2f # (DW_AT_upper_bound) -+ .uleb128 0x7 # (DW_FORM_data8) -+#endif -+ .byte 0 -+ .byte 0 -+ .uleb128 0x9 # (abbrev code) -+ .uleb128 0x2e # (TAG: DW_TAG_subprogram) -+ .byte 0x1 # DW_children_yes -+ .uleb128 0x3f # (DW_AT_external) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x40 # (DW_AT_frame_base) -+ .uleb128 0x6 # (DW_FORM_data4) -+ .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites) -+ .uleb128 0xc # (DW_FORM_flag) -+ .uleb128 0x1 # (DW_AT_sibling) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xa # (abbrev code) -+ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) -+ .byte 0 # DW_children_no -+ .uleb128 0x3 # (DW_AT_name) -+ .uleb128 0xe # (DW_FORM_strp) -+ .uleb128 0x3a # (DW_AT_decl_file) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x3b # (DW_AT_decl_line) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .uleb128 0x2 # (DW_AT_location) -+ .uleb128 0xa # (DW_FORM_block1) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xb # (abbrev code) -+ .uleb128 0x26 # (TAG: DW_TAG_const_type) -+ .byte 0 # DW_children_no -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .uleb128 0xc # (abbrev code) -+ .uleb128 0xf # (TAG: DW_TAG_pointer_type) -+ .byte 0 # DW_children_no -+ .uleb128 0xb # (DW_AT_byte_size) -+ .uleb128 0xb # (DW_FORM_data1) -+ .uleb128 0x49 # (DW_AT_type) -+ .uleb128 0x13 # (DW_FORM_ref4) -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .section .debug_loc,"",@progbits -+.Ldebug_loc0: -+.LLST0: -+ .long .LFB0-.Ltext0 # Location list begin address (*.LLST0) -+ .long .LCFI0-.Ltext0 # Location list end address (*.LLST0) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI0-.Ltext0 # Location list begin address (*.LLST0) -+ .long .LCFI1-.Ltext0 # Location list end address (*.LLST0) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI1-.Ltext0 # Location list begin address (*.LLST0) -+ .long .LFE0-.Ltext0 # Location list end address (*.LLST0) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long 0 # Location list terminator begin (*.LLST0) -+ .long 0 # Location list terminator end (*.LLST0) -+.LLST1: -+ .long .LFB1-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LCFI2-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long .LCFI2-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LCFI3-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 8 -+ .long .LCFI3-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LCFI4-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x75 # DW_OP_breg5 -+ .sleb128 8 -+ .long .LCFI4-.Ltext0 # Location list begin address (*.LLST1) -+ .long .LFE1-.Ltext0 # Location list end address (*.LLST1) -+ .value 0x2 # Location expression size -+ .byte 0x74 # DW_OP_breg4 -+ .sleb128 4 -+ .long 0 # Location list terminator begin (*.LLST1) -+ .long 0 # Location list terminator end (*.LLST1) -+ .section .debug_aranges,"",@progbits -+ .long 0x1c # Length of Address Ranges Info -+ .value 0x2 # DWARF Version -+ .long .Ldebug_info0 # Offset of Compilation Unit Info -+ .byte 0x4 # Size of Address -+ .byte 0 # Size of Segment Descriptor -+ .value 0 # Pad to 8 byte boundary -+ .value 0 -+ .long .Ltext0 # Address -+ .long .Letext0-.Ltext0 # Length -+ .long 0 -+ .long 0 -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .section .debug_str,"MS",@progbits,1 -+.LASF4: -+ .string "character(kind=1)" -+.LASF5: -+ .string "GNU Fortran 4.8.0 20121015 (experimental) -ffixed-form -m32 -mtune=generic -march=x86-64 -g -gdwarf-2 -fintrinsic-modules-path .../gcchead-root/lib/gcc/x86_64-unknown-linux-gnu/4.8.0/finclude" -+.LASF7: -+ .string "" -+.LASF0: -+#if 0 -+ .string "integer(kind=4)" -+#else -+ .string "integer(kind=8)" -+#endif -+.LASF9: -+ .string "main" -+.LASF8: -+ .string "MAIN__" -+.LASF6: -+ .string "gdb.fortran/array-bounds.f" -+.LASF2: -+ .string "argc" -+.LASF1: -+ .string "real(kind=4)" -+.LASF3: -+ .string "argv" -+ .ident "GCC: (GNU) 4.8.0 20121015 (experimental)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.fortran/array-bounds.exp b/gdb/testsuite/gdb.fortran/array-bounds.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/array-bounds.exp -@@ -0,0 +1,43 @@ -+# Copyright 2012 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 . -+ -+# This file is part of the gdb testsuite. It contains test to ensure that -+# array bounds accept LONGEST. -+ -+if { [skip_fortran_tests] } { return -1 } -+ -+set testfile "array-bounds" -+ -+if { [is_ilp32_target] && ([istarget "i\[34567\]86-*-linux*"] -+ || [istarget "x86_64-*-linux*"]) } { -+ set srcfile ${testfile}.S -+ set opts {nodebug f90} -+} else { -+ set srcfile ${testfile}.f -+ set opts {debug f90} -+} -+ -+if {[prepare_for_testing $testfile.exp $testfile $srcfile $opts]} { -+ print "compile failed" -+ return -1 -+} -+ -+if { ![runto MAIN__] } { -+ perror "Could not run to breakpoint `MAIN__'." -+ continue -+} -+ -+gdb_test "print &foo" {.*\(4294967296:4294967297\).*} -+gdb_test "print &bar" {.*\(-4294967297:-4294967296\).*} -diff --git a/gdb/testsuite/gdb.fortran/array-bounds.f b/gdb/testsuite/gdb.fortran/array-bounds.f -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/array-bounds.f -@@ -0,0 +1,22 @@ -+c Copyright 2012 Free Software Foundation, Inc. -+ -+c This program is free software; you can redistribute it and/or modify -+c it under the terms of the GNU General Public License as published by -+c the Free Software Foundation; either version 3 of the License, or -+c (at your option) any later version. -+c -+c This program is distributed in the hope that it will be useful, -+c but WITHOUT ANY WARRANTY; without even the implied warranty of -+c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+c GNU General Public License for more details. -+c -+c You should have received a copy of the GNU General Public License -+c along with this program. If not, see . -+ -+ dimension foo(4294967296_8:4294967297_8) -+ dimension bar(-4294967297_8:-4294967296_8) -+ bar = 42 -+ foo=bar -+ stop -+ end -+ - diff --git a/gdb-rhbz795424-bitpos-25of25.patch b/gdb-rhbz795424-bitpos-25of25.patch deleted file mode 100644 index 1feb24f2ae1d50f0545506a73728cc0eb6f29875..0000000000000000000000000000000000000000 --- a/gdb-rhbz795424-bitpos-25of25.patch +++ /dev/null @@ -1,132 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html - ---MP_/90J7bck2fqDySEX9JkZtaqL -Content-Type: text/plain; charset=US-ASCII -Content-Transfer-Encoding: 7bit -Content-Disposition: inline - -Hi, - -Range bounds for a gdb type can have LONGEST values for low and high -bounds. Fortran range bounds functions however use only int. The larger -ranges don't compile by default on gcc, but it is possible to override -the check in the compiler by using -fno-range-check. As a result, this -check is necessary so that we don't print junk in case of an overflow. - -Attached patch does this expansion and also includes a test case that -verifies that the problem is fixed. I have also verified on x86_64 that -this patch does not cause any regressions. - -Regards, -Siddhesh - -gdb/ChangeLog: - - * f-lang.h (f77_get_upperbound): Return LONGEST. - (f77_get_lowerbound): Likewise. - * f-typeprint.c (f_type_print_varspec_suffix): Expand - UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format - print them. - (f_type_print_base): Expand UPPER_BOUND to LONGEST. Use - plongest to format print it. - * f-valprint.c (f77_get_lowerbound): Return LONGEST. - (f77_get_upperbound): Likewise. - (f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND, - LOWER_BOUND to LONGEST. - (f77_create_arrayprint_offset_tbl): Likewise. - -testsuite/ChangeLog: - - * gdb.fortran/array-bounds.exp: New test case. - * gdb.fortran/array-bounds.f: New test case. - ---MP_/90J7bck2fqDySEX9JkZtaqL -Content-Type: text/x-patch -Content-Transfer-Encoding: 7bit -Content-Disposition: attachment; filename=f77-bounds.patch - -diff --git a/gdb/f-lang.h b/gdb/f-lang.h ---- a/gdb/f-lang.h -+++ b/gdb/f-lang.h -@@ -50,9 +50,9 @@ struct common_block - struct symbol *contents[1]; - }; - --extern int f77_get_upperbound (struct type *); -+extern LONGEST f77_get_upperbound (struct type *); - --extern int f77_get_lowerbound (struct type *); -+extern LONGEST f77_get_lowerbound (struct type *); - - extern void f77_get_dynamic_array_length (struct type *); - -diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c ---- a/gdb/f-typeprint.c -+++ b/gdb/f-typeprint.c -@@ -149,7 +149,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - int show, int passed_a_ptr, int demangled_args, - int arrayprint_recurse_level, int print_rank_only) - { -- int upper_bound, lower_bound; -+ LONGEST upper_bound, lower_bound; - - /* No static variables are permitted as an error call may occur during - execution of this function. */ -@@ -196,7 +196,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - { - lower_bound = f77_get_lowerbound (type); - if (lower_bound != 1) /* Not the default. */ -- fprintf_filtered (stream, "%d:", lower_bound); -+ fprintf_filtered (stream, "%s:", plongest (lower_bound)); - - /* Make sure that, if we have an assumed size array, we - print out a warning and print the upperbound as '*'. */ -@@ -206,7 +206,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - else - { - upper_bound = f77_get_upperbound (type); -- fprintf_filtered (stream, "%d", upper_bound); -+ fprintf_filtered (stream, "%s", plongest (upper_bound)); - } - } - -@@ -278,7 +278,7 @@ void - f_type_print_base (struct type *type, struct ui_file *stream, int show, - int level) - { -- int upper_bound; -+ LONGEST upper_bound; - int index; - - QUIT; -@@ -370,7 +370,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, - else - { - upper_bound = f77_get_upperbound (type); -- fprintf_filtered (stream, "character*%d", upper_bound); -+ fprintf_filtered (stream, "character*%s", plongest (upper_bound)); - } - break; - -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c -@@ -41,7 +41,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; - /* Array which holds offsets to be applied to get a row's elements - for a given array. Array also holds the size of each subarray. */ - --int -+LONGEST - f77_get_lowerbound (struct type *type) - { - if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type)) -@@ -50,7 +50,7 @@ f77_get_lowerbound (struct type *type) - return TYPE_ARRAY_LOWER_BOUND_VALUE (type); - } - --int -+LONGEST - f77_get_upperbound (struct type *type) - { - if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) - diff --git a/gdb-rhbz795424-bitpos-arrayview.patch b/gdb-rhbz795424-bitpos-arrayview.patch deleted file mode 100644 index 791cdbd229f6a2403d0a7aeee143c297d9f9aca6..0000000000000000000000000000000000000000 --- a/gdb-rhbz795424-bitpos-arrayview.patch +++ /dev/null @@ -1,52 +0,0 @@ -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; } -@@ -196,7 +196,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-rhbz795424-bitpos-lazyvalue.patch b/gdb-rhbz795424-bitpos-lazyvalue.patch deleted file mode 100644 index 9c77b653cae5c5cc626dc35199c405f2384b4d91..0000000000000000000000000000000000000000 --- a/gdb-rhbz795424-bitpos-lazyvalue.patch +++ /dev/null @@ -1,424 +0,0 @@ -diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.S b/gdb/testsuite/gdb.base/longest-types-64bit.S -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/longest-types-64bit.S -@@ -0,0 +1,249 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2012 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 . */ -+ -+ .file "longest-types-64bit.c" -+ .text -+.Ltext0: -+ .globl main -+main: -+ .comm f,8,8 -+.Letext0: -+ .file 1 "gdb.base/longest-types-64bit.c" -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .4byte 0x9a /* Length of Compilation Unit Info */ -+ .2byte 0x2 /* DWARF version number */ -+ .4byte .Ldebug_abbrev0 /* Offset Into Abbrev. Section */ -+ .byte 0x8 /* Pointer Size (in bytes) */ -+ .uleb128 0x1 /* (DIE (0xb) DW_TAG_compile_unit) */ -+ .4byte .LASF3 /* DW_AT_producer: "GNU C 4.7.3 20121109 (prerelease)" */ -+ .byte 0x1 /* DW_AT_language */ -+ .4byte .LASF4 /* DW_AT_name: "gdb.base/longest-types-64bit.c" */ -+ .4byte .LASF5 /* DW_AT_comp_dir: "" */ -+ .4byte .Ldebug_line0 /* DW_AT_stmt_list */ -+ .uleb128 0x2 /* (DIE (0x1d) DW_TAG_structure_type) */ -+ .ascii "foo\0" /* DW_AT_name */ -+ .4byte 0xff000002 /* DW_AT_byte_size */ -+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */ -+ .byte 0x12 /* DW_AT_decl_line */ -+ .4byte 0x4e /* DW_AT_sibling */ -+ .uleb128 0x3 /* (DIE (0x2c) DW_TAG_member) */ -+ .ascii "buf\0" /* DW_AT_name */ -+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */ -+ .byte 0x14 /* DW_AT_decl_line */ -+ .4byte 0x4e /* DW_AT_type */ -+ .byte 0x2 /* DW_AT_data_member_location */ -+ .byte 0x23 /* DW_OP_plus_uconst */ -+ .uleb128 0 -+ .uleb128 0x4 /* (DIE (0x3a) DW_TAG_member) */ -+ .4byte .LASF0 /* DW_AT_name: "buf2" */ -+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */ -+ .byte 0x15 /* DW_AT_decl_line */ -+ .4byte 0x73 /* DW_AT_type */ -+ .byte 0x7 /* DW_AT_data_member_location */ -+ .byte 0x23 /* DW_OP_plus_uconst */ -+ .uleb128 0xffff000000 -+ .byte 0 /* end of children of DIE 0x1d */ -+ .uleb128 0x5 /* (DIE (0x4e) DW_TAG_array_type) */ -+ .4byte 0x6c /* DW_AT_type */ -+ .4byte 0x65 /* DW_AT_sibling */ -+ .uleb128 0x6 /* (DIE (0x57) DW_TAG_subrange_type) */ -+ .4byte 0x65 /* DW_AT_type */ -+ .quad 0xfffeffffff /* DW_AT_upper_bound */ -+ .byte 0 /* end of children of DIE 0x4e */ -+ .uleb128 0x7 /* (DIE (0x65) DW_TAG_base_type) */ -+ .byte 0x8 /* DW_AT_byte_size */ -+ .byte 0x7 /* DW_AT_encoding */ -+ .4byte .LASF1 /* DW_AT_name: "sizetype" */ -+ .uleb128 0x7 /* (DIE (0x6c) DW_TAG_base_type) */ -+ .byte 0x1 /* DW_AT_byte_size */ -+ .byte 0x6 /* DW_AT_encoding */ -+ .4byte .LASF2 /* DW_AT_name: "char" */ -+ .uleb128 0x5 /* (DIE (0x73) DW_TAG_array_type) */ -+ .4byte 0x6c /* DW_AT_type */ -+ .4byte 0x83 /* DW_AT_sibling */ -+ .uleb128 0x8 /* (DIE (0x7c) DW_TAG_subrange_type) */ -+ .4byte 0x65 /* DW_AT_type */ -+ .byte 0x1 /* DW_AT_upper_bound */ -+ .byte 0 /* end of children of DIE 0x73 */ -+ .uleb128 0x9 /* (DIE (0x83) DW_TAG_variable) */ -+ .ascii "f\0" /* DW_AT_name */ -+ .byte 0x1 /* DW_AT_decl_file (gdb.base/longest-types-64bit.c) */ -+ .byte 0x16 /* DW_AT_decl_line */ -+ .4byte 0x97 /* DW_AT_type */ -+ .byte 0x1 /* DW_AT_external */ -+ .byte 0x9 /* DW_AT_location */ -+ .byte 0x3 /* DW_OP_addr */ -+ .quad f -+ .uleb128 0xa /* (DIE (0x97) DW_TAG_pointer_type) */ -+ .byte 0x8 /* DW_AT_byte_size */ -+ .4byte 0x1d /* DW_AT_type */ -+ .byte 0 /* end of children of DIE 0xb */ -+ .section .debug_abbrev,"",@progbits -+.Ldebug_abbrev0: -+ .uleb128 0x1 /* (abbrev code) */ -+ .uleb128 0x11 /* (TAG: DW_TAG_compile_unit) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x25 /* (DW_AT_producer) */ -+ .uleb128 0xe /* (DW_FORM_strp) */ -+ .uleb128 0x13 /* (DW_AT_language) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0xe /* (DW_FORM_strp) */ -+ .uleb128 0x1b /* (DW_AT_comp_dir) */ -+ .uleb128 0xe /* (DW_FORM_strp) */ -+ .uleb128 0x10 /* (DW_AT_stmt_list) */ -+ .uleb128 0x6 /* (DW_FORM_data4) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x2 /* (abbrev code) */ -+ .uleb128 0x13 /* (TAG: DW_TAG_structure_type) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0x6 /* (DW_FORM_data4) */ -+ .uleb128 0x3a /* (DW_AT_decl_file) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3b /* (DW_AT_decl_line) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x1 /* (DW_AT_sibling) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x3 /* (abbrev code) */ -+ .uleb128 0xd /* (TAG: DW_TAG_member) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x3a /* (DW_AT_decl_file) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3b /* (DW_AT_decl_line) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x38 /* (DW_AT_data_member_location) */ -+ .uleb128 0xa /* (DW_FORM_block1) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x4 /* (abbrev code) */ -+ .uleb128 0xd /* (TAG: DW_TAG_member) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0xe /* (DW_FORM_strp) */ -+ .uleb128 0x3a /* (DW_AT_decl_file) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3b /* (DW_AT_decl_line) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x38 /* (DW_AT_data_member_location) */ -+ .uleb128 0xa /* (DW_FORM_block1) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x5 /* (abbrev code) */ -+ .uleb128 0x1 /* (TAG: DW_TAG_array_type) */ -+ .byte 0x1 /* DW_children_yes */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x1 /* (DW_AT_sibling) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x6 /* (abbrev code) */ -+ .uleb128 0x21 /* (TAG: DW_TAG_subrange_type) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x2f /* (DW_AT_upper_bound) */ -+ .uleb128 0x7 /* (DW_FORM_data8) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x7 /* (abbrev code) */ -+ .uleb128 0x24 /* (TAG: DW_TAG_base_type) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3e /* (DW_AT_encoding) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0xe /* (DW_FORM_strp) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x8 /* (abbrev code) */ -+ .uleb128 0x21 /* (TAG: DW_TAG_subrange_type) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x2f /* (DW_AT_upper_bound) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0x9 /* (abbrev code) */ -+ .uleb128 0x34 /* (TAG: DW_TAG_variable) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0x3 /* (DW_AT_name) */ -+ .uleb128 0x8 /* (DW_FORM_string) */ -+ .uleb128 0x3a /* (DW_AT_decl_file) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x3b /* (DW_AT_decl_line) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .uleb128 0x3f /* (DW_AT_external) */ -+ .uleb128 0xc /* (DW_FORM_flag) */ -+ .uleb128 0x2 /* (DW_AT_location) */ -+ .uleb128 0xa /* (DW_FORM_block1) */ -+ .byte 0 -+ .byte 0 -+ .uleb128 0xa /* (abbrev code) */ -+ .uleb128 0xf /* (TAG: DW_TAG_pointer_type) */ -+ .byte 0 /* DW_children_no */ -+ .uleb128 0xb /* (DW_AT_byte_size) */ -+ .uleb128 0xb /* (DW_FORM_data1) */ -+ .uleb128 0x49 /* (DW_AT_type) */ -+ .uleb128 0x13 /* (DW_FORM_ref4) */ -+ .byte 0 -+ .byte 0 -+ .byte 0 -+ .section .debug_aranges,"",@progbits -+ .4byte 0x1c /* Length of Address Ranges Info */ -+ .2byte 0x2 /* DWARF Version */ -+ .4byte .Ldebug_info0 /* Offset of Compilation Unit Info */ -+ .byte 0x8 /* Size of Address */ -+ .byte 0 /* Size of Segment Descriptor */ -+ .2byte 0 /* Pad to 16 byte boundary */ -+ .2byte 0 -+ .quad 0 -+ .quad 0 -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .section .debug_str,"MS",@progbits,1 -+.LASF4: -+ .string "gdb.base/longest-types-64bit.c" -+.LASF3: -+ .string "GNU C 4.7.3 20121109 (prerelease)" -+.LASF0: -+ .string "buf2" -+.LASF1: -+ .string "sizetype" -+.LASF5: -+ .string "" -+.LASF2: -+ .string "char" -+ .ident "GCC: (GNU) 4.7.3 20121109 (prerelease)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu b/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu -@@ -0,0 +1,67 @@ -+begin 755 gdb.base/longest-types-64bit.bz2 -+M0EIH.3%!62936<'N#OH`"G/________^______?_Y______//]7SQD5'^/_% -+M=VY7?F_[X`F]]SG7531-==V:Z-.FW;M.U7=';:UH@<&FD31,E3]J'HE-/TR@ -+M]4_5/32;%/U3]1--HU/U$#$R'I'J,FC0T-,)B'J#:CU,F@]0`/4:>F@CU/4, -+MA@$S2>IH!H`TR/0-$$:9`C(&FHU3VE-J;4\%,@>4T:#]49-J/4`>HT!H#3)^ -+MJ`!H-``T]0&@-```:'J``&@`:9!`R9,@&3(`#3!#0!H``-#$--`,@``T`T#( -+M:`:`&0&@::,0:-```:``-`E-$1#4-3:4]3R9-39(Q/)#3R-30:9#$T!D!H&@ -+M,CTGI!H#(#0T`#0``T`T`:``-``T`0,F3(!DR``TP0T`:``#0Q#30#(``-`- -+M`R&@&@!D!H&FC$&C0``&@`#0)%)H32>JGZ&!)Z1B1X@)DTVC4>H`&0:``R&@ -+M,C0:``T``,C0``!H``#(`T`:#0U^\?]7K8M.96V/2[?M*DC)>WIUF)H7T\$:KKRE&\Q -+M..M]L1*,!>D!X)RW,[,1I,9N%X-N&2+*:&)DJY4(VFQG%9K[/?J06WACF6-I -+MJ&JJ9,ZK4;X28M@[==%ME(A54:%>+3->MRK(G!8#TY>@E$6DR&<_5:C&/RZE -+MI,!E6#`;*8R*E@++*))U)[6=OKFM%'+$-H5\X@1D)_Y*"NKV. -+M&\F8?SXW^HQ:Y@(Q[.>PEG=]@^ -+M%C"3EZ/1X'H*02ZQH":6"@;8Z0LEW6)> -+M6^V=*`FB'5G4MD8L3J5XT#SW;J1]ZO+"SPIS%J(P46+Q=CC2$H-`-B&TD)M` -+M&A:066DA%AB0C6,460>M8B+$:-BR&@NM()F`S',,F8+#&0.SMOK@.G<'83N. -+MDA"#5-`JVC("1*TA;/M()&8J0+YH%IFV)+OA@4,`E?3M$[$@&Q`3]A!$&A(- -+M$PBT+2,@PU+2H9(T-H3N6'(2;""%2T*1I2P@`L?AG8&A!=31J7)1(9FB'8X= -+MWJ0S#YEG9K$.#.[L.[CNA"4JSJ^GK2*)UH=MC0.R8+E75'.09[G -+MMQ1*[GI:>#>K`_NZS:V6>$K;OX6#!!N'"2413$DTL&]7KY>B<3V5!!C8#X5+ -+MF%9X!8NOKM5 -+M+"N&P4.75C16!A9Q;:C.6N`WZDV=-]!,5PG]SNP[GV^L?YGI]7_'D8N?XV -+M'[7KZJWYVMXGBQS[`!)YI%3:D)I2!;%'R`W&YB<`9O2#F"C/)F;JK9P+@3&( -+MAH31[W)=YCODQDUKNM7A"3.C!2%CHTJNZ"Z\+#F-?(DLE>XAC%07B8;$%J_L -+MJPK48QC&,916=IM+<1&WRKLB6&Q2O79*!7S$,`7J8*!`!=K:5W550[NH9M#_ -+MKL!LT,&;59GZW7S"5Z4%`%&!`9"J9`0:IR&H=MTKT=PEYC$,4K90M9AT'%;_ -+MB0HVLE)(W&YWF,C:TURXO:`M[RX(A-GT97456Q4Z*HPU*4J:*[WU-4GD.9UV -+MSA#L4X[[*Y+)8IF.EO<.TP4IC2?(4HX)W1#:GOMOD2F;HM1BV#;PH[ -+M7:PJ-!#,!6N<3')-0C,>15'IZ>@U^CJJJ+>+>%%)%BBATD\)*F6&BLMIR&?\ -+MQ2_?33@"NR1/CN\:)>5DG6`>$;$3QA94'-3]*CU6YG])<=2)'GC"RP-RK&-3 -+MZDT-M_)R+F06DS?CR>E@^!,33"U6X<@OXO$Q>U$\T@IU'@T=>K`G7H8K5GLXMS3*^@JLVBHHE'.&?9RKC?Y`&&3J5!/C$++<@U#Q' -+M9R3I.$+S`%]-.UO>WH^C73F<&;RIJR+(Q@7(3PP*W[-O,,DD3S7BUK^I@D%* -+M`Y<*2TXJ&7;2'6'R.U>]0-="M`K+&N%/==N4U@9%@M1)U&251C($^S"WL"]T -+M-XN'D2[II3-$K%+&`3['O)%,8G*E%_8RV6A5B_4(2/?-AIC.\/>,YFJ<(G.8 -+MAVP?UN*=ME:7&T!C%)I:&4H:-5>&^!&0>A.O'0G'/6&ZZ964@04&=#DC`%&: -+MUNLOS?,?'T:T!8L80='M:96K4;JX)6.('1#J$.1/L)$IS<4/*'2D34 -+M/@J\BA(I2T40JS%9G8F!7U5_!#'U!+[7$ES&)@:*QAET-IBX6'_N5^7/#>@V -+MN3&,-6(AG[8&!8LV+F_U"W?/)+Y^,;=1K:SW28<0WA2"UPHP^8FG#R$!`Y`, -+MLF<`U*NNU\[6N03"*?I8D=K7.Z*H=A_37;S=LVC(BQ,58Q_\#G`'P*_-]T!G4$`V0BS]'S)D/;V7R?.2F?SF)N+2+#P2_G(49TCE&*UIVT-MP808VTVV-$(*`VT<%>%96AHOL`(7%SI2%-R -+M#G2F02VQQH-7KT3E05I9Z)E\$Y8ED1KU`(4QHT%B]1$F:F1&8DAN.Q4&*?F@ -+M.8D965.$PRHT5HD,G=G!KTF3D -+M94"&ZA-F,.19=8`\(Q;A07Q%!19*3#*F9Q+D(0K@V87@O.=7EJIM6`!4`>D! -+M)49QHA!BV+:4O@K00$$!5*6>A@2@4D)@R\"%$2F"O:24J*L(RP#N;O4K7I&2 -+M[#)KR47H-N[VJ%3>$`9,AF8QID&I3G+D`*]BX98B$2K":A7_\ -+M_]7LT!4,$NL5)NE>9[:MK2_/'GO:7"P`=P(\L]O?"-APH(834$,W!IJS+U1F1C.!D$!&KS^-6%F90PQ[F]F=$^QE\X+- -+M@.W*LPH_78B>MHH@69RU[*'1J@8QAC\KSV@IG\(;_CUW:ZR2.,0$E3LZ_^P= -+M<_DCP"Q<`;+_;YP#^U%&E^#2M%,T?F3UN^>TSH)GFL"\%RF[KNZ+[R+@<&.$ -+MC42)B96\1-.O_I).K7)X]W>EQ):4C(XB*+:S%0_37D^EBP+1HU(D?3"%_O2R -+M6-#X>AU#<$*!/,W6QC^;O^%]LR&_X'<8X$<3CUU_QFAJ;">H)2443GD4W!4# -+?<55!2^6_8J$)-O<>\H0U/6Q^>UG0%W)%.%"0P>X.^@`` -+` -+end -diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.c b/gdb/testsuite/gdb.base/longest-types-64bit.c -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/longest-types-64bit.c -@@ -0,0 +1,28 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2012 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 . */ -+ -+struct foo -+{ -+ char buf[0xffff000000]; -+ char buf2[2]; -+} *f; -+ -+int -+main (void) -+{ -+ return 0; -+} -diff --git a/gdb/testsuite/gdb.base/longest-types-64bit.exp b/gdb/testsuite/gdb.base/longest-types-64bit.exp -new file mode 100644 ---- /dev/null -+++ b/gdb/testsuite/gdb.base/longest-types-64bit.exp -@@ -0,0 +1,59 @@ -+# This testcase is part of GDB, the GNU debugger. -+ -+# Copyright 2012 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 . -+ -+standard_testfile .c longest-types-64bit.S -+ -+proc test { name } { with_test_prefix $name { -+ # 64-bit array size should not overflow -+ gdb_test "print &f->buf" {= \(char \(\*\)\[1099494850560\]\) 0x0} -+ -+ # The offset should not overflow -+ gdb_test "print &f->buf2" {= \(char \(\*\)\[2\]\) 0xffff000000} -+}} -+ -+ -+# Test 64-bit file first as it is not compiled so its compilation never fails. -+ -+set file64bitbz2uu ${srcdir}/${subdir}/${testfile}.bz2.uu -+set file64bit [standard_output_file ${testfile}] -+ -+if {[catch "system \"uudecode -o - ${file64bitbz2uu} | bzip2 -dc >${file64bit}\""] != 0} { -+ untested "failed uudecode or bzip2" -+ return -1 -+} -+file stat ${file64bit} file64bitstat -+if {$file64bitstat(size) != 9501} { -+ untested "uudecode or bzip2 produce invalid result" -+ return -1 -+} -+ -+clean_restart ${file64bit} -+ -+#if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile2 {nodebug}] } { -+# return -1 -+#} -+ -+test "64bit" -+ -+ -+# And here is the native build test. -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug quiet}] } { -+ return -1 -+} -+ -+test "native" - diff --git a/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch b/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch index 167ffba643370a00675cf236dd3f42a60fd5a093..198c125fb67ebcee37d1ece17e5245281c603f61 100644 --- a/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch +++ b/gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch @@ -136,4 +136,3 @@ new file mode 100644 +} else { + fail "different values for TLS variable" +} - diff --git a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch index 1886b8765b0a451a37f56e9a6a7c315d756e21a7..413181855ca8ae4d93fccb736256d9205fe46f5a 100644 --- a/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +++ b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch @@ -721,4 +721,3 @@ new file mode 100644 + use mod1 + call sub1 + end - diff --git a/gdb-runtest-pie-override.patch b/gdb-runtest-pie-override.patch index 9354d8b4286d8da5552331ca49b2b9ff97626623..a496cc807de12ea88c82808a403482cffa28f858 100644 --- a/gdb-runtest-pie-override.patch +++ b/gdb-runtest-pie-override.patch @@ -1,23 +1,7 @@ -make check//unix/-fPIE/-pie RUNTESTFLAGS=solib-display.exp - -gcc -fpic -c -fPIE -pie -o x.o x.c -/usr/lib/gcc/x86_64-redhat-linux/4.6.1/../../../../lib64/Scrt1.o: In function `_start': -(.text+0x20): undefined reference to `main' - -=> Change the order for overrides. - -One has to also use -fPIC rather than -fPIE, -fPIC is stronger. - -The correct way would be: -make check//unix RUNTESTFLAGS='CC_FOR_TARGET=gcc\ -fPIC\ -pie CXX_FOR_TARGET=g++\ -fPIC\ -pie solib-display.exp' - -But there is a problem with testsuite.unix non-unique subdir name and also -a problem with make -j parallelization of the testsuite. - diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp --- a/gdb/testsuite/lib/future.exp +++ b/gdb/testsuite/lib/future.exp -@@ -185,6 +185,10 @@ proc gdb_default_target_compile {source destfile type options} { +@@ -195,6 +195,10 @@ proc gdb_default_target_compile {source destfile type options} { set ldflags "" set dest [target_info name] @@ -28,7 +12,7 @@ diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp if {[info exists CFLAGS_FOR_TARGET]} { append add_flags " $CFLAGS_FOR_TARGET" } -@@ -519,10 +523,6 @@ proc gdb_default_target_compile {source destfile type options} { +@@ -529,10 +533,6 @@ proc gdb_default_target_compile {source destfile type options} { } } @@ -39,4 +23,3 @@ diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp verbose "doing compile" set sources "" - diff --git a/gdb-simultaneous-step-resume-breakpoint-test.patch b/gdb-simultaneous-step-resume-breakpoint-test.patch index 604d2822db42c39f05a4ea48105c7982b8926829..b3c0ae6a99d6f51d41102ce8013efa01f0c46b7d 100644 --- a/gdb-simultaneous-step-resume-breakpoint-test.patch +++ b/gdb-simultaneous-step-resume-breakpoint-test.patch @@ -152,4 +152,3 @@ new file mode 100644 + +gdb_test "continue" "sleep-after.*" "second continue" +gdb_test "continue" "final-exit.*" "third continue" - diff --git a/gdb-test-bt-cfi-without-die.patch b/gdb-test-bt-cfi-without-die.patch index 42a017c8a6b4c6711f44215058470f29f2d47c1c..ad1a4fd23b3712959c0047300aea5a813da8845b 100644 --- a/gdb-test-bt-cfi-without-die.patch +++ b/gdb-test-bt-cfi-without-die.patch @@ -1,63 +1,3 @@ -http://sourceware.org/ml/archer/2010-q3/msg00028.html - -On Wed, 25 Feb 2009 00:14:29 +0100, Jan Kratochvil wrote: -> commit 6a37c2b9962258ecf9299cc34a650e64a06acaa5 -> -> There was a regression on gdb.base/savedregs.exp. -> -> quick_addrmap/require_partial_symbols should be used even for the unwind debug -> info checking as its load has been also delayed by this branch. -[...] -> --- a/gdb/dwarf2-frame.c -> +++ b/gdb/dwarf2-frame.c -[...] -> @@ -1499,6 +1500,14 @@ dwarf2_frame_find_fde (CORE_ADDR *pc) -> struct dwarf2_fde *fde; -> CORE_ADDR offset; -> -> + if (objfile->quick_addrmap) -> + { -> + if (!addrmap_find (objfile->quick_addrmap, *pc)) -> + continue; -> + } -> + /* FIXME: Read-in only .debug_frame/.eh_frame without .debug_info? */ -> + require_partial_symbols (objfile); -> + - -but this has caused a different regression (as discussed in the confcall). - -QUICK_ADDRMAP is built only from .debug_aranges. But we can have existing -built .debug_aranges for CUs in OBJFILE but still some CUs do not need to have -DWARF at all while they can feature CFIs (.eh_frame or .debug_frame). -It has been described by Daniel Jacobowitz at: - Re: [2/4] RFC: check psymtabs_addrmap before reading FDEs - http://sourceware.org/ml/gdb-patches/2010-07/msg00012.html - -Sorry for this regression by me (in that fix of a different regression). - -Fixed it the "slow way" as this branch is now obsoleted by .gdb-index. - -No regressions on {x86_64,x86_64-m32,i686}-fedora13-linux-gnu. - -Checked-in. - -Thanks, -Jan - -eb8df8566acc1ed963e3e9b77c13b9c2c3db03fb - -Test CFI is parsed even for range (function) not described by any DIE. - -https://bugzilla.redhat.com/show_bug.cgi?id=614028 - -gdb/ - * dwarf2-frame.c (dwarf2_frame_find_fde): Remove the - OBJFILE->QUICK_ADDRMAP check. New comment why. - -gdb/testsuite/ - * gdb.base/cfi-without-die.exp, gdb.base/cfi-without-die-main.c, - gdb.base/cfi-without-die-caller.c: New files. - diff --git a/gdb/testsuite/gdb.base/cfi-without-die-caller.c b/gdb/testsuite/gdb.base/cfi-without-die-caller.c new file mode 100644 --- /dev/null @@ -204,4 +144,3 @@ new file mode 100644 +# #1 0x00000000004004e9 in caller () +# #2 0x00000000004004cd in main () at ... +gdb_test "bt" "#0 +callback \[^\r\n\]+\r\n#1 \[^\r\n\]+ in caller \[^\r\n\]+\r\n#2 \[^\r\n\]+ in main \[^\r\n\]+" "verify unwindin works for CFI without DIEs" - diff --git a/gdb-test-dw2-aranges.patch b/gdb-test-dw2-aranges.patch index ce41c364210b0f3181af0fc141e882ebcbbce0a8..8a48e3c5331736646c77c2334fe4312244c6f99f 100644 --- a/gdb-test-dw2-aranges.patch +++ b/gdb-test-dw2-aranges.patch @@ -1,25 +1,3 @@ -[archer-tromey-delayed-symfile] - -commit 77fa7778a37b0d28a7e4e5235f074a10ecf1815d -Author: Jan Kratochvil -Date: Sat Aug 15 15:05:54 2009 +0200 - - Test for "handle incorrect aranges". - - readelf: - Contents of the .debug_aranges section: - - Length: 8 - Version: 2 - Offset into .debug_info: 0x0 - Pointer Size: 0 - Segment Size: 0 - - Address Length - Floating point exception - - * gdb.dwarf2/dw2-aranges.exp, gdb.dwarf2/dw2-aranges.S: New files. - diff --git a/gdb/testsuite/gdb.dwarf2/dw2-aranges.S b/gdb/testsuite/gdb.dwarf2/dw2-aranges.S new file mode 100644 --- /dev/null @@ -210,4 +188,3 @@ new file mode 100644 + +# Failed gdb_load would abort the testcase execution earlier. +pass "file loaded" - diff --git a/gdb-test-expr-cumulative-archer.patch b/gdb-test-expr-cumulative-archer.patch index ba41b81d30cdbe44fbd82371b1ef4e4ef0dd4175..4055546fdf7a44b8632738c871f745d1b5d44cb1 100644 --- a/gdb-test-expr-cumulative-archer.patch +++ b/gdb-test-expr-cumulative-archer.patch @@ -1,6 +1,3 @@ -archer archer-keiths-expr-cumulative -b5a7497340b24199f0c7ba7fdf0d54d4df44d6bc - diff --git a/gdb/testsuite/gdb.cp/namespace-nested-imports.cc b/gdb/testsuite/gdb.cp/namespace-nested-imports.cc new file mode 100644 --- /dev/null @@ -213,4 +210,3 @@ new file mode 100644 +gdb_test "print _a" "= 11" +gdb_test "print ab" "= 22" +gdb_test "print abc" "= 33" - diff --git a/gdb-test-ivy-bridge.patch b/gdb-test-ivy-bridge.patch index 5b4ea18e64569f39c0788f4debb5a7593be89961..e3c9c11d612ea8f81113de37c29198065d540ed6 100644 --- a/gdb-test-ivy-bridge.patch +++ b/gdb-test-ivy-bridge.patch @@ -459,4 +459,3 @@ new file mode 100644 +\[^\r\n\]+:\tf3 0f ae d3\t\( \)?wrfsbase ebx\r +\[^\r\n\]+:\tf3 0f ae db\t\( \)?wrgsbase ebx\r +End of assembler dump\\." "intel" - diff --git a/gdb-test-pid0-core.patch b/gdb-test-pid0-core.patch index b127ced0cb5c8488d088f166b6be5d4cec615900..cf0a18f0790b3db01a163ae54b2e04048f16d95f 100644 --- a/gdb-test-pid0-core.patch +++ b/gdb-test-pid0-core.patch @@ -1,11 +1,3 @@ -https://bugzilla.redhat.com/show_bug.cgi?id=611435 - -Fix: -Re: [RFA]corelow.c: Add tid to add_to_thread_list -http://sourceware.org/ml/gdb-patches/2010-08/msg00085.html -http://sourceware.org/ml/gdb-cvs/2010-08/msg00026.html -2e5bcfdef1ec3883d48c3f87a4be5c0dff25e17e - diff --git a/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu b/gdb/testsuite/gdb.arch/x86_64-pid0-core.core.bz2.uu new file mode 100644 --- /dev/null @@ -82,4 +74,3 @@ new file mode 100644 +# Former crash was: +# thread.c:884: internal-error: switch_to_thread: Assertion `inf != NULL' failed. +gdb_test "core-file ${corefile}" "Program terminated with signal (11|SIGSEGV), Segmentation fault\\.\r\n.*" - diff --git a/gdb-testsuite-readline63-sigint.patch b/gdb-testsuite-readline63-sigint.patch deleted file mode 100644 index 98b2d6e6abe385aa37895d9056b4ce37599d59a1..0000000000000000000000000000000000000000 --- a/gdb-testsuite-readline63-sigint.patch +++ /dev/null @@ -1,39 +0,0 @@ -gdb/users/ppalka/readline-7.0-update -commit 379059215e823555a37a8dc7e02cef8fd86566e4 -https://sourceware.org/ml/gdb-patches/2015-07/msg00422.html -Message-Id: <1436927724-4059-1-git-send-email-patrick@parcs.ath.cx> -https://bugzilla.redhat.com/show_bug.cgi?id=1301175 - -diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp ---- a/gdb/testsuite/gdb.gdb/selftest.exp -+++ b/gdb/testsuite/gdb.gdb/selftest.exp -@@ -113,9 +113,25 @@ proc test_with_self { } { - } - - set description "send SIGINT signal to child process" -- gdb_test "signal SIGINT" \ -- "Continuing with signal SIGINT.*" \ -- "$description" -+ gdb_test_multiple "signal SIGINT" "$description" { -+ -re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\nQuit\r\n" { -+ pass "$description" -+ } -+ } -+ -+ set description "send ^C to child process again" -+ send_gdb "\003" -+ gdb_expect { -+ -re "(Thread .*|Program) received signal SIGINT.*$gdb_prompt $" { -+ pass "$description" -+ } -+ -re ".*$gdb_prompt $" { -+ fail "$description" -+ } -+ timeout { -+ fail "$description (timeout)" -+ } -+ } - - # Switch back to the GDB thread if Guile support is linked in. - # "signal SIGINT" could also switch the current thread. - diff --git a/gdb-threads-Fix-hang-in-stop_all_threads-after-killi.patch b/gdb-threads-Fix-hang-in-stop_all_threads-after-killi.patch deleted file mode 100644 index 55a2987ebc1e21564cbf60352f94f3e15d22dd25..0000000000000000000000000000000000000000 --- a/gdb-threads-Fix-hang-in-stop_all_threads-after-killi.patch +++ /dev/null @@ -1,135 +0,0 @@ - inferior - -Consider a two-threaded testcase a.out, sleeping in both its threads: -... -$ gdb -ex r --args a.out -Reading symbols from a.out... -Starting program: /data/gdb_versions/devel/a.out -[Thread debugging using libthread_db enabled] -Using host libthread_db library "/lib64/libthread_db.so.1". -[New Thread 0x7ffff77fe700 (LWP 31268)] -... - -Typing ^C causes stop_all_threads to be executed, and if an external SIGKILL -(such as caused by killall -9 a.out) arrives at the start of stop_all_threads, -gdb hangs in stop_all_threads after giving this warning: -... -warning: unable to open /proc file '/proc/24938/status' -... - -Using "set debug infrun 1" we can see in more detail where we hang: -... -infrun: stop_all_threads -infrun: stop_all_threads, pass=0, iterations=0 -infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing -infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, need stop -infrun: target_wait (-1.0.0, status) = -infrun: 10264.10268.0 [Thread 0x7ffff77fe700 (LWP 10268)], -infrun: status->kind = signalled, signal = GDB_SIGNAL_KILL -infrun: stop_all_threads status->kind = signalled, signal = GDB_SIGNAL_KILL \ - Thread 0x7ffff77fe700 (LWP 10268) -infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing -infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, already stopping -warning: unable to open /proc file '/proc/10264/status' -infrun: target_wait (-1.0.0, status) = -infrun: -1.0.0 [process -1], -infrun: status->kind = no-resumed -infrun: infrun_async(0) -infrun: stop_all_threads status->kind = no-resumed process -1 -infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing -infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, already stopping -infrun: stop_all_threads status->kind = no-resumed process -1 -infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing -infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, already stopping -infrun: stop_all_threads status->kind = no-resumed process -1 -infrun: Thread 0x7ffff7fa6740 (LWP 10264) not executing -infrun: Thread 0x7ffff77fe700 (LWP 10268) executing, already stopping - -...... - -So, we're hanging in the 'while (1)' loop in stop_all_threads as follows: -- thread t is tested, and both t->executing and t->stop_requested are found - to be 1 (noted with 'executing, already stopping') -- consequently need_wait is set 1 -- consequently wait_one is executed -- wait_one returns a TARGET_WAITKIND_NO_RESUMED event, which is handled by - continuing at the start of the loop - -The loop actually starts with update_thread_list (), but that doesn't seem -to change the state of the threads. - -Fix the hang by: -- detecting the first sign of trouble: the TARGET_WAITKIND_SIGNALLED event - with signal GDB_SIGNAL_KILL, -- making that event pending again, -- making sure the corresponding thread will not set need_wait again - (by setting t->executing == 0) -- making sure that the corresponding thread keeps t->resumed == 1 in the - the all_non_exited_threads loop - -This results in the ^C being handled without showing the user that the -test-case was killed: -... -^C -Thread 1 received signal SIGINT, Interrupt. -0x00007ffff78c50f0 in nanosleep () from /lib64/libc.so.6 -(gdb) -... - -But a subsequent continue does show that: -... -(gdb) c -Continuing. - -Program terminated with signal SIGKILL, Killed. -The program no longer exists. -(gdb) -.... -link: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/759 - -Signed-off-by: Tom de Vries ---- - gdb/infrun.c | 20 ++++++++++++++++++-- - 1 file changed, 18 insertions(+), 2 deletions(-) - -diff --git a/gdb/infrun.c b/gdb/infrun.c -index ecd1346..3bd32c2 100644 ---- a/gdb/infrun.c -+++ b/gdb/infrun.c -@@ -4354,7 +4354,12 @@ stop_all_threads (void) - - /* The thread may be not executing, but still be - resumed with a pending status to process. */ -- t->resumed = 0; -+ if (t->suspend.waitstatus.kind == TARGET_WAITKIND_SIGNALLED -+ && t->suspend.waitstatus.value.sig == GDB_SIGNAL_KILL -+ && t->suspend.waitstatus_pending_p) -+ ; -+ else -+ t->resumed = 0; - } - } - -@@ -4369,7 +4374,18 @@ stop_all_threads (void) - - event_ptid = wait_one (&ws); - -- if (ws.kind == TARGET_WAITKIND_NO_RESUMED) -+ if (ws.kind == TARGET_WAITKIND_SIGNALLED -+ && ws.value.sig == GDB_SIGNAL_KILL) -+ { -+ thread_info *t = find_thread_ptid (event_ptid); -+ if (t != NULL) -+ { -+ save_waitstatus (t, &ws); -+ t->resumed = 1; -+ t->executing = 0; -+ } -+ } -+ else if (ws.kind == TARGET_WAITKIND_NO_RESUMED) - { - /* All resumed threads exited. */ - } --- -2.19.1 - diff --git a/gdb-vla-intel-fix-print-char-array.patch b/gdb-vla-intel-fix-print-char-array.patch index b4b069f406247f5ec88733bc424a04a8e3356aee..6cfaf541ed528e39c538616df2df582aa43dfaa3 100644 --- a/gdb-vla-intel-fix-print-char-array.patch +++ b/gdb-vla-intel-fix-print-char-array.patch @@ -1,21 +1,7 @@ -Revert commit (only the part touching gdb/f-valprint.c): - - commit 469412dd9ccc4de5874fd3299b105833f36b34cd - Author: Christoph Weinmann - Date: Fri Sep 8 15:11:47 2017 +0200 - - Remove C/C++ relevant code in Fortran specific file. - - Remove code relevant for printing C/C++ Integer values in a - Fortran specific file to unify printing of Fortran values. - This does not change the output. - -And adjust its testcase. - diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c -@@ -313,8 +313,22 @@ f_val_print (struct type *type, LONGEST embedded_offset, +@@ -319,8 +319,22 @@ f_val_print (struct type *type, int embedded_offset, original_value, &opts, 0, stream); } else @@ -52,4 +38,3 @@ diff --git a/gdb/testsuite/gdb.fortran/printing-types.exp b/gdb/testsuite/gdb.fo gdb_test "print twobytes" " = 2" gdb_test "print chvalue" " = \'a\'" gdb_test "print logvalue" " = \.TRUE\." - diff --git a/gdb-vla-intel-fortran-strides.patch b/gdb-vla-intel-fortran-strides.patch index ba6ab1cd564537fe83fd4542696d150d18b1af91..7a87b6e441136f14c54910ab37501c574617d142 100644 --- a/gdb-vla-intel-fortran-strides.patch +++ b/gdb-vla-intel-fortran-strides.patch @@ -26,162 +26,10 @@ dbfd7140bf4c0500d1f5d192be781f83f78f7922 gdb/value.h | 2 + 23 files changed, 1242 insertions(+), 183 deletions(-) -diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c ---- a/gdb/dwarf2loc.c -+++ b/gdb/dwarf2loc.c -@@ -2429,11 +2429,14 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, - /* See dwarf2loc.h. */ - - int --dwarf2_evaluate_property (const struct dynamic_prop *prop, -+dwarf2_evaluate_property_signed (const struct dynamic_prop *prop, - struct frame_info *frame, - struct property_addr_info *addr_stack, -- CORE_ADDR *value) -+ CORE_ADDR *value, -+ int is_signed) - { -+ int rc = 0; -+ - if (prop == NULL) - return 0; - -@@ -2457,7 +2460,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, - - *value = value_as_address (val); - } -- return 1; -+ rc = 1; - } - } - break; -@@ -2479,7 +2482,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, - if (!value_optimized_out (val)) - { - *value = value_as_address (val); -- return 1; -+ rc = 1; - } - } - } -@@ -2487,8 +2490,8 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, - - case PROP_CONST: - *value = prop->data.const_val; -- return 1; -- -+ rc = 1; -+ break; - case PROP_ADDR_OFFSET: - { - struct dwarf2_property_baton *baton -@@ -2509,11 +2512,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); -- return 1; -+ rc = 1; - } -+ break; - } - -- return 0; -+ if (rc == 1 && is_signed == 1) -+ { -+ /* If we have a valid return candidate and it's value is signed, -+ we have to sign-extend the value because CORE_ADDR on 64bit machine has -+ 8 bytes but address size of an 32bit application is 4 bytes. */ -+ struct gdbarch * gdbarch = target_gdbarch (); -+ const int addr_bit = gdbarch_addr_bit (gdbarch); -+ const CORE_ADDR neg_mask = ((~0) << (addr_bit - 1)); -+ -+ /* Check if signed bit is set and sign-extend values. */ -+ if (*value & (neg_mask)) -+ *value |= (neg_mask ); -+ } -+ return rc; -+} -+ -+int -+dwarf2_evaluate_property (const struct dynamic_prop *prop, -+ struct frame_info *frame, -+ struct property_addr_info *addr_stack, -+ CORE_ADDR *value) -+{ -+ return dwarf2_evaluate_property_signed (prop, -+ frame, -+ addr_stack, -+ value, -+ 0); - } - - /* See dwarf2loc.h. */ -diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h ---- a/gdb/dwarf2loc.h -+++ b/gdb/dwarf2loc.h -@@ -143,6 +143,12 @@ int dwarf2_evaluate_property (const struct dynamic_prop *prop, - struct property_addr_info *addr_stack, - CORE_ADDR *value); - -+int dwarf2_evaluate_property_signed (const struct dynamic_prop *prop, -+ struct frame_info *frame, -+ struct property_addr_info *addr_stack, -+ CORE_ADDR *value, -+ int is_signed); -+ - /* A helper for the compiler interface that compiles a single dynamic - property to C code. - -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -17773,7 +17773,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; -- struct dynamic_prop low, high; -+ struct dynamic_prop low, high, stride; - int low_default_is_valid; - int high_bound_is_count = 0; - const char *name; -@@ -17793,7 +17793,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - - low.kind = PROP_CONST; - high.kind = PROP_CONST; -+ stride.kind = PROP_CONST; - high.data.const_val = 0; -+ stride.data.const_val = 0; - - /* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow - omitting DW_AT_lower_bound. */ -@@ -17826,6 +17828,14 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - break; - } - -+ attr = dwarf2_attr (die, DW_AT_byte_stride, cu); -+ if (attr) -+ if (!attr_to_dynamic_prop (attr, die, cu, &stride)) -+ complaint (_("Missing DW_AT_byte_stride " -+ "- DIE at 0x%s [in module %s]"), -+ sect_offset_str (die->sect_off), -+ objfile_name (cu->per_cu->dwarf2_per_objfile->objfile)); -+ - attr = dwarf2_attr (die, DW_AT_lower_bound, cu); - if (attr) - attr_to_dynamic_prop (attr, die, cu, &low); -@@ -17918,7 +17928,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; - -- range_type = create_range_type (NULL, orig_base_type, &low, &high); -+ range_type = create_range_type (NULL, orig_base_type, &low, &high, &stride); - - if (high_bound_is_count) - TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1; diff --git a/gdb/eval.c b/gdb/eval.c --- a/gdb/eval.c +++ b/gdb/eval.c -@@ -377,29 +377,324 @@ init_array_element (struct value *array, struct value *element, +@@ -372,29 +372,324 @@ init_array_element (struct value *array, struct value *element, return index; } @@ -525,7 +373,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c } -@@ -1242,19 +1537,6 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, +@@ -1235,19 +1530,6 @@ evaluate_funcall (type *expect_type, expression *exp, int *pos, return eval_call (exp, noside, nargs, argvec, var_func_name, expect_type); } @@ -545,7 +393,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c struct value * evaluate_subexp_standard (struct type *expect_type, struct expression *exp, int *pos, -@@ -1949,33 +2231,8 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1942,33 +2224,8 @@ evaluate_subexp_standard (struct type *expect_type, switch (code) { case TYPE_CODE_ARRAY: @@ -580,7 +428,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c case TYPE_CODE_PTR: case TYPE_CODE_FUNC: -@@ -2372,49 +2629,6 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2388,49 +2645,6 @@ evaluate_subexp_standard (struct type *expect_type, } return (arg1); @@ -630,7 +478,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) -@@ -3334,6 +3548,9 @@ calc_f77_array_dims (struct type *array_type) +@@ -3350,6 +3564,9 @@ calc_f77_array_dims (struct type *array_type) int ndimen = 1; struct type *tmp_type; @@ -643,7 +491,7 @@ diff --git a/gdb/eval.c b/gdb/eval.c diff --git a/gdb/expprint.c b/gdb/expprint.c --- a/gdb/expprint.c +++ b/gdb/expprint.c -@@ -578,17 +578,14 @@ print_subexp_standard (struct expression *exp, int *pos, +@@ -580,17 +580,14 @@ print_subexp_standard (struct expression *exp, int *pos, longest_to_int (exp->elts[pc + 1].longconst); *pos += 2; @@ -665,7 +513,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c print_subexp (exp, pos, stream, PREC_ABOVE_COMMA); fputs_filtered (")", stream); return; -@@ -1105,22 +1102,24 @@ dump_subexp_body_standard (struct expression *exp, +@@ -1107,22 +1104,24 @@ dump_subexp_body_standard (struct expression *exp, switch (range_type) { @@ -698,7 +546,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c fputs_filtered ("ExclusiveRange 'EXP..EXP'", stream); break; default: -@@ -1128,11 +1127,9 @@ dump_subexp_body_standard (struct expression *exp, +@@ -1130,11 +1129,9 @@ dump_subexp_body_standard (struct expression *exp, break; } @@ -715,7 +563,7 @@ diff --git a/gdb/expprint.c b/gdb/expprint.c diff --git a/gdb/expression.h b/gdb/expression.h --- a/gdb/expression.h +++ b/gdb/expression.h -@@ -150,28 +150,27 @@ extern void dump_raw_expression (struct expression *, +@@ -167,28 +167,27 @@ extern void dump_raw_expression (struct expression *, struct ui_file *, const char *); extern void dump_prefix_expression (struct expression *, struct ui_file *); @@ -767,12 +615,12 @@ diff --git a/gdb/expression.h b/gdb/expression.h diff --git a/gdb/f-exp.y b/gdb/f-exp.y --- a/gdb/f-exp.y +++ b/gdb/f-exp.y -@@ -257,31 +257,63 @@ arglist : subrange +@@ -282,31 +282,63 @@ arglist : subrange arglist : arglist ',' exp %prec ABOVE_COMMA - { arglist_len++; } + { pstate->arglist_len++; } + | arglist ',' subrange %prec ABOVE_COMMA -+ { arglist_len++; } ++ { pstate->arglist_len++; } ; /* There are four sorts of subrange types in F90. */ @@ -839,148 +687,52 @@ diff --git a/gdb/f-exp.y b/gdb/f-exp.y diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c -@@ -119,8 +119,14 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, - - if (nss != ndimensions) - { -- size_t dim_size = TYPE_LENGTH (TYPE_TARGET_TYPE (type)); -+ size_t dim_size; +@@ -129,6 +129,11 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, + byte_stride = dim_size; size_t offs = 0; -+ LONGEST byte_stride = abs (TYPE_BYTE_STRIDE (range_type)); -+ + + if (byte_stride) + dim_size = byte_stride; + else + dim_size = TYPE_LENGTH (TYPE_TARGET_TYPE (type)); - ++ for (i = lowerbound; (i < upperbound + 1 && (*elts) < options->print_max); + i++) diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -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, -- const struct dynamic_prop *high_bound) -+ const struct dynamic_prop *high_bound, -+ const struct dynamic_prop *stride) - { - if (result_type == NULL) - result_type = alloc_type_copy (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; +@@ -936,7 +936,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_RANGE_DATA (result_type)->high = *high_bound; -+ TYPE_RANGE_DATA (result_type)->stride = *stride; + TYPE_RANGE_DATA (result_type)->bias = bias; - if (low_bound->kind == PROP_CONST && low_bound->data.const_val >= 0) - TYPE_UNSIGNED (result_type) = 1; -@@ -954,7 +956,7 @@ struct type * - create_static_range_type (struct type *result_type, struct type *index_type, - LONGEST low_bound, LONGEST high_bound) - { -- struct dynamic_prop low, high; -+ struct dynamic_prop low, high, stride; +- /* Initialize the stride to be a constant, the value will already be zero ++ /* bias the stride to be a constant, the value will already be zero + thanks to the use of TYPE_ZALLOC above. */ + TYPE_RANGE_DATA (result_type)->stride.kind = PROP_CONST; - low.kind = PROP_CONST; - low.data.const_val = low_bound; -@@ -962,7 +964,11 @@ create_static_range_type (struct type *result_type, struct type *index_type, +@@ -1001,7 +1001,8 @@ create_static_range_type (struct type *result_type, struct type *index_type, high.kind = PROP_CONST; high.data.const_val = high_bound; -- result_type = create_range_type (result_type, index_type, &low, &high); -+ stride.kind = PROP_CONST; -+ stride.data.const_val = 0; -+ +- result_type = create_range_type (result_type, index_type, &low, &high, 0); + result_type = create_range_type (result_type, index_type, -+ &low, &high, &stride); ++ &low, &high, 0); return 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))) - { -- LONGEST low_bound, high_bound; -+ LONGEST low_bound, high_bound, byte_stride; - +@@ -1236,6 +1237,7 @@ create_array_type_with_stride (struct type *result_type, if (get_discrete_bounds (range_type, &low_bound, &high_bound) < 0) low_bound = high_bound = 0; element_type = check_typedef (element_type); -+ byte_stride = abs (TYPE_BYTE_STRIDE (range_type)); + /* Be careful when setting the array length. Ada arrays can be empty arrays with the high_bound being smaller than the low_bound. In such cases, the array length should be zero. */ - if (high_bound < low_bound) - TYPE_LENGTH (result_type) = 0; -+ else if (byte_stride > 0) -+ TYPE_LENGTH (result_type) = byte_stride * (high_bound - low_bound + 1); - else if (bit_stride > 0) - TYPE_LENGTH (result_type) = - (bit_stride * (high_bound - low_bound + 1) + 7) / 8; -@@ -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; -- struct dynamic_prop low_bound, high_bound; -+ struct dynamic_prop low_bound, high_bound, stride; - - gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE); - - prop = &TYPE_RANGE_DATA (dyn_range_type)->low; -- if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) -+ if (dwarf2_evaluate_property_signed (prop, NULL, addr_stack, &value, 1)) - { - low_bound.kind = PROP_CONST; - low_bound.data.const_val = value; -@@ -2007,7 +2017,7 @@ resolve_dynamic_range (struct type *dyn_range_type, - } - - prop = &TYPE_RANGE_DATA (dyn_range_type)->high; -- if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value)) -+ if (dwarf2_evaluate_property_signed (prop, NULL, addr_stack, &value, 1)) - { - high_bound.kind = PROP_CONST; - high_bound.data.const_val = value; -@@ -2022,12 +2032,20 @@ resolve_dynamic_range (struct type *dyn_range_type, - high_bound.data.const_val = 0; - } - -+ prop = &TYPE_RANGE_DATA (dyn_range_type)->stride; -+ if (dwarf2_evaluate_property_signed (prop, NULL, addr_stack, &value, 1)) -+ { -+ stride.kind = PROP_CONST; -+ stride.data.const_val = value; -+ } -+ - static_target_type - = resolve_dynamic_type_internal (TYPE_TARGET_TYPE (dyn_range_type), - addr_stack, 0); - static_range_type = create_range_type (copy_type (dyn_range_type), - static_target_type, -- &low_bound, &high_bound); -+ &low_bound, &high_bound, &stride); -+ - TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1; - return static_range_type; - } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -614,6 +614,10 @@ struct range_bounds - - struct dynamic_prop high; - -+ /* * Stride of range. */ -+ -+ struct dynamic_prop stride; -+ - /* True if HIGH range bound contains the number of elements in the - subrange. This affects how the final hight bound is computed. */ - -@@ -778,7 +782,6 @@ struct main_type +@@ -803,7 +803,6 @@ struct main_type /* * Union member used for range types. */ struct range_bounds *bounds; @@ -988,10 +740,10 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h } flds_bnds; /* * Slot to point to additional language-specific fields of this -@@ -1327,6 +1330,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 +@@ -1365,6 +1364,15 @@ extern bool set_type_align (struct type *, ULONGEST); + #define TYPE_BIT_STRIDE(range_type) \ + (TYPE_RANGE_DATA(range_type)->stride.data.const_val \ + * (TYPE_RANGE_DATA(range_type)->flag_is_byte_stride ? 8 : 1)) +#define TYPE_BYTE_STRIDE(range_type) \ + TYPE_RANGE_DATA(range_type)->stride.data.const_val +#define TYPE_BYTE_STRIDE_BLOCK(range_type) \ @@ -1004,7 +756,7 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h /* Property accessors for the type data location. */ #define TYPE_DATA_LOCATION(thistype) \ -@@ -1361,6 +1373,9 @@ extern bool set_type_align (struct type *, ULONGEST); +@@ -1400,6 +1408,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)) @@ -1014,18 +766,10 @@ diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) -@@ -1896,6 +1911,7 @@ extern struct type *create_array_type_with_stride - struct dynamic_prop *, unsigned int); - - extern struct type *create_range_type (struct type *, struct type *, -+ const struct dynamic_prop *, - const struct dynamic_prop *, - const struct dynamic_prop *); - 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, +@@ -919,24 +919,20 @@ operator_length_standard (const struct expression *expr, int endpos, case OP_RANGE: oplen = 3; @@ -1064,7 +808,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 -@@ -2475,24 +2475,28 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, +@@ -2492,24 +2492,28 @@ rust_parser::convert_ast_to_expression (const struct rust_op *operation, case OP_RANGE: { @@ -1104,7 +848,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 -@@ -1193,13 +1193,11 @@ rust_range (struct expression *exp, int *pos, enum noside noside) +@@ -1224,13 +1224,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; @@ -1121,7 +865,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); -@@ -1288,7 +1286,7 @@ rust_compute_range (struct type *type, struct value *range, +@@ -1319,7 +1317,7 @@ rust_compute_range (struct type *type, struct value *range, *low = 0; *high = 0; @@ -1130,7 +874,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c if (TYPE_NFIELDS (type) == 0) return; -@@ -1296,15 +1294,14 @@ rust_compute_range (struct type *type, struct value *range, +@@ -1327,15 +1325,14 @@ rust_compute_range (struct type *type, struct value *range, i = 0; if (strcmp (TYPE_FIELD_NAME (type, 0), "start") == 0) { @@ -1148,7 +892,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)) -@@ -1322,7 +1319,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1353,7 +1350,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, struct type *rhstype; LONGEST low, high_bound; /* Initialized to appease the compiler. */ @@ -1157,7 +901,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c LONGEST high = 0; int want_slice = 0; -@@ -1420,7 +1417,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1451,7 +1448,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, error (_("Cannot subscript non-array type")); if (want_slice @@ -1166,7 +910,7 @@ diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c low = low_bound; if (low < 0) error (_("Index less than zero")); -@@ -1438,7 +1435,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, +@@ -1469,7 +1466,7 @@ rust_subscript (struct expression *exp, int *pos, enum noside noside, CORE_ADDR addr; struct value *addrval, *tem; @@ -1661,33 +1405,53 @@ new file mode 100644 +program testprog + call sub +end -diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp ---- a/gdb/testsuite/gdb.fortran/vla-ptype.exp -+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp -@@ -98,3 +98,7 @@ gdb_test "ptype vla2" "type = " "ptype vla2 not allocated" - gdb_test "ptype vla2(5, 45, 20)" \ - "no such vector element \\\(vector not allocated\\\)" \ - "ptype vla2(5, 45, 20) not allocated" -+ -+gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds"] -+gdb_continue_to_breakpoint "vla1-neg-bounds" -+gdb_test "ptype vla1" "type = $real \\(-2:1,-5:4,-3:-1\\)" "ptype vla1 negative bounds" diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp --- a/gdb/testsuite/gdb.fortran/vla-sizeof.exp +++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp -@@ -44,3 +44,7 @@ gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla" - gdb_breakpoint [gdb_get_line_number "pvla-associated"] - gdb_continue_to_breakpoint "pvla-associated" +@@ -32,7 +32,8 @@ gdb_test "print sizeof(vla1)" " = 0" "print sizeof non-allocated vla1" + gdb_test "print sizeof(vla1(3,2,1))" \ + "no such vector element \\(vector not allocated\\)" \ + "print sizeof non-allocated indexed vla1" +-gdb_test "print sizeof(vla1(3:4,2,1))" "array not allocated" \ ++gdb_test "print sizeof(vla1(3:4,2,1))" \ ++ "provided bound\\(s\\) outside array bound\\(s\\)" \ + "print sizeof non-allocated sliced vla1" + + # Try to access value in allocated VLA +@@ -41,7 +42,7 @@ gdb_continue_to_breakpoint "vla1-allocated" + gdb_test "print sizeof(vla1)" " = 4000" "print sizeof allocated vla1" + gdb_test "print sizeof(vla1(3,2,1))" "4" \ + "print sizeof element from allocated vla1" +-gdb_test "print sizeof(vla1(3:4,2,1))" "800" \ ++gdb_test "print sizeof(vla1(3:4,2,1))" "8" \ + "print sizeof sliced vla1" + + # Try to access values in undefined pointer to VLA (dangling) +@@ -49,7 +50,8 @@ gdb_test "print sizeof(pvla)" " = 0" "print sizeof non-associated pvla" + gdb_test "print sizeof(pvla(3,2,1))" \ + "no such vector element \\(vector not associated\\)" \ + "print sizeof non-associated indexed pvla" +-gdb_test "print sizeof(pvla(3:4,2,1))" "array not associated" \ ++gdb_test "print sizeof(pvla(3:4,2,1))" \ ++ "provided bound\\(s\\) outside array bound\\(s\\)" \ + "print sizeof non-associated sliced pvla" + + # Try to access values in pointer to VLA and compare them +@@ -58,7 +60,8 @@ gdb_continue_to_breakpoint "pvla-associated" gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla" + gdb_test "print sizeof(pvla(3,2,1))" "4" \ + "print sizeof element from associated pvla" +-gdb_test "print sizeof(pvla(3:4,2,1))" "800" "print sizeof sliced pvla" + -+gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds"] -+gdb_continue_to_breakpoint "vla1-neg-bounds" -+gdb_test "print sizeof(vla1)" " = 480" "print sizeof vla1 negative bounds" ++gdb_test "print sizeof(pvla(3:4,2,1))" "8" "print sizeof sliced pvla" + + gdb_breakpoint [gdb_get_line_number "vla1-neg-bounds-v1"] + gdb_continue_to_breakpoint "vla1-neg-bounds-v1" diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp new file mode 100644 --- /dev/null +++ b/gdb/testsuite/gdb.fortran/vla-stride.exp -@@ -0,0 +1,44 @@ +@@ -0,0 +1,47 @@ +# Copyright 2016 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify @@ -1715,6 +1479,9 @@ new file mode 100644 + continue +} + ++gdb_test_no_output "set max-value-size unlimited" \ ++ "set max-value-size to unlimited" ++ +gdb_breakpoint [gdb_get_line_number "re-reverse-elements"] +gdb_continue_to_breakpoint "re-reverse-elements" +gdb_test "print pvla" " = \\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\\)" \ @@ -1766,51 +1533,10 @@ new file mode 100644 + + pvla => null() ! single-element +end program vla_stride -diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90 ---- a/gdb/testsuite/gdb.fortran/vla.f90 -+++ b/gdb/testsuite/gdb.fortran/vla.f90 -@@ -54,4 +54,14 @@ program vla - - allocate (vla3 (2,2)) ! vla2-deallocated - vla3(:,:) = 13 -+ -+ allocate (vla1 (-2:1, -5:4, -3:-1)) -+ l = allocated(vla1) -+ -+ vla1(:, :, :) = 1 -+ vla1(-2, -3, -1) = -231 -+ -+ deallocate (vla1) ! vla1-neg-bounds -+ l = allocated(vla1) -+ - end program vla -diff --git a/gdb/valarith.c b/gdb/valarith.c ---- a/gdb/valarith.c -+++ b/gdb/valarith.c -@@ -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); -- ULONGEST elt_offs = elt_size * (index - lowerbound); -+ LONGEST elt_offs = index - lowerbound; -+ LONGEST elt_stride = TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type)); -+ -+ if (elt_stride != 0) -+ elt_offs *= elt_stride; -+ 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)) - || (VALUE_LVAL (array) != lval_memory - && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type))) - { diff --git a/gdb/valops.c b/gdb/valops.c --- a/gdb/valops.c +++ b/gdb/valops.c -@@ -3792,56 +3792,195 @@ value_of_this_silent (const struct language_defn *lang) +@@ -3797,13 +3797,42 @@ value_of_this_silent (const struct language_defn *lang) struct value * value_slice (struct value *array, int lowbound, int length) @@ -1857,6 +1583,9 @@ diff --git a/gdb/valops.c b/gdb/valops.c if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY && TYPE_CODE (array_type) != TYPE_CODE_STRING) error (_("cannot take slice of non-array")); +@@ -3813,45 +3842,155 @@ value_slice (struct value *array, int lowbound, int length) + if (type_not_associated (array_type)) + error (_("array not associated")); - range_type = TYPE_INDEX_TYPE (array_type); - if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0) @@ -1924,7 +1653,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c /* FIXME-type-allocation: need a way to free this type when we are - done with it. */ -- slice_range_type = create_static_range_type ((struct type *) NULL, +- slice_range_type = create_static_range_type (NULL, - TYPE_TARGET_TYPE (range_type), - lowbound, - lowbound + length - 1); @@ -1946,7 +1675,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c + + slice_type = create_array_type (NULL, element_type, slice_range_type); -- slice_type = create_array_type ((struct type *) NULL, +- slice_type = create_array_type (NULL, - element_type, - slice_range_type); - TYPE_CODE (slice_type) = TYPE_CODE (array_type); @@ -2039,7 +1768,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c diff --git a/gdb/value.h b/gdb/value.h --- a/gdb/value.h +++ b/gdb/value.h -@@ -1139,6 +1139,8 @@ extern struct value *varying_to_slice (struct value *); +@@ -1145,6 +1145,8 @@ extern struct value *varying_to_slice (struct value *); extern struct value *value_slice (struct value *, int, int); @@ -2048,4 +1777,3 @@ diff --git a/gdb/value.h b/gdb/value.h extern struct value *value_literal_complex (struct value *, struct value *, struct type *); - diff --git a/gdb-vla-intel-fortran-vla-strings.patch b/gdb-vla-intel-fortran-vla-strings.patch index 8b81c5383de562ce0f088cb353e1683b66aecf24..c56dbde9ed78eb5006a32f1b92b17ae8e4c2e63b 100644 --- a/gdb-vla-intel-fortran-vla-strings.patch +++ b/gdb-vla-intel-fortran-vla-strings.patch @@ -26,7 +26,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 -@@ -336,6 +336,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd* +@@ -805,6 +805,8 @@ SH-5/SH64 running OpenBSD SH-5/SH64 support in sh*-*-openbsd* *** Changes in GDB 8.1 @@ -38,7 +38,7 @@ diff --git a/gdb/NEWS b/gdb/NEWS diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c -@@ -653,6 +653,28 @@ c_value_print (struct value *val, struct ui_file *stream, +@@ -649,6 +649,28 @@ c_value_print (struct value *val, struct ui_file *stream, else { /* normal case */ @@ -70,50 +70,68 @@ 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 -@@ -1833,7 +1833,8 @@ static void read_signatured_type (struct signatured_type *); +@@ -1827,7 +1827,10 @@ 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, -- struct dynamic_prop *prop); -+ struct dynamic_prop *prop, const gdb_byte *additional_data, +- struct dynamic_prop *prop, struct type *type); ++ struct dynamic_prop *prop, ++ struct type *default_type, ++ const gdb_byte *additional_data, + int additional_data_size); /* memory allocation interface */ -@@ -13757,7 +13758,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) - { +@@ -13799,7 +13802,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) newobj->static_link = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop); -- attr_to_dynamic_prop (attr, die, cu, newobj->static_link); -+ attr_to_dynamic_prop (attr, die, cu, newobj->static_link, NULL, 0); + attr_to_dynamic_prop (attr, die, cu, newobj->static_link, +- dwarf2_per_cu_addr_type (cu->per_cu)); ++ dwarf2_per_cu_addr_type (cu->per_cu), NULL, 0); } cu->list_in_scope = cu->get_builder ()->get_local_symbols (); -@@ -16516,7 +16517,8 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) - +@@ -16565,7 +16568,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) byte_stride_prop = (struct dynamic_prop *) alloca (sizeof (struct dynamic_prop)); -- stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop); -+ stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop, -+ NULL, 0); + stride_ok = attr_to_dynamic_prop (attr, die, cu, byte_stride_prop, +- prop_type); ++ prop_type, NULL, 0); if (!stride_ok) { complaint (_("unable to read array DW_AT_byte_stride " -@@ -17277,29 +17279,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; +@@ -17325,7 +17328,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct attribute *attr; -- unsigned int length; -+ unsigned int length = UINT_MAX; -+ + struct dynamic_prop prop; + bool length_is_constant = true; +- LONGEST length; ++ ULONGEST length = UINT_MAX; + + /* There are a couple of places where bit sizes might be made use of + when parsing a DW_TAG_string_type, however, no producer that we know +@@ -17346,6 +17349,10 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) + } + } + + index_type = objfile_type (objfile)->builtin_int; + range_type = create_static_range_type (NULL, index_type, 1, length); - ++ + /* If DW_AT_string_length is defined, the length is stored in memory. */ attr = dwarf2_attr (die, DW_AT_string_length, cu); - if (attr) + if (attr != nullptr && !attr_form_is_constant (attr)) + { +@@ -17372,13 +17379,71 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) + } + + /* Convert the attribute into a dynamic property. */ +- if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) ++ if (!attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0)) + length = 1; + else + length_is_constant = false; + } + else if (attr != nullptr) { -- length = DW_UNSND (attr); + if (attr_form_is_block (attr)) + { + struct attribute *byte_size, *bit_size; @@ -145,8 +163,8 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c + /* Operand for DW_OP_deref_size. */ + (gdb_byte) DW_UNSND(byte_size) }; + -+ if (!attr_to_dynamic_prop (attr, die, cu, &high, append_ops, -+ ARRAY_SIZE(append_ops))) ++ if (!attr_to_dynamic_prop (attr, die, cu, &high, index_type, ++ append_ops, ARRAY_SIZE(append_ops))) + complaint (_("Could not parse DW_AT_byte_size")); + } + else if (bit_size != NULL) @@ -159,8 +177,8 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c + const gdb_byte append_ops[] = + { DW_OP_deref }; + -+ if (!attr_to_dynamic_prop (attr, die, cu, &high, append_ops, -+ ARRAY_SIZE(append_ops))) ++ if (!attr_to_dynamic_prop (attr, die, cu, &high, index_type, ++ append_ops, ARRAY_SIZE(append_ops))) + complaint (_("Could not parse DW_AT_string_length")); + } + @@ -171,56 +189,53 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c + TYPE_HIGH_BOUND (range_type) = DW_UNSND(attr); + TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST; + } ++ + /* This DW_AT_string_length just contains the length with no + indirection. There's no need to create a dynamic property in this + case. Pass 0 for the default value as we know it will not be +@@ -17392,6 +17457,20 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) } else { -- /* Check for the DW_AT_byte_size attribute. */ + /* Check for the DW_AT_byte_size attribute, which represents the length + in this case. */ - attr = dwarf2_attr (die, DW_AT_byte_size, cu); - if (attr) -- { -- length = DW_UNSND (attr); -- } ++ attr = dwarf2_attr (die, DW_AT_byte_size, cu); ++ if (attr) + { + TYPE_HIGH_BOUND (range_type) = DW_UNSND(attr); + TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST; + } - else -- { -- length = 1; -- } ++ else + { + TYPE_HIGH_BOUND (range_type) = 1; + TYPE_HIGH_BOUND_KIND (range_type) = PROP_CONST; + } ++ + /* Use 1 as a fallback length if we have nothing else. */ + length = 1; } - -- index_type = objfile_type (objfile)->builtin_int; -- range_type = create_static_range_type (NULL, index_type, 1, length); +@@ -17407,6 +17486,7 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) + low_bound.data.const_val = 1; + range_type = create_range_type (NULL, index_type, &low_bound, &prop, 0); + } ++ char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -17667,7 +17730,8 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) - +@@ -17858,7 +17938,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, -- struct dwarf2_cu *cu, struct dynamic_prop *prop) -+ struct dwarf2_cu *cu, struct dynamic_prop *prop, + struct dwarf2_cu *cu, struct dynamic_prop *prop, +- struct type *default_type) ++ struct type *default_type, + const gdb_byte *additional_data, int additional_data_size) { struct dwarf2_property_baton *baton; struct obstack *obstack -@@ -17678,14 +17742,33 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, - - if (attr_form_is_block (attr)) - { -- baton = XOBNEW (obstack, struct dwarf2_property_baton); -+ baton = XOBNEW(obstack, struct dwarf2_property_baton); - baton->referenced_type = NULL; - baton->locexpr.per_cu = cu->per_cu; -- baton->locexpr.size = DW_BLOCK (attr)->size; -- baton->locexpr.data = DW_BLOCK (attr)->data; +@@ -17885,9 +17966,30 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, + baton->locexpr.is_reference = false; + break; + } + + if (additional_data != NULL && additional_data_size > 0) + { @@ -249,12 +264,13 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c } else if (attr_form_is_ref (attr)) { -@@ -17718,8 +17801,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -17920,9 +18022,29 @@ 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->property_type = die_type (target_die, target_cu); baton->locexpr.per_cu = cu->per_cu; - baton->locexpr.size = DW_BLOCK (target_attr)->size; - baton->locexpr.data = DW_BLOCK (target_attr)->data; + baton->locexpr.is_reference = true; + + if (additional_data != NULL && additional_data_size > 0) + { @@ -280,124 +296,91 @@ diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c prop->data.baton = baton; prop->kind = PROP_LOCEXPR; gdb_assert (prop->data.baton != NULL); -@@ -17830,7 +17933,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) - - attr = dwarf2_attr (die, DW_AT_byte_stride, cu); - if (attr) -- if (!attr_to_dynamic_prop (attr, die, cu, &stride)) -+ if (!attr_to_dynamic_prop (attr, die, cu, &stride, NULL, 0)) - complaint (_("Missing DW_AT_byte_stride " - "- DIE at 0x%s [in module %s]"), - sect_offset_str (die->sect_off), -@@ -17838,7 +17941,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -18099,8 +18221,8 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) + } attr = dwarf2_attr (die, DW_AT_lower_bound, cu); - if (attr) -- attr_to_dynamic_prop (attr, die, cu, &low); -+ attr_to_dynamic_prop (attr, die, cu, &low, NULL, 0); +- if (attr != nullptr) +- attr_to_dynamic_prop (attr, die, cu, &low, base_type); ++ if (attr) ++ attr_to_dynamic_prop (attr, die, cu, &low, base_type, NULL, 0); else if (!low_default_is_valid) complaint (_("Missing DW_AT_lower_bound " "- DIE at %s [in module %s]"), -@@ -17847,10 +17950,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -18109,10 +18231,10 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *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)) +- if (!attr_to_dynamic_prop (attr, die, cu, &high, base_type)) ++ if (!attr_to_dynamic_prop (attr, die, cu, &high, base_type, NULL, 0)) { 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 (attr_to_dynamic_prop (attr, die, cu, &high, base_type)) ++ if (attr_to_dynamic_prop (attr, die, cu, &high, base_type, NULL, 0)) { /* If bounds are constant do the final calculation here. */ if (low.kind == PROP_CONST && high.kind == PROP_CONST) -@@ -25417,7 +25520,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)) +@@ -18164,7 +18286,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) + struct type *prop_type + = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false); + attr_to_dynamic_prop (attr_byte_stride, die, cu, &byte_stride_prop, +- prop_type); ++ prop_type, NULL, 0); + } + + struct dynamic_prop bit_stride_prop; +@@ -18185,7 +18307,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) + struct type *prop_type + = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false); + attr_to_dynamic_prop (attr_bit_stride, die, cu, &bit_stride_prop, +- prop_type); ++ prop_type, NULL, 0); + } + } + +@@ -25879,7 +26001,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { -- if (attr_to_dynamic_prop (attr, die, cu, &prop)) -+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0)) + struct type *prop_type + = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false); +- if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) ++ if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0)) add_dyn_prop (DYN_PROP_ALLOCATED, prop, type); } else if (attr != NULL) -@@ -25431,7 +25534,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)) +@@ -25895,7 +26017,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) { -- if (attr_to_dynamic_prop (attr, die, cu, &prop)) -+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0)) + struct type *prop_type + = dwarf2_per_cu_addr_sized_int_type (cu->per_cu, false); +- if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type)) ++ if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type, NULL, 0)) add_dyn_prop (DYN_PROP_ASSOCIATED, prop, type); } else if (attr != NULL) -@@ -25443,7 +25546,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) - +@@ -25908,7 +26030,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); -- if (attr_to_dynamic_prop (attr, die, cu, &prop)) -+ if (attr_to_dynamic_prop (attr, die, cu, &prop, NULL, 0)) + if (attr_to_dynamic_prop (attr, die, cu, &prop, +- dwarf2_per_cu_addr_type (cu->per_cu))) ++ dwarf2_per_cu_addr_type (cu->per_cu), NULL, 0)) add_dyn_prop (DYN_PROP_DATA_LOCATION, prop, type); if (dwarf2_per_objfile->die_type_hash == NULL) diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c --- a/gdb/f-typeprint.c +++ b/gdb/f-typeprint.c -@@ -37,7 +37,7 @@ static void f_type_print_args (struct type *, struct ui_file *); - #endif - - static void f_type_print_varspec_suffix (struct type *, struct ui_file *, int, -- int, int, int); -+ int, int, int, int); - - void f_type_print_varspec_prefix (struct type *, struct ui_file *, - int, int); -@@ -53,18 +53,6 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, - { - enum type_code code; - -- if (type_not_associated (type)) -- { -- val_print_not_associated (stream); -- return; -- } -- -- if (type_not_allocated (type)) -- { -- val_print_not_allocated (stream); -- return; -- } -- - f_type_print_base (type, stream, show, level); - code = TYPE_CODE (type); - if ((varstring != NULL && *varstring != '\0') -@@ -89,7 +77,7 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, - - demangled_args = (*varstring != '\0' - && varstring[strlen (varstring) - 1] == ')'); -- f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0); -+ f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0, 0); - } - } - -@@ -159,7 +147,7 @@ f_type_print_varspec_prefix (struct type *type, struct ui_file *stream, - static void - f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - int show, int passed_a_ptr, int demangled_args, -- int arrayprint_recurse_level) -+ int arrayprint_recurse_level, int print_rank_only) - { - int upper_bound, lower_bound; - -@@ -183,34 +171,50 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - fprintf_filtered (stream, "("); - - if (type_not_associated (type)) -- val_print_not_associated (stream); -+ print_rank_only = 1; - else if (type_not_allocated (type)) -- val_print_not_allocated (stream); -+ print_rank_only = 1; -+ else if ((TYPE_ASSOCIATED_PROP (type) -+ && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ASSOCIATED_PROP (type))) +@@ -197,15 +197,14 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, + print_rank_only = true; + else if ((TYPE_ASSOCIATED_PROP (type) + && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ASSOCIATED_PROP (type))) +- || (TYPE_ALLOCATED_PROP (type) +- && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type))) +- || (TYPE_DATA_LOCATION (type) +- && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_DATA_LOCATION (type)))) +- { +- /* This case exist when we ptype a typename which has the dynamic +- properties but cannot be resolved as there is no object. */ +- print_rank_only = true; +- } + || (TYPE_ALLOCATED_PROP (type) + && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type))) + || (TYPE_DATA_LOCATION (type) @@ -405,95 +388,43 @@ diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c + /* This case exist when we ptype a typename which has the + dynamic properties but cannot be resolved as there is + no object. */ -+ print_rank_only = 1; -+ -+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY) -+ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, -+ 0, 0, arrayprint_recurse_level, -+ print_rank_only); -+ -+ if (print_rank_only == 1) -+ fprintf_filtered (stream, ":"); ++ print_rank_only = true; + + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY) + f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, +@@ -217,8 +216,9 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, else -- { -- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY) -- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, -- 0, 0, arrayprint_recurse_level); -- -- lower_bound = f77_get_lowerbound (type); -- if (lower_bound != 1) /* Not the default. */ -- fprintf_filtered (stream, "%d:", lower_bound); -- -- /* Make sure that, if we have an assumed size array, we -- print out a warning and print the upperbound as '*'. */ -- -- if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) -- fprintf_filtered (stream, "*"); -- else -- { -- upper_bound = f77_get_upperbound (type); -- fprintf_filtered (stream, "%d", upper_bound); -- } -- -- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) -- f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, -- 0, 0, arrayprint_recurse_level); -- } -+ { -+ lower_bound = f77_get_lowerbound (type); -+ if (lower_bound != 1) /* Not the default. */ -+ fprintf_filtered (stream, "%d:", lower_bound); -+ -+ /* Make sure that, if we have an assumed size array, we -+ print out a warning and print the upperbound as '*'. */ -+ -+ if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type)) -+ fprintf_filtered (stream, "*"); -+ else -+ { -+ upper_bound = f77_get_upperbound (type); -+ fprintf_filtered (stream, "%d", upper_bound); -+ } -+ } -+ -+ if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) -+ f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, -+ 0, 0, arrayprint_recurse_level, -+ print_rank_only); + { + LONGEST lower_bound = f77_get_lowerbound (type); + - if (arrayprint_recurse_level == 1) - fprintf_filtered (stream, ")"); - else -@@ -221,13 +225,14 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, - case TYPE_CODE_PTR: + if (lower_bound != 1) /* Not the default. */ +- fprintf_filtered (stream, "%s:", plongest (lower_bound)); ++ fprintf_filtered (stream, "%s:", plongest (lower_bound)); + + /* Make sure that, if we have an assumed size array, we + print out a warning and print the upperbound as '*'. */ +@@ -229,7 +229,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, + { + LONGEST upper_bound = f77_get_upperbound (type); + +- fputs_filtered (plongest (upper_bound), stream); ++ fprintf_filtered (stream, "%s", plongest (upper_bound)); + } + } + +@@ -249,7 +249,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, case TYPE_CODE_REF: f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0, -- arrayprint_recurse_level); -+ arrayprint_recurse_level, 0); - fprintf_filtered (stream, ")"); + arrayprint_recurse_level, false); +- fprintf_filtered (stream, " )"); ++ fprintf_filtered (stream, ")"); break; case TYPE_CODE_FUNC: - f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, -- passed_a_ptr, 0, arrayprint_recurse_level); -+ passed_a_ptr, 0, arrayprint_recurse_level, -+ 0); - if (passed_a_ptr) - fprintf_filtered (stream, ")"); - -@@ -388,7 +393,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show, - fputs_filtered (" :: ", stream); - fputs_filtered (TYPE_FIELD_NAME (type, index), stream); - f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index), -- stream, show - 1, 0, 0, 0); -+ stream, show - 1, 0, 0, 0, 0); - fputs_filtered ("\n", stream); - } - fprintfi_filtered (level, stream, "End Type "); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c -@@ -1913,7 +1913,8 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1939,7 +1939,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. */ @@ -503,32 +434,26 @@ 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 -@@ -1947,6 +1948,7 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1972,10 +1973,10 @@ is_dynamic_type_internal (struct type *type, int top_level) + || is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0)); } +- case TYPE_CODE_STRING: + /* Strings are very much like an array of characters, and can be + treated as one here. */ case TYPE_CODE_ARRAY: + case TYPE_CODE_STRING: { gdb_assert (TYPE_NFIELDS (type) == 1); -@@ -2065,7 +2067,8 @@ resolve_dynamic_array (struct type *type, - struct dynamic_prop *prop; - unsigned int bit_stride = 0; - -- gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY); -+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY -+ || TYPE_CODE (type) == TYPE_CODE_STRING); - - type = copy_type (type); - -@@ -2090,11 +2093,15 @@ resolve_dynamic_array (struct type *type, +@@ -2139,11 +2140,15 @@ resolve_dynamic_array_or_string (struct type *type, ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type)); - if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY) + if (ary_dim != NULL && (TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY + || TYPE_CODE (ary_dim) == TYPE_CODE_STRING)) - elt_type = resolve_dynamic_array (ary_dim, addr_stack); + elt_type = resolve_dynamic_array_or_string (ary_dim, addr_stack); else elt_type = TYPE_TARGET_TYPE (type); @@ -538,7 +463,7 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c prop = get_dyn_prop (DYN_PROP_BYTE_STRIDE, type); if (prop != NULL) { -@@ -2249,6 +2256,28 @@ resolve_dynamic_struct (struct type *type, +@@ -2295,6 +2300,28 @@ resolve_dynamic_struct (struct type *type, return resolved_type; } @@ -567,19 +492,16 @@ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c /* Worker for resolved_dynamic_type. */ static struct type * -@@ -2297,7 +2326,12 @@ resolve_dynamic_type_internal (struct type *type, - break; - } - +@@ -2349,6 +2376,9 @@ resolve_dynamic_type_internal (struct type *type, + case TYPE_CODE_ARRAY: + resolved_type = resolve_dynamic_array_or_string (type, addr_stack); + break; + case TYPE_CODE_PTR: + resolved_type = resolve_dynamic_pointer (type, addr_stack); + break; -+ - case TYPE_CODE_ARRAY: -+ case TYPE_CODE_STRING: - resolved_type = resolve_dynamic_array (type, addr_stack); - break; + case TYPE_CODE_RANGE: + resolved_type = resolve_dynamic_range (type, addr_stack); diff --git a/gdb/testsuite/gdb.cp/vla-cxx.cc b/gdb/testsuite/gdb.cp/vla-cxx.cc --- a/gdb/testsuite/gdb.cp/vla-cxx.cc +++ b/gdb/testsuite/gdb.cp/vla-cxx.cc @@ -676,15 +598,15 @@ new file mode 100644 + +gdb_breakpoint [gdb_get_line_number "Before pointer assignment"] +gdb_continue_to_breakpoint "Before pointer assignment" -+gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) 0x0" "print logp, not associated" ++gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) 0x0" "print logp, not associated" +gdb_test "print *logp" "Cannot access memory at address 0x0" "print *logp, not associated" -+gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) 0x0" "print comp, not associated" ++gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) 0x0" "print comp, not associated" +gdb_test "print *comp" "Cannot access memory at address 0x0" "print *comp, not associated" -+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) 0x0" "print charp, not associated" ++gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) 0x0" "print charp, not associated" +gdb_test "print *charp" "Cannot access memory at address 0x0" "print *charp, not associated" -+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) 0x0" "print charap, not associated" ++gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) 0x0" "print charap, not associated" +gdb_test "print *charap" "Cannot access memory at address 0x0" "print *charap, not associated" -+gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" "print intp, not associated" ++gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" "print intp, not associated" +gdb_test "print *intp" "Cannot access memory at address 0x0" "print *intp, not associated" +set test "print intap, not associated" +gdb_test_multiple "print intap" $test { @@ -695,9 +617,9 @@ new file mode 100644 + pass $test + } +} -+gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) 0x0" "print realp, not associated" ++gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) 0x0" "print realp, not associated" +gdb_test "print *realp" "Cannot access memory at address 0x0" "print *realp, not associated" -+gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int \\)\\) 0x0" ++gdb_test "print \$my_var = intp" "= \\(PTR TO -> \\( $int\\)\\) 0x0" +set test "print cyclicp1, not associated" +gdb_test_multiple "print cyclicp1" $test { + -re "= \\( i = -?\\d+, p = 0x0 \\)\r\n$gdb_prompt $" { @@ -709,10 +631,10 @@ new file mode 100644 +} +set test "print cyclicp1%p, not associated" +gdb_test_multiple "print cyclicp1%p" $test { -+ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) 0x0\r\n$gdb_prompt $" { ++ -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) 0x0\r\n$gdb_prompt $" { + pass $test + } -+ -re "= \\(PTR TO -> \\( Type typewithpointer \\)\\) \r\n$gdb_prompt $" { ++ -re "= \\(PTR TO -> \\( Type typewithpointer\\)\\) \r\n$gdb_prompt $" { + pass $test + } +} @@ -725,15 +647,15 @@ new file mode 100644 + +gdb_breakpoint [gdb_get_line_number "After value assignment"] +gdb_continue_to_breakpoint "After value assignment" -+gdb_test "print logp" "= \\(PTR TO -> \\( $logical \\)\\) $hex\( <.*>\)?" ++gdb_test "print logp" "= \\(PTR TO -> \\( $logical\\)\\) $hex\( <.*>\)?" +gdb_test "print *logp" "= \\.TRUE\\." -+gdb_test "print comp" "= \\(PTR TO -> \\( $complex \\)\\) $hex\( <.*>\)?" ++gdb_test "print comp" "= \\(PTR TO -> \\( $complex\\)\\) $hex\( <.*>\)?" +gdb_test "print *comp" "= \\(1,2\\)" -+gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1 \\)\\) $hex\( <.*>\)?" ++gdb_test "print charp" "= \\(PTR TO -> \\( character\\*1\\)\\) $hex\( <.*>\)?" +gdb_test "print *charp" "= 'a'" -+gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\( <.*>\)?" ++gdb_test "print charap" "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\( <.*>\)?" +gdb_test "print *charap" "= 'abc'" -+gdb_test "print intp" "= \\(PTR TO -> \\( $int \\)\\) $hex\( <.*>\)?" ++gdb_test "print intp" "= \\(PTR TO -> \\( $int\\)\\) $hex\( <.*>\)?" +gdb_test "print *intp" "= 10" +set test_name "print intap, associated" +gdb_test_multiple "print intap" $test_name { @@ -755,16 +677,16 @@ new file mode 100644 + pass $test_name + } +} -+gdb_test "print realp" "= \\(PTR TO -> \\( $real \\)\\) $hex\( <.*>\)?" ++gdb_test "print realp" "= \\(PTR TO -> \\( $real\\)\\) $hex\( <.*>\)?" +gdb_test "print *realp" "= 3\\.14000\\d+" -+gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two \\)\\) $hex\( <.*>\)?" ++gdb_test "print arrayOfPtr(2)%p" "= \\(PTR TO -> \\( Type two\\)\\) $hex\( <.*>\)?" +gdb_test "print *(arrayOfPtr(2)%p)" "= \\( ivla1 = \\(11, 12, 13\\), ivla2 = \\(\\( 211, 221\\) \\( 212, 222\\) \\) \\)" +set test_name "print arrayOfPtr(3)%p" +gdb_test_multiple $test_name $test_name { -+ -re "= \\(PTR TO -> \\( Type two \\)\\) \r\n$gdb_prompt $" { ++ -re "= \\(PTR TO -> \\( Type two\\)\\) \r\n$gdb_prompt $" { + pass $test_name + } -+ -re "= \\(PTR TO -> \\( Type two \\)\\) 0x0\r\n$gdb_prompt $" { ++ -re "= \\(PTR TO -> \\( Type two\\)\\) 0x0\r\n$gdb_prompt $" { + pass $test_name + } +} @@ -778,37 +700,17 @@ new file mode 100644 + } +} +gdb_test "print cyclicp1" "= \\( i = 1, p = $hex\( <.*>\)? \\)" -+gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer \\)\\) $hex\( <.*>\)?" ++gdb_test "print cyclicp1%p" "= \\(PTR TO -> \\( Type typewithpointer\\)\\) $hex\( <.*>\)?" +gdb_test "print *((integer*) &inta + 2)" "= 3" "print temporary pointer, array" +gdb_test "print *((integer*) &intvla + 3)" "= 4" "print temporary pointer, allocated vla" -+gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\)\\(\\)\\)\\) $hex " "Print program counter" ++gdb_test "print \$pc" "= \\(PTR TO -> \\( void \\(\\) \\(\\)\\)\\) $hex " "Print program counter" diff --git a/gdb/testsuite/gdb.fortran/pointers.f90 b/gdb/testsuite/gdb.fortran/pointers.f90 -new file mode 100644 ---- /dev/null +--- a/gdb/testsuite/gdb.fortran/pointers.f90 +++ b/gdb/testsuite/gdb.fortran/pointers.f90 -@@ -0,0 +1,109 @@ -+! Copyright 2016 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 . -+ -+program pointers -+ -+ type :: two -+ integer, allocatable :: ivla1 (:) -+ integer, allocatable :: ivla2 (:, :) -+ end type two -+ +@@ -20,21 +20,34 @@ program pointers + integer, allocatable :: ivla2 (:, :) + end type two + + type :: typeWithPointer + integer i + type(typeWithPointer), pointer:: p @@ -818,229 +720,125 @@ new file mode 100644 + type (two), pointer :: p + end type twoPtr + -+ logical, target :: logv -+ complex, target :: comv -+ character, target :: charv -+ character (len=3), target :: chara -+ integer, target :: intv -+ integer, target, dimension (10,2) :: inta + logical, target :: logv + complex, target :: comv + character, target :: charv + character (len=3), target :: chara + integer, target :: intv + integer, target, dimension (10,2) :: inta +- real, target :: realv +- type(two), target :: twov + integer, target, allocatable, dimension (:) :: intvla + real, target :: realv + type(two), target :: twov + type(twoPtr) :: arrayOfPtr (3) + type(typeWithPointer), target:: cyclicp1,cyclicp2 -+ -+ logical, pointer :: logp -+ complex, pointer :: comp + + logical, pointer :: logp + complex, pointer :: comp +- character, pointer :: charp +- character (len=3), pointer :: charap + character, pointer:: charp + character (len=3), pointer:: charap -+ integer, pointer :: intp -+ integer, pointer, dimension (:,:) :: intap + integer, pointer :: intp + integer, pointer, dimension (:,:) :: intap + integer, pointer, dimension (:) :: intvlap -+ real, pointer :: realp -+ type(two), pointer :: twop -+ -+ nullify (logp) -+ nullify (comp) -+ nullify (charp) -+ nullify (charap) -+ nullify (intp) -+ nullify (intap) + real, pointer :: realp + type(two), pointer :: twop + +@@ -44,8 +57,14 @@ program pointers + nullify (charap) + nullify (intp) + nullify (intap) + nullify (intvlap) -+ nullify (realp) -+ nullify (twop) + nullify (realp) + nullify (twop) + nullify (arrayOfPtr(1)%p) + nullify (arrayOfPtr(2)%p) + nullify (arrayOfPtr(3)%p) + nullify (cyclicp1%p) + nullify (cyclicp2%p) -+ -+ logp => logv ! Before pointer assignment -+ comp => comv -+ charp => charv -+ charap => chara -+ intp => intv -+ intap => inta + + logp => logv ! Before pointer assignment + comp => comv +@@ -53,8 +72,14 @@ program pointers + charap => chara + intp => intv + intap => inta + intvlap => intvla -+ realp => realv -+ twop => twov + realp => realv + twop => twov + arrayOfPtr(2)%p => twov + cyclicp1%i = 1 + cyclicp1%p => cyclicp2 + cyclicp2%i = 2 + cyclicp2%p => cyclicp1 -+ -+ logv = associated(logp) ! Before value assignment -+ comv = cmplx(1,2) -+ charv = "a" -+ chara = "abc" -+ intv = 10 -+ inta(:,:) = 1 -+ inta(3,1) = 3 + + logv = associated(logp) ! Before value assignment + comv = cmplx(1,2) +@@ -63,6 +88,10 @@ program pointers + intv = 10 + inta(:,:) = 1 + inta(3,1) = 3 + allocate (intvla(10)) + intvla(:) = 2 + intvla(4) = 4 + intvlap => intvla -+ realv = 3.14 -+ -+ allocate (twov%ivla1(3)) -+ allocate (twov%ivla2(2,2)) -+ twov%ivla1(1) = 11 -+ twov%ivla1(2) = 12 -+ twov%ivla1(3) = 13 -+ twov%ivla2(1,1) = 211 -+ twov%ivla2(2,1) = 221 -+ twov%ivla2(1,2) = 212 -+ twov%ivla2(2,2) = 222 -+ -+ intv = intv + 1 ! After value assignment -+ -+end program pointers + realv = 3.14 + + allocate (twov%ivla1(3)) diff --git a/gdb/testsuite/gdb.fortran/print_type.exp b/gdb/testsuite/gdb.fortran/print_type.exp -new file mode 100644 ---- /dev/null +--- a/gdb/testsuite/gdb.fortran/print_type.exp +++ b/gdb/testsuite/gdb.fortran/print_type.exp -@@ -0,0 +1,100 @@ -+# Copyright 2016 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 . -+ -+standard_testfile "pointers.f90" -+load_lib fortran.exp -+ -+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \ -+ {debug f90 quiet}] } { -+ return -1 -+} -+ -+ -+if ![runto_main] { -+ untested "could not run to main" -+ return -1 -+} -+ -+# Depending on the compiler being used, the type names can be printed differently. -+set logical [fortran_logical4] -+set real [fortran_real4] -+set int [fortran_int4] -+set complex [fortran_complex4] -+ -+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"] -+gdb_continue_to_breakpoint "Before pointer assignment" -+gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)" "ptype logp, not associated" -+gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)" "ptype comp, not associated" -+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)" "ptype charp, not associated" -+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)" "ptype charap, not associated" -+gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)" "ptype intp, not associated" -+set test "ptype intap, not associated" -+gdb_test_multiple "ptype intap" $test { -+ -re "type = PTR TO -> \\( $int \\(:,:\\)\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "type = $int \\(:,:\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)" "ptype realp, not associated" -+gdb_test "ptype twop" \ -+ [multi_line "type = PTR TO -> \\( Type two" \ -+ " $int :: ivla1\\(:\\)" \ -+ " $int :: ivla2\\(:,:\\)" \ -+ "End Type two \\)"] \ -+ "ptype twop, not associated" -+gdb_test "ptype two" \ -+ [multi_line "type = Type two" \ -+ " $int :: ivla1\\(:\\)" \ -+ " $int :: ivla2\\(:,:\\)" \ -+ "End Type two"] -+ -+ -+gdb_breakpoint [gdb_get_line_number "Before value assignment"] -+gdb_continue_to_breakpoint "Before value assignment" -+gdb_test "ptype twop" \ -+ [multi_line "type = PTR TO -> \\( Type two" \ -+ " $int :: ivla1\\(:\\)" \ -+ " $int :: ivla2\\(:,:\\)" \ -+ "End Type two \\)"] -+ -+ -+gdb_breakpoint [gdb_get_line_number "After value assignment"] -+gdb_continue_to_breakpoint "After value assignment" -+gdb_test "ptype logv" "type = $logical" -+gdb_test "ptype comv" "type = $complex" -+gdb_test "ptype charv" "type = character\\*1" -+gdb_test "ptype chara" "type = character\\*3" -+gdb_test "ptype intv" "type = $int" -+gdb_test "ptype inta" "type = $int \\(10,2\\)" -+gdb_test "ptype realv" "type = $real" -+ -+ -+gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)" -+gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)" -+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)" -+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)" -+gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)" -+set test "ptype intap" -+gdb_test_multiple $test $test { -+ -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "type = PTR TO -> \\( $int \\(10,2\\)\\)\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)" -diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp ---- a/gdb/testsuite/gdb.fortran/vla-ptype.exp -+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp -@@ -32,9 +32,9 @@ set real [fortran_real4] - # Check the ptype of various VLA states and pointer to VLA's. - gdb_breakpoint [gdb_get_line_number "vla1-init"] - gdb_continue_to_breakpoint "vla1-init" --gdb_test "ptype vla1" "type = " "ptype vla1 not initialized" --gdb_test "ptype vla2" "type = " "ptype vla2 not initialized" --gdb_test "ptype pvla" "type = " "ptype pvla not initialized" -+gdb_test "ptype vla1" "type = $real \\(:,:,:\\)" "ptype vla1 not initialized" -+gdb_test "ptype vla2" "type = $real \\(:,:,:\\)" "ptype vla2 not initialized" -+gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla not initialized" - gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \ - "ptype vla1(3, 6, 9) not initialized" - gdb_test "ptype vla2(5, 45, 20)" \ -@@ -81,20 +81,20 @@ gdb_test "ptype vla2(5, 45, 20)" "type = $real" \ +@@ -1,5 +1,6 @@ + # Copyright 2019-2020 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 +@@ -40,7 +41,7 @@ set complex [fortran_complex4] + # matches the string TYPE. + proc check_pointer_type { var_name type } { + gdb_test "ptype ${var_name}" \ +- "type = PTR TO -> \\( ${type} \\)" ++ "type = PTR TO -> \\( ${type}\\)" + } - gdb_breakpoint [gdb_get_line_number "pvla-deassociated"] - gdb_continue_to_breakpoint "pvla-deassociated" --gdb_test "ptype pvla" "type = " "ptype pvla deassociated" -+gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla deassociated" - gdb_test "ptype pvla(5, 45, 20)" \ - "no such vector element \\\(vector not associated\\\)" \ - "ptype pvla(5, 45, 20) not associated" + gdb_breakpoint [gdb_get_line_number "Before pointer assignment"] +@@ -85,7 +86,8 @@ gdb_test "ptype twop" \ + [multi_line "type = PTR TO -> \\( Type two" \ + " $int, allocatable :: ivla1\\(:\\)" \ + " $int, allocatable :: ivla2\\(:,:\\)" \ +- "End Type two \\)"] ++ "End Type two\\)"] ++ - gdb_breakpoint [gdb_get_line_number "vla1-deallocated"] - gdb_continue_to_breakpoint "vla1-deallocated" --gdb_test "ptype vla1" "type = " "ptype vla1 not allocated" -+gdb_test "ptype vla1" "type = $real \\(:,:,:\\)" "ptype vla1 not allocated" - gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \ - "ptype vla1(3, 6, 9) not allocated" + gdb_breakpoint [gdb_get_line_number "After value assignment"] + gdb_continue_to_breakpoint "After value assignment" +@@ -97,11 +99,11 @@ gdb_test "ptype intv" "type = $int" + gdb_test "ptype inta" "type = $int \\(10,2\\)" + gdb_test "ptype realv" "type = $real" - gdb_breakpoint [gdb_get_line_number "vla2-deallocated"] - gdb_continue_to_breakpoint "vla2-deallocated" --gdb_test "ptype vla2" "type = " "ptype vla2 not allocated" -+gdb_test "ptype vla2" "type = $real \\(:,:,:\\)" "ptype vla2 not allocated" - gdb_test "ptype vla2(5, 45, 20)" \ - "no such vector element \\\(vector not allocated\\\)" \ - "ptype vla2(5, 45, 20) not allocated" +-gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)" +-gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)" +-gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)" +-gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)" +-gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)" ++gdb_test "ptype logp" "type = PTR TO -> \\( $logical\\)" ++gdb_test "ptype comp" "type = PTR TO -> \\( $complex\\)" ++gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1\\)" ++gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3\\)" ++gdb_test "ptype intp" "type = PTR TO -> \\( $int\\)" + set test "ptype intap" + gdb_test_multiple $test $test { + -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" { +@@ -111,4 +113,4 @@ gdb_test_multiple $test $test { + pass $test + } + } +-gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)" ++gdb_test "ptype realp" "type = PTR TO -> \\( $real\\)" diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp new file mode 100644 --- /dev/null @@ -1080,7 +878,7 @@ new file mode 100644 +gdb_continue_to_breakpoint "var_char-allocated-1" +set test "whatis var_char first time" +gdb_test_multiple "whatis var_char" $test { -+ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" { ++ -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" { + pass $test + } + -re "type = character\\*10\r\n$gdb_prompt $" { @@ -1089,7 +887,7 @@ new file mode 100644 +} +set test "ptype var_char first time" +gdb_test_multiple "ptype var_char" $test { -+ -re "type = PTR TO -> \\( character\\*10 \\)\r\n$gdb_prompt $" { ++ -re "type = PTR TO -> \\( character\\*10\\)\r\n$gdb_prompt $" { + pass $test + } + -re "type = character\\*10\r\n$gdb_prompt $" { @@ -1107,7 +905,7 @@ new file mode 100644 +gdb_continue_to_breakpoint "var_char-filled-1" +set test "print var_char, var_char-filled-1" +gdb_test_multiple "print var_char" $test { -+ -re "= \\(PTR TO -> \\( character\\*3 \\)\\) $hex\r\n$gdb_prompt $" { ++ -re "= \\(PTR TO -> \\( character\\*3\\)\\) $hex\r\n$gdb_prompt $" { + gdb_test "print *var_char" "= 'foo'" "print *var_char, var_char-filled-1" + pass $test + } @@ -1117,7 +915,7 @@ new file mode 100644 +} +set test "ptype var_char, var_char-filled-1" +gdb_test_multiple "ptype var_char" $test { -+ -re "type = PTR TO -> \\( character\\*3 \\)\r\n$gdb_prompt $" { ++ -re "type = PTR TO -> \\( character\\*3\\)\r\n$gdb_prompt $" { + pass $test + } + -re "type = character\\*3\r\n$gdb_prompt $" { @@ -1132,7 +930,7 @@ new file mode 100644 +gdb_continue_to_breakpoint "var_char-filled-2" +set test "print var_char, var_char-filled-2" +gdb_test_multiple "print var_char" $test { -+ -re "= \\(PTR TO -> \\( character\\*6 \\)\\) $hex\r\n$gdb_prompt $" { ++ -re "= \\(PTR TO -> \\( character\\*6\\)\\) $hex\r\n$gdb_prompt $" { + gdb_test "print *var_char" "= 'foobar'" "print *var_char, var_char-filled-2" + pass $test + } @@ -1142,7 +940,7 @@ new file mode 100644 +} +set test "ptype var_char, var_char-filled-2" +gdb_test_multiple "ptype var_char" $test { -+ -re "type = PTR TO -> \\( character\\*6 \\)\r\n$gdb_prompt $" { ++ -re "type = PTR TO -> \\( character\\*6\\)\r\n$gdb_prompt $" { + pass $test + } + -re "type = character\\*6\r\n$gdb_prompt $" { @@ -1193,30 +991,6 @@ new file mode 100644 + var_char_p => null() + l = associated(var_char_p) ! var_char_p-not-associated +end program vla_strings -diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp ---- a/gdb/testsuite/gdb.fortran/vla-type.exp -+++ b/gdb/testsuite/gdb.fortran/vla-type.exp -@@ -132,7 +132,10 @@ gdb_test "ptype fivearr(2)%tone" \ - "End Type one" ] - - # Check allocation status of dynamic array and it's dynamic members --gdb_test "ptype fivedynarr" "type = " -+gdb_test "ptype fivedynarr" \ -+ [multi_line "type = Type five" \ -+ " Type one :: tone" \ -+ "End Type five \\(:\\)" ] - gdb_test "next" "" - gdb_test "ptype fivedynarr(2)" \ - [multi_line "type = Type five" \ -@@ -141,7 +144,7 @@ gdb_test "ptype fivedynarr(2)" \ - "ptype fivedynarr(2), tone is not allocated" - gdb_test "ptype fivedynarr(2)%tone" \ - [multi_line "type = Type one" \ -- " $int :: ivla\\(\\)" \ -+ " $int :: ivla\\(:,:,:\\)" \ - "End Type one" ] \ - "ptype fivedynarr(2)%tone, not allocated" - diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp --- a/gdb/testsuite/gdb.fortran/vla-value.exp +++ b/gdb/testsuite/gdb.fortran/vla-value.exp @@ -1224,53 +998,42 @@ diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran gdb_continue_to_breakpoint "vla1-init" gdb_test "print vla1" " = " "print non-allocated vla1" gdb_test "print &vla1" \ -- " = \\\(PTR TO -> \\\( $real \\\(\\\)\\\)\\\) $hex" \ -+ " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \ +- " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\) \\\)\\\) $hex" \ ++ " = \\\(PTR TO -> \\\( $real, allocatable \\\(:,:,:\\\)\\\)\\\) $hex" \ "print non-allocated &vla1" gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \ "print member in non-allocated vla1 (1)" +@@ -56,7 +56,7 @@ with_timeout_factor 15 { + "step over value assignment of vla1" + } + gdb_test "print &vla1" \ +- " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\) \\\)\\\) $hex" \ ++ " = \\\(PTR TO -> \\\( $real, allocatable \\\(10,10,10\\\)\\\)\\\) $hex" \ + "print allocated &vla1" + gdb_test "print vla1(3, 6, 9)" " = 1311" "print allocated vla1(3,6,9)" + gdb_test "print vla1(1, 3, 8)" " = 1311" "print allocated vla1(1,3,8)" @@ -76,7 +76,7 @@ gdb_test "print vla1(9, 9, 9)" " = 999" \ # Try to access values in undefined pointer to VLA (dangling) gdb_test "print pvla" " = " "print undefined pvla" gdb_test "print &pvla" \ -- " = \\\(PTR TO -> \\\( $real \\\(\\\)\\\)\\\) $hex" \ +- " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\) \\\)\\\) $hex" \ + " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \ "print non-associated &pvla" gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \ "print undefined pvla(1,3,8)" -diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp ---- a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp -+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp -@@ -51,10 +51,10 @@ mi_expect_stop "breakpoint-hit" "vla" "" ".*vla.f90" "$bp_lineno" \ - mi_gdb_test "500-data-evaluate-expression vla1" \ - "500\\^done,value=\"\"" "evaluate not allocated vla, before allocation" - --mi_create_varobj_checked vla1_not_allocated vla1 "" \ -+mi_create_varobj_checked vla1_not_allocated vla1 "$real \\(:\\)" \ - "create local variable vla1_not_allocated" - mi_gdb_test "501-var-info-type vla1_not_allocated" \ -- "501\\^done,type=\"\"" \ -+ "501\\^done,type=\"$real \\(:\\)\"" \ - "info type variable vla1_not_allocated" - mi_gdb_test "502-var-show-format vla1_not_allocated" \ - "502\\^done,format=\"natural\"" \ -@@ -146,10 +146,10 @@ gdb_expect { - -re "580\\^done,value=\"\".*${mi_gdb_prompt}$" { - pass $test - -- mi_create_varobj_checked pvla2_not_associated pvla2 "" \ -+ mi_create_varobj_checked pvla2_not_associated pvla2 "$real \\(:,:\\)" \ - "create local variable pvla2_not_associated" - mi_gdb_test "581-var-info-type pvla2_not_associated" \ -- "581\\^done,type=\"\"" \ -+ "581\\^done,type=\"$real \\(:,:\\)\"" \ - "info type variable pvla2_not_associated" - mi_gdb_test "582-var-show-format pvla2_not_associated" \ - "582\\^done,format=\"natural\"" \ +@@ -85,7 +85,7 @@ gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated + gdb_breakpoint [gdb_get_line_number "pvla-associated"] + gdb_continue_to_breakpoint "pvla-associated" + gdb_test "print &pvla" \ +- " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\) \\\)\\\) $hex" \ ++ " = \\\(PTR TO -> \\\( $real \\\(10,10,10\\\)\\\)\\\) $hex" \ + "print associated &pvla" + gdb_test "print pvla(3, 6, 9)" " = 42" "print associated pvla(3,6,9)" + gdb_test "print pvla(1, 3, 8)" " = 1001" "print associated pvla(1,3,8)" diff --git a/gdb/typeprint.c b/gdb/typeprint.c --- a/gdb/typeprint.c +++ b/gdb/typeprint.c -@@ -589,6 +589,25 @@ whatis_exp (const char *exp, int show) +@@ -574,6 +574,25 @@ whatis_exp (const char *exp, int show) printf_filtered (" */\n"); } @@ -1332,7 +1095,7 @@ diff --git a/gdb/valops.c b/gdb/valops.c diff --git a/gdb/valprint.c b/gdb/valprint.c --- a/gdb/valprint.c +++ b/gdb/valprint.c -@@ -1108,12 +1108,6 @@ value_check_printable (struct value *val, struct ui_file *stream, +@@ -1149,12 +1149,6 @@ value_check_printable (struct value *val, struct ui_file *stream, return 0; } @@ -1345,4 +1108,3 @@ diff --git a/gdb/valprint.c b/gdb/valprint.c if (type_not_allocated (value_type (val))) { val_print_not_allocated (stream); - diff --git a/gdb-vla-intel-stringbt-fix.patch b/gdb-vla-intel-stringbt-fix.patch index b31e525a7c91b588493a271405cb1d78ab3c2a94..1e2eeba6d071ce7b56f0c27aa60f21b255a1ffd6 100644 --- a/gdb-vla-intel-stringbt-fix.patch +++ b/gdb-vla-intel-stringbt-fix.patch @@ -1,37 +1,7 @@ -http://sourceware.org/ml/gdb-patches/2014-08/msg00025.html - -On Fri, 01 Aug 2014 09:20:19 +0200, Keven Boell wrote: -> I just tried it on Fedora 20 i686. Applied the patch, you mentioned, on top of -> the Fortran VLA series and executed your dynamic-other-frame test. Everything -> is working fine here, I cannot reproduce the crash. - -I have it reproducible on Fedora 20 i686 with plain -CFLAGS=-g ./configure;make;cd gdb/testsuite;make site.exp;runtest gdb.fortran/dynamic-other-frame.exp - -Besides that I have updated the testcase with - gdb_test_no_output "set print frame-arguments all" -so that there is no longer needed the patch: - [patch] Display Fortran strings in backtraces - https://sourceware.org/ml/gdb-patches/2014-07/msg00709.html - -The fix below has no regressions for me. Unfortunately I do not see why you -cannot reproduce it. - -Thanks, -Jan - diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -42,6 +42,7 @@ - #include - #include - #include -+#include - #include "common/underlying.h" - #include "common/byte-vector.h" - -@@ -2158,6 +2159,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2154,6 +2154,20 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, ctx.per_cu = per_cu; ctx.obj_address = 0; @@ -166,4 +136,3 @@ new file mode 100644 + end interface + call foo ('hello') +end - diff --git a/gdb-vla-intel-tests.patch b/gdb-vla-intel-tests.patch index d7a2407f8e7fe02d74aabf90916ea2f96411d3a7..b2ab402f5a98842e8a695f204a0d55501a1019f3 100644 --- a/gdb-vla-intel-tests.patch +++ b/gdb-vla-intel-tests.patch @@ -1,3 +1,22 @@ +diff --git a/gdb/testsuite/gdb.fortran/ptr-indentation.exp b/gdb/testsuite/gdb.fortran/ptr-indentation.exp +--- a/gdb/testsuite/gdb.fortran/ptr-indentation.exp ++++ b/gdb/testsuite/gdb.fortran/ptr-indentation.exp +@@ -37,5 +37,5 @@ gdb_continue_to_breakpoint "BP1" + gdb_test "ptype tinsta" \ + [multi_line "type = Type tuserdef" \ + " $int :: i" \ +- " PTR TO -> \\( $real :: ptr \\)" \ ++ " PTR TO -> \\( $real :: ptr\\)" \ + "End Type tuserdef"] +diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp +--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp ++++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp +@@ -42,4 +42,4 @@ gdb_test "ptype say_numbers" \ + "type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)" + + gdb_test "ptype fun_ptr" \ +- "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)" ++ "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\)\\)\\)\\)" diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp new file mode 100644 --- /dev/null @@ -35,7 +54,7 @@ new file mode 100644 +gdb_continue_to_breakpoint "func1-vla-passed" +gdb_test "print vla" " = \\( *\\( *22, *22, *22,\[()22, .\]*\\)" \ + "print vla (func1)" -+gdb_test "ptype vla" "type = integer\\\(kind=4\\\) \\\(10,10\\\)" \ ++gdb_test "ptype vla" "type = integer\\\(kind=4\\\), allocatable \\\(10,10\\\)" \ + "ptype vla (func1)" + +gdb_breakpoint [gdb_get_line_number "func1-vla-modified"] @@ -62,7 +81,7 @@ new file mode 100644 +gdb_continue_to_breakpoint "func2-returned" +gdb_test "print vla3" " = \\\(1, 2, 44, 4, 44, 44, 44, 8, 44, 44\\\)" \ + "print vla3 (after func2)" -+gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \ ++gdb_test "ptype vla3" "type = integer\\\(kind=4\\\), allocatable \\\(10\\\)" \ + "ptype vla3 (after func2)" diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90 new file mode 100644 @@ -140,6 +159,16 @@ new file mode 100644 + + ret = .TRUE. ! func2-returned +end program vla_func +diff --git a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp +--- a/gdb/testsuite/gdb.fortran/vla-ptr-info.exp ++++ b/gdb/testsuite/gdb.fortran/vla-ptr-info.exp +@@ -28,5 +28,5 @@ if ![runto_main] { + # Check the status of a pointer to a dynamic array. + gdb_breakpoint [gdb_get_line_number "pvla-associated"] + gdb_continue_to_breakpoint "pvla-associated" +-gdb_test "print &pvla" " = \\(PTR TO -> \\( real\\(kind=4\\) \\(10,10,10\\) \\)\\) ${hex}" \ ++gdb_test "print &pvla" " = \\(PTR TO -> \\( real\\(kind=4\\) \\(10,10,10\\)\\)\\) ${hex}" \ + "print pvla pointer information" diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.exp b/gdb/testsuite/gdb.fortran/vla-stringsold.exp new file mode 100644 --- /dev/null @@ -178,11 +207,11 @@ new file mode 100644 +gdb_breakpoint [gdb_get_line_number "var_char-allocated-1"] +gdb_continue_to_breakpoint "var_char-allocated-1" +gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*10 \\)\\) ${hex}" \ ++ " = \\(PTR TO -> \\( character\\*10\\)\\) ${hex}" \ + "print var_char after allocated first time" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10 \\)" \ ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*10\\)" \ + "whatis var_char first time" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10 \\)" \ ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*10\\)" \ + "ptype var_char first time" +gdb_test "next" "\\d+.*var_char = 'foo'.*" \ + "next to allocation status of var_char" @@ -191,13 +220,13 @@ new file mode 100644 +gdb_breakpoint [gdb_get_line_number "var_char-filled-1"] +gdb_continue_to_breakpoint "var_char-filled-1" +gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*3 \\)\\) ${hex}" \ ++ " = \\(PTR TO -> \\( character\\*3\\)\\) ${hex}" \ + "print var_char after filled first time" +gdb_test "print *var_char" " = 'foo'" \ + "print *var_char after filled first time" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3 \\)" \ ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*3\\)" \ + "whatis var_char after filled first time" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3 \\)" \ ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*3\\)" \ + "ptype var_char after filled first time" +gdb_test "print var_char(1)" " = 102 'f'" "print var_char(1)" +gdb_test "print var_char(3)" " = 111 'o'" "print var_char(3)" @@ -205,46 +234,46 @@ new file mode 100644 +gdb_breakpoint [gdb_get_line_number "var_char-filled-2"] +gdb_continue_to_breakpoint "var_char-filled-2" +gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*6 \\)\\) ${hex}" \ ++ " = \\(PTR TO -> \\( character\\*6\\)\\) ${hex}" \ + "print var_char after allocated second time" +gdb_test "print *var_char" " = 'foobar'" \ + "print *var_char after allocated second time" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6 \\)" \ ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*6\\)" \ + "whatis var_char second time" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6 \\)" \ ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*6\\)" \ + "ptype var_char second time" + +gdb_breakpoint [gdb_get_line_number "var_char-empty"] +gdb_continue_to_breakpoint "var_char-empty" +gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*0 \\)\\) ${hex}" \ ++ " = \\(PTR TO -> \\( character\\*0\\)\\) ${hex}" \ + "print var_char after set empty" +gdb_test "print *var_char" " = \"\"" "print *var_char after set empty" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0 \\)" \ ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*0\\)" \ + "whatis var_char after set empty" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0 \\)" \ ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*0\\)" \ + "ptype var_char after set empty" + +gdb_breakpoint [gdb_get_line_number "var_char-allocated-3"] +gdb_continue_to_breakpoint "var_char-allocated-3" +gdb_test "print var_char" \ -+ " = \\(PTR TO -> \\( character\\*21 \\)\\) ${hex}" \ ++ " = \\(PTR TO -> \\( character\\*21\\)\\) ${hex}" \ + "print var_char after allocated third time" -+gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21 \\)" \ ++gdb_test "whatis var_char" "type = PTR TO -> \\( character\\*21\\)" \ + "whatis var_char after allocated third time" -+gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21 \\)" \ ++gdb_test "ptype var_char" "type = PTR TO -> \\( character\\*21\\)" \ + "ptype var_char after allocated third time" + +gdb_breakpoint [gdb_get_line_number "var_char_p-associated"] +gdb_continue_to_breakpoint "var_char_p-associated" +gdb_test "print var_char_p" \ -+ " = \\(PTR TO -> \\( character\\*7 \\)\\) ${hex}" \ ++ " = \\(PTR TO -> \\( character\\*7\\)\\) ${hex}" \ + "print var_char_p after associated" +gdb_test "print *var_char_p" " = 'johndoe'" \ + "print *var_char_ after associated" -+gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ ++gdb_test "whatis var_char_p" "type = PTR TO -> \\( character\\*7\\)" \ + "whatis var_char_p after associated" -+gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ ++gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7\\)" \ + "ptype var_char_p after associated" diff --git a/gdb/testsuite/gdb.fortran/vla-stringsold.f90 b/gdb/testsuite/gdb.fortran/vla-stringsold.f90 new file mode 100644 @@ -291,4 +320,21 @@ new file mode 100644 + var_char_p => null() + l = associated(var_char_p) ! var_char_p-not-associated +end program vla_strings - +diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp +--- a/gdb/testsuite/gdb.fortran/whatis_type.exp ++++ b/gdb/testsuite/gdb.fortran/whatis_type.exp +@@ -44,7 +44,7 @@ gdb_test "whatis t2" "type = Type t2" + gdb_test "whatis t2v" "type = Type t2" + gdb_test "whatis t3" "type = Type t3" + gdb_test "whatis t3v" "type = Type t3" +-gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3 \\)" ++gdb_test "whatis t3p" "type = PTR TO -> \\( Type t3\\)" + + gdb_test "ptype t1" \ + [multi_line "type = Type t1" \ +@@ -73,4 +73,4 @@ gdb_test "ptype t3p" \ + [multi_line "type = PTR TO -> \\( Type t3" \ + " $int :: t3_i" \ + " Type t2 :: t2_n" \ +- "End Type t3 \\)"] ++ "End Type t3\\)"] diff --git a/gdb.spec b/gdb.spec index de0f12a5ebd0e921a234ce3286278b5b1a867e9c..9ca3cab8a4b6171a6ec3da4288e1a3ccffce7669 100644 --- a/gdb.spec +++ b/gdb.spec @@ -1,6 +1,6 @@ Name: gdb -Version: 8.3.1 -Release: 12 +Version: 9.2 +Release: 1 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 Source: ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.xz @@ -14,10 +14,10 @@ URL: http://gnu.org/software/gdb/ Summary: GNU Project debugger -Recommends: gcc-gdb-plugin%{?_isa} +Recommends: gcc-gdb-plugin Recommends: dnf-command(debuginfo-install) Conflicts: gdb-headless < 7.12-29 -Requires: gdb-headless%{?_isa} = %{version}-%{release} +Requires: gdb-headless = %{version}-%{release} BuildRequires: gdb %description @@ -46,133 +46,110 @@ Source1: gdb-gstack.man Source2: gdbinit # patch from Fedora -Patch2: gdb-vla-intel-fortran-strides.patch -Patch3: gdb-vla-intel-fortran-vla-strings.patch -Patch4: gdb-vla-intel-stringbt-fix.patch -Patch5: gdb-6.3-gstack-20050411.patch -Patch6: gdb-6.3-test-pie-20050107.patch -Patch7: gdb-6.3-test-self-20050110.patch -Patch8: gdb-6.3-test-dtorfix-20050121.patch -Patch9: gdb-6.3-test-movedir-20050125.patch -Patch10: gdb-6.3-threaded-watchpoints2-20050225.patch -Patch11: gdb-6.3-inferior-notification-20050721.patch -Patch12: gdb-6.3-inheritancetest-20050726.patch -Patch13: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch -Patch14: gdb-6.5-sharedlibrary-path.patch -Patch15: gdb-6.5-BEA-testsuite.patch -Patch16: gdb-6.5-last-address-space-byte-test.patch -Patch17: gdb-6.5-readline-long-line-crash-test.patch -Patch18: gdb-6.5-bz216711-clone-is-outermost.patch -Patch19: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch -Patch20: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch -Patch21: gdb-6.5-bz109921-DW_AT_decl_file-test.patch -Patch22: gdb-6.3-bz140532-ppc-unwinding-test.patch -Patch23: gdb-6.3-bz202689-exec-from-pthread-test.patch -Patch24: gdb-6.6-bz230000-power6-disassembly-test.patch -Patch25: gdb-6.6-bz229517-gcore-without-terminal.patch -Patch26: gdb-6.6-testsuite-timeouts.patch -Patch27: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch -Patch28: gdb-6.6-scheduler_locking-step-is-default.patch -Patch29: gdb-6.3-attach-see-vdso-test.patch -Patch30: gdb-6.5-bz243845-stale-testing-zombie-test.patch -Patch31: gdb-6.6-buildid-locate.patch -Patch32: gdb-6.6-buildid-locate-solib-missing-ids.patch -Patch33: gdb-6.6-buildid-locate-rpm.patch -Patch34: gdb-6.7-charsign-test.patch -Patch35: gdb-6.7-ppc-clobbered-registers-O2-test.patch -Patch36: gdb-6.7-testsuite-stable-results.patch -Patch37: gdb-6.5-ia64-libunwind-leak-test.patch -Patch38: gdb-6.5-missed-trap-on-step-test.patch -Patch39: gdb-6.5-gcore-buffer-limit-test.patch -Patch40: gdb-6.3-mapping-zero-inode-test.patch -Patch41: gdb-6.3-focus-cmd-prev-test.patch -Patch42: gdb-6.8-bz442765-threaded-exec-test.patch -Patch43: gdb-6.5-section-num-fixup-test.patch -Patch44: gdb-6.8-bz436037-reg-no-longer-active.patch -Patch45: gdb-6.8-bz466901-backtrace-full-prelinked.patch -Patch46: gdb-simultaneous-step-resume-breakpoint-test.patch -Patch47: gdb-core-open-vdso-warning.patch -Patch49: gdb-bz533176-fortran-omp-step.patch -Patch50: gdb-follow-child-stale-parent.patch -Patch51: gdb-ccache-workaround.patch -Patch52: gdb-archer-pie-addons.patch -Patch53: gdb-archer-pie-addons-keep-disabled.patch -Patch54: gdb-lineno-makeup-test.patch -Patch55: gdb-ppc-power7-test.patch -Patch56: gdb-bz541866-rwatch-before-run.patch -Patch57: gdb-moribund-utrace-workaround.patch -Patch58: gdb-archer-next-over-throw-cxx-exec.patch -Patch59: gdb-bz601887-dwarf4-rh-test.patch -Patch60: gdb-6.6-buildid-locate-core-as-arg.patch -Patch61: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch -Patch62: gdb-test-bt-cfi-without-die.patch -Patch63: gdb-bz568248-oom-is-error.patch -Patch64: gdb-bz634108-solib_address.patch -Patch65: gdb-test-pid0-core.patch -Patch66: gdb-test-dw2-aranges.patch -Patch67: gdb-test-expr-cumulative-archer.patch -Patch68: gdb-physname-pr11734-test.patch -Patch69: gdb-physname-pr12273-test.patch -Patch70: gdb-test-ivy-bridge.patch -Patch71: gdb-runtest-pie-override.patch -Patch72: gdb-attach-fail-reasons-5of5.patch -Patch73: gdb-glibc-strstr-workaround.patch -Patch74: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch -Patch75: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch -Patch76: gdb-rhbz795424-bitpos-20of25.patch -Patch77: gdb-rhbz795424-bitpos-21of25.patch -Patch78: gdb-rhbz795424-bitpos-22of25.patch -Patch79: gdb-rhbz795424-bitpos-23of25.patch -Patch80: gdb-rhbz795424-bitpos-25of25.patch -Patch81: gdb-rhbz795424-bitpos-25of25-test.patch -Patch82: gdb-rhbz795424-bitpos-lazyvalue.patch -Patch83: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch -Patch84: gdb-gnat-dwarf-crash-3of3.patch -Patch85: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch -Patch86: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch -Patch87: gdb-archer-vla-tests.patch -Patch88: gdb-vla-intel-tests.patch -Patch89: gdb-btrobust.patch -Patch90: gdb-fortran-frame-string.patch -Patch91: gdb-rhbz1156192-recursive-dlopen-test.patch -Patch92: gdb-jit-reader-multilib.patch -Patch93: gdb-rhbz1149205-catch-syscall-after-fork-test.patch -Patch94: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch -Patch95: gdb-rhbz1350436-type-printers-error.patch -Patch96: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch -Patch97: gdb-bz1219747-attach-kills.patch -Patch98: gdb-fedora-libncursesw.patch -Patch99: gdb-opcodes-clflushopt-test.patch -Patch100: gdb-dts-rhel6-python-compat.patch -Patch101: gdb-6.6-buildid-locate-rpm-scl.patch -Patch102: gdb-readline62-ask-more-rh.patch -Patch103: gdb-6.8-quit-never-aborts.patch -Patch104: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch -Patch105: gdb-container-rh-pkg.patch -Patch106: gdb-rhbz1325795-framefilters-test.patch -Patch107: gdb-linux_perf-bundle.patch -Patch108: gdb-libexec-add-index.patch -Patch109: gdb-rhbz1398387-tab-crash-test.patch -Patch110: gdb-testsuite-readline63-sigint.patch -Patch111: gdb-archer.patch -Patch112: gdb-vla-intel-fix-print-char-array.patch -Patch113: gdb-rhbz1553104-s390x-arch12-test.patch -Patch114: gdb-rhbz795424-bitpos-arrayview.patch -Patch115: gdb-rhbz1371380-gcore-elf-headers.patch -Patch116: gdb-rhbz1708192-parse_macro_definition-crash.patch -Patch117: gdb-rhbz1704406-disable-style-log-output-1of3.patch -Patch118: gdb-rhbz1704406-disable-style-log-output-2of3.patch -Patch119: gdb-rhbz1704406-disable-style-log-output-3of3.patch -Patch120: gdb-rhbz1723564-gdb-crash-PYTHONMALLOC-debug.patch -Patch121: gdb-rhbz1553086-binutils-warning-loadable-section-outside-elf.patch +Patch1: gdb-vla-intel-fortran-strides.patch +Patch2: gdb-vla-intel-fortran-vla-strings.patch +Patch3: gdb-vla-intel-stringbt-fix.patch +Patch4: gdb-6.3-gstack-20050411.patch +Patch5: gdb-6.3-test-pie-20050107.patch +Patch6: gdb-6.3-test-self-20050110.patch +Patch7: gdb-6.3-test-dtorfix-20050121.patch +Patch8: gdb-6.3-test-movedir-20050125.patch +Patch9: gdb-6.3-threaded-watchpoints2-20050225.patch +Patch10: gdb-6.3-inferior-notification-20050721.patch +Patch11: gdb-6.3-inheritancetest-20050726.patch +Patch12: gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +Patch13: gdb-6.5-sharedlibrary-path.patch +Patch14: gdb-6.5-BEA-testsuite.patch +Patch15: gdb-6.5-last-address-space-byte-test.patch +Patch16: gdb-6.5-readline-long-line-crash-test.patch +Patch17: gdb-6.5-bz218379-ppc-solib-trampoline-test.patch +Patch18: gdb-6.5-bz218379-solib-trampoline-lookup-lock-fix.patch +Patch19: gdb-6.5-bz109921-DW_AT_decl_file-test.patch +Patch20: gdb-6.3-bz140532-ppc-unwinding-test.patch +Patch21: gdb-6.3-bz202689-exec-from-pthread-test.patch +Patch22: gdb-6.6-bz230000-power6-disassembly-test.patch +Patch23: gdb-6.6-bz229517-gcore-without-terminal.patch +Patch24: gdb-6.6-testsuite-timeouts.patch +Patch25: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch +Patch26: gdb-6.3-attach-see-vdso-test.patch +Patch27: gdb-6.5-bz243845-stale-testing-zombie-test.patch +Patch28: gdb-6.6-buildid-locate.patch +Patch29: gdb-6.6-buildid-locate-solib-missing-ids.patch +Patch30: gdb-6.6-buildid-locate-rpm.patch +Patch31: gdb-6.7-charsign-test.patch +Patch32: gdb-6.7-ppc-clobbered-registers-O2-test.patch +Patch33: gdb-6.7-testsuite-stable-results.patch +Patch34: gdb-6.5-ia64-libunwind-leak-test.patch +Patch35: gdb-6.5-missed-trap-on-step-test.patch +Patch36: gdb-6.5-gcore-buffer-limit-test.patch +Patch37: gdb-6.3-mapping-zero-inode-test.patch +Patch38: gdb-6.3-focus-cmd-prev-test.patch +Patch39: gdb-6.8-bz442765-threaded-exec-test.patch +Patch40: gdb-6.5-section-num-fixup-test.patch +Patch41: gdb-6.8-bz466901-backtrace-full-prelinked.patch +Patch42: gdb-simultaneous-step-resume-breakpoint-test.patch +Patch43: gdb-core-open-vdso-warning.patch +Patch44: gdb-bz533176-fortran-omp-step.patch +Patch45: gdb-ccache-workaround.patch +Patch46: gdb-archer-pie-addons.patch +Patch47: gdb-archer-pie-addons-keep-disabled.patch +Patch48: gdb-lineno-makeup-test.patch +Patch49: gdb-ppc-power7-test.patch +Patch50: gdb-moribund-utrace-workaround.patch +Patch51: gdb-archer-next-over-throw-cxx-exec.patch +Patch52: gdb-bz601887-dwarf4-rh-test.patch +Patch53: gdb-6.6-buildid-locate-core-as-arg.patch +Patch54: gdb-6.6-buildid-locate-rpm-librpm-workaround.patch +Patch55: gdb-test-bt-cfi-without-die.patch +Patch56: gdb-bz634108-solib_address.patch +Patch57: gdb-test-pid0-core.patch +Patch58: gdb-test-dw2-aranges.patch +Patch59: gdb-test-expr-cumulative-archer.patch +Patch60: gdb-physname-pr11734-test.patch +Patch61: gdb-physname-pr12273-test.patch +Patch62: gdb-test-ivy-bridge.patch +Patch63: gdb-runtest-pie-override.patch +Patch64: gdb-attach-fail-reasons-5of5.patch +Patch65: gdb-glibc-strstr-workaround.patch +Patch66: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch +Patch67: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch +Patch68: gdb-rhbz947564-findvar-assertion-frame-failed-testcase.patch +Patch69: gdb-gnat-dwarf-crash-3of3.patch +Patch70: gdb-rhbz1007614-memleak-infpy_read_memory-test.patch +Patch71: gdb-6.6-buildid-locate-misleading-warning-missing-debuginfo-rhbz981154.patch +Patch72: gdb-archer-vla-tests.patch +Patch73: gdb-vla-intel-tests.patch +Patch74: gdb-btrobust.patch +Patch75: gdb-fortran-frame-string.patch +Patch76: gdb-rhbz1156192-recursive-dlopen-test.patch +Patch77: gdb-jit-reader-multilib.patch +Patch78: gdb-rhbz1149205-catch-syscall-after-fork-test.patch +Patch79: gdb-rhbz1186476-internal-error-unqualified-name-re-set-test.patch +Patch80: gdb-rhbz1350436-type-printers-error.patch +Patch81: gdb-rhbz1084404-ppc64-s390x-wrong-prologue-skip-O2-g-3of3.patch +Patch82: gdb-bz1219747-attach-kills.patch +Patch83: gdb-fedora-libncursesw.patch +Patch84: gdb-opcodes-clflushopt-test.patch +Patch85: gdb-dts-rhel6-python-compat.patch +Patch86: gdb-6.6-buildid-locate-rpm-scl.patch +Patch87: gdb-6.8-quit-never-aborts.patch +Patch88: gdb-rhbz1261564-aarch64-hw-watchpoint-test.patch +Patch89: gdb-container-rh-pkg.patch +Patch90: gdb-rhbz1325795-framefilters-test.patch +Patch91: gdb-linux_perf-bundle.patch +Patch92: gdb-libexec-add-index.patch +Patch93: gdb-rhbz1398387-tab-crash-test.patch +Patch94: gdb-archer.patch +Patch95: gdb-vla-intel-fix-print-char-array.patch +Patch96: gdb-rhbz1553104-s390x-arch12-test.patch +Patch97: gdb-rhbz1818011-bfd-gcc10-error.patch +Patch98: gdb-rhbz1822715-fix-python-deprecation.patch +Patch99: gdb-rhbz1829702-fix-python39.patch +Patch100: gdb-rhbz1844458-use-fputX_unfiltered.patch +Patch101: gdb-rhbz1838777-debuginfod.patch # Fedora patch end -# Patch from upstream -Patch6000: gdb-detect-invalid-length-field-in-debug-frame-FDE-header.patch -Patch6001: gdb-threads-Fix-hang-in-stop_all_threads-after-killi.patch -# Upstream patch end - -BuildRequires: rpm-libs +BuildRequires: rpm-libs autoconf BuildRequires: readline-devel >= 6.2-4 BuildRequires: gcc-c++ ncurses-devel texinfo gettext flex bison BuildRequires: expat-devel xz-devel rpm-devel zlib-devel libselinux-devel @@ -238,9 +215,9 @@ rm -f bfd/doc/*.info rm -f bfd/doc/*.info-* rm -f gdb/doc/*.info rm -f gdb/doc/*.info-* -mv -f readline/doc readline-doc -rm -rf readline/* -mv -f readline-doc readline/doc +mv -f readline/readline/doc readline-doc +rm -rf readline/readline/* +mv -f readline-doc readline/readline/doc rm -rf zlib texinfo %build @@ -355,7 +332,7 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/bfd* rm -f $RPM_BUILD_ROOT%{_infodir}/standard* rm -f $RPM_BUILD_ROOT%{_infodir}/configure* rm -rf $RPM_BUILD_ROOT%{_includedir}/*.h -rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*} +rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*,ctf*} cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_mandir}/man1/gstack.1 ln -s gstack.1 $RPM_BUILD_ROOT%{_mandir}/man1/pstack.1 @@ -417,6 +394,9 @@ rm -f $RPM_BUILD_ROOT%{_datadir}/gdb/python/gdb/command/backtrace.py %{_infodir}/gdb.info* %changelog +* Wed Jul 22 2020 qinyu - 9.2-1 +- upgrade GDB version to 9.2 + * Wed Apr 8 2020 Yunfeng Ye - 8.3.1-12 - remove some useless information for cleancode