From 16b5661a6fdc0961e0baa777668049160cea95369834a1288438bba726048c37 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Fri, 11 Jan 2013 14:55:20 +0000 Subject: [PATCH] Accepting request 147743 from devel:gcc - Merge from gdb-7.5.1-30.fc18.src.rpm. 7.5.1 gives: * An "Attempt to dereference a generic pointer" errors (-var-create). * Backtrace problems on x32 (PR backtrace/14646). * next/step/finish problems on x32 (PR gdb/14647). * A "malformed linespec error: unexpected keyword, [...]" error (PR breakpoints/14643). * GDB crash while stepping through powerpc (32bits) code. * A failed assertion in linux_ptrace_test_ret_to_nx. * A "!frame_id_inlined_p (frame_id)" failed assertion. * A "No more reverse-execution history." error during reverse "next" execution (PR 14548). * Incomplete command descriptions in "apropos" output. * PR gdb/14494 (a GDB crash difficult to characterize). 7.5 gives: * Go language support. * New targets (x32 ABI, microMIPS, Renesas RL78, HP OpenVMS ia64). * More Python scripting improvements. * SDT (Static Defined Tracing) probes support with SystemTap probes. * GDBserver improvements (stdio connections, target-side evaluation of breakpoint conditions, remote protocol improvements). * Other miscellaneous improvements (ability to stop when a shared library is loaded/unloaded, dynamic printf, etc). * Reverse debugging on ARM. - Do not provide a custom (safe) auto-load dir. OBS-URL: https://build.opensuse.org/request/show/147743 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=90 --- gdb-6.3-readnever-20050907.patch | 42 +- gdb-6.5-bz216711-clone-is-outermost.patch | 52 +- gdb-6.6-buildid-locate.patch | 144 +- ....6-scheduler_locking-step-is-default.patch | 54 +- ...heduler_locking-step-sw-watchpoints2.patch | 46 +- ...add-workaround-to-broken-debug-files.patch | 58 +- gdb-7.4.50.20120603.tar.bz2 | 3 - gdb-7.5.1.tar.bz2 | 3 + gdb-archer.patch | 5052 ++++++++++++++++- gdb-attach-fail-reasons-5of5.patch | 72 +- gdb-bz592031-siginfo-lost-4of5.patch | 994 ---- gdb-bz592031-siginfo-lost-5of5.patch | 141 - gdb-check-type.patch | 1002 ++++ gdb-core-open-vdso-warning.patch | 155 +- gdb-dejagnu-go.patch | 42 - gdb-disable-mcheck.patch | 24 - gdb-dlopen-stap-probe-1of7.patch | 795 +++ gdb-dlopen-stap-probe-2of7.patch | 74 + gdb-dlopen-stap-probe-3of7.patch | 98 + gdb-dlopen-stap-probe-4of7.patch | 131 + gdb-dlopen-stap-probe-5of7.patch | 17 + gdb-dlopen-stap-probe-6of7.patch | 1989 +++++++ gdb-dlopen-stap-probe-7of7.patch | 147 + gdb-dlopen-stap-probe-test.patch | 186 +- gdb-dlopen-stap-probe-test2.patch | 69 + gdb-dlopen-stap-probe.patch | 358 -- gdb-entryval-inlined.patch | 888 +++ gdb-fortran-common.patch | 88 +- gdb-index-assert.patch | 60 - gdb-minidebuginfo.patch | 1056 ++++ gdb-objfile-order.patch | 215 - gdb-print-class.patch | 110 + ...3-set-solib-absolute-prefix-testcase.patch | 75 + gdb-rhbz795424-bitpos-06of25.patch | 23 + gdb-rhbz795424-bitpos-07of25.patch | 64 + gdb-rhbz795424-bitpos-08of25.patch | 139 + gdb-rhbz795424-bitpos-09of25.patch | 34 + gdb-rhbz795424-bitpos-10of25.patch | 119 + gdb-rhbz795424-bitpos-11of25.patch | 34 + gdb-rhbz795424-bitpos-12of25.patch | 66 + gdb-rhbz795424-bitpos-13of25.patch | 28 + gdb-rhbz795424-bitpos-14of25.patch | 209 + gdb-rhbz795424-bitpos-15of25.patch | 36 + gdb-rhbz795424-bitpos-16of25.patch | 27 + gdb-rhbz795424-bitpos-17of25.patch | 729 +++ gdb-rhbz795424-bitpos-18of25.patch | 45 + gdb-rhbz795424-bitpos-19of25.patch | 260 + gdb-rhbz795424-bitpos-20of25.patch | 4532 +++++++++++++++ gdb-rhbz795424-bitpos-21of25.patch | 224 + gdb-rhbz795424-bitpos-22of25.patch | 701 +++ gdb-rhbz795424-bitpos-23of25.patch | 1324 +++++ gdb-rhbz795424-bitpos-24of25.patch | 113 + gdb-rhbz795424-bitpos-25of25-test.patch | 627 ++ gdb-rhbz795424-bitpos-25of25.patch | 156 + gdb-rhbz795424-bitpos-lazyvalue.patch | 425 ++ gdb-rhel5.9-testcase-xlf-var-inside-mod.patch | 723 +++ gdb-upstream.patch | 293 - gdb-x86-onstack-1of2.patch | 119 - gdb-x86-onstack-2of2.patch | 166 - gdb.changes | 35 + gdb.spec | 257 +- 61 files changed, 22681 insertions(+), 3067 deletions(-) delete mode 100644 gdb-7.4.50.20120603.tar.bz2 create mode 100644 gdb-7.5.1.tar.bz2 delete mode 100644 gdb-bz592031-siginfo-lost-4of5.patch delete mode 100644 gdb-bz592031-siginfo-lost-5of5.patch create mode 100644 gdb-check-type.patch delete mode 100644 gdb-dejagnu-go.patch delete mode 100644 gdb-disable-mcheck.patch create mode 100644 gdb-dlopen-stap-probe-1of7.patch create mode 100644 gdb-dlopen-stap-probe-2of7.patch create mode 100644 gdb-dlopen-stap-probe-3of7.patch create mode 100644 gdb-dlopen-stap-probe-4of7.patch create mode 100644 gdb-dlopen-stap-probe-5of7.patch create mode 100644 gdb-dlopen-stap-probe-6of7.patch create mode 100644 gdb-dlopen-stap-probe-7of7.patch create mode 100644 gdb-dlopen-stap-probe-test2.patch delete mode 100644 gdb-dlopen-stap-probe.patch create mode 100644 gdb-entryval-inlined.patch delete mode 100644 gdb-index-assert.patch create mode 100644 gdb-minidebuginfo.patch delete mode 100644 gdb-objfile-order.patch create mode 100644 gdb-print-class.patch create mode 100644 gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch create mode 100644 gdb-rhbz795424-bitpos-06of25.patch create mode 100644 gdb-rhbz795424-bitpos-07of25.patch create mode 100644 gdb-rhbz795424-bitpos-08of25.patch create mode 100644 gdb-rhbz795424-bitpos-09of25.patch create mode 100644 gdb-rhbz795424-bitpos-10of25.patch create mode 100644 gdb-rhbz795424-bitpos-11of25.patch create mode 100644 gdb-rhbz795424-bitpos-12of25.patch create mode 100644 gdb-rhbz795424-bitpos-13of25.patch create mode 100644 gdb-rhbz795424-bitpos-14of25.patch create mode 100644 gdb-rhbz795424-bitpos-15of25.patch create mode 100644 gdb-rhbz795424-bitpos-16of25.patch create mode 100644 gdb-rhbz795424-bitpos-17of25.patch create mode 100644 gdb-rhbz795424-bitpos-18of25.patch create mode 100644 gdb-rhbz795424-bitpos-19of25.patch create mode 100644 gdb-rhbz795424-bitpos-20of25.patch create mode 100644 gdb-rhbz795424-bitpos-21of25.patch create mode 100644 gdb-rhbz795424-bitpos-22of25.patch create mode 100644 gdb-rhbz795424-bitpos-23of25.patch create mode 100644 gdb-rhbz795424-bitpos-24of25.patch create mode 100644 gdb-rhbz795424-bitpos-25of25-test.patch create mode 100644 gdb-rhbz795424-bitpos-25of25.patch create mode 100644 gdb-rhbz795424-bitpos-lazyvalue.patch create mode 100644 gdb-rhel5.9-testcase-xlf-var-inside-mod.patch delete mode 100644 gdb-upstream.patch delete mode 100644 gdb-x86-onstack-1of2.patch delete mode 100644 gdb-x86-onstack-2of2.patch diff --git a/gdb-6.3-readnever-20050907.patch b/gdb-6.3-readnever-20050907.patch index bd7abf3..bd02d4e 100644 --- a/gdb-6.3-readnever-20050907.patch +++ b/gdb-6.3-readnever-20050907.patch @@ -11,11 +11,11 @@ * gdb.texinfo (File Options): Document --readnever. -Index: gdb-7.4.50.20120602/gdb/doc/gdb.texinfo +Index: gdb-7.4.50.20120703/gdb/doc/gdb.texinfo =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/doc/gdb.texinfo 2012-06-02 18:16:36.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/doc/gdb.texinfo 2012-06-02 18:25:20.300254019 +0200 -@@ -1020,6 +1020,12 @@ Read each symbol file's entire symbol ta +--- gdb-7.4.50.20120703.orig/gdb/doc/gdb.texinfo 2012-07-03 17:30:07.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/doc/gdb.texinfo 2012-07-03 17:31:40.695642449 +0200 +@@ -1023,6 +1023,12 @@ Read each symbol file's entire symbol ta the default, which is to read it incrementally as it is needed. This makes startup slower, but makes future operations faster. @@ -28,10 +28,10 @@ Index: gdb-7.4.50.20120602/gdb/doc/gdb.texinfo @end table @node Mode Options -Index: gdb-7.4.50.20120602/gdb/main.c +Index: gdb-7.4.50.20120703/gdb/main.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/main.c 2012-06-02 18:16:36.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/main.c 2012-06-02 18:25:20.302254019 +0200 +--- gdb-7.4.50.20120703.orig/gdb/main.c 2012-07-03 17:30:07.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/main.c 2012-07-03 17:31:40.696642448 +0200 @@ -414,6 +414,7 @@ captured_main (void *data) {"xdb", no_argument, &xdb_commands, 1}, {"dbx", no_argument, &dbx_commands, 1}, @@ -48,11 +48,11 @@ Index: gdb-7.4.50.20120602/gdb/main.c "), stream); fputs_unfiltered (_("\ --se=FILE Use FILE as symbol file and executable file.\n\ -Index: gdb-7.4.50.20120602/gdb/symfile.c +Index: gdb-7.4.50.20120703/gdb/symfile.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/symfile.c 2012-05-31 20:44:49.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/symfile.c 2012-06-02 18:25:20.334254013 +0200 -@@ -80,6 +80,7 @@ static void clear_symtab_users_cleanup ( +--- gdb-7.4.50.20120703.orig/gdb/symfile.c 2012-07-03 17:30:07.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/symfile.c 2012-07-03 17:31:40.697642447 +0200 +@@ -81,6 +81,7 @@ static void clear_symtab_users_cleanup ( /* Global variables owned by this file. */ int readnow_symbol_files; /* Read full symbols immediately. */ @@ -60,19 +60,19 @@ Index: gdb-7.4.50.20120602/gdb/symfile.c /* External variables and functions referenced. */ -Index: gdb-7.4.50.20120602/gdb/dwarf2read.c +Index: gdb-7.4.50.20120703/gdb/dwarf2read.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 18:16:36.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 18:25:32.837250535 +0200 -@@ -63,6 +63,7 @@ - #include "valprint.h" - #include "gdbcore.h" /* for gnutarget */ +--- gdb-7.4.50.20120703.orig/gdb/dwarf2read.c 2012-07-03 17:30:07.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/dwarf2read.c 2012-07-03 17:31:53.421627153 +0200 +@@ -65,6 +65,7 @@ + #include "gdb/gdb-index.h" #include + #include "gdb_bfd.h" +#include "top.h" #include #include "gdb_string.h" -@@ -1514,8 +1515,9 @@ dwarf2_has_info (struct objfile *objfile +@@ -1587,8 +1588,9 @@ dwarf2_has_info (struct objfile *objfile (void *) names); dwarf2_per_objfile->objfile = objfile; } @@ -84,10 +84,10 @@ Index: gdb-7.4.50.20120602/gdb/dwarf2read.c } /* When loading sections, we look either for uncompressed section or for -Index: gdb-7.4.50.20120602/gdb/top.h +Index: gdb-7.4.50.20120703/gdb/top.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/top.h 2012-01-23 18:12:30.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/top.h 2012-06-02 18:25:20.367254001 +0200 +--- gdb-7.4.50.20120703.orig/gdb/top.h 2012-01-23 18:12:30.000000000 +0100 ++++ gdb-7.4.50.20120703/gdb/top.h 2012-07-03 17:31:40.700642444 +0200 @@ -60,6 +60,7 @@ extern void set_prompt (const char *s); /* From random places. */ diff --git a/gdb-6.5-bz216711-clone-is-outermost.patch b/gdb-6.5-bz216711-clone-is-outermost.patch index 225f9a0..1dfb83f 100644 --- a/gdb-6.5-bz216711-clone-is-outermost.patch +++ b/gdb-6.5-bz216711-clone-is-outermost.patch @@ -23,10 +23,10 @@ instead. Port to GDB-6.7. -Index: gdb-7.4.50.20120602/gdb/amd64-linux-tdep.c +Index: gdb-7.4.50.20120703/gdb/amd64-linux-tdep.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/amd64-linux-tdep.c 2012-06-02 21:05:45.352280128 +0200 -+++ gdb-7.4.50.20120602/gdb/amd64-linux-tdep.c 2012-06-02 21:06:25.536265325 +0200 +--- gdb-7.4.50.20120703.orig/gdb/amd64-linux-tdep.c 2012-06-13 22:36:48.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/amd64-linux-tdep.c 2012-07-03 17:32:46.547563363 +0200 @@ -271,6 +271,80 @@ amd64_linux_register_reggroup_p (struct /* Set the program counter for process PTID to PC. */ @@ -108,20 +108,20 @@ Index: gdb-7.4.50.20120602/gdb/amd64-linux-tdep.c static void amd64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc) { -@@ -1330,6 +1404,8 @@ amd64_linux_init_abi (struct gdbarch_inf +@@ -1547,6 +1621,8 @@ amd64_linux_init_abi (struct gdbarch_inf - tdep->xsave_xcr0_offset = I386_LINUX_XSAVE_XCR0_OFFSET; + amd64_linux_init_abi_common (info, gdbarch); + tdep->outermost_frame_p = amd64_linux_outermost_frame; + /* GNU/Linux uses SVR4-style shared libraries. */ set_solib_svr4_fetch_link_map_offsets (gdbarch, svr4_lp64_fetch_link_map_offsets); -Index: gdb-7.4.50.20120602/gdb/amd64-tdep.c +Index: gdb-7.4.50.20120703/gdb/amd64-tdep.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/amd64-tdep.c 2012-06-02 21:05:45.352280128 +0200 -+++ gdb-7.4.50.20120602/gdb/amd64-tdep.c 2012-06-02 21:06:00.437274574 +0200 -@@ -2138,6 +2138,7 @@ amd64_frame_unwind_stop_reason (struct f +--- gdb-7.4.50.20120703.orig/gdb/amd64-tdep.c 2012-06-16 17:20:22.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/amd64-tdep.c 2012-07-03 17:32:12.335604415 +0200 +@@ -2324,6 +2324,7 @@ amd64_frame_unwind_stop_reason (struct f { struct amd64_frame_cache *cache = amd64_frame_cache (this_frame, this_cache); @@ -129,7 +129,7 @@ Index: gdb-7.4.50.20120602/gdb/amd64-tdep.c if (!cache->base_p) return UNWIND_UNAVAILABLE; -@@ -2146,6 +2147,10 @@ amd64_frame_unwind_stop_reason (struct f +@@ -2332,6 +2333,10 @@ amd64_frame_unwind_stop_reason (struct f if (cache->base == 0) return UNWIND_OUTERMOST; @@ -140,7 +140,7 @@ Index: gdb-7.4.50.20120602/gdb/amd64-tdep.c return UNWIND_NO_REASON; } -@@ -2155,6 +2160,7 @@ amd64_frame_this_id (struct frame_info * +@@ -2341,6 +2346,7 @@ amd64_frame_this_id (struct frame_info * { struct amd64_frame_cache *cache = amd64_frame_cache (this_frame, this_cache); @@ -148,7 +148,7 @@ Index: gdb-7.4.50.20120602/gdb/amd64-tdep.c if (!cache->base_p) return; -@@ -2163,6 +2169,10 @@ amd64_frame_this_id (struct frame_info * +@@ -2349,6 +2355,10 @@ amd64_frame_this_id (struct frame_info * if (cache->base == 0) return; @@ -159,11 +159,11 @@ Index: gdb-7.4.50.20120602/gdb/amd64-tdep.c (*this_id) = frame_id_build (cache->base + 16, cache->pc); } -Index: gdb-7.4.50.20120602/gdb/i386-tdep.c +Index: gdb-7.4.50.20120703/gdb/i386-tdep.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/i386-tdep.c 2012-06-02 21:05:45.352280128 +0200 -+++ gdb-7.4.50.20120602/gdb/i386-tdep.c 2012-06-02 21:06:00.466274562 +0200 -@@ -7639,6 +7639,9 @@ i386_gdbarch_init (struct gdbarch_info i +--- gdb-7.4.50.20120703.orig/gdb/i386-tdep.c 2012-06-18 19:31:34.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/i386-tdep.c 2012-07-03 17:32:12.339604409 +0200 +@@ -7655,6 +7655,9 @@ i386_gdbarch_init (struct gdbarch_info i tdep->xsave_xcr0_offset = -1; @@ -173,10 +173,10 @@ Index: gdb-7.4.50.20120602/gdb/i386-tdep.c tdep->record_regmap = i386_record_regmap; set_gdbarch_long_long_align_bit (gdbarch, 32); -Index: gdb-7.4.50.20120602/gdb/i386-tdep.h +Index: gdb-7.4.50.20120703/gdb/i386-tdep.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/i386-tdep.h 2012-06-02 21:05:45.352280128 +0200 -+++ gdb-7.4.50.20120602/gdb/i386-tdep.h 2012-06-02 21:06:00.486274568 +0200 +--- gdb-7.4.50.20120703.orig/gdb/i386-tdep.h 2012-06-13 22:29:15.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/i386-tdep.h 2012-07-03 17:32:12.340604408 +0200 @@ -219,6 +219,9 @@ struct gdbarch_tdep int (*i386_sysenter_record) (struct regcache *regcache); /* Parse syscall args. */ @@ -187,10 +187,10 @@ Index: gdb-7.4.50.20120602/gdb/i386-tdep.h }; /* Floating-point registers. */ -Index: gdb-7.4.50.20120602/gdb/ia64-tdep.c +Index: gdb-7.4.50.20120703/gdb/ia64-tdep.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/ia64-tdep.c 2012-06-02 21:05:45.352280128 +0200 -+++ gdb-7.4.50.20120602/gdb/ia64-tdep.c 2012-06-02 21:06:00.490274552 +0200 +--- gdb-7.4.50.20120703.orig/gdb/ia64-tdep.c 2012-07-03 17:30:09.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/ia64-tdep.c 2012-07-03 17:32:12.343604405 +0200 @@ -2176,6 +2176,138 @@ static const struct frame_unwind ia64_fr default_frame_sniffer }; @@ -338,10 +338,10 @@ Index: gdb-7.4.50.20120602/gdb/ia64-tdep.c #ifdef HAVE_LIBUNWIND_IA64_H frame_unwind_append_unwinder (gdbarch, &ia64_libunwind_sigtramp_frame_unwind); -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.c +Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.c 2012-06-02 21:06:00.514274544 +0200 ++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.c 2012-07-03 17:32:12.344604404 +0200 @@ -0,0 +1,39 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -382,10 +382,10 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.c + for (;;) + pause(); +} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.exp +Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/bt-clone-stop.exp 2012-06-02 21:06:00.515274547 +0200 ++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.threads/bt-clone-stop.exp 2012-07-03 17:32:12.344604404 +0200 @@ -0,0 +1,61 @@ +# Copyright 2006 Free Software Foundation, Inc. + diff --git a/gdb-6.6-buildid-locate.patch b/gdb-6.6-buildid-locate.patch index 7e3077f..3db8ce1 100644 --- a/gdb-6.6-buildid-locate.patch +++ b/gdb-6.6-buildid-locate.patch @@ -1,18 +1,18 @@ -Index: gdb-7.4.50.20120602/gdb/corelow.c +Index: gdb-7.4.91.20120801/gdb/corelow.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/corelow.c 2012-06-02 21:07:03.695251272 +0200 -+++ gdb-7.4.50.20120602/gdb/corelow.c 2012-06-02 21:07:16.464246569 +0200 -@@ -46,6 +46,9 @@ - #include "filenames.h" +--- gdb-7.4.91.20120801.orig/gdb/corelow.c 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/corelow.c 2012-08-01 18:37:44.584925750 +0200 +@@ -47,6 +47,9 @@ #include "progspace.h" #include "objfiles.h" + #include "gdb_bfd.h" +#include "auxv.h" +#include "elf/common.h" +#include "gdbcmd.h" #ifndef O_LARGEFILE #define O_LARGEFILE 0 -@@ -275,6 +278,52 @@ add_to_thread_list (bfd *abfd, asection +@@ -274,6 +277,52 @@ add_to_thread_list (bfd *abfd, asection inferior_ptid = ptid; /* Yes, make it current. */ } @@ -65,20 +65,22 @@ Index: gdb-7.4.50.20120602/gdb/corelow.c /* This routine opens and sets up the core file bfd. */ static void -@@ -377,6 +426,12 @@ core_open (char *filename, int from_tty) - push_target (&core_ops); - discard_cleanups (old_chain); +@@ -418,6 +467,14 @@ core_open (char *filename, int from_tty) + switch_to_thread (thread->ptid); + } + /* 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. */ ++ 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); + - /* Do this before acknowledging the inferior, so if - post_create_inferior throws (can happen easilly if you're loading - a core file with the wrong exec), we aren't left with threads -@@ -935,4 +990,11 @@ _initialize_corelow (void) + post_create_inferior (&core_ops, from_tty); + + /* Now go through the target stack looking for threads since there +@@ -939,4 +996,11 @@ _initialize_corelow (void) init_core_ops (); add_target (&core_ops); @@ -86,15 +88,15 @@ Index: gdb-7.4.50.20120602/gdb/corelow.c + add_setshow_boolean_cmd ("build-id-core-loads", class_files, + &build_id_core_loads, _("\ +Set whether CORE-FILE loads the build-id associated files automatically."), _("\ -+Show whether CORE-FILE loads the build-id associated files automatically.."), ++Show whether CORE-FILE loads the build-id associated files automatically."), + NULL, NULL, NULL, + &setlist, &showlist); } -Index: gdb-7.4.50.20120602/gdb/doc/gdb.texinfo +Index: gdb-7.4.91.20120801/gdb/doc/gdb.texinfo =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/doc/gdb.texinfo 2012-06-02 21:07:03.695251272 +0200 -+++ gdb-7.4.50.20120602/gdb/doc/gdb.texinfo 2012-06-02 21:07:16.480246563 +0200 -@@ -16502,6 +16502,27 @@ information files. +--- gdb-7.4.91.20120801.orig/gdb/doc/gdb.texinfo 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/doc/gdb.texinfo 2012-08-01 18:37:44.598925672 +0200 +@@ -16530,6 +16530,27 @@ information files. @end table @@ -122,11 +124,11 @@ Index: gdb-7.4.50.20120602/gdb/doc/gdb.texinfo @cindex @code{.gnu_debuglink} sections @cindex debug link sections A debug link is a special section of the executable file named -Index: gdb-7.4.50.20120602/gdb/solib-svr4.c +Index: gdb-7.4.91.20120801/gdb/solib-svr4.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/solib-svr4.c 2012-06-02 21:07:03.695251272 +0200 -+++ gdb-7.4.50.20120602/gdb/solib-svr4.c 2012-06-02 21:07:16.510246552 +0200 -@@ -1227,9 +1227,52 @@ svr4_read_so_list (CORE_ADDR lm, struct +--- gdb-7.4.91.20120801.orig/gdb/solib-svr4.c 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/solib-svr4.c 2012-08-01 18:37:44.599925667 +0200 +@@ -1228,9 +1228,52 @@ svr4_read_so_list (CORE_ADDR lm, struct continue; } @@ -182,14 +184,14 @@ Index: gdb-7.4.50.20120602/gdb/solib-svr4.c xfree (buffer); /* If this entry has no name, or its name matches the name -Index: gdb-7.4.50.20120602/gdb/elfread.c +Index: gdb-7.4.91.20120801/gdb/elfread.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/elfread.c 2012-06-02 21:07:03.695251272 +0200 -+++ gdb-7.4.50.20120602/gdb/elfread.c 2012-06-02 21:07:56.264232049 +0200 -@@ -44,6 +44,11 @@ - #include "gdbthread.h" +--- gdb-7.4.91.20120801.orig/gdb/elfread.c 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/elfread.c 2012-08-01 18:38:08.956790879 +0200 +@@ -45,6 +45,11 @@ #include "regcache.h" #include "bcache.h" + #include "gdb_bfd.h" +#include "libbfd.h" +#include "gdbcore.h" +#include "gdbcmd.h" @@ -198,7 +200,7 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c extern void _initialize_elfread (void); -@@ -1072,16 +1077,65 @@ elf_gnu_ifunc_resolver_return_stop (stru +@@ -1074,16 +1079,65 @@ elf_gnu_ifunc_resolver_return_stop (stru update_breakpoint_locations (b, sals, sals_end); } @@ -266,7 +268,7 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c { struct build_id *retval; -@@ -1097,6 +1151,348 @@ build_id_bfd_get (bfd *abfd) +@@ -1099,6 +1153,348 @@ build_id_bfd_get (bfd *abfd) return retval; } @@ -615,7 +617,7 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c /* Return if FILENAME has NT_GNU_BUILD_ID matching the CHECK value. */ static int -@@ -1111,7 +1507,7 @@ build_id_verify (const char *filename, s +@@ -1113,7 +1509,7 @@ build_id_verify (const char *filename, s if (abfd == NULL) return 0; @@ -624,7 +626,7 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c if (found == NULL) warning (_("File \"%s\" has no build-id, file skipped"), filename); -@@ -1129,17 +1525,18 @@ build_id_verify (const char *filename, s +@@ -1131,17 +1527,18 @@ build_id_verify (const char *filename, s return retval; } @@ -647,7 +649,7 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will cause "/.build-id/..." lookups. */ -@@ -1152,6 +1549,8 @@ build_id_to_debug_filename (struct build +@@ -1154,6 +1551,8 @@ build_id_to_debug_filename (struct build size_t debugdir_len = strlen (debugdir); gdb_byte *data = build_id->data; size_t size = build_id->size; @@ -656,7 +658,7 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c char *s; memcpy (link, debugdir, debugdir_len); -@@ -1166,37 +1565,240 @@ build_id_to_debug_filename (struct build +@@ -1168,37 +1567,240 @@ build_id_to_debug_filename (struct build *s++ = '/'; while (size-- > 0) s += sprintf (s, "%02x", (unsigned) *data++); @@ -908,7 +910,7 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c xfree (build_id); /* Prevent looping on a stripped .debug file. */ if (build_id_name != NULL -@@ -1207,7 +1809,7 @@ find_separate_debug_file_by_buildid (str +@@ -1209,7 +1811,7 @@ find_separate_debug_file_by_buildid (str xfree (build_id_name); } else if (build_id_name != NULL) @@ -917,7 +919,7 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c } return NULL; } -@@ -1427,9 +2029,10 @@ elf_symfile_read (struct objfile *objfil +@@ -1436,9 +2038,10 @@ elf_symfile_read (struct objfile *objfil `.note.gnu.build-id'. */ else if (!objfile_has_partial_symbols (objfile)) { @@ -930,9 +932,9 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c if (debugfile == NULL) debugfile = find_separate_debug_file_by_debuglink (objfile); -@@ -1441,6 +2044,12 @@ elf_symfile_read (struct objfile *objfil +@@ -1452,6 +2055,12 @@ elf_symfile_read (struct objfile *objfil symbol_file_add_separate (abfd, symfile_flags, objfile); - xfree (debugfile); + do_cleanups (cleanup); } + /* Check if any separate debug info has been extracted out. */ + else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") @@ -941,9 +943,9 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c + + xfree (build_id_filename); } - } -@@ -1770,4 +2379,16 @@ _initialize_elfread (void) + if (symtab_create_debug) +@@ -1784,4 +2393,16 @@ _initialize_elfread (void) elf_objfile_gnu_ifunc_cache_data = register_objfile_data (); gnu_ifunc_fns_p = &elf_gnu_ifunc_fns; @@ -960,10 +962,10 @@ Index: gdb-7.4.50.20120602/gdb/elfread.c + + observer_attach_executable_changed (debug_print_executable_changed); } -Index: gdb-7.4.50.20120602/gdb/symfile.h +Index: gdb-7.4.91.20120801/gdb/symfile.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/symfile.h 2012-06-02 21:07:03.695251272 +0200 -+++ gdb-7.4.50.20120602/gdb/symfile.h 2012-06-02 21:07:16.524246547 +0200 +--- gdb-7.4.91.20120801.orig/gdb/symfile.h 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/symfile.h 2012-08-01 18:37:44.600925662 +0200 @@ -615,6 +615,13 @@ void free_symfile_segment_data (struct s extern struct cleanup *increment_reading_symtab (void); @@ -978,10 +980,10 @@ Index: gdb-7.4.50.20120602/gdb/symfile.h /* From dwarf2read.c */ /* Names for a dwarf2 debugging section. The field NORMAL is the normal -Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp +Index: gdb-7.4.91.20120801/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 21:07:03.695251272 +0200 -+++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp 2012-06-02 21:07:16.526246546 +0200 +--- gdb-7.4.91.20120801.orig/gdb/testsuite/lib/gdb.exp 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/testsuite/lib/gdb.exp 2012-08-01 18:37:44.601925656 +0200 @@ -1388,6 +1388,16 @@ proc default_gdb_start { } { warning "Couldn't set the width to 0." } @@ -999,10 +1001,10 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp return 0; } -Index: gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp +Index: gdb-7.4.91.20120801/gdb/testsuite/lib/mi-support.exp =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:07:03.695251272 +0200 -+++ gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp 2012-06-02 21:07:16.535246544 +0200 +--- gdb-7.4.91.20120801.orig/gdb/testsuite/lib/mi-support.exp 2012-07-25 22:35:30.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/testsuite/lib/mi-support.exp 2012-08-01 18:37:44.601925656 +0200 @@ -213,6 +213,16 @@ proc default_mi_gdb_start { args } { warning "Couldn't set the width to 0." } @@ -1020,10 +1022,10 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/lib/mi-support.exp # If allowing the inferior to have its own PTY then assign the inferior # its own terminal device here. if { $separate_inferior_pty } { -Index: gdb-7.4.50.20120602/gdb/objfiles.h +Index: gdb-7.4.91.20120801/gdb/objfiles.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/objfiles.h 2012-06-02 21:07:03.695251272 +0200 -+++ gdb-7.4.50.20120602/gdb/objfiles.h 2012-06-02 21:07:16.539246541 +0200 +--- gdb-7.4.91.20120801.orig/gdb/objfiles.h 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/objfiles.h 2012-08-01 18:37:44.601925656 +0200 @@ -432,6 +432,10 @@ struct objfile #define OBJF_MAINLINE (1 << 5) @@ -1035,3 +1037,41 @@ Index: gdb-7.4.50.20120602/gdb/objfiles.h /* The object file that contains the runtime common minimal symbols for SunOS4. Note that this objfile has no associated BFD. */ +Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.base/corefile.exp +=================================================================== +--- gdb-7.4.91.20120801.orig/gdb/testsuite/gdb.base/corefile.exp 2012-06-21 22:46:21.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.base/corefile.exp 2012-08-01 18:37:44.602925650 +0200 +@@ -256,3 +256,33 @@ if ![is_remote target] { + + gdb_exit + } ++ ++ ++# Test auto-loading of binary files through build-id from the core file. ++set buildid [build_id_debug_filename_get $binfile] ++set wholetest "binfile found by build-id" ++if {$buildid == ""} { ++ untested "$wholetest (binary has no build-id)" ++} else { ++ gdb_exit ++ gdb_start ++ ++ regsub {\.debug$} $buildid {} buildid ++ set debugdir ${objdir}/${subdir}/${testfile}-debugdir ++ file delete -force -- $debugdir ++ file mkdir $debugdir/[file dirname $buildid] ++ file copy $binfile $debugdir/$buildid ++ ++ set test "show debug-file-directory" ++ gdb_test_multiple $test $test { ++ -re "The directory where separate debug symbols are searched for is \"(.*)\"\\.\r\n$gdb_prompt $" { ++ set debugdir_orig $expect_out(1,string) ++ pass $test ++ } ++ } ++ gdb_test_no_output "set debug-file-directory $debugdir:$debugdir_orig" "set debug-file-directory" ++ gdb_test "show build-id-core-loads" {Whether CORE-FILE loads the build-id associated files automatically is on\.} ++ gdb_test "core-file $corefile" "\r\nProgram terminated with .*" "core-file without executable" ++ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" ++ pass $wholetest ++} diff --git a/gdb-6.6-scheduler_locking-step-is-default.patch b/gdb-6.6-scheduler_locking-step-is-default.patch index 6d0746a..fbc5f68 100644 --- a/gdb-6.6-scheduler_locking-step-is-default.patch +++ b/gdb-6.6-scheduler_locking-step-is-default.patch @@ -1,8 +1,8 @@ -Index: gdb-7.3.50.20110722/gdb/infrun.c +Index: gdb-7.4.50.20120703/gdb/infrun.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/infrun.c 2011-07-22 19:12:56.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/infrun.c 2011-07-22 19:17:06.000000000 +0200 -@@ -1549,7 +1549,7 @@ static const char *scheduler_enums[] = { +--- gdb-7.4.50.20120703.orig/gdb/infrun.c 2012-07-03 20:26:25.060940765 +0200 ++++ gdb-7.4.50.20120703/gdb/infrun.c 2012-07-03 20:26:32.808929860 +0200 +@@ -1591,7 +1591,7 @@ static const char *const scheduler_enums schedlock_step, NULL }; @@ -11,11 +11,11 @@ Index: gdb-7.3.50.20110722/gdb/infrun.c static void show_scheduler_mode (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp +Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-console.exp =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi-console.exp 2011-01-01 16:33:47.000000000 +0100 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp 2011-07-22 19:17:06.000000000 +0200 -@@ -47,6 +47,9 @@ if { [gdb_compile "${srcdir}/${subdir}/ +--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-console.exp 2012-07-03 20:26:25.060940765 +0200 ++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-console.exp 2012-07-03 20:26:32.809929858 +0200 +@@ -46,6 +46,9 @@ if { [gdb_compile "${srcdir}/${subdir}/ mi_run_to_main @@ -25,11 +25,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-console.exp # Next over the hello() call which will produce lots of output mi_gdb_test "220-exec-next" \ "220\\^running(\r\n\\*running,thread-id=\"all\")?" \ -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp +Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi2-console.exp =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi2-console.exp 2011-06-23 11:40:50.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp 2011-07-22 19:17:27.000000000 +0200 -@@ -47,6 +47,9 @@ if { [gdb_compile "${srcdir}/${subdir}/ +--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi2-console.exp 2012-07-03 20:26:25.060940765 +0200 ++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi2-console.exp 2012-07-03 20:26:32.809929858 +0200 +@@ -46,6 +46,9 @@ if { [gdb_compile "${srcdir}/${subdir}/ mi_run_to_main @@ -39,11 +39,11 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi2-console.exp # Next over the hello() call which will produce lots of output mi_gdb_test "220-exec-next" "220\\^running(\r\n)?(\\*running,thread-id=\"all\")?" \ "Started step over hello" -Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp +Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-cli.exp =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2011-04-27 12:17:38.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp 2011-07-22 19:17:06.000000000 +0200 -@@ -176,7 +176,7 @@ mi_execute_to "exec-continue" "breakpoin +--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-cli.exp 2012-07-03 20:26:25.060940765 +0200 ++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-cli.exp 2012-07-03 20:26:32.810929856 +0200 +@@ -175,7 +175,7 @@ mi_execute_to "exec-continue" "breakpoin # Test that the token is output even for CLI commands # Also test that *stopped includes frame information. mi_gdb_test "34 next" \ @@ -52,3 +52,25 @@ Index: gdb-7.3.50.20110722/gdb/testsuite/gdb.mi/mi-cli.exp "34 next: run" if {!$async} { +Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-logging.exp +=================================================================== +--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.mi/mi-logging.exp 2012-06-29 00:11:23.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.mi/mi-logging.exp 2012-07-03 20:29:03.573717651 +0200 +@@ -56,7 +56,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" +@@ -79,7 +79,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-6.6-scheduler_locking-step-sw-watchpoints2.patch b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch index 3f3a217..d2da3cf 100644 --- a/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch +++ b/gdb-6.6-scheduler_locking-step-sw-watchpoints2.patch @@ -21,10 +21,10 @@ Port to GDB-6.8pre. -Index: gdb-7.4.50.20120602/gdb/inferior.h +Index: gdb-7.4.50.20120714/gdb/inferior.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/inferior.h 2012-05-24 18:39:09.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/inferior.h 2012-06-02 18:24:12.875274179 +0200 +--- gdb-7.4.50.20120714.orig/gdb/inferior.h 2012-06-13 20:15:05.000000000 +0200 ++++ gdb-7.4.50.20120714/gdb/inferior.h 2012-07-14 23:21:01.795161794 +0200 @@ -159,7 +159,15 @@ extern void reopen_exec_file (void); /* The `resume' routine should only be called in special circumstances. Normally, use `proceed', which handles a lot of bookkeeping. */ @@ -42,10 +42,10 @@ Index: gdb-7.4.50.20120602/gdb/inferior.h extern ptid_t user_visible_resume_ptid (int step); -Index: gdb-7.4.50.20120602/gdb/infrun.c +Index: gdb-7.4.50.20120714/gdb/infrun.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/infrun.c 2012-05-28 22:43:26.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/infrun.c 2012-06-02 18:23:59.339278268 +0200 +--- gdb-7.4.50.20120714.orig/gdb/infrun.c 2012-07-01 12:37:04.000000000 +0200 ++++ gdb-7.4.50.20120714/gdb/infrun.c 2012-07-14 23:21:01.800161767 +0200 @@ -79,7 +79,7 @@ static int follow_fork (void); static void set_schedlock_func (char *args, int from_tty, struct cmd_list_element *c); @@ -55,7 +55,7 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c static int currently_stepping_or_nexting_callback (struct thread_info *tp, void *data); -@@ -1687,7 +1687,8 @@ user_visible_resume_ptid (int step) +@@ -1672,7 +1672,8 @@ user_visible_resume_ptid (int step) } else if ((scheduler_mode == schedlock_on) || (scheduler_mode == schedlock_step @@ -65,7 +65,7 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c { /* User-settable 'scheduler' mode requires solo thread resume. */ resume_ptid = inferior_ptid; -@@ -1705,7 +1706,7 @@ user_visible_resume_ptid (int step) +@@ -1690,7 +1691,7 @@ user_visible_resume_ptid (int step) STEP nonzero if we should step (zero to continue instead). SIG is the signal to give the inferior (zero for none). */ void @@ -74,7 +74,7 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c { int should_resume = 1; struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0); -@@ -1738,9 +1739,13 @@ resume (int step, enum gdb_signal sig) +@@ -1723,9 +1724,13 @@ resume (int step, enum gdb_signal sig) if (debug_infrun) fprintf_unfiltered (gdb_stdlog, @@ -90,7 +90,7 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c target_pid_to_str (inferior_ptid), paddress (gdbarch, pc)); -@@ -2117,7 +2122,7 @@ proceed (CORE_ADDR addr, enum gdb_signal +@@ -2102,7 +2107,7 @@ proceed (CORE_ADDR addr, enum gdb_signal struct thread_info *tp; CORE_ADDR pc; struct address_space *aspace; @@ -99,7 +99,7 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c /* If we're stopped at a fork/vfork, follow the branch set by the "set follow-fork-mode" command; otherwise, we'll just proceed -@@ -2157,13 +2162,13 @@ proceed (CORE_ADDR addr, enum gdb_signal +@@ -2142,13 +2147,13 @@ proceed (CORE_ADDR addr, enum gdb_signal actually be executing the breakpoint insn anyway. We'll be (un-)executing the previous instruction. */ @@ -115,7 +115,7 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c } else { -@@ -2194,13 +2199,13 @@ proceed (CORE_ADDR addr, enum gdb_signal +@@ -2179,13 +2184,13 @@ proceed (CORE_ADDR addr, enum gdb_signal is required it returns TRUE and sets the current thread to the old thread. */ if (prepare_to_proceed (step)) @@ -131,7 +131,7 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c { tp->control.trap_expected = 1; /* If displaced stepping is enabled, we can step over the -@@ -2287,8 +2292,13 @@ proceed (CORE_ADDR addr, enum gdb_signal +@@ -2272,8 +2277,13 @@ proceed (CORE_ADDR addr, enum gdb_signal /* Reset to normal state. */ init_infwait_state (); @@ -146,7 +146,7 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c /* Wait for it to stop (if not standalone) and in any case decode why it stopped, and act accordingly. */ -@@ -5249,13 +5259,18 @@ process_event_stop_test: +@@ -5205,13 +5215,18 @@ process_event_stop_test: /* Is thread TP in the middle of single-stepping? */ @@ -170,11 +170,11 @@ Index: gdb-7.4.50.20120602/gdb/infrun.c } /* Returns true if any thread *but* the one passed in "data" is in the -Index: gdb-7.4.50.20120602/gdb/linux-nat.c +Index: gdb-7.4.50.20120714/gdb/linux-nat.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-05-24 18:51:34.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 18:23:07.409293800 +0200 -@@ -3051,7 +3051,11 @@ static int +--- gdb-7.4.50.20120714.orig/gdb/linux-nat.c 2012-07-07 14:13:56.000000000 +0200 ++++ gdb-7.4.50.20120714/gdb/linux-nat.c 2012-07-14 23:21:01.803161750 +0200 +@@ -2982,7 +2982,11 @@ static int select_singlestep_lwp_callback (struct lwp_info *lp, void *data) { if (lp->last_resume_kind == resume_step @@ -187,10 +187,10 @@ Index: gdb-7.4.50.20120602/gdb/linux-nat.c return 1; else return 0; -Index: gdb-7.4.50.20120602/gdb/linux-nat.h +Index: gdb-7.4.50.20120714/gdb/linux-nat.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/linux-nat.h 2012-03-21 14:43:54.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/linux-nat.h 2012-06-02 18:23:07.411293798 +0200 +--- gdb-7.4.50.20120714.orig/gdb/linux-nat.h 2012-07-06 18:52:20.000000000 +0200 ++++ gdb-7.4.50.20120714/gdb/linux-nat.h 2012-07-14 23:21:17.414075355 +0200 @@ -73,8 +73,8 @@ struct lwp_info /* If non-zero, a pending wait status. */ int status; @@ -200,5 +200,5 @@ Index: gdb-7.4.50.20120602/gdb/linux-nat.h + /* The kind of stepping of this LWP. */ + enum resume_step step; - /* Non-zero si_signo if this LWP stopped with a trap. si_addr may - be the address of a hardware watchpoint. */ + /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data + watchpoint trap. */ diff --git a/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch b/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch index 267c06b..601e7dc 100644 --- a/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch +++ b/gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch @@ -1,8 +1,8 @@ -Index: gdb-7.3.50.20110722/gdb/dwarf2read.c +Index: gdb-7.4.50.20120703/gdb/gdb_bfd.c =================================================================== ---- gdb-7.3.50.20110722.orig/gdb/dwarf2read.c 2011-07-22 19:37:15.000000000 +0200 -+++ gdb-7.3.50.20110722/gdb/dwarf2read.c 2011-07-22 19:44:42.000000000 +0200 -@@ -67,12 +67,14 @@ +--- gdb-7.4.50.20120703.orig/gdb/gdb_bfd.c 2012-07-03 17:30:07.356754655 +0200 ++++ gdb-7.4.50.20120703/gdb/gdb_bfd.c 2012-07-03 17:43:52.565762454 +0200 +@@ -26,12 +26,14 @@ #ifdef HAVE_ZLIB_H #include #endif @@ -15,37 +15,37 @@ Index: gdb-7.3.50.20110722/gdb/dwarf2read.c #endif +#endif - typedef struct symbol *symbolp; - DEF_VEC_P (symbolp); -@@ -1618,6 +1620,7 @@ dwarf2_read_section (struct objfile *obj + /* An object of this type is stored in the section's user data when + mapping a section. */ +@@ -181,6 +183,7 @@ free_one_bfd_section (bfd *abfd, asectio + + if (sect != NULL && sect->data != NULL) + { ++#ifndef __sparc__ + #ifdef HAVE_MMAP + if (sect->map_addr != NULL) + { +@@ -191,6 +194,7 @@ free_one_bfd_section (bfd *abfd, asectio + } + else + #endif ++#endif + xfree (sect->data); + } + } +@@ -425,6 +429,7 @@ gdb_bfd_map_section (asection *sectp, bf } } +#ifndef __sparc__ #ifdef HAVE_MMAP - if (pagesize == 0) - pagesize = getpagesize (); -@@ -1641,6 +1644,7 @@ dwarf2_read_section (struct objfile *obj - } - } - #endif + { + /* The page size, used when mmapping. */ +@@ -458,6 +463,7 @@ gdb_bfd_map_section (asection *sectp, bf + } + } + #endif /* HAVE_MMAP */ +#endif /* If we get here, we are a normal, not-compressed section. */ - info->buffer = buf -@@ -15983,6 +15987,7 @@ munmap_section_buffer (struct dwarf2_sec - { - if (info->map_addr != NULL) - { -+#ifndef __sparc__ - #ifdef HAVE_MMAP - int res; - -@@ -15992,6 +15997,7 @@ munmap_section_buffer (struct dwarf2_sec - /* Without HAVE_MMAP, we should never be here to begin with. */ - gdb_assert_not_reached ("no mmap support"); - #endif -+#endif - } - } diff --git a/gdb-7.4.50.20120603.tar.bz2 b/gdb-7.4.50.20120603.tar.bz2 deleted file mode 100644 index a93e4f9..0000000 --- a/gdb-7.4.50.20120603.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1ab4776fcd213e101553e81c6b0ce033d624cbe1b5ad322203a61bdaab8a3e09 -size 22315415 diff --git a/gdb-7.5.1.tar.bz2 b/gdb-7.5.1.tar.bz2 new file mode 100644 index 0000000..cc7a124 --- /dev/null +++ b/gdb-7.5.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:070b808d289fa8f0291738eeaccc0cd7700d476998781f572856155240d29d20 +size 21349391 diff --git a/gdb-archer.patch b/gdb-archer.patch index 13df606..32ba0a7 100644 --- a/gdb-archer.patch +++ b/gdb-archer.patch @@ -2,18 +2,46 @@ http://sourceware.org/gdb/wiki/ProjectArcher http://sourceware.org/gdb/wiki/ArcherBranchManagement GIT snapshot: -commit d10213220191589814714d71ef0f5ba64fbc3b75 +commit 897686c0aedb7a6da59b823f22b1d24ec5a1d2ba branch `archer' - the merge of branches: archer-jankratochvil-vla archer-tromey-python +archer-tromey-dwz-multifile-rebase (but from post-7.5 FSF GDB commits) diff --git a/gdb/Makefile.in b/gdb/Makefile.in -index bf6b0da..f0d46dd 100644 +index a41cff9..d7786a6 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in -@@ -1304,6 +1304,12 @@ stamp-h: $(srcdir)/config.in config.status +@@ -704,7 +704,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c ada-tasks.c \ + exceptions.c expprint.c \ + f-exp.y f-lang.c f-typeprint.c f-valprint.c filesystem.c \ + findcmd.c findvar.c frame.c frame-base.c frame-unwind.c \ +- gdbarch.c arch-utils.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \ ++ gdbarch.c arch-utils.c gdb_bfd.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \ + go-exp.y go-lang.c go-typeprint.c go-valprint.c \ + inf-loop.c \ + infcall.c \ +@@ -829,7 +829,7 @@ gnulib/import/extra/snippet/warn-on-use.h \ + gnulib/import/stddef.in.h gnulib/import/inttypes.in.h inline-frame.h skip.h \ + common/common-utils.h common/xml-utils.h common/buffer.h common/ptid.h \ + common/format.h \ +-common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h ++common/linux-osdata.h gdb-dlfcn.h auto-load.h probe.h stap-probe.h gdb_bfd.h + + # Header files that already have srcdir in them, or which are in objdir. + +@@ -879,7 +879,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \ + macrotab.o macrocmd.o macroexp.o macroscope.o \ + mi-common.o \ + event-loop.o event-top.o inf-loop.o completer.o \ +- gdbarch.o arch-utils.o gdbtypes.o osabi.o copying.o \ ++ gdbarch.o arch-utils.o gdbtypes.o gdb_bfd.o osabi.o copying.o \ + memattr.o mem-break.o target.o parse.o language.o buildsym.o \ + findcmd.o \ + std-regs.o \ +@@ -1307,6 +1307,12 @@ stamp-h: $(srcdir)/config.in config.status CONFIG_LINKS= \ $(SHELL) config.status @@ -26,11 +54,29 @@ index bf6b0da..f0d46dd 100644 config.status: $(srcdir)/configure configure.tgt configure.host $(SHELL) config.status --recheck +diff --git a/gdb/NEWS b/gdb/NEWS +index b281824..4da886c 100644 +--- a/gdb/NEWS ++++ b/gdb/NEWS +@@ -1,6 +1,13 @@ + What has changed in GDB? + (Organized release by release) + ++*** Changes since GDB 7.5 ++ ++* New commands (for set/show, see "New options" below) ++ ++maint info bfds ++ List the BFDs known to GDB. ++ + *** Changes in GDB 7.5 + + * GDB now supports x32 ABI. Visit diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c -index af0fdb5..02c6e6f 100644 +index aa090af..e672731 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c -@@ -12055,6 +12055,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp, +@@ -12037,6 +12037,7 @@ ada_operator_length (const struct expression *exp, int pc, int *oplenp, static int ada_operator_check (struct expression *exp, int pos, @@ -38,7 +84,7 @@ index af0fdb5..02c6e6f 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data) { -@@ -12069,12 +12070,15 @@ ada_operator_check (struct expression *exp, int pos, +@@ -12051,12 +12052,15 @@ ada_operator_check (struct expression *exp, int pos, break; default: @@ -56,11 +102,57 @@ index af0fdb5..02c6e6f 100644 && (*objfile_func) (TYPE_OBJFILE (type), data)) return 1; +diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c +index 6728800..455d3e6 100644 +--- a/gdb/bfd-target.c ++++ b/gdb/bfd-target.c +@@ -21,6 +21,7 @@ + #include "target.h" + #include "bfd-target.h" + #include "exec.h" ++#include "gdb_bfd.h" + + /* The object that is stored in the target_ops->to_data field has this + type. */ +@@ -70,7 +71,7 @@ target_bfd_xclose (struct target_ops *t, int quitting) + { + struct target_bfd_data *data = t->to_data; + +- bfd_close (data->bfd); ++ gdb_bfd_unref (data->bfd); + xfree (data->table.sections); + xfree (data); + xfree (t); +@@ -84,6 +85,7 @@ target_bfd_reopen (struct bfd *abfd) + + data = XZALLOC (struct target_bfd_data); + data->bfd = abfd; ++ gdb_bfd_ref (abfd); + build_section_table (abfd, &data->table.sections, &data->table.sections_end); + + t = XZALLOC (struct target_ops); +diff --git a/gdb/bfd-target.h b/gdb/bfd-target.h +index 71001c5..7f4e628 100644 +--- a/gdb/bfd-target.h ++++ b/gdb/bfd-target.h +@@ -23,9 +23,9 @@ + struct bfd; + struct target_ops; + +-/* Given an existing BFD, re-open it as a "struct target_ops". On +- close, it will also close the corresponding BFD (which is like +- freopen and fdopen). */ ++/* Given an existing BFD, re-open it as a "struct target_ops". This ++ acquires a new reference to the BFD. This reference will be ++ released when the target is closed. */ + struct target_ops *target_bfd_reopen (struct bfd *bfd); + + #endif diff --git a/gdb/block.c b/gdb/block.c -index 1503730..a522bca 100644 +index a0f82ec..097dbf6 100644 --- a/gdb/block.c +++ b/gdb/block.c -@@ -687,3 +687,21 @@ block_iter_match_next (const char *name, +@@ -692,3 +692,21 @@ block_iter_match_next (const char *name, return block_iter_match_step (iterator, name, compare, 0); } @@ -94,10 +186,10 @@ index 99c4788..6ceb704 100644 + #endif /* BLOCK_H */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c -index a867b10..e41c692 100644 +index 78fffd3..224ba49 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c -@@ -15154,6 +15154,24 @@ all_tracepoints (void) +@@ -15519,6 +15519,24 @@ all_tracepoints (void) return tp_vec; } @@ -122,7 +214,7 @@ index a867b10..e41c692 100644 /* This help string is used for the break, hbreak, tbreak and thbreak commands. It is defined as a macro to prevent duplication. -@@ -16097,4 +16115,7 @@ Show the channel to use for dynamic printf"), NULL, +@@ -16484,4 +16502,7 @@ agent-printf \"printf format string\", arg1, arg2, arg3, ..., argn\n\ automatic_hardware_breakpoints = 1; observer_attach_about_to_proceed (breakpoint_about_to_proceed); @@ -130,6 +222,69 @@ index a867b10..e41c692 100644 + observer_attach_mark_used (breakpoint_types_mark_used); +#endif } +diff --git a/gdb/buildsym.c b/gdb/buildsym.c +index d547012..e4882fb 100644 +--- a/gdb/buildsym.c ++++ b/gdb/buildsym.c +@@ -966,11 +966,14 @@ reset_symtab_globals (void) + file's text. + + If EXPANDABLE is non-zero the STATIC_BLOCK dictionary is made +- expandable. */ ++ expandable. ++ ++ If REQUIRED is non-zero, then a symtab is created even if it does ++ not contain any symbols. */ + + struct block * + end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile, +- int expandable) ++ int expandable, int required) + { + /* Finish the lexical context of the last function in the file; pop + the context stack. */ +@@ -1038,7 +1041,8 @@ end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile, + cleanup_undefined_stabs_types (objfile); + finish_global_stabs (objfile); + +- if (pending_blocks == NULL ++ if (!required ++ && pending_blocks == NULL + && file_symbols == NULL + && global_symbols == NULL + && have_line_numbers == 0 +@@ -1296,7 +1300,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) + { + struct block *static_block; + +- static_block = end_symtab_get_static_block (end_addr, objfile, 0); ++ static_block = end_symtab_get_static_block (end_addr, objfile, 0, 0); + return end_symtab_from_static_block (static_block, objfile, section, 0); + } + +@@ -1308,7 +1312,7 @@ end_expandable_symtab (CORE_ADDR end_addr, struct objfile *objfile, + { + struct block *static_block; + +- static_block = end_symtab_get_static_block (end_addr, objfile, 1); ++ static_block = end_symtab_get_static_block (end_addr, objfile, 1, 0); + return end_symtab_from_static_block (static_block, objfile, section, 1); + } + +diff --git a/gdb/buildsym.h b/gdb/buildsym.h +index 162ee8c..33b34c8 100644 +--- a/gdb/buildsym.h ++++ b/gdb/buildsym.h +@@ -260,7 +260,8 @@ extern char *pop_subfile (void); + + extern struct block *end_symtab_get_static_block (CORE_ADDR end_addr, + struct objfile *objfile, +- int expandable); ++ int expandable, ++ int required); + + extern struct symtab *end_symtab_from_static_block (struct block *static_block, + struct objfile *objfile, diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index a5892b5..2944c2d 100644 --- a/gdb/c-typeprint.c @@ -152,6 +307,507 @@ index a5892b5..2944c2d 100644 fprintf_filtered (stream, "]"); c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, +diff --git a/gdb/cc-with-dwz.sh b/gdb/cc-with-dwz.sh +deleted file mode 100755 +index f66deb1..0000000 +--- a/gdb/cc-with-dwz.sh ++++ /dev/null +@@ -1,80 +0,0 @@ +-#! /bin/sh +-# Wrapper around gcc to run 'dwz' when running the testsuite. +- +-# Copyright (C) 2010-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 program requires dwz in addition to gcc. +-# +-# Example usage: +-# +-# bash$ cd $objdir/gdb/testsuite +-# bash$ runtest \ +-# CC_FOR_TARGET="/bin/sh $srcdir/cc-with-dwz.sh gcc" \ +-# CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-dwz.sh g++" +-# +- +-myname=cc-with-dwz.sh +- +-DWZ=${DWZ:-dwz} +- +-have_link=unknown +-next_is_output_file=no +-output_file=a.out +- +-for arg in "$@" +-do +- if [ "$next_is_output_file" = "yes" ] +- then +- output_file="$arg" +- next_is_output_file=no +- continue +- fi +- +- # Poor man's gcc argument parser. +- # We don't need to handle all arguments, we just need to know if we're +- # doing a link and what the output file is. +- # It's not perfect, but it seems to work well enough for the task at hand. +- case "$arg" in +- "-c") have_link=no ;; +- "-E") have_link=no ;; +- "-S") have_link=no ;; +- "-o") next_is_output_file=yes ;; +- esac +-done +- +-if [ "$next_is_output_file" = "yes" ] +-then +- echo "$myname: Unable to find output file" >&2 +- exit 1 +-fi +- +-if [ "$have_link" = "no" ] +-then +- "$@" +- exit $? +-fi +- +-"$@" +-rc=$? +-[ $rc != 0 ] && exit $rc +-if [ ! -f "$output_file" ] +-then +- echo "$myname: Internal error: $output_file missing." >&2 +- exit 1 +-fi +- +-$DWZ "$output_file" > /dev/null 2>&1 +- +-exit 0 +diff --git a/gdb/cc-with-index.sh b/gdb/cc-with-index.sh +deleted file mode 100644 +index 644ba34..0000000 +--- a/gdb/cc-with-index.sh ++++ /dev/null +@@ -1,126 +0,0 @@ +-#! /bin/sh +-# Wrapper around gcc to add the .gdb_index section when running the testsuite. +- +-# Copyright (C) 2010-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 program requires gdb and objcopy in addition to gcc. +-# The default values are gdb from the build tree and objcopy from $PATH. +-# They may be overridden by setting environment variables GDB and OBJCOPY +-# respectively. +-# We assume the current directory is either $obj/gdb or $obj/gdb/testsuite. +-# +-# Example usage: +-# +-# bash$ cd $objdir/gdb/testsuite +-# bash$ runtest \ +-# CC_FOR_TARGET="/bin/sh $srcdir/cc-with-index.sh gcc" \ +-# CXX_FOR_TARGET="/bin/sh $srcdir/cc-with-index.sh g++" +-# +-# For documentation on index files: info -f gdb.info -n "Index Files" +- +-myname=cc-with-index.sh +- +-if [ -z "$GDB" ] +-then +- if [ -f ./gdb ] +- then +- GDB="./gdb" +- elif [ -f ../gdb ] +- then +- GDB="../gdb" +- elif [ -f ../../gdb ] +- then +- GDB="../../gdb" +- else +- echo "$myname: unable to find usable gdb" >&2 +- exit 1 +- fi +-fi +- +-OBJCOPY=${OBJCOPY:-objcopy} +- +-have_link=unknown +-next_is_output_file=no +-output_file=a.out +- +-for arg in "$@" +-do +- if [ "$next_is_output_file" = "yes" ] +- then +- output_file="$arg" +- next_is_output_file=no +- continue +- fi +- +- # Poor man's gcc argument parser. +- # We don't need to handle all arguments, we just need to know if we're +- # doing a link and what the output file is. +- # It's not perfect, but it seems to work well enough for the task at hand. +- case "$arg" in +- "-c") have_link=no ;; +- "-E") have_link=no ;; +- "-S") have_link=no ;; +- "-o") next_is_output_file=yes ;; +- esac +-done +- +-if [ "$next_is_output_file" = "yes" ] +-then +- echo "$myname: Unable to find output file" >&2 +- exit 1 +-fi +- +-if [ "$have_link" = "no" ] +-then +- "$@" +- exit $? +-fi +- +-index_file="${output_file}.gdb-index" +-if [ -f "$index_file" ] +-then +- echo "$myname: Index file $index_file exists, won't clobber." >&2 +- exit 1 +-fi +- +-output_dir="${output_file%/*}" +-[ "$output_dir" = "$output_file" ] && output_dir="." +- +-"$@" +-rc=$? +-[ $rc != 0 ] && exit $rc +-if [ ! -f "$output_file" ] +-then +- echo "$myname: Internal error: $output_file missing." >&2 +- exit 1 +-fi +- +-$GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save gdb-index $output_dir" +-rc=$? +-[ $rc != 0 ] && exit $rc +- +-# GDB might not always create an index. Cope. +-if [ -f "$index_file" ] +-then +- $OBJCOPY --add-section .gdb_index="$index_file" \ +- --set-section-flags .gdb_index=readonly \ +- "$output_file" "$output_file" +- rc=$? +-else +- rc=0 +-fi +- +-rm -f "$index_file" +-exit $rc +diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c +index 4a8b5d1..7341f00 100644 +--- a/gdb/cli/cli-dump.c ++++ b/gdb/cli/cli-dump.c +@@ -32,6 +32,7 @@ + #include "readline/readline.h" + #include "gdbcore.h" + #include "cli/cli-utils.h" ++#include "gdb_bfd.h" + + #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) + +@@ -111,12 +112,12 @@ bfd_openr_with_cleanup (const char *filename, const char *target) + { + bfd *ibfd; + +- ibfd = bfd_openr (filename, target); ++ ibfd = gdb_bfd_openr (filename, target); + if (ibfd == NULL) + error (_("Failed to open %s: %s."), filename, + bfd_errmsg (bfd_get_error ())); + +- make_cleanup_bfd_close (ibfd); ++ make_cleanup_bfd_unref (ibfd); + if (!bfd_check_format (ibfd, bfd_object)) + error (_("'%s' is not a recognized file format."), filename); + +@@ -131,11 +132,11 @@ bfd_openw_with_cleanup (const char *filename, const char *target, + + if (*mode == 'w') /* Write: create new file */ + { +- obfd = bfd_openw (filename, target); ++ obfd = gdb_bfd_openw (filename, target); + if (obfd == NULL) + error (_("Failed to open %s: %s."), filename, + bfd_errmsg (bfd_get_error ())); +- make_cleanup_bfd_close (obfd); ++ make_cleanup_bfd_unref (obfd); + if (!bfd_set_format (obfd, bfd_object)) + error (_("bfd_openw_with_cleanup: %s."), bfd_errmsg (bfd_get_error ())); + } +diff --git a/gdb/coffread.c b/gdb/coffread.c +index b0a8b82..0c7e6d9 100644 +--- a/gdb/coffread.c ++++ b/gdb/coffread.c +@@ -653,13 +653,14 @@ coff_symfile_read (struct objfile *objfile, int symfile_flags) + char *debugfile; + + debugfile = find_separate_debug_file_by_debuglink (objfile); ++ make_cleanup (xfree, debugfile); + + if (debugfile) + { + bfd *abfd = symfile_bfd_open (debugfile); + ++ make_cleanup_bfd_unref (abfd); + symbol_file_add_separate (abfd, symfile_flags, objfile); +- xfree (debugfile); + } + } + +diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh +new file mode 100755 +index 0000000..7d7932c +--- /dev/null ++++ b/gdb/contrib/cc-with-tweaks.sh +@@ -0,0 +1,162 @@ ++#! /bin/sh ++# Wrapper around gcc to tweak the output in various ways when running ++# the testsuite. ++ ++# Copyright (C) 2010-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 program requires gdb and objcopy in addition to gcc. ++# The default values are gdb from the build tree and objcopy from $PATH. ++# They may be overridden by setting environment variables GDB and OBJCOPY ++# respectively. ++# We assume the current directory is either $obj/gdb or $obj/gdb/testsuite. ++# ++# Example usage: ++# ++# bash$ cd $objdir/gdb/testsuite ++# bash$ runtest \ ++# CC_FOR_TARGET="/bin/sh $srcdir/gdb/contrib/cc-with-tweaks.sh ARGS gcc" \ ++# CXX_FOR_TARGET="/bin/sh $srcdir/gdb/contrib/cc-with-tweaks.sh ARGS g++" ++# ++# For documentation on index files: info -f gdb.info -n "Index Files" ++# For information about 'dwz', see the announcement: ++# http://gcc.gnu.org/ml/gcc/2012-04/msg00686.html ++# (More documentation is to come.) ++ ++# ARGS determine what is done. They can be: ++# -z compress using dwz ++# -m compress using dwz -m ++# -i make an index ++# If nothing is given, no changes are made ++ ++myname=cc-with-tweaks.sh ++ ++if [ -z "$GDB" ] ++then ++ if [ -f ./gdb ] ++ then ++ GDB="./gdb" ++ elif [ -f ../gdb ] ++ then ++ GDB="../gdb" ++ elif [ -f ../../gdb ] ++ then ++ GDB="../../gdb" ++ else ++ echo "$myname: unable to find usable gdb" >&2 ++ exit 1 ++ fi ++fi ++ ++OBJCOPY=${OBJCOPY:-objcopy} ++ ++DWZ=${DWZ:-dwz} ++ ++have_link=unknown ++next_is_output_file=no ++output_file=a.out ++ ++want_index=false ++want_dwz=false ++want_multi=false ++ ++while [ $# -gt 0 ]; do ++ case "$1" in ++ -z) want_dwz=true ;; ++ -i) want_index=true ;; ++ -m) want_multi=true ;; ++ *) break ;; ++ esac ++ shift ++done ++ ++for arg in "$@" ++do ++ if [ "$next_is_output_file" = "yes" ] ++ then ++ output_file="$arg" ++ next_is_output_file=no ++ continue ++ fi ++ ++ # Poor man's gcc argument parser. ++ # We don't need to handle all arguments, we just need to know if we're ++ # doing a link and what the output file is. ++ # It's not perfect, but it seems to work well enough for the task at hand. ++ case "$arg" in ++ "-c") have_link=no ;; ++ "-E") have_link=no ;; ++ "-S") have_link=no ;; ++ "-o") next_is_output_file=yes ;; ++ esac ++done ++ ++if [ "$next_is_output_file" = "yes" ] ++then ++ echo "$myname: Unable to find output file" >&2 ++ exit 1 ++fi ++ ++if [ "$have_link" = "no" ] ++then ++ "$@" ++ exit $? ++fi ++ ++index_file="${output_file}.gdb-index" ++if [ "$want_index" = true ] && [ -f "$index_file" ] ++then ++ echo "$myname: Index file $index_file exists, won't clobber." >&2 ++ exit 1 ++fi ++ ++output_dir="${output_file%/*}" ++[ "$output_dir" = "$output_file" ] && output_dir="." ++ ++"$@" ++rc=$? ++[ $rc != 0 ] && exit $rc ++if [ ! -f "$output_file" ] ++then ++ echo "$myname: Internal error: $output_file missing." >&2 ++ exit 1 ++fi ++ ++if [ "$want_index" = true ]; then ++ $GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save gdb-index $output_dir" ++ rc=$? ++ [ $rc != 0 ] && exit $rc ++ ++ # GDB might not always create an index. Cope. ++ if [ -f "$index_file" ] ++ then ++ $OBJCOPY --add-section .gdb_index="$index_file" \ ++ --set-section-flags .gdb_index=readonly \ ++ "$output_file" "$output_file" ++ rc=$? ++ else ++ rc=0 ++ fi ++ [ $rc != 0 ] && exit $rc ++fi ++ ++if [ "$want_dwz" = true ]; then ++ $DWZ "$output_file" > /dev/null 2>&1 ++elif [ "$want_multi" = true ]; then ++ cp $output_file ${output_file}.alt ++ $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null 2>&1 ++fi ++ ++rm -f "$index_file" ++exit $rc +diff --git a/gdb/corelow.c b/gdb/corelow.c +index dd62560..340b149 100644 +--- a/gdb/corelow.c ++++ b/gdb/corelow.c +@@ -46,6 +46,7 @@ + #include "filenames.h" + #include "progspace.h" + #include "objfiles.h" ++#include "gdb_bfd.h" + + #ifndef O_LARGEFILE + #define O_LARGEFILE 0 +@@ -215,9 +216,7 @@ core_close (int quitting) + core_data = NULL; + } + +- name = bfd_get_filename (core_bfd); +- gdb_bfd_close_or_warn (core_bfd); +- xfree (name); ++ gdb_bfd_unref (core_bfd); + core_bfd = NULL; + } + core_vec = NULL; +@@ -319,9 +318,9 @@ core_open (char *filename, int from_tty) + if (scratch_chan < 0) + perror_with_name (filename); + +- temp_bfd = bfd_fopen (filename, gnutarget, +- write_files ? FOPEN_RUB : FOPEN_RB, +- scratch_chan); ++ temp_bfd = gdb_bfd_fopen (filename, gnutarget, ++ write_files ? FOPEN_RUB : FOPEN_RB, ++ scratch_chan); + if (temp_bfd == NULL) + perror_with_name (filename); + +@@ -332,7 +331,7 @@ core_open (char *filename, int from_tty) + /* FIXME: should be checking for errors from bfd_close (for one + thing, on error it does not free all the storage associated + with the bfd). */ +- make_cleanup_bfd_close (temp_bfd); ++ make_cleanup_bfd_unref (temp_bfd); + error (_("\"%s\" is not a core dump: %s"), + filename, bfd_errmsg (bfd_get_error ())); + } +@@ -340,7 +339,7 @@ core_open (char *filename, int from_tty) + /* Looks semi-reasonable. Toss the old core file and work on the + new. */ + +- discard_cleanups (old_chain); /* Don't free filename any more */ ++ do_cleanups (old_chain); + unpush_target (&core_ops); + core_bfd = temp_bfd; + old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/); diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in index 87c6dd4..1c26652 100644 --- a/gdb/data-directory/Makefile.in @@ -187,9 +843,18 @@ index 87c6dd4..1c26652 100644 FLAGS_TO_PASS = \ "prefix=$(prefix)" \ diff --git a/gdb/defs.h b/gdb/defs.h -index 03092aa..6d73386 100644 +index 1c6fa79..ec08348 100644 --- a/gdb/defs.h +++ b/gdb/defs.h +@@ -315,7 +315,7 @@ extern struct cleanup *make_cleanup_close (int fd); + + extern struct cleanup *make_cleanup_fclose (FILE *file); + +-extern struct cleanup *make_cleanup_bfd_close (bfd *abfd); ++extern struct cleanup *make_cleanup_bfd_unref (bfd *abfd); + + struct obstack; + extern struct cleanup *make_cleanup_obstack_free (struct obstack *obstack); @@ -353,6 +353,8 @@ extern struct cleanup *make_cleanup_restore_page_info (void); extern struct cleanup * set_batch_flag_and_make_cleanup_restore_page_info (void); @@ -200,10 +865,10 @@ index 03092aa..6d73386 100644 extern char *xfullpath (const char *); diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo -index 014cfd8..d0a8c51 100644 +index 68ea817..5945bac 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo -@@ -1191,6 +1191,16 @@ for remote debugging. +@@ -1200,6 +1200,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. @@ -220,7 +885,7 @@ index 014cfd8..d0a8c51 100644 @c resolve the situation of these eventually @item -tui @cindex @code{--tui} -@@ -22494,8 +22504,6 @@ containing @code{end}. For example: +@@ -22563,8 +22573,6 @@ containing @code{end}. For example: @smallexample (@value{GDBP}) python @@ -229,7 +894,7 @@ index 014cfd8..d0a8c51 100644 >print 23 >end 23 -@@ -22509,6 +22517,14 @@ controlled using @code{set python print-stack}: if @code{full}, then +@@ -22578,6 +22586,14 @@ controlled using @code{set python print-stack}: if @code{full}, then full Python stack printing is enabled; if @code{none}, then Python stack and message printing is disabled; if @code{message}, the default, only the message component of the error is printed. @@ -244,7 +909,7 @@ index 014cfd8..d0a8c51 100644 @end table It is also possible to execute a Python script from the @value{GDBN} -@@ -22530,6 +22546,14 @@ and thus is always available. +@@ -22599,6 +22615,14 @@ and thus is always available. @cindex python api @cindex programming in python @@ -259,11 +924,23 @@ index 014cfd8..d0a8c51 100644 @cindex python stdout @cindex python pagination At startup, @value{GDBN} overrides Python's @code{sys.stdout} and +@@ -34536,6 +34560,11 @@ Shared library events. + + @end table + ++@kindex maint info bfds ++@item maint info bfds ++This prints information about each @code{bfd} object that is known to ++@value{GDBN}. @xref{Top, , BFD, bfd, The Binary File Descriptor Library}. ++ + @kindex set displaced-stepping + @kindex show displaced-stepping + @cindex displaced stepping support diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo -index 267a6eb..4f159b4 100644 +index 5e00f1f..c5c432b 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo -@@ -2103,6 +2103,18 @@ time, and so we attempt to handle symbols incrementally. For instance, +@@ -2102,6 +2102,18 @@ time, and so we attempt to handle symbols incrementally. For instance, we create @dfn{partial symbol tables} consisting of only selected symbols, and only expand them to full symbol tables when necessary. @@ -282,7 +959,7 @@ index 267a6eb..4f159b4 100644 @section Symbol Reading @cindex symbol reading -@@ -2195,6 +2207,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and +@@ -2194,6 +2206,7 @@ symtab. Upon return, @code{pst->readin} should have been set to 1, and zero if there were no symbols in that part of the symbol file. @end table @@ -290,7 +967,7 @@ index 267a6eb..4f159b4 100644 @section Partial Symbol Tables @value{GDBN} has three types of symbol tables: -@@ -2296,6 +2309,7 @@ and partial symbol tables behind a set of function pointers known as +@@ -2295,6 +2308,7 @@ and partial symbol tables behind a set of function pointers known as the @dfn{quick symbol functions}. These are documented in @file{symfile.h}. @@ -298,7 +975,7 @@ index 267a6eb..4f159b4 100644 @section Types @unnumberedsubsec Fundamental Types (e.g., @code{FT_VOID}, @code{FT_BOOLEAN}). -@@ -2318,6 +2332,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by +@@ -2317,6 +2331,7 @@ types map to one @code{TYPE_CODE_*} type, and are distinguished by other members of the type struct, such as whether the type is signed or unsigned, and how many bits it uses. @@ -306,7 +983,7 @@ index 267a6eb..4f159b4 100644 @unnumberedsubsec Builtin Types (e.g., @code{builtin_type_void}, @code{builtin_type_char}). These are instances of type structs that roughly correspond to -@@ -2332,6 +2347,7 @@ only one instance exists, while @file{c-lang.c} builds as many +@@ -2331,6 +2346,7 @@ only one instance exists, while @file{c-lang.c} builds as many @code{TYPE_CODE_INT} types as needed, with each one associated with some particular objfile. @@ -314,7 +991,7 @@ index 267a6eb..4f159b4 100644 @section Object File Formats @cindex object file formats -@@ -2417,6 +2433,7 @@ SOM, which is a cross-language ABI). +@@ -2416,6 +2432,7 @@ SOM, which is a cross-language ABI). The SOM reader is in @file{somread.c}. @@ -322,7 +999,7 @@ index 267a6eb..4f159b4 100644 @section Debugging File Formats This section describes characteristics of debugging information that -@@ -2488,6 +2505,7 @@ DWARF 3 is an improved version of DWARF 2. +@@ -2487,6 +2504,7 @@ DWARF 3 is an improved version of DWARF 2. @cindex SOM debugging info Like COFF, the SOM definition includes debugging information. @@ -330,7 +1007,7 @@ index 267a6eb..4f159b4 100644 @section Adding a New Symbol Reader to @value{GDBN} @cindex adding debugging info reader -@@ -2510,6 +2528,7 @@ will only ever be implemented by one object file format may be called +@@ -2509,6 +2527,7 @@ will only ever be implemented by one object file format may be called directly. This interface should be described in a file @file{bfd/lib@var{xyz}.h}, which is included by @value{GDBN}. @@ -338,7 +1015,7 @@ index 267a6eb..4f159b4 100644 @section Memory Management for Symbol Files Most memory associated with a loaded symbol file is stored on -@@ -2521,10 +2540,45 @@ released when the objfile is unloaded or reloaded. Therefore one +@@ -2520,10 +2539,45 @@ released when the objfile is unloaded or reloaded. Therefore one objfile must not reference symbol or type data from another objfile; they could be unloaded at different times. @@ -404,11 +1081,55 @@ index 6827ed8..c63b901 100644 @deftypefun void test_notification (int @var{somearg}) This observer is used for internal testing. Do not use. See testsuite/gdb.gdb/observer.exp. +diff --git a/gdb/dsrec.c b/gdb/dsrec.c +index d2c99b2..f39d0ed 100644 +--- a/gdb/dsrec.c ++++ b/gdb/dsrec.c +@@ -23,6 +23,7 @@ + #include + #include "gdb_assert.h" + #include "gdb_string.h" ++#include "gdb_bfd.h" + + extern void report_transfer_performance (unsigned long, time_t, time_t); + +@@ -56,19 +57,22 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset, + int reclen; + time_t start_time, end_time; + unsigned long data_count = 0; ++ struct cleanup *cleanup; + + srec = (char *) alloca (maxrecsize + 1); + +- abfd = bfd_openr (file, 0); ++ abfd = gdb_bfd_openr (file, 0); + if (!abfd) + { + printf_filtered (_("Unable to open file %s\n"), file); + return; + } + ++ cleanup = make_cleanup_bfd_unref (abfd); + if (bfd_check_format (abfd, bfd_object) == 0) + { + printf_filtered (_("File is not an object file\n")); ++ do_cleanups (cleanup); + return; + } + +@@ -170,6 +174,7 @@ load_srec (struct serial *desc, const char *file, bfd_vma load_offset, + serial_flush_input (desc); + + report_transfer_performance (data_count, start_time, end_time); ++ do_cleanups (cleanup); + } + + /* diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c -index e0aafc7..7387711 100644 +index 214b371..d9b3751 100644 --- a/gdb/dwarf2expr.c +++ b/gdb/dwarf2expr.c -@@ -1458,6 +1458,14 @@ execute_stack_op (struct dwarf_expr_context *ctx, +@@ -1480,6 +1480,14 @@ execute_stack_op (struct dwarf_expr_context *ctx, } break; @@ -424,10 +1145,10 @@ index e0aafc7..7387711 100644 error (_("Unhandled dwarf expression opcode 0x%x"), op); } diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h -index f39ef3c..066cb10 100644 +index 19efbfd..0e0e498 100644 --- a/gdb/dwarf2expr.h +++ b/gdb/dwarf2expr.h -@@ -91,12 +91,8 @@ struct dwarf_expr_context_funcs +@@ -78,12 +78,8 @@ struct dwarf_expr_context_funcs This can throw an exception if the index is out of range. */ CORE_ADDR (*get_addr_index) (void *baton, unsigned int index); @@ -441,10 +1162,10 @@ index f39ef3c..066cb10 100644 /* The location of a value. */ diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index 8c97f19..a6f3e9c 100644 +index 38e4814..46a033d 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c -@@ -274,6 +274,9 @@ struct dwarf_expr_baton +@@ -293,6 +293,9 @@ struct dwarf_expr_baton { struct frame_info *frame; struct dwarf2_per_cu_data *per_cu; @@ -454,7 +1175,7 @@ index 8c97f19..a6f3e9c 100644 }; /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -333,16 +336,14 @@ static void +@@ -352,16 +355,14 @@ static void dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, const gdb_byte **start, size_t *length) { @@ -473,7 +1194,7 @@ index 8c97f19..a6f3e9c 100644 { struct dwarf2_locexpr_baton *symbaton; -@@ -355,10 +356,23 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, +@@ -374,10 +375,23 @@ dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc, else *length = 0; } @@ -498,7 +1219,7 @@ index 8c97f19..a6f3e9c 100644 } /* Helper function for dwarf2_evaluate_loc_desc. Computes the CFA for -@@ -426,6 +440,85 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, cu_offset die_offset) +@@ -445,6 +459,85 @@ dwarf_expr_dwarf_call (struct dwarf_expr_context *ctx, cu_offset die_offset) ctx->funcs->get_frame_pc, ctx->baton); } @@ -584,7 +1305,7 @@ index 8c97f19..a6f3e9c 100644 /* Callback function for dwarf2_evaluate_loc_desc. */ static struct type * -@@ -1105,10 +1198,12 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, +@@ -1139,10 +1232,12 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, saved_ctx.gdbarch = ctx->gdbarch; saved_ctx.addr_size = ctx->addr_size; @@ -597,7 +1318,7 @@ index 8c97f19..a6f3e9c 100644 ctx->offset = dwarf2_per_cu_text_offset (baton_local.per_cu); ctx->baton = &baton_local; -@@ -1116,10 +1211,95 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, +@@ -1150,10 +1245,95 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, ctx->gdbarch = saved_ctx.gdbarch; ctx->addr_size = saved_ctx.addr_size; @@ -693,7 +1414,7 @@ index 8c97f19..a6f3e9c 100644 /* Callback function for dwarf2_evaluate_loc_desc. Fetch the address indexed by DW_OP_GNU_addr_index. */ -@@ -2053,22 +2233,6 @@ invalid_synthetic_pointer (void) +@@ -2088,22 +2268,6 @@ invalid_synthetic_pointer (void) "referenced via synthetic pointer")); } @@ -716,7 +1437,7 @@ index 8c97f19..a6f3e9c 100644 /* Evaluate a location description, starting at DATA and with length SIZE, to find the current location of variable of TYPE in the context of FRAME. BYTE_OFFSET is applied after the contents are -@@ -2081,7 +2245,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2116,7 +2280,6 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, LONGEST byte_offset) { struct value *retval; @@ -724,7 +1445,7 @@ index 8c97f19..a6f3e9c 100644 struct dwarf_expr_context *ctx; struct cleanup *old_chain, *value_chain; struct objfile *objfile = dwarf2_per_cu_objfile (per_cu); -@@ -2093,29 +2256,18 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2128,29 +2291,18 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, if (size == 0) return allocate_optimized_out_value (type); @@ -755,7 +1476,7 @@ index 8c97f19..a6f3e9c 100644 retval = allocate_value (type); mark_value_bytes_unavailable (retval, 0, TYPE_LENGTH (type)); return retval; -@@ -2179,6 +2331,16 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2214,6 +2366,16 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); do_cleanups (value_chain); @@ -772,7 +1493,7 @@ index 8c97f19..a6f3e9c 100644 retval = allocate_value_lazy (type); VALUE_LVAL (retval) = lval_memory; if (in_stack_memory) -@@ -4048,8 +4210,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, +@@ -4130,8 +4292,7 @@ loclist_tracepoint_var_ref (struct symbol *symbol, struct gdbarch *gdbarch, dlbaton->per_cu); } @@ -782,7 +1503,7 @@ index 8c97f19..a6f3e9c 100644 const struct symbol_computed_ops dwarf2_loclist_funcs = { loclist_read_variable, loclist_read_variable_at_entry, -@@ -4058,6 +4219,48 @@ const struct symbol_computed_ops dwarf2_loclist_funcs = { +@@ -4140,6 +4301,48 @@ const struct symbol_computed_ops dwarf2_loclist_funcs = { loclist_tracepoint_var_ref }; @@ -852,10 +1573,145 @@ index e9d06a3..bfa6776 100644 /* Compile a DWARF location expression to an agent expression. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 8dbc53e..b5b7813 100644 +index deee5a2..b2f052b 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c -@@ -1348,6 +1348,9 @@ static void fill_in_loclist_baton (struct dwarf2_cu *cu, +@@ -64,20 +64,12 @@ + #include "gdbcore.h" /* for gnutarget */ + #include "gdb/gdb-index.h" + #include ++#include "gdb_bfd.h" + + #include + #include "gdb_string.h" + #include "gdb_assert.h" + #include +-#ifdef HAVE_ZLIB_H +-#include +-#endif +-#ifdef HAVE_MMAP +-#include +-#ifndef MAP_FAILED +-#define MAP_FAILED ((void *) -1) +-#endif +-#endif + + typedef struct symbol *symbolp; + DEF_VEC_P (symbolp); +@@ -95,8 +87,6 @@ static int check_physname = 0; + /* When non-zero, do not reject deprecated .gdb_index sections. */ + static int use_deprecated_index_sections = 0; + +-static int pagesize; +- + /* When set, the file that we're processing is known to have debugging + info for C++ namespaces. GCC 3.3.x did not produce this information, + but later versions do. */ +@@ -110,10 +100,6 @@ struct dwarf2_section_info + asection *asection; + gdb_byte *buffer; + bfd_size_type size; +- /* Not NULL if the section was actually mmapped. */ +- void *map_addr; +- /* Page aligned size of mmapped area. */ +- bfd_size_type map_len; + /* True if we have tried to read this section. */ + int readin; + }; +@@ -247,6 +233,10 @@ struct dwarf2_per_objfile + This is NULL if the table hasn't been allocated yet. */ + htab_t dwo_files; + ++ /* The shared '.dwz' file, if one exists. This is used when the ++ original data was compressed using 'dwz -m'. */ ++ struct dwz_file *dwz_file; ++ + /* A flag indicating wether this objfile has a section loaded at a + VMA of 0. */ + int has_section_at_zero; +@@ -505,15 +495,13 @@ struct dwarf2_cu + + struct dwarf2_per_cu_data + { +- /* The start offset and length of this compilation unit. 2**29-1 +- bytes should suffice to store the length of any compilation unit +- - if it doesn't, GDB will fall over anyway. ++ /* The start offset and length of this compilation unit. + NOTE: Unlike comp_unit_head.length, this length includes + initial_length_size. + If the DIE refers to a DWO file, this is always of the original die, + not the DWO file. */ + sect_offset offset; +- unsigned int length : 29; ++ unsigned int length; + + /* Flag indicating this compilation unit will be read in before + any of the current compilation units are processed. */ +@@ -528,6 +516,9 @@ struct dwarf2_per_cu_data + /* Non-zero if this CU is from .debug_types. */ + unsigned int is_debug_types : 1; + ++ /* Non-zero if this CU is from the .dwz file. */ ++ unsigned int is_dwz : 1; ++ + /* The section this CU/TU lives in. + If the DIE refers to a DWO file, this is always the original die, + not the DWO file. */ +@@ -715,6 +706,22 @@ struct dwo_file + htab_t tus; + }; + ++/* This represents a '.dwz' file. */ ++ ++struct dwz_file ++{ ++ /* A dwz file can only contain a few sections. */ ++ struct dwarf2_section_info abbrev; ++ struct dwarf2_section_info info; ++ struct dwarf2_section_info str; ++ struct dwarf2_section_info line; ++ struct dwarf2_section_info macro; ++ struct dwarf2_section_info gdb_index; ++ ++ /* The dwz's BFD. */ ++ bfd *dwz_bfd; ++}; ++ + /* Struct used to pass misc. parameters to read_die_and_children, et + al. which are used for both .debug_info and .debug_types dies. + All parameters here are unchanging for the life of the call. This +@@ -828,6 +835,12 @@ struct partial_die_info + /* Flag set if fixup_partial_die has been called on this die. */ + unsigned int fixup_called : 1; + ++ /* Flag set if DW_TAG_imported_unit uses DW_FORM_GNU_ref_alt. */ ++ unsigned int is_dwz : 1; ++ ++ /* Flag set if spec_offset uses DW_FORM_GNU_ref_alt. */ ++ unsigned int spec_is_dwz : 1; ++ + /* The name of this DIE. Normally the value of DW_AT_name, but + sometimes a default name for unnamed DIEs. */ + char *name; +@@ -1213,7 +1226,7 @@ static gdb_byte *read_partial_die (const struct die_reader_specs *, + unsigned int, + gdb_byte *); + +-static struct partial_die_info *find_partial_die (sect_offset, ++static struct partial_die_info *find_partial_die (sect_offset, int, + struct dwarf2_cu *); + + static void fixup_partial_die (struct partial_die_info *, +@@ -1258,6 +1271,8 @@ static char *read_indirect_string (bfd *, gdb_byte *, + const struct comp_unit_head *, + unsigned int *); + ++static char *read_indirect_string_from_dwz (struct dwz_file *, LONGEST); ++ + static ULONGEST read_unsigned_leb128 (bfd *, gdb_byte *, unsigned int *); + + static LONGEST read_signed_leb128 (bfd *, gdb_byte *, unsigned int *); +@@ -1509,6 +1524,9 @@ static void fill_in_loclist_baton (struct dwarf2_cu *cu, struct dwarf2_loclist_baton *baton, struct attribute *attr); @@ -865,7 +1721,16 @@ index 8dbc53e..b5b7813 100644 static void dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, struct dwarf2_cu *cu); -@@ -1380,6 +1383,9 @@ static void age_cached_comp_units (void); +@@ -1524,7 +1542,7 @@ static hashval_t partial_die_hash (const void *item); + static int partial_die_eq (const void *item_lhs, const void *item_rhs); + + static struct dwarf2_per_cu_data *dwarf2_find_containing_comp_unit +- (sect_offset offset, struct objfile *objfile); ++ (sect_offset offset, unsigned int offset_in_dwz, struct objfile *objfile); + + static void init_one_comp_unit (struct dwarf2_cu *cu, + struct dwarf2_per_cu_data *per_cu); +@@ -1541,6 +1559,9 @@ static void age_cached_comp_units (void); static void free_one_cached_comp_unit (struct dwarf2_per_cu_data *); @@ -875,7 +1740,7 @@ index 8dbc53e..b5b7813 100644 static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *); -@@ -1405,6 +1411,9 @@ static struct type *get_die_type_at_offset (sect_offset, +@@ -1569,6 +1590,9 @@ static struct type *get_die_type_at_offset (sect_offset, static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); @@ -885,7 +1750,861 @@ index 8dbc53e..b5b7813 100644 static void dwarf2_release_queue (void *dummy); static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu, -@@ -9526,6 +9535,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) +@@ -1587,6 +1611,12 @@ static void find_file_and_directory (struct die_info *die, + static char *file_full_name (int file, struct line_header *lh, + const char *comp_dir); + ++static gdb_byte *read_and_check_comp_unit_head ++ (struct comp_unit_head *header, ++ struct dwarf2_section_info *section, ++ struct dwarf2_section_info *abbrev_section, gdb_byte *info_ptr, ++ int is_debug_types_section); ++ + static void init_cutu_and_read_dies + (struct dwarf2_per_cu_data *this_cu, struct abbrev_table *abbrev_table, + int use_existing_cu, int keep, +@@ -1608,8 +1638,6 @@ static struct dwo_unit *lookup_dwo_type_unit + + static void free_dwo_file_cleanup (void *); + +-static void munmap_section_buffer (struct dwarf2_section_info *); +- + static void process_cu_includes (void); + + #if WORDS_BIGENDIAN +@@ -1779,85 +1807,6 @@ dwarf2_locate_sections (bfd *abfd, asection *sectp, void *vnames) + dwarf2_per_objfile->has_section_at_zero = 1; + } + +-/* Decompress a section that was compressed using zlib. Store the +- decompressed buffer, and its size, in OUTBUF and OUTSIZE. */ +- +-static void +-zlib_decompress_section (struct objfile *objfile, asection *sectp, +- gdb_byte **outbuf, bfd_size_type *outsize) +-{ +- bfd *abfd = sectp->owner; +-#ifndef HAVE_ZLIB_H +- error (_("Support for zlib-compressed DWARF data (from '%s') " +- "is disabled in this copy of GDB"), +- bfd_get_filename (abfd)); +-#else +- bfd_size_type compressed_size = bfd_get_section_size (sectp); +- gdb_byte *compressed_buffer = xmalloc (compressed_size); +- struct cleanup *cleanup = make_cleanup (xfree, compressed_buffer); +- bfd_size_type uncompressed_size; +- gdb_byte *uncompressed_buffer; +- z_stream strm; +- int rc; +- int header_size = 12; +- +- if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 +- || bfd_bread (compressed_buffer, +- compressed_size, abfd) != compressed_size) +- error (_("Dwarf Error: Can't read DWARF data from '%s'"), +- bfd_get_filename (abfd)); +- +- /* Read the zlib header. In this case, it should be "ZLIB" followed +- by the uncompressed section size, 8 bytes in big-endian order. */ +- if (compressed_size < header_size +- || strncmp (compressed_buffer, "ZLIB", 4) != 0) +- error (_("Dwarf Error: Corrupt DWARF ZLIB header from '%s'"), +- bfd_get_filename (abfd)); +- uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8; +- uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8; +- uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8; +- uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8; +- uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8; +- uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8; +- uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8; +- uncompressed_size += compressed_buffer[11]; +- +- /* It is possible the section consists of several compressed +- buffers concatenated together, so we uncompress in a loop. */ +- strm.zalloc = NULL; +- strm.zfree = NULL; +- strm.opaque = NULL; +- strm.avail_in = compressed_size - header_size; +- strm.next_in = (Bytef*) compressed_buffer + header_size; +- strm.avail_out = uncompressed_size; +- uncompressed_buffer = obstack_alloc (&objfile->objfile_obstack, +- uncompressed_size); +- rc = inflateInit (&strm); +- while (strm.avail_in > 0) +- { +- if (rc != Z_OK) +- error (_("Dwarf Error: setting up DWARF uncompression in '%s': %d"), +- bfd_get_filename (abfd), rc); +- strm.next_out = ((Bytef*) uncompressed_buffer +- + (uncompressed_size - strm.avail_out)); +- rc = inflate (&strm, Z_FINISH); +- if (rc != Z_STREAM_END) +- error (_("Dwarf Error: zlib error uncompressing from '%s': %d"), +- bfd_get_filename (abfd), rc); +- rc = inflateReset (&strm); +- } +- rc = inflateEnd (&strm); +- if (rc != Z_OK +- || strm.avail_out != 0) +- error (_("Dwarf Error: concluding DWARF uncompression in '%s': %d"), +- bfd_get_filename (abfd), rc); +- +- do_cleanups (cleanup); +- *outbuf = uncompressed_buffer; +- *outsize = uncompressed_size; +-#endif +-} +- + /* A helper function that decides whether a section is empty, + or not present. */ + +@@ -1884,56 +1833,27 @@ dwarf2_read_section (struct objfile *objfile, struct dwarf2_section_info *info) + if (info->readin) + return; + info->buffer = NULL; +- info->map_addr = NULL; + info->readin = 1; + + if (dwarf2_section_empty_p (info)) + return; + +- /* Note that ABFD may not be from OBJFILE, e.g. a DWO section. */ + abfd = sectp->owner; + +- /* Check if the file has a 4-byte header indicating compression. */ +- if (info->size > sizeof (header) +- && bfd_seek (abfd, sectp->filepos, SEEK_SET) == 0 +- && bfd_bread (header, sizeof (header), abfd) == sizeof (header)) +- { +- /* Upon decompression, update the buffer and its size. */ +- if (strncmp (header, "ZLIB", sizeof (header)) == 0) +- { +- zlib_decompress_section (objfile, sectp, &info->buffer, +- &info->size); +- return; +- } +- } +- +-#ifdef HAVE_MMAP +- if (pagesize == 0) +- pagesize = getpagesize (); +- +- /* Only try to mmap sections which are large enough: we don't want to +- waste space due to fragmentation. Also, only try mmap for sections +- without relocations. */ +- +- if (info->size > 4 * pagesize && (sectp->flags & SEC_RELOC) == 0) ++ /* If the section has relocations, we must read it ourselves. ++ Otherwise we attach it to the BFD. */ ++ if ((sectp->flags & SEC_RELOC) == 0) + { +- info->buffer = bfd_mmap (abfd, 0, info->size, PROT_READ, +- MAP_PRIVATE, sectp->filepos, +- &info->map_addr, &info->map_len); ++ const gdb_byte *bytes = gdb_bfd_map_section (sectp, &info->size); + +- if ((caddr_t)info->buffer != MAP_FAILED) +- { +-#if HAVE_POSIX_MADVISE +- posix_madvise (info->map_addr, info->map_len, POSIX_MADV_WILLNEED); +-#endif +- return; +- } ++ /* We have to cast away const here for historical reasons. ++ Fixing dwarf2read to be const-correct would be quite nice. */ ++ info->buffer = (gdb_byte *) bytes; ++ return; + } +-#endif + +- /* If we get here, we are a normal, not-compressed section. */ +- info->buffer = buf +- = obstack_alloc (&objfile->objfile_obstack, info->size); ++ buf = obstack_alloc (&objfile->objfile_obstack, info->size); ++ info->buffer = buf; + + /* When debugging .o files, we may need to apply relocations; see + http://sourceware.org/ml/gdb-patches/2002-04/msg00136.html . +@@ -2009,6 +1929,111 @@ dwarf2_get_section_info (struct objfile *objfile, + *sizep = info->size; + } + ++/* A helper function to find the sections for a .dwz file. */ ++ ++static void ++locate_dwz_sections (bfd *abfd, asection *sectp, void *arg) ++{ ++ struct dwz_file *dwz_file = arg; ++ ++ /* Note that we only support the standard ELF names, because .dwz ++ is ELF-only (at the time of writing). */ ++ if (section_is_p (sectp->name, &dwarf2_elf_names.abbrev)) ++ { ++ dwz_file->abbrev.asection = sectp; ++ dwz_file->abbrev.size = bfd_get_section_size (sectp); ++ } ++ else if (section_is_p (sectp->name, &dwarf2_elf_names.info)) ++ { ++ dwz_file->info.asection = sectp; ++ dwz_file->info.size = bfd_get_section_size (sectp); ++ } ++ else if (section_is_p (sectp->name, &dwarf2_elf_names.str)) ++ { ++ dwz_file->str.asection = sectp; ++ dwz_file->str.size = bfd_get_section_size (sectp); ++ } ++ else if (section_is_p (sectp->name, &dwarf2_elf_names.line)) ++ { ++ dwz_file->line.asection = sectp; ++ dwz_file->line.size = bfd_get_section_size (sectp); ++ } ++ else if (section_is_p (sectp->name, &dwarf2_elf_names.macro)) ++ { ++ dwz_file->macro.asection = sectp; ++ dwz_file->macro.size = bfd_get_section_size (sectp); ++ } ++ else if (section_is_p (sectp->name, &dwarf2_elf_names.gdb_index)) ++ { ++ dwz_file->gdb_index.asection = sectp; ++ dwz_file->gdb_index.size = bfd_get_section_size (sectp); ++ } ++} ++ ++/* Open the separate '.dwz' debug file, if needed. Error if the file ++ cannot be found. */ ++ ++static struct dwz_file * ++dwarf2_get_dwz_file (void) ++{ ++ bfd *abfd, *dwz_bfd; ++ asection *section; ++ gdb_byte *data; ++ struct cleanup *cleanup; ++ const char *filename; ++ struct dwz_file *result; ++ ++ if (dwarf2_per_objfile->dwz_file != NULL) ++ return dwarf2_per_objfile->dwz_file; ++ ++ abfd = dwarf2_per_objfile->objfile->obfd; ++ section = bfd_get_section_by_name (abfd, ".gnu_debugaltlink"); ++ if (section == NULL) ++ error (_("could not find '.gnu_debugaltlink' section")); ++ if (!bfd_malloc_and_get_section (abfd, section, &data)) ++ error (_("could not read '.gnu_debugaltlink' section: %s"), ++ bfd_errmsg (bfd_get_error ())); ++ cleanup = make_cleanup (xfree, data); ++ ++ filename = data; ++ if (!IS_ABSOLUTE_PATH (filename)) ++ { ++ char *abs = gdb_realpath (dwarf2_per_objfile->objfile->name); ++ char *rel; ++ ++ make_cleanup (xfree, abs); ++ abs = ldirname (abs); ++ make_cleanup (xfree, abs); ++ ++ rel = concat (abs, SLASH_STRING, filename, (char *) NULL); ++ make_cleanup (xfree, rel); ++ filename = rel; ++ } ++ ++ /* The format is just a NUL-terminated file name, followed by the ++ build-id. For now, though, we ignore the build-id. */ ++ dwz_bfd = gdb_bfd_open (filename, gnutarget, -1); ++ if (dwz_bfd == NULL) ++ error (_("could not read '%s': %s"), filename, ++ bfd_errmsg (bfd_get_error ())); ++ ++ if (!bfd_check_format (dwz_bfd, bfd_object)) ++ { ++ gdb_bfd_unref (dwz_bfd); ++ error (_("file '%s' was not usable: %s"), filename, ++ bfd_errmsg (bfd_get_error ())); ++ } ++ ++ result = OBSTACK_ZALLOC (&dwarf2_per_objfile->objfile->objfile_obstack, ++ struct dwz_file); ++ result->dwz_bfd = dwz_bfd; ++ ++ bfd_map_over_sections (dwz_bfd, locate_dwz_sections, result); ++ ++ do_cleanups (cleanup); ++ ++ return result; ++} + + /* DWARF quick_symbols_functions support. */ + +@@ -2279,23 +2304,19 @@ extract_cu_value (const char *bytes, ULONGEST *result) + return 1; + } + +-/* Read the CU list from the mapped index, and use it to create all +- the CU objects for this objfile. Return 0 if something went wrong, +- 1 if everything went ok. */ ++/* A helper for create_cus_from_index that handles a given list of ++ CUs. */ + + static int +-create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list, +- offset_type cu_list_elements) ++create_cus_from_index_list (struct objfile *objfile, ++ const gdb_byte *cu_list, offset_type n_elements, ++ struct dwarf2_section_info *section, ++ int is_dwz, ++ int base_offset) + { + offset_type i; + +- dwarf2_per_objfile->n_comp_units = cu_list_elements / 2; +- dwarf2_per_objfile->all_comp_units +- = obstack_alloc (&objfile->objfile_obstack, +- dwarf2_per_objfile->n_comp_units +- * sizeof (struct dwarf2_per_cu_data *)); +- +- for (i = 0; i < cu_list_elements; i += 2) ++ for (i = 0; i < n_elements; i += 2) + { + struct dwarf2_per_cu_data *the_cu; + ULONGEST offset, length; +@@ -2310,15 +2331,45 @@ create_cus_from_index (struct objfile *objfile, const gdb_byte *cu_list, + the_cu->offset.sect_off = offset; + the_cu->length = length; + the_cu->objfile = objfile; +- the_cu->info_or_types_section = &dwarf2_per_objfile->info; ++ the_cu->info_or_types_section = section; + the_cu->v.quick = OBSTACK_ZALLOC (&objfile->objfile_obstack, + struct dwarf2_per_cu_quick_data); +- dwarf2_per_objfile->all_comp_units[i / 2] = the_cu; ++ the_cu->is_dwz = is_dwz; ++ dwarf2_per_objfile->all_comp_units[base_offset + i / 2] = the_cu; + } + + return 1; + } + ++/* Read the CU list from the mapped index, and use it to create all ++ the CU objects for this objfile. Return 0 if something went wrong, ++ 1 if everything went ok. */ ++ ++static int ++create_cus_from_index (struct objfile *objfile, ++ const gdb_byte *cu_list, offset_type cu_list_elements, ++ const gdb_byte *dwz_list, offset_type dwz_elements) ++{ ++ struct dwz_file *dwz; ++ ++ dwarf2_per_objfile->n_comp_units = (cu_list_elements + dwz_elements) / 2; ++ dwarf2_per_objfile->all_comp_units ++ = obstack_alloc (&objfile->objfile_obstack, ++ dwarf2_per_objfile->n_comp_units ++ * sizeof (struct dwarf2_per_cu_data *)); ++ ++ if (!create_cus_from_index_list (objfile, cu_list, cu_list_elements, ++ &dwarf2_per_objfile->info, 0, 0)) ++ return 0; ++ ++ if (dwz_elements == 0) ++ return 1; ++ ++ dwz = dwarf2_get_dwz_file (); ++ return create_cus_from_index_list (objfile, dwz_list, dwz_elements, ++ &dwz->info, 1, cu_list_elements / 2); ++} ++ + /* Create the signatured type hash table from the index. */ + + static int +@@ -2508,33 +2559,44 @@ find_slot_in_mapped_hash (struct mapped_index *index, const char *name, + } + } + +-/* Read the index file. If everything went ok, initialize the "quick" +- elements of all the CUs and return 1. Otherwise, return 0. */ ++/* A helper function that reads the .gdb_index from SECTION and fills ++ in MAP. FILENAME is the name of the file containing the section; ++ it is used for error reporting. DEPRECATED_OK is nonzero if it is ++ ok to use deprecated sections. ++ ++ CU_LIST, CU_LIST_ELEMENTS, TYPES_LIST, and TYPES_LIST_ELEMENTS are ++ out parameters that are filled in with information about the CU and ++ TU lists in the section. ++ ++ Returns 1 if all went well, 0 otherwise. */ + + static int +-dwarf2_read_index (struct objfile *objfile) ++read_index_from_section (struct objfile *objfile, ++ const char *filename, ++ int deprecated_ok, ++ struct dwarf2_section_info *section, ++ struct mapped_index *map, ++ const gdb_byte **cu_list, ++ offset_type *cu_list_elements, ++ const gdb_byte **types_list, ++ offset_type *types_list_elements) + { + char *addr; +- struct mapped_index *map; ++ offset_type version; + offset_type *metadata; +- const gdb_byte *cu_list; +- const gdb_byte *types_list = NULL; +- offset_type version, cu_list_elements; +- offset_type types_list_elements = 0; + int i; + +- if (dwarf2_section_empty_p (&dwarf2_per_objfile->gdb_index)) ++ if (dwarf2_section_empty_p (section)) + return 0; + + /* Older elfutils strip versions could keep the section in the main + executable while splitting it for the separate debug info file. */ +- if ((bfd_get_file_flags (dwarf2_per_objfile->gdb_index.asection) +- & SEC_HAS_CONTENTS) == 0) ++ if ((bfd_get_file_flags (section->asection) & SEC_HAS_CONTENTS) == 0) + return 0; + +- dwarf2_read_section (objfile, &dwarf2_per_objfile->gdb_index); ++ dwarf2_read_section (objfile, section); + +- addr = dwarf2_per_objfile->gdb_index.buffer; ++ addr = section->buffer; + /* Version check. */ + version = MAYBE_SWAP (*(offset_type *) addr); + /* Versions earlier than 3 emitted every copy of a psymbol. This +@@ -2547,7 +2609,7 @@ dwarf2_read_index (struct objfile *objfile) + if (!warning_printed) + { + warning (_("Skipping obsolete .gdb_index section in %s."), +- objfile->name); ++ filename); + warning_printed = 1; + } + return 0; +@@ -2560,7 +2622,7 @@ dwarf2_read_index (struct objfile *objfile) + set breakpoints on inlined functions by name, so we ignore these + indices unless the user has done + "set use-deprecated-index-sections on". */ +- if (version < 6 && !use_deprecated_index_sections) ++ if (version < 6 && !deprecated_ok) + { + static int warning_printed = 0; + if (!warning_printed) +@@ -2569,7 +2631,7 @@ dwarf2_read_index (struct objfile *objfile) + Skipping deprecated .gdb_index section in %s.\n\ + Do \"set use-deprecated-index-sections on\" before the file is read\n\ + to use the section anyway."), +- objfile->name); ++ filename); + warning_printed = 1; + } + return 0; +@@ -2579,22 +2641,21 @@ to use the section anyway."), + if (version > 7) + return 0; + +- map = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct mapped_index); + map->version = version; +- map->total_size = dwarf2_per_objfile->gdb_index.size; ++ map->total_size = section->size; + + metadata = (offset_type *) (addr + sizeof (offset_type)); + + i = 0; +- cu_list = addr + MAYBE_SWAP (metadata[i]); +- cu_list_elements = ((MAYBE_SWAP (metadata[i + 1]) - MAYBE_SWAP (metadata[i])) +- / 8); ++ *cu_list = addr + MAYBE_SWAP (metadata[i]); ++ *cu_list_elements = ((MAYBE_SWAP (metadata[i + 1]) - MAYBE_SWAP (metadata[i])) ++ / 8); + ++i; + +- types_list = addr + MAYBE_SWAP (metadata[i]); +- types_list_elements = ((MAYBE_SWAP (metadata[i + 1]) +- - MAYBE_SWAP (metadata[i])) +- / 8); ++ *types_list = addr + MAYBE_SWAP (metadata[i]); ++ *types_list_elements = ((MAYBE_SWAP (metadata[i + 1]) ++ - MAYBE_SWAP (metadata[i])) ++ / 8); + ++i; + + map->address_table = addr + MAYBE_SWAP (metadata[i]); +@@ -2610,11 +2671,55 @@ to use the section anyway."), + + map->constant_pool = addr + MAYBE_SWAP (metadata[i]); + ++ return 1; ++} ++ ++ ++/* Read the index file. If everything went ok, initialize the "quick" ++ elements of all the CUs and return 1. Otherwise, return 0. */ ++ ++static int ++dwarf2_read_index (struct objfile *objfile) ++{ ++ struct mapped_index local_map, *map; ++ const gdb_byte *cu_list, *types_list, *dwz_list = NULL; ++ offset_type cu_list_elements, types_list_elements, dwz_list_elements = 0; ++ ++ if (!read_index_from_section (objfile, objfile->name, ++ use_deprecated_index_sections, ++ &dwarf2_per_objfile->gdb_index, &local_map, ++ &cu_list, &cu_list_elements, ++ &types_list, &types_list_elements)) ++ return 0; ++ + /* Don't use the index if it's empty. */ +- if (map->symbol_table_slots == 0) ++ if (local_map.symbol_table_slots == 0) + return 0; + +- if (!create_cus_from_index (objfile, cu_list, cu_list_elements)) ++ /* If there is a .dwz file, read it so we can get its CU list as ++ well. */ ++ if (bfd_get_section_by_name (objfile->obfd, ".gnu_debugaltlink") != NULL) ++ { ++ struct dwz_file *dwz = dwarf2_get_dwz_file (); ++ struct mapped_index dwz_map; ++ const gdb_byte *dwz_types_ignore; ++ offset_type dwz_types_elements_ignore; ++ ++ if (!read_index_from_section (objfile, bfd_get_filename (dwz->dwz_bfd), ++ 1, ++ &dwz->gdb_index, &dwz_map, ++ &dwz_list, &dwz_list_elements, ++ &dwz_types_ignore, ++ &dwz_types_elements_ignore)) ++ { ++ warning (_("could not read '.gdb_index' section from %s; skipping"), ++ bfd_get_filename (dwz->dwz_bfd)); ++ return 0; ++ } ++ } ++ ++ if (!create_cus_from_index (objfile, cu_list, cu_list_elements, ++ dwz_list, dwz_list_elements)) + return 0; + + if (types_list_elements) +@@ -2635,7 +2740,10 @@ to use the section anyway."), + return 0; + } + +- create_addrmap_from_index (objfile, map); ++ create_addrmap_from_index (objfile, &local_map); ++ ++ map = obstack_alloc (&objfile->objfile_obstack, sizeof (struct mapped_index)); ++ *map = local_map; + + dwarf2_per_objfile->index_table = map; + dwarf2_per_objfile->using_index = 1; +@@ -3686,6 +3794,22 @@ read_comp_unit_head (struct comp_unit_head *cu_header, + return info_ptr; + } + ++/* Helper function that returns the proper abbrev section for ++ THIS_CU. */ ++ ++static struct dwarf2_section_info * ++get_abbrev_section_for_cu (struct dwarf2_per_cu_data *this_cu) ++{ ++ struct dwarf2_section_info *abbrev; ++ ++ if (this_cu->is_dwz) ++ abbrev = &dwarf2_get_dwz_file ()->abbrev; ++ else ++ abbrev = &dwarf2_per_objfile->abbrev; ++ ++ return abbrev; ++} ++ + /* Subroutine of read_and_check_comp_unit_head and + read_and_check_type_unit_head to simplify them. + Perform various error checking on the header. */ +@@ -3704,8 +3828,7 @@ error_check_comp_unit_head (struct comp_unit_head *header, + filename); + + if (header->abbrev_offset.sect_off +- >= dwarf2_section_size (dwarf2_per_objfile->objfile, +- &dwarf2_per_objfile->abbrev)) ++ >= dwarf2_section_size (dwarf2_per_objfile->objfile, abbrev_section)) + error (_("Dwarf Error: bad offset (0x%lx) in compilation unit header " + "(offset 0x%lx + 6) [in module %s]"), + (long) header->abbrev_offset.sect_off, (long) header->offset.sect_off, +@@ -3942,6 +4065,7 @@ create_debug_types_hash_table (struct dwo_file *dwo_file, + { + bfd *abfd; + gdb_byte *info_ptr, *end_ptr; ++ struct dwarf2_section_info *abbrev_section; + + dwarf2_read_section (objfile, section); + info_ptr = section->buffer; +@@ -3953,6 +4077,11 @@ create_debug_types_hash_table (struct dwo_file *dwo_file, + not present, in which case section->asection will be NULL. */ + abfd = section->asection->owner; + ++ if (dwo_file) ++ abbrev_section = &dwo_file->sections.abbrev; ++ else ++ abbrev_section = &dwarf2_per_objfile->abbrev; ++ + if (types_htab == NULL) + { + if (dwo_file) +@@ -4192,7 +4321,8 @@ init_cutu_and_read_dies (struct dwarf2_per_cu_data *this_cu, + dwarf2_read_section (objfile, section); + + begin_info_ptr = info_ptr = section->buffer + this_cu->offset.sect_off; +- abbrev_section = &dwarf2_per_objfile->abbrev; ++ ++ abbrev_section = get_abbrev_section_for_cu (this_cu); + + if (use_existing_cu && this_cu->cu != NULL) + { +@@ -4574,7 +4704,7 @@ init_cutu_and_read_dies_simple (struct dwarf2_per_cu_data *this_cu, + void *data) + { + init_cutu_and_read_dies_no_follow (this_cu, +- &dwarf2_per_objfile->abbrev, ++ get_abbrev_section_for_cu (this_cu), + NULL, + die_reader_func, data); + } +@@ -5202,6 +5332,9 @@ set_partial_user (struct objfile *objfile) + struct partial_symtab *pst = per_cu->v.psymtab; + int j; + ++ if (pst == NULL) ++ continue; ++ + for (j = 0; j < pst->number_of_dependencies; ++j) + { + /* Set the 'user' field only if it is not already set. */ +@@ -5296,38 +5429,32 @@ load_partial_comp_unit (struct dwarf2_per_cu_data *this_cu) + load_partial_comp_unit_reader, NULL); + } + +-/* Create a list of all compilation units in OBJFILE. +- This is only done for -readnow and building partial symtabs. */ +- + static void +-create_all_comp_units (struct objfile *objfile) ++read_comp_units_from_section (struct objfile *objfile, ++ struct dwarf2_section_info *section, ++ unsigned int is_dwz, ++ int *n_allocated, ++ int *n_comp_units, ++ struct dwarf2_per_cu_data ***all_comp_units) + { +- int n_allocated; +- int n_comp_units; +- struct dwarf2_per_cu_data **all_comp_units; + gdb_byte *info_ptr; ++ bfd *abfd = section->asection->owner; + +- dwarf2_read_section (objfile, &dwarf2_per_objfile->info); +- info_ptr = dwarf2_per_objfile->info.buffer; ++ dwarf2_read_section (objfile, section); + +- n_comp_units = 0; +- n_allocated = 10; +- all_comp_units = xmalloc (n_allocated +- * sizeof (struct dwarf2_per_cu_data *)); ++ info_ptr = section->buffer; + +- while (info_ptr < dwarf2_per_objfile->info.buffer +- + dwarf2_per_objfile->info.size) ++ while (info_ptr < section->buffer + section->size) + { + unsigned int length, initial_length_size; + struct dwarf2_per_cu_data *this_cu; + sect_offset offset; + +- offset.sect_off = info_ptr - dwarf2_per_objfile->info.buffer; ++ offset.sect_off = info_ptr - section->buffer; + + /* Read just enough information to find out where the next + compilation unit is. */ +- length = read_initial_length (objfile->obfd, info_ptr, +- &initial_length_size); ++ length = read_initial_length (abfd, info_ptr, &initial_length_size); + + /* Save the compilation unit for later lookup. */ + this_cu = obstack_alloc (&objfile->objfile_obstack, +@@ -5335,20 +5462,50 @@ create_all_comp_units (struct objfile *objfile) + memset (this_cu, 0, sizeof (*this_cu)); + this_cu->offset = offset; + this_cu->length = length + initial_length_size; ++ this_cu->is_dwz = is_dwz; + this_cu->objfile = objfile; +- this_cu->info_or_types_section = &dwarf2_per_objfile->info; ++ this_cu->info_or_types_section = section; + +- if (n_comp_units == n_allocated) ++ if (*n_comp_units == *n_allocated) + { +- n_allocated *= 2; +- all_comp_units = xrealloc (all_comp_units, +- n_allocated +- * sizeof (struct dwarf2_per_cu_data *)); ++ *n_allocated *= 2; ++ *all_comp_units = xrealloc (*all_comp_units, ++ *n_allocated ++ * sizeof (struct dwarf2_per_cu_data *)); + } +- all_comp_units[n_comp_units++] = this_cu; ++ (*all_comp_units)[*n_comp_units] = this_cu; ++ ++*n_comp_units; + + info_ptr = info_ptr + this_cu->length; + } ++} ++ ++/* Create a list of all compilation units in OBJFILE. ++ This is only done for -readnow and building partial symtabs. */ ++ ++static void ++create_all_comp_units (struct objfile *objfile) ++{ ++ int n_allocated; ++ int n_comp_units; ++ struct dwarf2_per_cu_data **all_comp_units; ++ ++ n_comp_units = 0; ++ n_allocated = 10; ++ all_comp_units = xmalloc (n_allocated ++ * sizeof (struct dwarf2_per_cu_data *)); ++ ++ read_comp_units_from_section (objfile, &dwarf2_per_objfile->info, 0, ++ &n_allocated, &n_comp_units, &all_comp_units); ++ ++ if (bfd_get_section_by_name (objfile->obfd, ".gnu_debugaltlink") != NULL) ++ { ++ struct dwz_file *dwz = dwarf2_get_dwz_file (); ++ ++ read_comp_units_from_section (objfile, &dwz->info, 1, ++ &n_allocated, &n_comp_units, ++ &all_comp_units); ++ } + + dwarf2_per_objfile->all_comp_units + = obstack_alloc (&objfile->objfile_obstack, +@@ -5441,6 +5598,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc, + } + + per_cu = dwarf2_find_containing_comp_unit (pdi->d.offset, ++ pdi->is_dwz, + cu->objfile); + + /* Go read the partial unit, if needed. */ +@@ -5498,7 +5656,8 @@ partial_die_parent_scope (struct partial_die_info *pdi, + + real_pdi = pdi; + while (real_pdi->has_specification) +- real_pdi = find_partial_die (real_pdi->spec_offset, cu); ++ real_pdi = find_partial_die (real_pdi->spec_offset, ++ real_pdi->spec_is_dwz, cu); + + parent = real_pdi->die_parent; + if (parent == NULL) +@@ -5998,6 +6157,9 @@ skip_one_die (const struct die_reader_specs *reader, gdb_byte *info_ptr, + else + info_ptr += cu->header.offset_size; + break; ++ case DW_FORM_GNU_ref_alt: ++ info_ptr += cu->header.offset_size; ++ break; + case DW_FORM_addr: + info_ptr += cu->header.addr_size; + break; +@@ -6027,6 +6189,7 @@ skip_one_die (const struct die_reader_specs *reader, gdb_byte *info_ptr, + break; + case DW_FORM_sec_offset: + case DW_FORM_strp: ++ case DW_FORM_GNU_strp_alt: + info_ptr += cu->header.offset_size; + break; + case DW_FORM_exprloc: +@@ -6694,7 +6857,9 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu, + it, by scanning the DIE's below the compilation unit. */ + get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu); + +- static_block = end_symtab_get_static_block (highpc + baseaddr, objfile, 0); ++ static_block ++ = end_symtab_get_static_block (highpc + baseaddr, objfile, 0, ++ per_cu->s.imported_symtabs != NULL); + + /* If the comp unit has DW_AT_ranges, it may have discontiguous ranges. + Also, DW_AT_ranges may record ranges not belonging to any child DIEs +@@ -6845,9 +7010,11 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu) + struct dwarf2_per_cu_data *per_cu; + struct symtab *imported_symtab; + sect_offset offset; ++ int is_dwz; + + offset = dwarf2_get_ref_die_offset (attr); +- per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile); ++ is_dwz = (attr->form == DW_FORM_GNU_ref_alt || cu->per_cu->is_dwz); ++ per_cu = dwarf2_find_containing_comp_unit (offset, is_dwz, cu->objfile); + + /* Queue the unit, if needed. */ + if (maybe_queue_comp_unit (cu, per_cu, cu->language)) +@@ -8116,24 +8283,21 @@ try_open_dwo_file (const char *file_name) + if (desc < 0) + return NULL; + +- sym_bfd = bfd_fopen (absolute_name, gnutarget, FOPEN_RB, desc); ++ sym_bfd = gdb_bfd_open (absolute_name, gnutarget, desc); + if (!sym_bfd) + { + xfree (absolute_name); + return NULL; + } ++ xfree (absolute_name); + bfd_set_cacheable (sym_bfd, 1); + + if (!bfd_check_format (sym_bfd, bfd_object)) + { +- bfd_close (sym_bfd); /* This also closes desc. */ +- xfree (absolute_name); ++ gdb_bfd_unref (sym_bfd); /* This also closes desc. */ + return NULL; + } + +- /* bfd_usrdata exists for applications and libbfd must not touch it. */ +- gdb_assert (bfd_usrdata (sym_bfd) == NULL); +- + return sym_bfd; + } + +@@ -8325,20 +8489,7 @@ free_dwo_file (struct dwo_file *dwo_file, struct objfile *objfile) + struct dwarf2_section_info *section; + + gdb_assert (dwo_file->dwo_bfd != objfile->obfd); +- bfd_close (dwo_file->dwo_bfd); +- +- munmap_section_buffer (&dwo_file->sections.abbrev); +- munmap_section_buffer (&dwo_file->sections.info); +- munmap_section_buffer (&dwo_file->sections.line); +- munmap_section_buffer (&dwo_file->sections.loc); +- munmap_section_buffer (&dwo_file->sections.str); +- munmap_section_buffer (&dwo_file->sections.str_offsets); +- +- for (ix = 0; +- VEC_iterate (dwarf2_section_info_def, dwo_file->sections.types, +- ix, section); +- ++ix) +- munmap_section_buffer (section); ++ gdb_bfd_unref (dwo_file->dwo_bfd); + + VEC_free (dwarf2_section_info_def, dwo_file->sections.types); + } +@@ -10721,6 +10872,29 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) new_symbol (die, this_type, cu); } @@ -915,7 +2634,7 @@ index 8dbc53e..b5b7813 100644 /* Extract all information from a DW_TAG_array_type DIE and put it in the DIE's type field. For now, this only handles one dimensional arrays. */ -@@ -9539,7 +9571,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -10734,7 +10908,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) struct type *element_type, *range_type, *index_type; struct type **range_types = NULL; struct attribute *attr; @@ -924,7 +2643,7 @@ index 8dbc53e..b5b7813 100644 struct cleanup *back_to; char *name; -@@ -9592,17 +9624,19 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -10787,17 +10961,19 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu) type = element_type; if (read_array_order (die, cu) == DW_ORD_col_major) @@ -955,7 +2674,7 @@ index 8dbc53e..b5b7813 100644 /* Understand Dwarf2 support for vector types (like they occur on the PowerPC w/ AltiVec). Gcc just adds another attribute to the -@@ -10086,29 +10120,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -11281,29 +11457,114 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; @@ -1083,7 +2802,7 @@ index 8dbc53e..b5b7813 100644 char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -10412,7 +10531,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -11607,7 +11868,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) struct type *base_type; struct type *range_type; struct attribute *attr; @@ -1092,7 +2811,7 @@ index 8dbc53e..b5b7813 100644 int low_default_is_valid; char *name; LONGEST negative_mask; -@@ -10468,42 +10587,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -11663,42 +11924,6 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) "- DIE at 0x%x [in module %s]"), die->offset.sect_off, cu->objfile->name); @@ -1135,7 +2854,7 @@ index 8dbc53e..b5b7813 100644 /* Dwarf-2 specifications explicitly allows to create subrange types without specifying a base type. In that case, the base type must be set to the type of -@@ -10542,24 +10625,163 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -11737,24 +11962,163 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) } } @@ -1177,7 +2896,10 @@ index 8dbc53e..b5b7813 100644 + struct die_info *target_die; + struct dwarf2_cu *target_cu = cu; + struct attribute *target_loc_attr; -+ + +- /* Ada expects an empty array on no boundary attributes. */ +- if (attr == NULL && cu->language != language_ada) +- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; + target_die = follow_die_ref_or_sig (die, attr, &target_cu); + gdb_assert (target_cu->objfile == cu->objfile); + target_loc_attr = dwarf2_attr (target_die, DW_AT_location, target_cu); @@ -1215,10 +2937,7 @@ index 8dbc53e..b5b7813 100644 + if (low >= 0) + TYPE_UNSIGNED (range_type) = 1; + } - -- /* Ada expects an empty array on no boundary attributes. */ -- if (attr == NULL && cu->language != language_ada) -- TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; ++ + attr = dwarf2_attr (die, DW_AT_upper_bound, cu); + if (!attr || (!attr_form_is_block (attr) && !attr_form_is_constant (attr) + && !is_ref_attr (attr))) @@ -1313,7 +3032,214 @@ index 8dbc53e..b5b7813 100644 name = dwarf2_name (die, cu); if (name) -@@ -13257,10 +13479,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, +@@ -12544,6 +12908,8 @@ read_partial_die (const struct die_reader_specs *reader, + case DW_AT_extension: + part_die->has_specification = 1; + part_die->spec_offset = dwarf2_get_ref_die_offset (&attr); ++ part_die->spec_is_dwz = (attr.form == DW_FORM_GNU_ref_alt ++ || cu->per_cu->is_dwz); + break; + case DW_AT_sibling: + /* Ignore absolute siblings, they might point outside of +@@ -12590,7 +12956,11 @@ read_partial_die (const struct die_reader_specs *reader, + + case DW_AT_import: + if (part_die->tag == DW_TAG_imported_unit) +- part_die->d.offset = dwarf2_get_ref_die_offset (&attr); ++ { ++ part_die->d.offset = dwarf2_get_ref_die_offset (&attr); ++ part_die->is_dwz = (attr.form == DW_FORM_GNU_ref_alt ++ || cu->per_cu->is_dwz); ++ } + break; + + default: +@@ -12661,13 +13031,14 @@ find_partial_die_in_comp_unit (sect_offset offset, struct dwarf2_cu *cu) + DW_FORM_ref_sig8). */ + + static struct partial_die_info * +-find_partial_die (sect_offset offset, struct dwarf2_cu *cu) ++find_partial_die (sect_offset offset, int offset_in_dwz, struct dwarf2_cu *cu) + { + struct objfile *objfile = cu->objfile; + struct dwarf2_per_cu_data *per_cu = NULL; + struct partial_die_info *pd = NULL; + +- if (offset_in_cu_p (&cu->header, offset)) ++ if (offset_in_dwz == cu->per_cu->is_dwz ++ && offset_in_cu_p (&cu->header, offset)) + { + pd = find_partial_die_in_comp_unit (offset, cu); + if (pd != NULL) +@@ -12686,7 +13057,8 @@ find_partial_die (sect_offset offset, struct dwarf2_cu *cu) + (long) cu->header.offset.sect_off, (long) offset.sect_off, + bfd_get_filename (objfile->obfd)); + } +- per_cu = dwarf2_find_containing_comp_unit (offset, objfile); ++ per_cu = dwarf2_find_containing_comp_unit (offset, offset_in_dwz, ++ objfile); + + if (per_cu->cu == NULL || per_cu->cu->partial_dies == NULL) + load_partial_comp_unit (per_cu); +@@ -12744,7 +13116,8 @@ guess_partial_die_structure_name (struct partial_die_info *struct_pdi, + + real_pdi = struct_pdi; + while (real_pdi->has_specification) +- real_pdi = find_partial_die (real_pdi->spec_offset, cu); ++ real_pdi = find_partial_die (real_pdi->spec_offset, ++ real_pdi->spec_is_dwz, cu); + + if (real_pdi->die_parent != NULL) + return; +@@ -12792,7 +13165,8 @@ fixup_partial_die (struct partial_die_info *part_die, + { + struct partial_die_info *spec_die; + +- spec_die = find_partial_die (part_die->spec_offset, cu); ++ spec_die = find_partial_die (part_die->spec_offset, ++ part_die->spec_is_dwz, cu); + + fixup_partial_die (spec_die, cu); + +@@ -12880,6 +13254,10 @@ read_attribute_value (const struct die_reader_specs *reader, + &cu->header, &bytes_read); + info_ptr += bytes_read; + break; ++ case DW_FORM_GNU_ref_alt: ++ DW_UNSND (attr) = read_offset (abfd, info_ptr, &cu->header, &bytes_read); ++ info_ptr += bytes_read; ++ break; + case DW_FORM_addr: + DW_ADDR (attr) = read_address (abfd, info_ptr, cu, &bytes_read); + info_ptr += bytes_read; +@@ -12922,10 +13300,25 @@ read_attribute_value (const struct die_reader_specs *reader, + info_ptr += bytes_read; + break; + case DW_FORM_strp: +- DW_STRING (attr) = read_indirect_string (abfd, info_ptr, cu_header, +- &bytes_read); +- DW_STRING_IS_CANONICAL (attr) = 0; +- info_ptr += bytes_read; ++ if (!cu->per_cu->is_dwz) ++ { ++ DW_STRING (attr) = read_indirect_string (abfd, info_ptr, cu_header, ++ &bytes_read); ++ DW_STRING_IS_CANONICAL (attr) = 0; ++ info_ptr += bytes_read; ++ break; ++ } ++ /* FALLTHROUGH */ ++ case DW_FORM_GNU_strp_alt: ++ { ++ struct dwz_file *dwz = dwarf2_get_dwz_file (); ++ LONGEST str_offset = read_offset (abfd, info_ptr, cu_header, ++ &bytes_read); ++ ++ DW_STRING (attr) = read_indirect_string_from_dwz (dwz, str_offset); ++ DW_STRING_IS_CANONICAL (attr) = 0; ++ info_ptr += bytes_read; ++ } + break; + case DW_FORM_exprloc: + case DW_FORM_block: +@@ -13037,6 +13430,10 @@ read_attribute_value (const struct die_reader_specs *reader, + bfd_get_filename (abfd)); + } + ++ /* Super hack. */ ++ if (cu->per_cu->is_dwz && is_ref_attr (attr)) ++ attr->form = DW_FORM_GNU_ref_alt; ++ + /* We have seen instances where the compiler tried to emit a byte + size attribute of -1 which ended up being encoded as an unsigned + 0xffffffff. Although 0xffffffff is technically a valid size value, +@@ -13333,6 +13730,30 @@ read_indirect_string_at_offset (bfd *abfd, LONGEST str_offset) + return (char *) (dwarf2_per_objfile->str.buffer + str_offset); + } + ++/* Read a string at offset STR_OFFSET in the .debug_str section from ++ the .dwz file DWZ. Throw an error if the offset is too large. If ++ the string consists of a single NUL byte, return NULL; otherwise ++ return a pointer to the string. */ ++ ++static char * ++read_indirect_string_from_dwz (struct dwz_file *dwz, LONGEST str_offset) ++{ ++ dwarf2_read_section (dwarf2_per_objfile->objfile, &dwz->str); ++ ++ if (dwz->str.buffer == NULL) ++ error (_("DW_FORM_GNU_strp_alt used without .debug_str " ++ "section [in module %s]"), ++ bfd_get_filename (dwz->dwz_bfd)); ++ if (str_offset >= dwz->str.size) ++ error (_("DW_FORM_GNU_strp_alt pointing outside of " ++ ".debug_str section [in module %s]"), ++ bfd_get_filename (dwz->dwz_bfd)); ++ gdb_assert (HOST_CHAR_BIT == 8); ++ if (dwz->str.buffer[str_offset] == '\0') ++ return NULL; ++ return (char *) (dwz->str.buffer + str_offset); ++} ++ + static char * + read_indirect_string (bfd *abfd, gdb_byte *buf, + const struct comp_unit_head *cu_header, +@@ -13804,6 +14225,30 @@ add_file_name (struct line_header *lh, + fe->symtab = NULL; + } + ++/* A convenience function to find the proper .debug_line section for a ++ CU. */ ++ ++static struct dwarf2_section_info * ++get_debug_line_section (struct dwarf2_cu *cu) ++{ ++ struct dwarf2_section_info *section; ++ ++ /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the ++ DWO file. */ ++ if (cu->dwo_unit && cu->per_cu->is_debug_types) ++ section = &cu->dwo_unit->dwo_file->sections.line; ++ else if (cu->per_cu->is_dwz) ++ { ++ struct dwz_file *dwz = dwarf2_get_dwz_file (); ++ ++ section = &dwz->line; ++ } ++ else ++ section = &dwarf2_per_objfile->line; ++ ++ return section; ++} ++ + /* Read the statement program header starting at OFFSET in + .debug_line, or .debug_line.dwo. Return a pointer + to a struct line_header, allocated using xmalloc. +@@ -13824,13 +14269,7 @@ dwarf_decode_line_header (unsigned int offset, struct dwarf2_cu *cu) + struct dwarf2_section_info *section; + bfd *abfd; + +- /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the +- DWO file. */ +- if (cu->dwo_unit && cu->per_cu->is_debug_types) +- section = &cu->dwo_unit->dwo_file->sections.line; +- else +- section = &dwarf2_per_objfile->line; +- ++ section = get_debug_line_section (cu); + dwarf2_read_section (dwarf2_per_objfile->objfile, section); + if (section->buffer == NULL) + { +@@ -14155,7 +14594,7 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir, + GCd by the linker. Ignore it. PR gdb/12528 */ + + long line_offset +- = line_ptr - dwarf2_per_objfile->line.buffer; ++ = line_ptr - get_debug_line_section (cu)->buffer; + + complaint (&symfile_complaints, + _(".debug_line address at offset 0x%lx is 0 " +@@ -14534,10 +14973,12 @@ var_decode_location (struct attribute *attr, struct symbol *sym, (i.e. when the value of a register or memory location is referenced, or a thread-local block, etc.). Then again, it might not be worthwhile. I'm assuming that it isn't unless performance @@ -1328,7 +3254,7 @@ index 8dbc53e..b5b7813 100644 if (SYMBOL_COMPUTED_OPS (sym) == &dwarf2_loclist_funcs) cu->has_loclist = 1; -@@ -13301,6 +13525,8 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, +@@ -14578,6 +15019,8 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu, else sym = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol); OBJSTAT (objfile, n_syms++); @@ -1337,7 +3263,32 @@ index 8dbc53e..b5b7813 100644 /* Cache this symbol's name and the name's demangled form (if any). */ SYMBOL_SET_LANGUAGE (sym, cu->language); -@@ -14075,6 +14301,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu) +@@ -15001,6 +15444,7 @@ dwarf2_const_value_attr (struct attribute *attr, struct type *type, + case DW_FORM_string: + case DW_FORM_strp: + case DW_FORM_GNU_str_index: ++ case DW_FORM_GNU_strp_alt: + /* DW_STRING is already allocated on the objfile obstack, point + directly to it. */ + *bytes = (gdb_byte *) DW_STRING (attr); +@@ -15187,7 +15631,15 @@ lookup_die_type (struct die_info *die, struct attribute *attr, + + /* First see if we have it cached. */ + +- if (is_ref_attr (attr)) ++ if (attr->form == DW_FORM_GNU_ref_alt) ++ { ++ struct dwarf2_per_cu_data *per_cu; ++ sect_offset offset = dwarf2_get_ref_die_offset (attr); ++ ++ per_cu = dwarf2_find_containing_comp_unit (offset, 1, cu->objfile); ++ this_type = get_die_type_at_offset (offset, per_cu); ++ } ++ else if (is_ref_attr (attr)) + { + sect_offset offset = dwarf2_get_ref_die_offset (attr); + +@@ -15352,6 +15804,9 @@ read_type_die_1 (struct die_info *die, struct dwarf2_cu *cu) break; } @@ -1347,7 +3298,213 @@ index 8dbc53e..b5b7813 100644 return this_type; } -@@ -16472,62 +16701,100 @@ fill_in_loclist_baton (struct dwarf2_cu *cu, +@@ -15960,6 +16415,10 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) + fprintf_unfiltered (f, "ref address: "); + fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f); + break; ++ case DW_FORM_GNU_ref_alt: ++ fprintf_unfiltered (f, "alt ref address: "); ++ fputs_filtered (hex_string (DW_UNSND (&die->attrs[i])), f); ++ break; + case DW_FORM_ref1: + case DW_FORM_ref2: + case DW_FORM_ref4: +@@ -15991,6 +16450,7 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die) + case DW_FORM_string: + case DW_FORM_strp: + case DW_FORM_GNU_str_index: ++ case DW_FORM_GNU_strp_alt: + fprintf_unfiltered (f, "string: \"%s\" (%s canonicalized)", + DW_STRING (&die->attrs[i]) + ? DW_STRING (&die->attrs[i]) : "", +@@ -16094,6 +16554,7 @@ is_ref_attr (struct attribute *attr) + case DW_FORM_ref4: + case DW_FORM_ref8: + case DW_FORM_ref_udata: ++ case DW_FORM_GNU_ref_alt: + return 1; + default: + return 0; +@@ -16171,7 +16632,8 @@ follow_die_ref_or_sig (struct die_info *src_die, struct attribute *attr, + Returns NULL if OFFSET is invalid. */ + + static struct die_info * +-follow_die_offset (sect_offset offset, struct dwarf2_cu **ref_cu) ++follow_die_offset (sect_offset offset, int offset_in_dwz, ++ struct dwarf2_cu **ref_cu) + { + struct die_info temp_die; + struct dwarf2_cu *target_cu, *cu = *ref_cu; +@@ -16188,11 +16650,13 @@ follow_die_offset (sect_offset offset, struct dwarf2_cu **ref_cu) + if (! offset_in_cu_p (&cu->header, offset)) + return NULL; + } +- else if (! offset_in_cu_p (&cu->header, offset)) ++ else if (offset_in_dwz != cu->per_cu->is_dwz ++ || ! offset_in_cu_p (&cu->header, offset)) + { + struct dwarf2_per_cu_data *per_cu; + +- per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile); ++ per_cu = dwarf2_find_containing_comp_unit (offset, offset_in_dwz, ++ cu->objfile); + + /* If necessary, add it to the queue and load its DIEs. */ + if (maybe_queue_comp_unit (cu, per_cu, cu->language)) +@@ -16224,7 +16688,10 @@ follow_die_ref (struct die_info *src_die, struct attribute *attr, + struct dwarf2_cu *cu = *ref_cu; + struct die_info *die; + +- die = follow_die_offset (offset, ref_cu); ++ die = follow_die_offset (offset, ++ (attr->form == DW_FORM_GNU_ref_alt ++ || cu->per_cu->is_dwz), ++ ref_cu); + if (!die) + error (_("Dwarf Error: Cannot find DIE at 0x%x referenced from DIE " + "at 0x%x [in module %s]"), +@@ -16255,7 +16722,7 @@ dwarf2_fetch_die_location_block (cu_offset offset_in_cu, + load_cu (per_cu); + cu = per_cu->cu; + +- die = follow_die_offset (offset, &cu); ++ die = follow_die_offset (offset, per_cu->is_dwz, &cu); + if (!die) + error (_("Dwarf Error: Cannot find DIE at 0x%x referenced in module %s"), + offset.sect_off, per_cu->objfile->name); +@@ -17049,6 +17516,7 @@ skip_form_bytes (bfd *abfd, gdb_byte *bytes, gdb_byte *buffer_end, + + case DW_FORM_sec_offset: + case DW_FORM_strp: ++ case DW_FORM_GNU_strp_alt: + bytes += offset_size; + break; + +@@ -17204,7 +17672,7 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, + struct macro_source_file *current_file, + struct line_header *lh, char *comp_dir, + struct dwarf2_section_info *section, +- int section_is_gnu, ++ int section_is_gnu, int section_is_dwz, + unsigned int offset_size, + struct objfile *objfile, + htab_t include_hash) +@@ -17255,6 +17723,8 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, + case DW_MACRO_GNU_undef: + case DW_MACRO_GNU_define_indirect: + case DW_MACRO_GNU_undef_indirect: ++ case DW_MACRO_GNU_define_indirect_alt: ++ case DW_MACRO_GNU_undef_indirect_alt: + { + unsigned int bytes_read; + int line; +@@ -17277,11 +17747,21 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, + str_offset = read_offset_1 (abfd, mac_ptr, offset_size); + mac_ptr += offset_size; + +- body = read_indirect_string_at_offset (abfd, str_offset); ++ if (macinfo_type == DW_MACRO_GNU_define_indirect_alt ++ || macinfo_type == DW_MACRO_GNU_undef_indirect_alt ++ || section_is_dwz) ++ { ++ struct dwz_file *dwz = dwarf2_get_dwz_file (); ++ ++ body = read_indirect_string_from_dwz (dwz, str_offset); ++ } ++ else ++ body = read_indirect_string_at_offset (abfd, str_offset); + } + + is_define = (macinfo_type == DW_MACRO_GNU_define +- || macinfo_type == DW_MACRO_GNU_define_indirect); ++ || macinfo_type == DW_MACRO_GNU_define_indirect ++ || macinfo_type == DW_MACRO_GNU_define_indirect_alt); + if (! current_file) + { + /* DWARF violation as no main source is present. */ +@@ -17305,7 +17785,8 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, + else + { + gdb_assert (macinfo_type == DW_MACRO_GNU_undef +- || macinfo_type == DW_MACRO_GNU_undef_indirect); ++ || macinfo_type == DW_MACRO_GNU_undef_indirect ++ || macinfo_type == DW_MACRO_GNU_undef_indirect_alt); + macro_undef (current_file, line, body); + } + } +@@ -17380,6 +17861,7 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, + break; + + case DW_MACRO_GNU_transparent_include: ++ case DW_MACRO_GNU_transparent_include_alt: + { + LONGEST offset; + void **slot; +@@ -17398,13 +17880,32 @@ dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end, + } + else + { ++ bfd *include_bfd = abfd; ++ struct dwarf2_section_info *include_section = section; ++ struct dwarf2_section_info alt_section; ++ gdb_byte *include_mac_end = mac_end; ++ int is_dwz = section_is_dwz; ++ + *slot = mac_ptr; + +- dwarf_decode_macro_bytes (abfd, +- section->buffer + offset, +- mac_end, current_file, ++ if (macinfo_type == DW_MACRO_GNU_transparent_include_alt) ++ { ++ struct dwz_file *dwz = dwarf2_get_dwz_file (); ++ ++ dwarf2_read_section (dwarf2_per_objfile->objfile, ++ &dwz->macro); ++ ++ include_bfd = dwz->macro.asection->owner; ++ include_section = &dwz->macro; ++ include_mac_end = dwz->macro.buffer + dwz->macro.size; ++ is_dwz = 1; ++ } ++ ++ dwarf_decode_macro_bytes (include_bfd, ++ include_section->buffer + offset, ++ include_mac_end, current_file, + lh, comp_dir, +- section, section_is_gnu, ++ section, section_is_gnu, is_dwz, + offset_size, objfile, include_hash); + + htab_remove_elt (include_hash, mac_ptr); +@@ -17571,6 +18072,8 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, + + case DW_MACRO_GNU_define_indirect: + case DW_MACRO_GNU_undef_indirect: ++ case DW_MACRO_GNU_define_indirect_alt: ++ case DW_MACRO_GNU_undef_indirect_alt: + { + unsigned int bytes_read; + +@@ -17581,6 +18084,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, + break; + + case DW_MACRO_GNU_transparent_include: ++ case DW_MACRO_GNU_transparent_include_alt: + /* Note that, according to the spec, a transparent include + chain cannot call DW_MACRO_GNU_start_file. So, we can just + skip this opcode. */ +@@ -17623,7 +18127,8 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset, + slot = htab_find_slot (include_hash, mac_ptr, INSERT); + *slot = mac_ptr; + dwarf_decode_macro_bytes (abfd, mac_ptr, mac_end, +- current_file, lh, comp_dir, section, section_is_gnu, ++ current_file, lh, comp_dir, section, ++ section_is_gnu, 0, + offset_size, objfile, include_hash); + do_cleanups (cleanup); + } +@@ -17721,62 +18226,100 @@ fill_in_loclist_baton (struct dwarf2_cu *cu, baton->from_dwo = cu->dwo_unit != NULL; } @@ -1486,7 +3643,48 @@ index 8dbc53e..b5b7813 100644 } } -@@ -16895,6 +17162,25 @@ per_cu_offset_and_type_eq (const void *item_lhs, const void *item_rhs) +@@ -17878,28 +18421,35 @@ dwarf2_per_cu_text_offset (struct dwarf2_per_cu_data *per_cu) + + static struct dwarf2_per_cu_data * + dwarf2_find_containing_comp_unit (sect_offset offset, ++ unsigned int offset_in_dwz, + struct objfile *objfile) + { + struct dwarf2_per_cu_data *this_cu; + int low, high; ++ const sect_offset *cu_off; + + low = 0; + high = dwarf2_per_objfile->n_comp_units - 1; + while (high > low) + { ++ struct dwarf2_per_cu_data *mid_cu; + int mid = low + (high - low) / 2; + +- if (dwarf2_per_objfile->all_comp_units[mid]->offset.sect_off +- >= offset.sect_off) ++ mid_cu = dwarf2_per_objfile->all_comp_units[mid]; ++ cu_off = &mid_cu->offset; ++ if (mid_cu->is_dwz > offset_in_dwz ++ || (mid_cu->is_dwz == offset_in_dwz ++ && cu_off->sect_off >= offset.sect_off)) + high = mid; + else + low = mid + 1; + } + gdb_assert (low == high); +- if (dwarf2_per_objfile->all_comp_units[low]->offset.sect_off +- > offset.sect_off) ++ this_cu = dwarf2_per_objfile->all_comp_units[low]; ++ cu_off = &this_cu->offset; ++ if (this_cu->is_dwz != offset_in_dwz || cu_off->sect_off > offset.sect_off) + { +- if (low == 0) ++ if (low == 0 || this_cu->is_dwz != offset_in_dwz) + error (_("Dwarf Error: could not find partial DIE containing " + "offset 0x%lx [in module %s]"), + (long) offset.sect_off, bfd_get_filename (objfile->obfd)); +@@ -18140,6 +18690,25 @@ per_cu_offset_and_type_eq (const void *item_lhs, const void *item_rhs) && ofs_lhs->offset.sect_off == ofs_rhs->offset.sect_off); } @@ -1512,7 +3710,7 @@ index 8dbc53e..b5b7813 100644 /* Set the type associated with DIE to TYPE. Save it in CU's hash table if necessary. For convenience, return TYPE. -@@ -16919,6 +17205,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -18164,6 +18733,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) struct dwarf2_per_cu_offset_and_type **slot, ofs; struct objfile *objfile = cu->objfile; @@ -1521,8 +3719,117 @@ index 8dbc53e..b5b7813 100644 /* For Ada types, make sure that the gnat-specific data is always initialized (if not already set). There are a few types where we should not be doing so, because the type-specific area is +@@ -18341,53 +18912,13 @@ show_dwarf2_cmd (char *args, int from_tty) + cmd_show_list (show_dwarf2_cmdlist, from_tty, ""); + } + +-/* If section described by INFO was mmapped, munmap it now. */ +- +-static void +-munmap_section_buffer (struct dwarf2_section_info *info) +-{ +- if (info->map_addr != NULL) +- { +-#ifdef HAVE_MMAP +- int res; +- +- res = munmap (info->map_addr, info->map_len); +- gdb_assert (res == 0); +-#else +- /* Without HAVE_MMAP, we should never be here to begin with. */ +- gdb_assert_not_reached ("no mmap support"); +-#endif +- } +-} +- +-/* munmap debug sections for OBJFILE, if necessary. */ ++/* Free data associated with OBJFILE, if necessary. */ + + static void + dwarf2_per_objfile_free (struct objfile *objfile, void *d) + { + struct dwarf2_per_objfile *data = d; + int ix; +- struct dwarf2_section_info *section; +- +- /* This is sorted according to the order they're defined in to make it easier +- to keep in sync. */ +- munmap_section_buffer (&data->info); +- munmap_section_buffer (&data->abbrev); +- munmap_section_buffer (&data->line); +- munmap_section_buffer (&data->loc); +- munmap_section_buffer (&data->macinfo); +- munmap_section_buffer (&data->macro); +- munmap_section_buffer (&data->str); +- munmap_section_buffer (&data->ranges); +- munmap_section_buffer (&data->addr); +- munmap_section_buffer (&data->frame); +- munmap_section_buffer (&data->eh_frame); +- munmap_section_buffer (&data->gdb_index); +- +- for (ix = 0; +- VEC_iterate (dwarf2_section_info_def, data->types, ix, section); +- ++ix) +- munmap_section_buffer (section); + + for (ix = 0; ix < dwarf2_per_objfile->n_comp_units; ++ix) + VEC_free (dwarf2_per_cu_ptr, +@@ -18397,6 +18928,9 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d) + + if (data->dwo_files) + free_dwo_files (data->dwo_files, objfile); ++ ++ if (data->dwz_file && data->dwz_file->dwz_bfd) ++ gdb_bfd_unref (data->dwz_file->dwz_bfd); + } + + +diff --git a/gdb/elfread.c b/gdb/elfread.c +index 1edfb27..0b54b8a 100644 +--- a/gdb/elfread.c ++++ b/gdb/elfread.c +@@ -44,6 +44,7 @@ + #include "gdbthread.h" + #include "regcache.h" + #include "bcache.h" ++#include "gdb_bfd.h" + + extern void _initialize_elfread (void); + +@@ -1108,7 +1109,7 @@ build_id_verify (const char *filename, struct build_id *check) + int retval = 0; + + /* We expect to be silent on the non-existing files. */ +- abfd = bfd_open_maybe_remote (filename); ++ abfd = gdb_bfd_open_maybe_remote (filename); + if (abfd == NULL) + return 0; + +@@ -1123,7 +1124,7 @@ build_id_verify (const char *filename, struct build_id *check) + else + retval = 1; + +- gdb_bfd_close_or_warn (abfd); ++ gdb_bfd_unref (abfd); + + xfree (found); + +@@ -1444,10 +1445,12 @@ elf_symfile_read (struct objfile *objfile, int symfile_flags) + + if (debugfile) + { ++ struct cleanup *cleanup = make_cleanup (xfree, debugfile); + bfd *abfd = symfile_bfd_open (debugfile); + ++ make_cleanup_bfd_unref (abfd); + symbol_file_add_separate (abfd, symfile_flags, objfile); +- xfree (debugfile); ++ do_cleanups (cleanup); + } + } + diff --git a/gdb/eval.c b/gdb/eval.c -index 7f1dfac..52462bc 100644 +index 7d3a8b9..f69dff0 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -41,6 +41,7 @@ @@ -1767,7 +4074,7 @@ index 7f1dfac..52462bc 100644 } -@@ -801,6 +992,7 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -818,6 +1009,7 @@ evaluate_subexp_standard (struct type *expect_type, int save_pos1; struct symbol *function = NULL; char *function_name = NULL; @@ -1775,7 +4082,7 @@ index 7f1dfac..52462bc 100644 pc = (*pos)++; op = exp->elts[pc].opcode; -@@ -1875,6 +2067,8 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1892,6 +2084,8 @@ evaluate_subexp_standard (struct type *expect_type, /* First determine the type code we are dealing with. */ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); @@ -1784,7 +4091,7 @@ index 7f1dfac..52462bc 100644 type = check_typedef (value_type (arg1)); code = TYPE_CODE (type); -@@ -1895,23 +2089,13 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -1912,23 +2106,13 @@ evaluate_subexp_standard (struct type *expect_type, code = TYPE_CODE (type); } } @@ -1810,7 +4117,7 @@ index 7f1dfac..52462bc 100644 case TYPE_CODE_PTR: case TYPE_CODE_FUNC: -@@ -2344,49 +2528,6 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2361,49 +2545,6 @@ evaluate_subexp_standard (struct type *expect_type, } return (arg1); @@ -1860,7 +4167,7 @@ index 7f1dfac..52462bc 100644 case BINOP_LOGICAL_AND: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); if (noside == EVAL_SKIP) -@@ -2618,15 +2759,23 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2635,15 +2776,23 @@ evaluate_subexp_standard (struct type *expect_type, if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR) expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type)); arg1 = evaluate_subexp (expect_type, exp, pos, noside); @@ -1886,7 +4193,7 @@ index 7f1dfac..52462bc 100644 else if (noside == EVAL_AVOID_SIDE_EFFECTS) { type = check_typedef (value_type (arg1)); -@@ -2635,12 +2784,18 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2652,12 +2801,18 @@ evaluate_subexp_standard (struct type *expect_type, /* In C you can dereference an array to get the 1st elt. */ || TYPE_CODE (type) == TYPE_CODE_ARRAY ) @@ -1910,7 +4217,7 @@ index 7f1dfac..52462bc 100644 else error (_("Attempt to take contents of a non-pointer value.")); } -@@ -2650,9 +2805,14 @@ evaluate_subexp_standard (struct type *expect_type, +@@ -2667,9 +2822,14 @@ evaluate_subexp_standard (struct type *expect_type, do. "long long" variables are rare enough that BUILTIN_TYPE_LONGEST would seem to be a mistake. */ if (TYPE_CODE (type) == TYPE_CODE_INT) @@ -1928,7 +4235,7 @@ index 7f1dfac..52462bc 100644 case UNOP_ADDR: /* C++: check for and handle pointer to members. */ -@@ -2994,7 +3154,7 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -3011,7 +3171,7 @@ evaluate_subexp_with_coercion (struct expression *exp, { enum exp_opcode op; int pc; @@ -1937,7 +4244,7 @@ index 7f1dfac..52462bc 100644 struct symbol *var; struct type *type; -@@ -3005,13 +3165,18 @@ evaluate_subexp_with_coercion (struct expression *exp, +@@ -3022,13 +3182,18 @@ evaluate_subexp_with_coercion (struct expression *exp, { case OP_VAR_VALUE: var = exp->elts[pc + 2].symbol; @@ -1957,7 +4264,7 @@ index 7f1dfac..52462bc 100644 return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)), val); } -@@ -3063,9 +3228,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) +@@ -3080,9 +3245,13 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) case OP_VAR_VALUE: (*pos) += 4; @@ -1974,7 +4281,7 @@ index 7f1dfac..52462bc 100644 default: val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); -@@ -3096,18 +3265,25 @@ parse_and_eval_type (char *p, int length) +@@ -3113,18 +3282,25 @@ parse_and_eval_type (char *p, int length) int calc_f77_array_dims (struct type *array_type) { @@ -2010,6 +4317,90 @@ index 7f1dfac..52462bc 100644 - return ndimen; + } +diff --git a/gdb/exec.c b/gdb/exec.c +index 6ba1986..e076609 100644 +--- a/gdb/exec.c ++++ b/gdb/exec.c +@@ -33,6 +33,7 @@ + #include "arch-utils.h" + #include "gdbthread.h" + #include "progspace.h" ++#include "gdb_bfd.h" + + #include + #include "readline/readline.h" +@@ -98,10 +99,8 @@ exec_close (void) + if (exec_bfd) + { + bfd *abfd = exec_bfd; +- char *name = bfd_get_filename (abfd); + +- gdb_bfd_close_or_warn (abfd); +- xfree (name); ++ gdb_bfd_unref (abfd); + + /* Removing target sections may close the exec_ops target. + Clear exec_bfd before doing so to prevent recursion. */ +@@ -128,17 +127,13 @@ exec_close_1 (int quitting) + vp = nxt; + nxt = vp->nxt; + +- /* if there is an objfile associated with this bfd, +- free_objfile() will do proper cleanup of objfile *and* bfd. */ +- + if (vp->objfile) + { + free_objfile (vp->objfile); + need_symtab_cleanup = 1; + } +- else if (vp->bfd != exec_bfd) +- /* FIXME-leak: We should be freeing vp->name too, I think. */ +- gdb_bfd_close_or_warn (vp->bfd); ++ ++ gdb_bfd_unref (vp->bfd); + + xfree (vp); + } +@@ -230,11 +225,14 @@ exec_file_attach (char *filename, int from_tty) + &scratch_pathname); + } + #endif ++ ++ cleanups = make_cleanup (xfree, scratch_pathname); ++ + if (scratch_chan < 0) + perror_with_name (filename); +- exec_bfd = bfd_fopen (scratch_pathname, gnutarget, +- write_files ? FOPEN_RUB : FOPEN_RB, +- scratch_chan); ++ exec_bfd = gdb_bfd_fopen (scratch_pathname, gnutarget, ++ write_files ? FOPEN_RUB : FOPEN_RB, ++ scratch_chan); + + if (!exec_bfd) + { +@@ -242,13 +240,6 @@ exec_file_attach (char *filename, int from_tty) + scratch_pathname, bfd_errmsg (bfd_get_error ())); + } + +- /* At this point, scratch_pathname and exec_bfd->name both point to the +- same malloc'd string. However exec_close() will attempt to free it +- via the exec_bfd->name pointer, so we need to make another copy and +- leave exec_bfd as the new owner of the original copy. */ +- scratch_pathname = xstrdup (scratch_pathname); +- cleanups = make_cleanup (xfree, scratch_pathname); +- + if (!bfd_check_format_matches (exec_bfd, bfd_object, &matching)) + { + /* Make sure to close exec_bfd, or else "run" might try to use +@@ -554,6 +545,7 @@ map_vmap (bfd *abfd, bfd *arch) + memset ((char *) vp, '\0', sizeof (*vp)); + vp->nxt = 0; + vp->bfd = abfd; ++ gdb_bfd_ref (abfd); + vp->name = bfd_get_filename (arch ? arch : abfd); + vp->member = arch ? bfd_get_filename (abfd) : ""; + diff --git a/gdb/f-exp.y b/gdb/f-exp.y index 33c7418..4db1bfa 100644 --- a/gdb/f-exp.y @@ -2109,7 +4500,7 @@ index a95ef84..830917d 100644 { case TYPE_CODE_ARRAY: diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index 8b84b5a..4b240a3 100644 +index 4359f6f..8ff834b 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -54,15 +54,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; @@ -2248,7 +4639,7 @@ index 8b84b5a..4b240a3 100644 switch (TYPE_CODE (type)) { diff --git a/gdb/findvar.c b/gdb/findvar.c -index ed7903c..e412a3d 100644 +index 66bcebe..e59e5f2 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -35,6 +35,7 @@ @@ -2259,7 +4650,7 @@ index ed7903c..e412a3d 100644 /* Basic byte-swapping routines. All 'extract' functions return a host-format integer from a target-format integer at ADDR which is -@@ -407,7 +408,10 @@ symbol_read_needs_frame (struct symbol *sym) +@@ -438,7 +439,10 @@ minsym_lookup_iterator_cb (struct objfile *objfile, void *cb_data) } /* A default implementation for the "la_read_var_value" hook in @@ -2271,7 +4662,7 @@ index ed7903c..e412a3d 100644 struct value * default_read_var_value (struct symbol *var, struct frame_info *frame) -@@ -415,16 +419,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -446,16 +450,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) struct value *v; struct type *type = SYMBOL_TYPE (var); CORE_ADDR addr; @@ -2288,7 +4679,7 @@ index ed7903c..e412a3d 100644 if (symbol_read_needs_frame (var)) gdb_assert (frame); -@@ -434,7 +428,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -465,7 +459,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) case LOC_CONST: /* Put the constant back in target format. */ v = allocate_value (type); @@ -2297,7 +4688,7 @@ index ed7903c..e412a3d 100644 gdbarch_byte_order (get_type_arch (type)), (LONGEST) SYMBOL_VALUE (var)); VALUE_LVAL (v) = not_lval; -@@ -459,12 +453,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -490,12 +484,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) case LOC_CONST_BYTES: v = allocate_value (type); @@ -2312,7 +4703,7 @@ index ed7903c..e412a3d 100644 if (overlay_debugging) addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var), SYMBOL_OBJ_SECTION (var)); -@@ -478,7 +472,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -509,7 +503,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) error (_("Unknown argument list address for `%s'."), SYMBOL_PRINT_NAME (var)); addr += SYMBOL_VALUE (var); @@ -2320,7 +4711,7 @@ index ed7903c..e412a3d 100644 break; case LOC_REF_ARG: -@@ -493,14 +486,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -524,14 +517,12 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) argref += SYMBOL_VALUE (var); ref = value_at (lookup_pointer_type (type), argref); addr = value_as_address (ref); @@ -2335,7 +4726,7 @@ index ed7903c..e412a3d 100644 break; case LOC_TYPEDEF: -@@ -509,7 +500,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -540,7 +531,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) break; case LOC_BLOCK: @@ -2343,7 +4734,7 @@ index ed7903c..e412a3d 100644 if (overlay_debugging) addr = symbol_overlayed_address (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (var)); -@@ -535,7 +525,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -566,7 +556,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) SYMBOL_PRINT_NAME (var)); addr = value_as_address (regval); @@ -2351,7 +4742,7 @@ index ed7903c..e412a3d 100644 } else { -@@ -583,7 +572,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -615,7 +604,6 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) if (obj_section && (obj_section->the_bfd_section->flags & SEC_THREAD_LOCAL) != 0) addr = target_translate_tls_address (obj_section->objfile, addr); @@ -2359,7 +4750,7 @@ index ed7903c..e412a3d 100644 } break; -@@ -596,6 +584,10 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) +@@ -628,6 +616,10 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) break; } @@ -2370,7 +4761,7 @@ index ed7903c..e412a3d 100644 VALUE_LVAL (v) = lval_memory; set_value_address (v, addr); return v; -@@ -691,10 +683,11 @@ struct value * +@@ -723,10 +715,11 @@ struct value * value_from_register (struct type *type, int regnum, struct frame_info *frame) { struct gdbarch *gdbarch = get_frame_arch (frame); @@ -2384,7 +4775,7 @@ index ed7903c..e412a3d 100644 { int optim, unavail, ok; -@@ -709,7 +702,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) +@@ -741,7 +734,7 @@ value_from_register (struct type *type, int regnum, struct frame_info *frame) VALUE_LVAL (v) = lval_register; VALUE_FRAME_ID (v) = get_frame_id (frame); VALUE_REGNUM (v) = regnum; @@ -2393,6 +4784,45 @@ index ed7903c..e412a3d 100644 value_contents_raw (v), &optim, &unavail); +diff --git a/gdb/gcore.c b/gdb/gcore.c +index aedda41..a45e787 100644 +--- a/gdb/gcore.c ++++ b/gdb/gcore.c +@@ -33,6 +33,7 @@ + #include + #include "regcache.h" + #include "regset.h" ++#include "gdb_bfd.h" + + /* The largest amount of memory to read from the target at once. We + must throttle it to limit the amount of memory used by GDB during +@@ -50,7 +51,7 @@ static int gcore_memory_sections (bfd *); + bfd * + create_gcore_bfd (char *filename) + { +- bfd *obfd = bfd_openw (filename, default_gcore_target ()); ++ bfd *obfd = gdb_bfd_openw (filename, default_gcore_target ()); + + if (!obfd) + error (_("Failed to open '%s' for output."), filename); +@@ -110,7 +111,7 @@ do_bfd_delete_cleanup (void *arg) + bfd *obfd = arg; + const char *filename = obfd->filename; + +- bfd_close (arg); ++ gdb_bfd_unref (arg); + unlink (filename); + } + +@@ -154,7 +155,7 @@ gcore_command (char *args, int from_tty) + fprintf_filtered (gdb_stdout, "Saved corefile %s\n", corefilename); + + discard_cleanups (old_chain); +- bfd_close (obfd); ++ gdb_bfd_unref (obfd); + } + + static unsigned long diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in index ffb7f53..a2e7e94 100644 --- a/gdb/gdb-gdb.gdb.in @@ -2413,8 +4843,796 @@ index ffb7f53..a2e7e94 100644 set complaints 1 b internal_error +diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c +new file mode 100644 +index 0000000..fac8776 +--- /dev/null ++++ b/gdb/gdb_bfd.c +@@ -0,0 +1,670 @@ ++/* Definitions for BFD wrappers used by GDB. ++ ++ Copyright (C) 2011, 2012 ++ 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 "gdb_bfd.h" ++#include "gdb_assert.h" ++#include "gdb_string.h" ++#include "ui-out.h" ++#include "gdbcmd.h" ++#include "hashtab.h" ++#ifdef HAVE_ZLIB_H ++#include ++#endif ++#ifdef HAVE_MMAP ++#include ++#ifndef MAP_FAILED ++#define MAP_FAILED ((void *) -1) ++#endif ++#endif ++ ++/* An object of this type is stored in the section's user data when ++ mapping a section. */ ++ ++struct gdb_bfd_section_data ++{ ++ /* Size of the data. */ ++ bfd_size_type size; ++ /* If the data was mmapped, this is the length of the map. */ ++ bfd_size_type map_len; ++ /* The data. If NULL, the section data has not been read. */ ++ void *data; ++ /* If the data was mmapped, this is the map address. */ ++ void *map_addr; ++}; ++ ++/* A hash table holding every BFD that gdb knows about. This is not ++ to be confused with 'gdb_bfd_cache', which is used for sharing ++ BFDs; in contrast, this hash is used just to implement ++ "maint info bfd". */ ++ ++static htab_t all_bfds; ++ ++/* See gdb_bfd.h. */ ++ ++void ++gdb_bfd_stash_filename (struct bfd *abfd) ++{ ++ char *name = bfd_get_filename (abfd); ++ char *data; ++ ++ data = bfd_alloc (abfd, strlen (name) + 1); ++ strcpy (data, name); ++ ++ /* Unwarranted chumminess with BFD. */ ++ abfd->filename = data; ++} ++ ++/* An object of this type is stored in each BFD's user data. */ ++ ++struct gdb_bfd_data ++{ ++ /* The reference count. */ ++ int refc; ++ ++ /* The mtime of the BFD at the point the cache entry was made. */ ++ time_t mtime; ++}; ++ ++/* A hash table storing all the BFDs maintained in the cache. */ ++ ++static htab_t gdb_bfd_cache; ++ ++/* The type of an object being looked up in gdb_bfd_cache. We use ++ htab's capability of storing one kind of object (BFD in this case) ++ and using a different sort of object for searching. */ ++ ++struct gdb_bfd_cache_search ++{ ++ /* The filename. */ ++ const char *filename; ++ /* The mtime. */ ++ time_t mtime; ++}; ++ ++/* A hash function for BFDs. */ ++ ++static hashval_t ++hash_bfd (const void *b) ++{ ++ const bfd *abfd = b; ++ ++ /* It is simplest to just hash the filename. */ ++ return htab_hash_string (bfd_get_filename (abfd)); ++} ++ ++/* An equality function for BFDs. Note that this expects the caller ++ to search using struct gdb_bfd_cache_search only, not BFDs. */ ++ ++static int ++eq_bfd (const void *a, const void *b) ++{ ++ const bfd *abfd = a; ++ const struct gdb_bfd_cache_search *s = b; ++ struct gdb_bfd_data *gdata = bfd_usrdata (abfd); ++ ++ return (gdata->mtime == s->mtime ++ && strcmp (bfd_get_filename (abfd), s->filename) == 0); ++} ++ ++/* See gdb_bfd.h. */ ++ ++struct bfd * ++gdb_bfd_open (const char *name, const char *target, int fd) ++{ ++ hashval_t hash; ++ void **slot; ++ bfd *abfd; ++ struct gdb_bfd_cache_search search; ++ struct stat st; ++ ++ if (gdb_bfd_cache == NULL) ++ gdb_bfd_cache = htab_create_alloc (1, hash_bfd, eq_bfd, NULL, ++ xcalloc, xfree); ++ ++ if (fd == -1) ++ { ++ fd = open (name, O_RDONLY | O_BINARY); ++ if (fd == -1) ++ { ++ bfd_set_error (bfd_error_system_call); ++ return NULL; ++ } ++ } ++ ++ search.filename = name; ++ if (fstat (fd, &st) < 0) ++ { ++ /* Weird situation here. */ ++ search.mtime = 0; ++ } ++ else ++ search.mtime = st.st_mtime; ++ ++ /* Note that this must compute the same result as hash_bfd. */ ++ hash = htab_hash_string (name); ++ /* Note that we cannot use htab_find_slot_with_hash here, because ++ opening the BFD may fail; and this would violate hashtab ++ invariants. */ ++ abfd = htab_find_with_hash (gdb_bfd_cache, &search, hash); ++ if (abfd != NULL) ++ { ++ close (fd); ++ gdb_bfd_ref (abfd); ++ return abfd; ++ } ++ ++ abfd = bfd_fopen (name, target, FOPEN_RB, fd); ++ if (abfd == NULL) ++ return NULL; ++ ++ slot = htab_find_slot_with_hash (gdb_bfd_cache, &search, hash, INSERT); ++ gdb_assert (!*slot); ++ *slot = abfd; ++ ++ gdb_bfd_stash_filename (abfd); ++ gdb_bfd_ref (abfd); ++ return abfd; ++} ++ ++/* A helper function that releases any section data attached to the ++ BFD. */ ++ ++static void ++free_one_bfd_section (bfd *abfd, asection *sectp, void *ignore) ++{ ++ struct gdb_bfd_section_data *sect = bfd_get_section_userdata (abfd, sectp); ++ ++ if (sect != NULL && sect->data != NULL) ++ { ++#ifdef HAVE_MMAP ++ if (sect->map_addr != NULL) ++ { ++ int res; ++ ++ res = munmap (sect->map_addr, sect->map_len); ++ gdb_assert (res == 0); ++ } ++ else ++#endif ++ xfree (sect->data); ++ } ++} ++ ++/* Close ABFD, and warn if that fails. */ ++ ++static int ++gdb_bfd_close_or_warn (struct bfd *abfd) ++{ ++ int ret; ++ char *name = bfd_get_filename (abfd); ++ ++ bfd_map_over_sections (abfd, free_one_bfd_section, NULL); ++ ++ ret = bfd_close (abfd); ++ ++ if (!ret) ++ warning (_("cannot close \"%s\": %s"), ++ name, bfd_errmsg (bfd_get_error ())); ++ ++ return ret; ++} ++ ++/* See gdb_bfd.h. */ ++ ++void ++gdb_bfd_ref (struct bfd *abfd) ++{ ++ struct gdb_bfd_data *gdata; ++ void **slot; ++ ++ if (abfd == NULL) ++ return; ++ ++ gdata = bfd_usrdata (abfd); ++ ++ if (gdata != NULL) ++ { ++ gdata->refc += 1; ++ return; ++ } ++ ++ gdata = bfd_zalloc (abfd, sizeof (struct gdb_bfd_data)); ++ gdata->refc = 1; ++ gdata->mtime = bfd_get_mtime (abfd); ++ bfd_usrdata (abfd) = gdata; ++ ++ /* This is the first we've seen it, so add it to the hash table. */ ++ slot = htab_find_slot (all_bfds, abfd, INSERT); ++ gdb_assert (slot && !*slot); ++ *slot = abfd; ++} ++ ++/* See gdb_bfd.h. */ ++ ++void ++gdb_bfd_unref (struct bfd *abfd) ++{ ++ struct gdb_bfd_data *gdata; ++ struct gdb_bfd_cache_search search; ++ void **slot; ++ ++ if (abfd == NULL) ++ return; ++ ++ gdata = bfd_usrdata (abfd); ++ gdb_assert (gdata->refc >= 1); ++ ++ gdata->refc -= 1; ++ if (gdata->refc > 0) ++ return; ++ ++ search.filename = bfd_get_filename (abfd); ++ ++ if (gdb_bfd_cache && search.filename) ++ { ++ hashval_t hash = htab_hash_string (search.filename); ++ void **slot; ++ ++ search.mtime = gdata->mtime; ++ slot = htab_find_slot_with_hash (gdb_bfd_cache, &search, hash, ++ NO_INSERT); ++ ++ if (slot && *slot) ++ htab_clear_slot (gdb_bfd_cache, slot); ++ } ++ ++ bfd_usrdata (abfd) = NULL; /* Paranoia. */ ++ ++ htab_remove_elt (all_bfds, abfd); ++ ++ gdb_bfd_close_or_warn (abfd); ++} ++ ++/* A helper function that returns the section data descriptor ++ associated with SECTION. If no such descriptor exists, a new one ++ is allocated and cleared. */ ++ ++static struct gdb_bfd_section_data * ++get_section_descriptor (asection *section) ++{ ++ struct gdb_bfd_section_data *result; ++ ++ result = bfd_get_section_userdata (section->owner, section); ++ ++ if (result == NULL) ++ { ++ result = bfd_zalloc (section->owner, sizeof (*result)); ++ bfd_set_section_userdata (section->owner, section, result); ++ } ++ ++ return result; ++} ++ ++/* Decompress a section that was compressed using zlib. Store the ++ decompressed buffer, and its size, in DESCRIPTOR. */ ++ ++static void ++zlib_decompress_section (asection *sectp, ++ struct gdb_bfd_section_data *descriptor) ++{ ++ bfd *abfd = sectp->owner; ++#ifndef HAVE_ZLIB_H ++ error (_("Support for zlib-compressed data (from '%s', section '%s') " ++ "is disabled in this copy of GDB"), ++ bfd_get_filename (abfd), ++ bfd_get_section_name (sectp)); ++#else ++ bfd_size_type compressed_size = bfd_get_section_size (sectp); ++ gdb_byte *compressed_buffer = xmalloc (compressed_size); ++ struct cleanup *cleanup = make_cleanup (xfree, compressed_buffer); ++ struct cleanup *inner_cleanup; ++ bfd_size_type uncompressed_size; ++ gdb_byte *uncompressed_buffer; ++ z_stream strm; ++ int rc; ++ int header_size = 12; ++ struct dwarf2_per_bfd_section *section_data; ++ ++ if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 ++ || bfd_bread (compressed_buffer, ++ compressed_size, abfd) != compressed_size) ++ error (_("can't read data from '%s', section '%s'"), ++ bfd_get_filename (abfd), ++ bfd_get_section_name (abfd, sectp)); ++ ++ /* Read the zlib header. In this case, it should be "ZLIB" followed ++ by the uncompressed section size, 8 bytes in big-endian order. */ ++ if (compressed_size < header_size ++ || strncmp (compressed_buffer, "ZLIB", 4) != 0) ++ error (_("corrupt ZLIB header from '%s', section '%s'"), ++ bfd_get_filename (abfd), ++ bfd_get_section_name (abfd, sectp)); ++ uncompressed_size = compressed_buffer[4]; uncompressed_size <<= 8; ++ uncompressed_size += compressed_buffer[5]; uncompressed_size <<= 8; ++ uncompressed_size += compressed_buffer[6]; uncompressed_size <<= 8; ++ uncompressed_size += compressed_buffer[7]; uncompressed_size <<= 8; ++ uncompressed_size += compressed_buffer[8]; uncompressed_size <<= 8; ++ uncompressed_size += compressed_buffer[9]; uncompressed_size <<= 8; ++ uncompressed_size += compressed_buffer[10]; uncompressed_size <<= 8; ++ uncompressed_size += compressed_buffer[11]; ++ ++ /* It is possible the section consists of several compressed ++ buffers concatenated together, so we uncompress in a loop. */ ++ strm.zalloc = NULL; ++ strm.zfree = NULL; ++ strm.opaque = NULL; ++ strm.avail_in = compressed_size - header_size; ++ strm.next_in = (Bytef*) compressed_buffer + header_size; ++ strm.avail_out = uncompressed_size; ++ uncompressed_buffer = xmalloc (uncompressed_size); ++ inner_cleanup = make_cleanup (xfree, uncompressed_buffer); ++ rc = inflateInit (&strm); ++ while (strm.avail_in > 0) ++ { ++ if (rc != Z_OK) ++ error (_("setting up uncompression in '%s', section '%s': %d"), ++ bfd_get_filename (abfd), ++ bfd_get_section_name (abfd, sectp), ++ rc); ++ strm.next_out = ((Bytef*) uncompressed_buffer ++ + (uncompressed_size - strm.avail_out)); ++ rc = inflate (&strm, Z_FINISH); ++ if (rc != Z_STREAM_END) ++ error (_("zlib error uncompressing from '%s', section '%s': %d"), ++ bfd_get_filename (abfd), ++ bfd_get_section_name (abfd, sectp), ++ rc); ++ rc = inflateReset (&strm); ++ } ++ rc = inflateEnd (&strm); ++ if (rc != Z_OK ++ || strm.avail_out != 0) ++ error (_("concluding uncompression in '%s', section '%s': %d"), ++ bfd_get_filename (abfd), ++ bfd_get_section_name (abfd, sectp), ++ rc); ++ ++ discard_cleanups (inner_cleanup); ++ do_cleanups (cleanup); ++ ++ /* Attach the data to the BFD section. */ ++ descriptor->data = uncompressed_buffer; ++ descriptor->size = uncompressed_size; ++#endif ++} ++ ++/* See gdb_bfd.h. */ ++ ++const gdb_byte * ++gdb_bfd_map_section (asection *sectp, bfd_size_type *size) ++{ ++ bfd *abfd; ++ gdb_byte *buf, *retbuf; ++ unsigned char header[4]; ++ struct gdb_bfd_section_data *descriptor; ++ ++ gdb_assert ((sectp->flags & SEC_RELOC) == 0); ++ gdb_assert (size != NULL); ++ ++ abfd = sectp->owner; ++ ++ descriptor = get_section_descriptor (sectp); ++ ++ /* If the data was already read for this BFD, just reuse it. */ ++ if (descriptor->data != NULL) ++ goto done; ++ ++ /* Check if the file has a 4-byte header indicating compression. */ ++ if (bfd_get_section_size (sectp) > sizeof (header) ++ && bfd_seek (abfd, sectp->filepos, SEEK_SET) == 0 ++ && bfd_bread (header, sizeof (header), abfd) == sizeof (header)) ++ { ++ /* Upon decompression, update the buffer and its size. */ ++ if (strncmp (header, "ZLIB", sizeof (header)) == 0) ++ { ++ zlib_decompress_section (sectp, descriptor); ++ goto done; ++ } ++ } ++ ++#ifdef HAVE_MMAP ++ { ++ /* The page size, used when mmapping. */ ++ static int pagesize; ++ ++ if (pagesize == 0) ++ pagesize = getpagesize (); ++ ++ /* Only try to mmap sections which are large enough: we don't want ++ to waste space due to fragmentation. */ ++ ++ if (bfd_get_section_size (sectp) > 4 * pagesize) ++ { ++ descriptor->size = bfd_get_section_size (sectp); ++ descriptor->data = bfd_mmap (abfd, 0, descriptor->size, PROT_READ, ++ MAP_PRIVATE, sectp->filepos, ++ &descriptor->map_addr, ++ &descriptor->map_len); ++ ++ if ((caddr_t)descriptor->data != MAP_FAILED) ++ { ++#if HAVE_POSIX_MADVISE ++ posix_madvise (descriptor->map_addr, descriptor->map_len, ++ POSIX_MADV_WILLNEED); ++#endif ++ goto done; ++ } ++ ++ /* On failure, clear out the section data and try again. */ ++ memset (descriptor, 0, sizeof (*descriptor)); ++ } ++ } ++#endif /* HAVE_MMAP */ ++ ++ /* If we get here, we are a normal, not-compressed section. */ ++ ++ descriptor->size = bfd_get_section_size (sectp); ++ descriptor->data = xmalloc (descriptor->size); ++ ++ if (bfd_seek (abfd, sectp->filepos, SEEK_SET) != 0 ++ || bfd_bread (descriptor->data, bfd_get_section_size (sectp), ++ abfd) != bfd_get_section_size (sectp)) ++ { ++ xfree (descriptor->data); ++ descriptor->data = NULL; ++ error (_("Can't read data for section '%s'"), ++ bfd_get_filename (abfd)); ++ } ++ ++ done: ++ gdb_assert (descriptor->data != NULL); ++ *size = descriptor->size; ++ return descriptor->data; ++} ++ ++ ++ ++/* See gdb_bfd.h. */ ++ ++bfd * ++gdb_bfd_fopen (const char *filename, const char *target, const char *mode, ++ int fd) ++{ ++ bfd *result = bfd_fopen (filename, target, mode, fd); ++ ++ if (result) ++ { ++ gdb_bfd_stash_filename (result); ++ gdb_bfd_ref (result); ++ } ++ ++ return result; ++} ++ ++/* See gdb_bfd.h. */ ++ ++bfd * ++gdb_bfd_openr (const char *filename, const char *target) ++{ ++ bfd *result = bfd_openr (filename, target); ++ ++ if (result) ++ { ++ gdb_bfd_stash_filename (result); ++ gdb_bfd_ref (result); ++ } ++ ++ return result; ++} ++ ++/* See gdb_bfd.h. */ ++ ++bfd * ++gdb_bfd_openw (const char *filename, const char *target) ++{ ++ bfd *result = bfd_openw (filename, target); ++ ++ if (result) ++ { ++ gdb_bfd_stash_filename (result); ++ gdb_bfd_ref (result); ++ } ++ ++ return result; ++} ++ ++/* See gdb_bfd.h. */ ++ ++bfd * ++gdb_bfd_openr_iovec (const char *filename, const char *target, ++ void *(*open_func) (struct bfd *nbfd, ++ void *open_closure), ++ void *open_closure, ++ file_ptr (*pread_func) (struct bfd *nbfd, ++ void *stream, ++ void *buf, ++ file_ptr nbytes, ++ file_ptr offset), ++ int (*close_func) (struct bfd *nbfd, ++ void *stream), ++ int (*stat_func) (struct bfd *abfd, ++ void *stream, ++ struct stat *sb)) ++{ ++ bfd *result = bfd_openr_iovec (filename, target, ++ open_func, open_closure, ++ pread_func, close_func, stat_func); ++ ++ if (result) ++ { ++ gdb_bfd_ref (result); ++ gdb_bfd_stash_filename (result); ++ } ++ ++ return result; ++} ++ ++/* See gdb_bfd.h. */ ++ ++bfd * ++gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous) ++{ ++ bfd *result = bfd_openr_next_archived_file (archive, previous); ++ ++ if (result) ++ { ++ gdb_bfd_ref (result); ++ /* No need to stash the filename here. */ ++ } ++ ++ return result; ++} ++ ++/* See gdb_bfd.h. */ ++ ++bfd * ++gdb_bfd_fdopenr (const char *filename, const char *target, int fd) ++{ ++ bfd *result = bfd_fdopenr (filename, target, fd); ++ ++ if (result) ++ { ++ gdb_bfd_ref (result); ++ gdb_bfd_stash_filename (result); ++ } ++ ++ return result; ++} ++ ++ ++ ++/* A callback for htab_traverse that prints a single BFD. */ ++ ++static int ++print_one_bfd (void **slot, void *data) ++{ ++ bfd *abfd = *slot; ++ struct gdb_bfd_data *gdata = bfd_usrdata (abfd); ++ struct ui_out *uiout = data; ++ struct cleanup *inner; ++ ++ inner = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); ++ ui_out_field_int (uiout, "refcount", gdata->refc); ++ ui_out_field_string (uiout, "addr", host_address_to_string (abfd)); ++ ui_out_field_string (uiout, "filename", bfd_get_filename (abfd)); ++ ui_out_text (uiout, "\n"); ++ do_cleanups (inner); ++ ++ return 1; ++} ++ ++/* Implement the 'maint info bfd' command. */ ++ ++static void ++maintenance_info_bfds (char *arg, int from_tty) ++{ ++ struct cleanup *cleanup; ++ struct ui_out *uiout = current_uiout; ++ ++ cleanup = make_cleanup_ui_out_table_begin_end (uiout, 3, -1, "bfds"); ++ ui_out_table_header (uiout, 10, ui_left, "refcount", "Refcount"); ++ ui_out_table_header (uiout, 18, ui_left, "addr", "Address"); ++ ui_out_table_header (uiout, 40, ui_left, "filename", "Filename"); ++ ++ ui_out_table_body (uiout); ++ htab_traverse (all_bfds, print_one_bfd, uiout); ++ ++ do_cleanups (cleanup); ++} ++ ++/* -Wmissing-prototypes */ ++extern initialize_file_ftype _initialize_gdb_bfd; ++ ++void ++_initialize_gdb_bfd (void) ++{ ++ all_bfds = htab_create_alloc (10, htab_hash_pointer, htab_eq_pointer, ++ NULL, xcalloc, xfree); ++ ++ add_cmd ("bfds", class_maintenance, maintenance_info_bfds, _("\ ++List the BFDs that are currently open."), ++ &maintenanceinfolist); ++} +diff --git a/gdb/gdb_bfd.h b/gdb/gdb_bfd.h +new file mode 100644 +index 0000000..f131ba7 +--- /dev/null ++++ b/gdb/gdb_bfd.h +@@ -0,0 +1,106 @@ ++/* Definitions for BFD wrappers used by GDB. ++ ++ Copyright (C) 2011, 2012 ++ 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 GDB_BFD_H ++#define GDB_BFD_H ++ ++/* Make a copy ABFD's filename using bfd_alloc, and reassign it to the ++ BFD. This ensures that the BFD's filename has the same lifetime as ++ the BFD itself. */ ++ ++void gdb_bfd_stash_filename (struct bfd *abfd); ++ ++/* Open a read-only (FOPEN_RB) BFD given arguments like bfd_fopen. ++ Returns NULL on error. On success, returns a new reference to the ++ BFD, which must be freed with gdb_bfd_unref. BFDs returned by this ++ call are shared among all callers opening the same file. If FD is ++ not -1, then after this call it is owned by BFD. */ ++ ++struct bfd *gdb_bfd_open (const char *name, const char *target, int fd); ++ ++/* Increment the reference count of ABFD. It is fine for ABFD to be ++ NULL; in this case the function does nothing. */ ++ ++void gdb_bfd_ref (struct bfd *abfd); ++ ++/* Decrement the reference count of ABFD. If this is the last ++ reference, ABFD will be freed. If ABFD is NULL, this function does ++ nothing. */ ++ ++void gdb_bfd_unref (struct bfd *abfd); ++ ++/* Try to read or map the contents of the section SECT. If ++ successful, the section data is returned and *SIZE is set to the ++ size of the section data; this may not be the same as the size ++ according to bfd_get_section_size if the section was compressed. ++ The returned section data is associated with the BFD and will be ++ destroyed when the BFD is destroyed. There is no other way to free ++ it; for temporary uses of section data, see ++ bfd_malloc_and_get_section. SECT may not have relocations. This ++ function will throw on error. */ ++ ++const gdb_byte *gdb_bfd_map_section (asection *section, bfd_size_type *size); ++ ++ ++ ++/* A wrapper for bfd_fopen that initializes the gdb-specific reference ++ count and calls gdb_bfd_stash_filename. */ ++ ++bfd *gdb_bfd_fopen (const char *, const char *, const char *, int); ++ ++/* A wrapper for bfd_openr that initializes the gdb-specific reference ++ count and calls gdb_bfd_stash_filename. */ ++ ++bfd *gdb_bfd_openr (const char *, const char *); ++ ++/* A wrapper for bfd_openw that initializes the gdb-specific reference ++ count and calls gdb_bfd_stash_filename. */ ++ ++bfd *gdb_bfd_openw (const char *, const char *); ++ ++/* A wrapper for bfd_openr_iovec that initializes the gdb-specific ++ reference count and calls gdb_bfd_stash_filename. */ ++ ++bfd *gdb_bfd_openr_iovec (const char *filename, const char *target, ++ void *(*open_func) (struct bfd *nbfd, ++ void *open_closure), ++ void *open_closure, ++ file_ptr (*pread_func) (struct bfd *nbfd, ++ void *stream, ++ void *buf, ++ file_ptr nbytes, ++ file_ptr offset), ++ int (*close_func) (struct bfd *nbfd, ++ void *stream), ++ int (*stat_func) (struct bfd *abfd, ++ void *stream, ++ struct stat *sb)); ++ ++/* A wrapper for bfd_openr_next_archived_file that initializes the ++ gdb-specific reference count and calls gdb_bfd_stash_filename. */ ++ ++bfd *gdb_bfd_openr_next_archived_file (bfd *archive, bfd *previous); ++ ++/* A wrapper for bfd_fdopenr that initializes the gdb-specific ++ reference count and calls gdb_bfd_stash_filename. */ ++ ++bfd *gdb_bfd_fdopenr (const char *filename, const char *target, int fd); ++ ++#endif /* GDB_BFD_H */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index e3db1ed..9a346e6 100644 +index 8142ab9..a2953cc 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -37,6 +37,9 @@ @@ -2506,7 +5724,7 @@ index e3db1ed..9a346e6 100644 if (typeptr) *typeptr = ntype; } -@@ -747,6 +796,7 @@ create_range_type (struct type *result_type, struct type *index_type, +@@ -784,6 +833,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); TYPE_LOW_BOUND (result_type) = low_bound; TYPE_HIGH_BOUND (result_type) = high_bound; @@ -2514,7 +5732,7 @@ index e3db1ed..9a346e6 100644 if (low_bound >= 0) TYPE_UNSIGNED (result_type) = 1; -@@ -890,26 +940,31 @@ create_array_type (struct type *result_type, +@@ -927,26 +977,31 @@ create_array_type (struct type *result_type, TYPE_CODE (result_type) = TYPE_CODE_ARRAY; TYPE_TARGET_TYPE (result_type) = element_type; @@ -2559,7 +5777,7 @@ index e3db1ed..9a346e6 100644 return result_type; } -@@ -1431,6 +1486,105 @@ stub_noname_complaint (void) +@@ -1468,6 +1523,105 @@ stub_noname_complaint (void) complaint (&symfile_complaints, _("stub type has NULL name")); } @@ -2665,7 +5883,7 @@ index e3db1ed..9a346e6 100644 /* Find the real type of TYPE. This function returns the real type, after removing all layers of typedefs, and completing opaque or stub types. Completion changes the TYPE argument, but stripping of -@@ -1597,52 +1751,37 @@ check_typedef (struct type *type) +@@ -1634,52 +1788,37 @@ check_typedef (struct type *type) } } @@ -2739,7 +5957,7 @@ index e3db1ed..9a346e6 100644 TYPE_TARGET_STUB (type) = 0; } else if (TYPE_CODE (type) == TYPE_CODE_RANGE) -@@ -1650,6 +1789,7 @@ check_typedef (struct type *type) +@@ -1687,6 +1826,7 @@ check_typedef (struct type *type) TYPE_LENGTH (type) = TYPE_LENGTH (target_type); TYPE_TARGET_STUB (type) = 0; } @@ -2747,7 +5965,7 @@ index e3db1ed..9a346e6 100644 } type = make_qualified_type (type, instance_flags, NULL); -@@ -3308,33 +3448,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) +@@ -3345,33 +3485,42 @@ type_pair_eq (const void *item_lhs, const void *item_rhs) } /* Allocate the hash table used by copy_type_recursive to walk @@ -2805,7 +6023,7 @@ index e3db1ed..9a346e6 100644 return type; /* This type shouldn't be pointing to any types in other objfiles; -@@ -3349,9 +3498,10 @@ copy_type_recursive (struct objfile *objfile, +@@ -3386,9 +3535,10 @@ copy_type_recursive (struct objfile *objfile, new_type = alloc_type_arch (get_type_arch (type)); /* We must add the new type to the hash table immediately, in case @@ -2819,7 +6037,7 @@ index e3db1ed..9a346e6 100644 stored->old = type; stored->new = new_type; *slot = stored; -@@ -3362,6 +3512,21 @@ copy_type_recursive (struct objfile *objfile, +@@ -3399,6 +3549,21 @@ copy_type_recursive (struct objfile *objfile, TYPE_OBJFILE_OWNED (new_type) = 0; TYPE_OWNER (new_type).gdbarch = get_type_arch (type); @@ -2841,7 +6059,7 @@ index e3db1ed..9a346e6 100644 if (TYPE_NAME (type)) TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); if (TYPE_TAG_NAME (type)) -@@ -3370,12 +3535,48 @@ copy_type_recursive (struct objfile *objfile, +@@ -3407,12 +3572,48 @@ copy_type_recursive (struct objfile *objfile, TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type); @@ -2890,7 +6108,7 @@ index e3db1ed..9a346e6 100644 TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); for (i = 0; i < nfields; i++) { -@@ -3384,8 +3585,8 @@ copy_type_recursive (struct objfile *objfile, +@@ -3421,8 +3622,8 @@ copy_type_recursive (struct objfile *objfile, TYPE_FIELD_BITSIZE (new_type, i) = TYPE_FIELD_BITSIZE (type, i); if (TYPE_FIELD_TYPE (type, i)) TYPE_FIELD_TYPE (new_type, i) @@ -2901,7 +6119,7 @@ index e3db1ed..9a346e6 100644 if (TYPE_FIELD_NAME (type, i)) TYPE_FIELD_NAME (new_type, i) = xstrdup (TYPE_FIELD_NAME (type, i)); -@@ -3416,24 +3617,184 @@ copy_type_recursive (struct objfile *objfile, +@@ -3453,24 +3654,184 @@ copy_type_recursive (struct objfile *objfile, } } @@ -3093,7 +6311,7 @@ index e3db1ed..9a346e6 100644 /* Maybe copy the type_specific bits. NOTE drow/2005-12-09: We do not copy the C++-specific bits like -@@ -3450,6 +3811,17 @@ copy_type_recursive (struct objfile *objfile, +@@ -3487,6 +3848,17 @@ copy_type_recursive (struct objfile *objfile, return new_type; } @@ -3111,7 +6329,7 @@ index e3db1ed..9a346e6 100644 /* Make a copy of the given TYPE, except that the pointer & reference types are not preserved. -@@ -3472,6 +3844,201 @@ copy_type (const struct type *type) +@@ -3509,6 +3881,201 @@ copy_type (const struct type *type) return new_type; } @@ -3313,7 +6531,7 @@ index e3db1ed..9a346e6 100644 /* Helper functions to initialize architecture-specific types. */ -@@ -4005,6 +4572,13 @@ void +@@ -4042,6 +4609,13 @@ void _initialize_gdbtypes (void) { gdbtypes_data = gdbarch_data_register_post_init (gdbtypes_post_init); @@ -3328,10 +6546,10 @@ index e3db1ed..9a346e6 100644 add_setshow_zinteger_cmd ("overload", no_class, &overload_debug, diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 887dfdb..6e972d1 100644 +index 17bfbc5..72e9cc5 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h -@@ -213,6 +213,11 @@ enum type_instance_flag_value +@@ -228,6 +228,11 @@ enum type_instance_flag_value #define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub) @@ -3343,7 +6561,7 @@ index 887dfdb..6e972d1 100644 /* Static type. If this is set, the corresponding type had a static modifier. Note: This may be unnecessary, since static data members -@@ -296,6 +301,50 @@ enum type_instance_flag_value +@@ -311,6 +316,50 @@ enum type_instance_flag_value #define TYPE_FLAG_ENUM(t) (TYPE_MAIN_TYPE (t)->flag_flag_enum) @@ -3394,7 +6612,7 @@ index 887dfdb..6e972d1 100644 /* Constant type. If this is set, the corresponding type has a const modifier. */ -@@ -406,6 +455,15 @@ struct main_type +@@ -421,6 +470,15 @@ struct main_type /* True if this type was declared with "class" rather than "struct". */ unsigned int flag_declared_class : 1; @@ -3410,7 +6628,7 @@ index 887dfdb..6e972d1 100644 /* True if this is an enum type with disjoint values. This affects how the enum is printed. */ -@@ -486,6 +544,20 @@ struct main_type +@@ -501,6 +559,20 @@ struct main_type struct type *target_type; @@ -3431,7 +6649,7 @@ index 887dfdb..6e972d1 100644 /* For structure and union types, a description of each field. For set and pascal array types, there is one "field", whose type is the domain type of the set or array. -@@ -568,13 +640,34 @@ struct main_type +@@ -583,13 +655,34 @@ struct main_type struct range_bounds { @@ -3471,7 +6689,7 @@ index 887dfdb..6e972d1 100644 /* Flags indicating whether the values of low and high are valid. When true, the respective range value is -@@ -1016,9 +1109,9 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -1054,9 +1147,9 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type #define TYPE_CHAIN(thistype) (thistype)->chain @@ -3484,7 +6702,7 @@ index 887dfdb..6e972d1 100644 calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ #define TYPE_LENGTH(thistype) (thistype)->length /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real -@@ -1026,11 +1119,16 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -1064,11 +1157,16 @@ extern void allocate_gnat_aux_type (struct type *); #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields @@ -3503,7 +6721,7 @@ index 887dfdb..6e972d1 100644 #define TYPE_LOW_BOUND_UNDEFINED(range_type) \ TYPE_RANGE_DATA(range_type)->low_undefined #define TYPE_HIGH_BOUND_UNDEFINED(range_type) \ -@@ -1047,7 +1145,14 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -1085,7 +1183,14 @@ extern void allocate_gnat_aux_type (struct type *); (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) #define TYPE_ARRAY_LOWER_BOUND_VALUE(arraytype) \ @@ -3519,7 +6737,7 @@ index 887dfdb..6e972d1 100644 /* C++ */ -@@ -1489,6 +1594,18 @@ extern struct type *create_array_type (struct type *, struct type *, +@@ -1531,6 +1636,18 @@ extern struct type *create_array_type (struct type *, struct type *, struct type *); extern struct type *lookup_array_range_type (struct type *, int, int); @@ -3538,7 +6756,7 @@ index 887dfdb..6e972d1 100644 extern struct type *create_string_type (struct type *, struct type *, struct type *); extern struct type *lookup_string_range_type (struct type *, int, int); -@@ -1534,6 +1651,10 @@ extern int is_public_ancestor (struct type *, struct type *); +@@ -1576,6 +1693,10 @@ extern int is_public_ancestor (struct type *, struct type *); extern int is_unique_ancestor (struct type *, struct value *); @@ -3549,7 +6767,7 @@ index 887dfdb..6e972d1 100644 /* Overload resolution */ #define LENGTH_MATCH(bv) ((bv)->rank[0]) -@@ -1609,10 +1730,13 @@ extern void maintenance_print_type (char *, int); +@@ -1651,10 +1772,13 @@ extern void maintenance_print_type (char *, int); extern htab_t create_copied_types_hash (struct objfile *objfile); @@ -3565,8 +6783,326 @@ index 887dfdb..6e972d1 100644 +#endif + #endif /* GDBTYPES_H */ +diff --git a/gdb/jit.c b/gdb/jit.c +index 568d17b..cdd9f49 100644 +--- a/gdb/jit.c ++++ b/gdb/jit.c +@@ -38,6 +38,7 @@ + #include "gdb-dlfcn.h" + #include "gdb_stat.h" + #include "exceptions.h" ++#include "gdb_bfd.h" + + static const char *jit_reader_dir = NULL; + +@@ -132,17 +133,16 @@ mem_bfd_iovec_stat (struct bfd *abfd, void *stream, struct stat *sb) + static struct bfd * + bfd_open_from_target_memory (CORE_ADDR addr, ULONGEST size, char *target) + { +- const char *filename = xstrdup (""); + struct target_buffer *buffer = xmalloc (sizeof (struct target_buffer)); + + buffer->base = addr; + buffer->size = size; +- return bfd_openr_iovec (filename, target, +- mem_bfd_iovec_open, +- buffer, +- mem_bfd_iovec_pread, +- mem_bfd_iovec_close, +- mem_bfd_iovec_stat); ++ return gdb_bfd_openr_iovec ("", target, ++ mem_bfd_iovec_open, ++ buffer, ++ mem_bfd_iovec_pread, ++ mem_bfd_iovec_close, ++ mem_bfd_iovec_stat); + } + + /* One reader that has been loaded successfully, and can potentially be used to +@@ -868,7 +868,7 @@ jit_bfd_try_read_symtab (struct jit_code_entry *code_entry, + { + printf_unfiltered (_("\ + JITed symbol file is not an object file, ignoring it.\n")); +- bfd_close (nbfd); ++ gdb_bfd_unref (nbfd); + return; + } + +@@ -896,7 +896,8 @@ JITed symbol file is not an object file, ignoring it.\n")); + ++i; + } + +- /* This call takes ownership of NBFD. It does not take ownership of SAI. */ ++ /* This call does not take ownership of SAI. */ ++ make_cleanup_bfd_unref (nbfd); + objfile = symbol_file_add_from_bfd (nbfd, 0, sai, OBJF_SHARED, NULL); + + do_cleanups (old_cleanups); +diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c +index 76e4bf1..9a2f5aa 100644 +--- a/gdb/m32r-rom.c ++++ b/gdb/m32r-rom.c +@@ -40,6 +40,7 @@ + #include "inferior.h" + #include + #include "regcache.h" ++#include "gdb_bfd.h" + + /* + * All this stuff just to get my host computer's IP address! +@@ -124,13 +125,15 @@ m32r_load (char *filename, int from_tty) + bfd *abfd; + unsigned int data_count = 0; + struct timeval start_time, end_time; ++ struct cleanup *cleanup; + + if (filename == NULL || filename[0] == 0) + filename = get_exec_file (1); + +- abfd = bfd_openr (filename, 0); ++ abfd = gdb_bfd_openr (filename, 0); + if (!abfd) + error (_("Unable to open file %s."), filename); ++ cleanup = make_cleanup_bfd_unref (abfd); + if (bfd_check_format (abfd, bfd_object) == 0) + error (_("File is not an object file.")); + gettimeofday (&start_time, NULL); +@@ -188,6 +191,7 @@ m32r_load (char *filename, int from_tty) + confused... */ + + clear_symtab_users (0); ++ do_cleanups (cleanup); + } + + static void +@@ -434,6 +438,7 @@ m32r_upload_command (char *args, int from_tty) + char buf[1024]; + struct hostent *hostent; + struct in_addr inet_addr; ++ struct cleanup *cleanup; + + /* First check to see if there's an ethernet port! */ + monitor_printf ("ust\r"); +@@ -524,7 +529,8 @@ m32r_upload_command (char *args, int from_tty) + printf_filtered (" -- Ethernet load complete.\n"); + + gettimeofday (&end_time, NULL); +- abfd = bfd_openr (args, 0); ++ abfd = gdb_bfd_openr (args, 0); ++ cleanup = make_cleanup_bfd_unref (abfd); + if (abfd != NULL) + { /* Download is done -- print section statistics. */ + if (bfd_check_format (abfd, bfd_object) == 0) +@@ -565,6 +571,7 @@ m32r_upload_command (char *args, int from_tty) + confused... */ + + clear_symtab_users (0); ++ do_cleanups (cleanup); + } + + /* Provide a prototype to silence -Wmissing-prototypes. */ +diff --git a/gdb/machoread.c b/gdb/machoread.c +index 22530ab..0d7578a 100644 +--- a/gdb/machoread.c ++++ b/gdb/machoread.c +@@ -454,6 +454,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, + asymbol **symp; + struct bfd_hash_table table; + int nbr_sections; ++ struct cleanup *cleanup; + + /* Per section flag to mark which section have been rebased. */ + unsigned char *sections_rebased; +@@ -466,14 +467,14 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, + { + warning (_("`%s': can't read symbols: %s."), oso->name, + bfd_errmsg (bfd_get_error ())); +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return; + } + + if (abfd->my_archive == NULL && oso->mtime != bfd_get_mtime (abfd)) + { + warning (_("`%s': file time stamp mismatch."), oso->name); +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return; + } + +@@ -482,7 +483,7 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, + oso->nbr_syms)) + { + warning (_("`%s': can't create hash table"), oso->name); +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return; + } + +@@ -629,18 +630,15 @@ macho_add_oso_symfile (oso_el *oso, bfd *abfd, + + bfd_hash_table_free (&table); + +- /* Make sure that the filename was malloc'ed. The current filename comes +- either from an OSO symbol name or from an archive name. Memory for both +- is not managed by gdb. */ +- abfd->filename = xstrdup (abfd->filename); +- + /* We need to clear SYMFILE_MAINLINE to avoid interractive question + from symfile.c:symbol_file_add_with_addrs_or_offsets. */ ++ cleanup = make_cleanup_bfd_unref (abfd); + symbol_file_add_from_bfd + (abfd, symfile_flags & ~(SYMFILE_MAINLINE | SYMFILE_VERBOSE), NULL, + main_objfile->flags & (OBJF_REORDERED | OBJF_SHARED + | OBJF_READNOW | OBJF_USERLOADED), + main_objfile); ++ do_cleanups (cleanup); + } + + /* Read symbols from the vector of oso files. */ +@@ -651,6 +649,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) + int ix; + VEC (oso_el) *vec; + oso_el *oso; ++ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL); + + vec = oso_vector; + oso_vector = NULL; +@@ -677,6 +676,8 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) + memcpy (archive_name, oso->name, pfx_len); + archive_name[pfx_len] = '\0'; + ++ make_cleanup (xfree, archive_name); ++ + /* Compute number of oso for this archive. */ + for (last_ix = ix; + VEC_iterate (oso_el, vec, last_ix, oso2); last_ix++) +@@ -686,7 +687,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) + } + + /* Open the archive and check the format. */ +- archive_bfd = bfd_openr (archive_name, gnutarget); ++ archive_bfd = gdb_bfd_openr (archive_name, gnutarget); + if (archive_bfd == NULL) + { + warning (_("Could not open OSO archive file \"%s\""), +@@ -698,17 +699,18 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) + { + warning (_("OSO archive file \"%s\" not an archive."), + archive_name); +- bfd_close (archive_bfd); ++ gdb_bfd_unref (archive_bfd); + ix = last_ix; + continue; + } +- member_bfd = bfd_openr_next_archived_file (archive_bfd, NULL); ++ ++ member_bfd = gdb_bfd_openr_next_archived_file (archive_bfd, NULL); + + if (member_bfd == NULL) + { + warning (_("Could not read archive members out of " + "OSO archive \"%s\""), archive_name); +- bfd_close (archive_bfd); ++ gdb_bfd_unref (archive_bfd); + ix = last_ix; + continue; + } +@@ -738,12 +740,12 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) + } + + prev = member_bfd; +- member_bfd = bfd_openr_next_archived_file +- (archive_bfd, member_bfd); ++ member_bfd = gdb_bfd_openr_next_archived_file (archive_bfd, ++ member_bfd); + + /* Free previous member if not referenced by an oso. */ + if (ix2 >= last_ix) +- bfd_close (prev); ++ gdb_bfd_unref (prev); + } + for (ix2 = ix; ix2 < last_ix; ix2++) + { +@@ -759,7 +761,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) + { + bfd *abfd; + +- abfd = bfd_openr (oso->name, gnutarget); ++ abfd = gdb_bfd_openr (oso->name, gnutarget); + if (!abfd) + warning (_("`%s': can't open to read symbols: %s."), oso->name, + bfd_errmsg (bfd_get_error ())); +@@ -771,6 +773,7 @@ macho_symfile_read_all_oso (struct objfile *main_objfile, int symfile_flags) + } + + VEC_free (oso_el, vec); ++ do_cleanups (cleanup); + } + + /* DSYM (debug symbols) files contain the debug info of an executable. +@@ -808,20 +811,17 @@ macho_check_dsym (struct objfile *objfile) + warning (_("can't find UUID in %s"), objfile->name); + return NULL; + } +- dsym_filename = xstrdup (dsym_filename); +- dsym_bfd = bfd_openr (dsym_filename, gnutarget); ++ dsym_bfd = gdb_bfd_openr (dsym_filename, gnutarget); + if (dsym_bfd == NULL) + { + warning (_("can't open dsym file %s"), dsym_filename); +- xfree (dsym_filename); + return NULL; + } + + if (!bfd_check_format (dsym_bfd, bfd_object)) + { +- bfd_close (dsym_bfd); ++ gdb_bfd_unref (dsym_bfd); + warning (_("bad dsym file format: %s"), bfd_errmsg (bfd_get_error ())); +- xfree (dsym_filename); + return NULL; + } + +@@ -829,16 +829,14 @@ macho_check_dsym (struct objfile *objfile) + BFD_MACH_O_LC_UUID, &dsym_uuid) == 0) + { + warning (_("can't find UUID in %s"), dsym_filename); +- bfd_close (dsym_bfd); +- xfree (dsym_filename); ++ gdb_bfd_unref (dsym_bfd); + return NULL; + } + if (memcmp (dsym_uuid->command.uuid.uuid, main_uuid->command.uuid.uuid, + sizeof (main_uuid->command.uuid.uuid))) + { + warning (_("dsym file UUID doesn't match the one in %s"), objfile->name); +- bfd_close (dsym_bfd); +- xfree (dsym_filename); ++ gdb_bfd_unref (dsym_bfd); + return NULL; + } + return dsym_bfd; +@@ -902,6 +900,7 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags) + int ix; + oso_el *oso; + struct bfd_section *asect, *dsect; ++ struct cleanup *cleanup; + + if (mach_o_debug_level > 0) + printf_unfiltered (_("dsym file found\n")); +@@ -922,7 +921,9 @@ macho_symfile_read (struct objfile *objfile, int symfile_flags) + } + + /* Add the dsym file as a separate file. */ ++ cleanup = make_cleanup_bfd_unref (dsym_bfd); + symbol_file_add_separate (dsym_bfd, symfile_flags, objfile); ++ do_cleanups (cleanup); + + /* Don't try to read dwarf2 from main file or shared libraries. */ + return; diff --git a/gdb/main.c b/gdb/main.c -index 3148d72..c5b4826 100644 +index d075694..e4da3f1 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -37,6 +37,7 @@ @@ -3586,10 +7122,10 @@ index 3148d72..c5b4826 100644 /* These are static so that we can take their address in an initializer. */ static int print_help; -@@ -473,10 +476,14 @@ captured_main (void *data) +@@ -471,10 +474,14 @@ captured_main (void *data) + {"args", no_argument, &set_args, 1}, + {"l", required_argument, 0, 'l'}, {"return-child-result", no_argument, &return_child_result, 1}, - {"use-deprecated-index-sections", no_argument, - &use_deprecated_index_sections, 1}, +#if HAVE_PYTHON + {"python", no_argument, 0, 'P'}, + {"P", no_argument, 0, 'P'}, @@ -3602,7 +7138,7 @@ index 3148d72..c5b4826 100644 { int option_index; -@@ -494,6 +501,9 @@ captured_main (void *data) +@@ -492,6 +499,9 @@ captured_main (void *data) case 0: /* Long option that just sets a flag. */ break; @@ -3612,7 +7148,7 @@ index 3148d72..c5b4826 100644 case OPT_SE: symarg = optarg; execarg = optarg; -@@ -701,7 +711,31 @@ captured_main (void *data) +@@ -699,7 +709,31 @@ captured_main (void *data) /* Now that gdb_init has created the initial inferior, we're in position to set args for that inferior. */ @@ -3645,7 +7181,7 @@ index 3148d72..c5b4826 100644 { /* The remaining options are the command-line options for the inferior. The first one is the sym/exec file, and the rest -@@ -981,7 +1015,8 @@ captured_main (void *data) +@@ -979,7 +1013,8 @@ captured_main (void *data) /* Read in the old history after all the command files have been read. */ @@ -3655,7 +7191,7 @@ index 3148d72..c5b4826 100644 if (batch_flag) { -@@ -992,13 +1027,25 @@ captured_main (void *data) +@@ -990,13 +1025,25 @@ captured_main (void *data) /* Show time and/or space usage. */ do_cleanups (pre_stat_chain); @@ -3687,7 +7223,7 @@ index 3148d72..c5b4826 100644 } /* No exit -- exit is through quit_command. */ } -@@ -1030,7 +1077,12 @@ print_gdb_help (struct ui_file *stream) +@@ -1028,7 +1075,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\ @@ -3701,7 +7237,7 @@ index 3148d72..c5b4826 100644 Options:\n\n\ "), stream); fputs_unfiltered (_("\ -@@ -1070,7 +1122,13 @@ Options:\n\n\ +@@ -1068,7 +1120,13 @@ Options:\n\n\ --nw Do not use a window interface.\n\ --nx Do not read "), stream); fputs_unfiltered (gdbinit, stream); @@ -3716,6 +7252,119 @@ index 3148d72..c5b4826 100644 --quiet Do not print version number on startup.\n\ --readnow Fully read symbol files on first access.\n\ "), stream); +diff --git a/gdb/objfiles.c b/gdb/objfiles.c +index f5e5c75..411618f 100644 +--- a/gdb/objfiles.c ++++ b/gdb/objfiles.c +@@ -53,6 +53,7 @@ + #include "complaints.h" + #include "psymtab.h" + #include "solist.h" ++#include "gdb_bfd.h" + + /* Prototypes for local functions */ + +@@ -195,7 +196,8 @@ allocate_objfile (bfd *abfd, int flags) + that any data that is reference is saved in the per-objfile data + region. */ + +- objfile->obfd = gdb_bfd_ref (abfd); ++ objfile->obfd = abfd; ++ gdb_bfd_ref (abfd); + if (abfd != NULL) + { + /* Look up the gdbarch associated with the BFD. */ +@@ -1456,75 +1458,6 @@ objfiles_changed (void) + get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1; + } + +-/* Close ABFD, and warn if that fails. */ +- +-int +-gdb_bfd_close_or_warn (struct bfd *abfd) +-{ +- int ret; +- char *name = bfd_get_filename (abfd); +- +- ret = bfd_close (abfd); +- +- if (!ret) +- warning (_("cannot close \"%s\": %s"), +- name, bfd_errmsg (bfd_get_error ())); +- +- return ret; +-} +- +-/* Add reference to ABFD. Returns ABFD. */ +-struct bfd * +-gdb_bfd_ref (struct bfd *abfd) +-{ +- int *p_refcount; +- +- if (abfd == NULL) +- return NULL; +- +- p_refcount = bfd_usrdata (abfd); +- +- if (p_refcount != NULL) +- { +- *p_refcount += 1; +- return abfd; +- } +- +- p_refcount = xmalloc (sizeof (*p_refcount)); +- *p_refcount = 1; +- bfd_usrdata (abfd) = p_refcount; +- +- return abfd; +-} +- +-/* Unreference and possibly close ABFD. */ +-void +-gdb_bfd_unref (struct bfd *abfd) +-{ +- int *p_refcount; +- char *name; +- +- if (abfd == NULL) +- return; +- +- p_refcount = bfd_usrdata (abfd); +- +- /* Valid range for p_refcount: a pointer to int counter, which has a +- value of 1 (single owner) or 2 (shared). */ +- gdb_assert (*p_refcount == 1 || *p_refcount == 2); +- +- *p_refcount -= 1; +- if (*p_refcount > 0) +- return; +- +- xfree (p_refcount); +- bfd_usrdata (abfd) = NULL; /* Paranoia. */ +- +- name = bfd_get_filename (abfd); +- gdb_bfd_close_or_warn (abfd); +- xfree (name); +-} +- + /* The default implementation for the "iterate_over_objfiles_in_search_order" + gdbarch method. It is equivalent to use the ALL_OBJFILES macro, + searching the objfiles in the order they are stored internally, +diff --git a/gdb/objfiles.h b/gdb/objfiles.h +index 01c3aea..0df5798 100644 +--- a/gdb/objfiles.h ++++ b/gdb/objfiles.h +@@ -522,10 +522,6 @@ extern void set_objfile_data (struct objfile *objfile, + extern void *objfile_data (struct objfile *objfile, + const struct objfile_data *data); + +-extern struct bfd *gdb_bfd_ref (struct bfd *abfd); +-extern void gdb_bfd_unref (struct bfd *abfd); +-extern int gdb_bfd_close_or_warn (struct bfd *abfd); +- + extern void default_iterate_over_objfiles_in_search_order + (struct gdbarch *gdbarch, + iterate_over_objfiles_in_search_order_cb_ftype *cb, diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index b8434ed..98a076d 100644 --- a/gdb/p-valprint.c @@ -3797,10 +7446,10 @@ index b8434ed..98a076d 100644 void diff --git a/gdb/parse.c b/gdb/parse.c -index f54c6f2..70e9a05 100644 +index 529c517..6326a01 100644 --- a/gdb/parse.c +++ b/gdb/parse.c -@@ -1516,6 +1516,7 @@ parser_fprintf (FILE *x, const char *y, ...) +@@ -1708,6 +1708,7 @@ parser_fprintf (FILE *x, const char *y, ...) int operator_check_standard (struct expression *exp, int pos, @@ -3808,7 +7457,7 @@ index f54c6f2..70e9a05 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data) -@@ -1557,7 +1558,7 @@ operator_check_standard (struct expression *exp, int pos, +@@ -1749,7 +1750,7 @@ operator_check_standard (struct expression *exp, int pos, struct type *type = elts[pos + 2 + arg].type; struct objfile *objfile = TYPE_OBJFILE (type); @@ -3817,7 +7466,7 @@ index f54c6f2..70e9a05 100644 return 1; } } -@@ -1575,7 +1576,8 @@ operator_check_standard (struct expression *exp, int pos, +@@ -1767,7 +1768,8 @@ operator_check_standard (struct expression *exp, int pos, /* Check objfile where the variable itself is placed. SYMBOL_OBJ_SECTION (symbol) may be NULL. */ @@ -3827,7 +7476,7 @@ index f54c6f2..70e9a05 100644 return 1; /* Check objfile where is placed the code touching the variable. */ -@@ -1588,24 +1590,27 @@ operator_check_standard (struct expression *exp, int pos, +@@ -1780,24 +1782,27 @@ operator_check_standard (struct expression *exp, int pos, /* Invoke callbacks for TYPE and OBJFILE if they were set as non-NULL. */ @@ -3863,7 +7512,7 @@ index f54c6f2..70e9a05 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data) { -@@ -1620,7 +1625,9 @@ exp_iterate (struct expression *exp, +@@ -1812,7 +1817,9 @@ exp_iterate (struct expression *exp, pos = endpos - oplen; if (exp->language_defn->la_exp_desc->operator_check (exp, pos, @@ -3874,7 +7523,7 @@ index f54c6f2..70e9a05 100644 return 1; endpos = pos; -@@ -1651,8 +1658,29 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile) +@@ -1843,8 +1850,29 @@ exp_uses_objfile (struct expression *exp, struct objfile *objfile) { gdb_assert (objfile->separate_debug_objfile_backlink == NULL); @@ -3906,10 +7555,10 @@ index f54c6f2..70e9a05 100644 void _initialize_parse (void) diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h -index 72b9e2f..719a652 100644 +index 86f3bdf..f908a61 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h -@@ -215,6 +215,8 @@ extern void operator_length_standard (const struct expression *, int, int *, +@@ -245,6 +245,8 @@ extern void operator_length_standard (const struct expression *, int, int *, int *); extern int operator_check_standard (struct expression *exp, int pos, @@ -3918,7 +7567,7 @@ index 72b9e2f..719a652 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data); -@@ -301,6 +303,7 @@ struct exp_descriptor +@@ -331,6 +333,7 @@ struct exp_descriptor value should be immediately returned to the caller. Otherwise zero should be returned. */ int (*operator_check) (struct expression *exp, int pos, @@ -3926,7 +7575,7 @@ index 72b9e2f..719a652 100644 int (*objfile_func) (struct objfile *objfile, void *data), void *data); -@@ -339,4 +342,10 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); +@@ -369,4 +372,10 @@ extern void parser_fprintf (FILE *, const char *, ...) ATTRIBUTE_PRINTF (2, 3); extern int exp_uses_objfile (struct expression *exp, struct objfile *objfile); @@ -3938,18 +7587,18 @@ index 72b9e2f..719a652 100644 + #endif /* PARSER_DEFS_H */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c -index 030a4f2..306be18 100644 +index d5b5b63..4bc2b5b 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c -@@ -49,6 +49,7 @@ - #include "charset.h" +@@ -50,6 +50,7 @@ #include "arch-utils.h" #include "cli/cli-utils.h" + #include "format.h" +#include "dwarf2loc.h" #ifdef TUI #include "tui/tui.h" /* For tui_active et al. */ -@@ -974,6 +975,11 @@ print_command_1 (char *exp, int inspect, int voidprint) +@@ -968,6 +969,11 @@ print_command_1 (char *exp, int inspect, int voidprint) else val = access_value_history (0); @@ -3961,7 +7610,7 @@ index 030a4f2..306be18 100644 if (voidprint || (val && value_type (val) && TYPE_CODE (value_type (val)) != TYPE_CODE_VOID)) { -@@ -1062,6 +1068,9 @@ output_command (char *exp, int from_tty) +@@ -1056,6 +1062,9 @@ output_command (char *exp, int from_tty) val = evaluate_expression (expr); @@ -3971,7 +7620,7 @@ index 030a4f2..306be18 100644 annotate_value_begin (value_type (val)); get_formatted_print_options (&opts, format); -@@ -1491,6 +1500,24 @@ x_command (char *exp, int from_tty) +@@ -1485,6 +1494,24 @@ x_command (char *exp, int from_tty) set_internalvar (lookup_internalvar ("__"), last_examine_value); } } @@ -3996,7 +7645,7 @@ index 030a4f2..306be18 100644 /* Add an expression to the auto-display chain. -@@ -1986,6 +2013,10 @@ print_variable_and_value (const char *name, struct symbol *var, +@@ -1982,6 +2009,10 @@ print_variable_and_value (const char *name, struct symbol *var, struct value_print_options opts; val = read_var_value (var, frame); @@ -4007,7 +7656,7 @@ index 030a4f2..306be18 100644 get_user_print_options (&opts); opts.deref_ref = 1; common_val_print (val, stream, indent, &opts, current_language); -@@ -2899,4 +2930,8 @@ Show printing of source filename and line number with ."), NULL, +@@ -2626,4 +2657,8 @@ Show printing of source filename and line number with ."), NULL, add_com ("eval", no_class, eval_command, _("\ Convert \"printf format string\", arg1, arg2, arg3, ..., argn to\n\ a command line, and call it.")); @@ -4016,6 +7665,46 @@ index 030a4f2..306be18 100644 + observer_attach_mark_used (print_types_mark_used); +#endif } +diff --git a/gdb/procfs.c b/gdb/procfs.c +index 774df2e..4409e5b 100644 +--- a/gdb/procfs.c ++++ b/gdb/procfs.c +@@ -3486,7 +3486,7 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored) + long storage_needed; + CORE_ADDR sym_addr; + +- abfd = bfd_fdopenr ("unamed", 0, fd); ++ abfd = gdb_bfd_fdopenr ("unamed", 0, fd); + if (abfd == NULL) + { + warning (_("Failed to create a bfd: %s."), bfd_errmsg (bfd_get_error ())); +@@ -3497,7 +3497,7 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored) + { + /* Not the correct format, so we can not possibly find the dbx_link + symbol in it. */ +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return 0; + } + +@@ -3511,14 +3511,14 @@ insert_dbx_link_bpt_in_file (int fd, CORE_ADDR ignored) + if (dbx_link_bpt == NULL) + { + warning (_("Failed to insert dbx_link breakpoint.")); +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return 0; + } +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return 1; + } + +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return 0; + } + diff --git a/gdb/python/lib/gdb/FrameIterator.py b/gdb/python/lib/gdb/FrameIterator.py new file mode 100644 index 0000000..5654546 @@ -5020,7 +8709,7 @@ index 6f67bdb..5ddd6bc 100644 diff --git a/gdb/python/python.c b/gdb/python/python.c -index 19eb7b5..0e7256e 100644 +index c66efe4..0211fcb 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -66,10 +66,13 @@ static const char *gdbpy_should_print_stack = python_excp_message; @@ -5037,7 +8726,7 @@ index 19eb7b5..0e7256e 100644 static PyMethodDef GdbMethods[]; -@@ -974,6 +977,53 @@ gdbpy_print_stack (void) +@@ -979,6 +982,53 @@ gdbpy_print_stack (void) /* Return the current Progspace. There always is one. */ @@ -5091,7 +8780,7 @@ index 19eb7b5..0e7256e 100644 static PyObject * gdbpy_get_current_progspace (PyObject *unused1, PyObject *unused2) -@@ -1415,6 +1465,8 @@ static PyMethodDef GdbMethods[] = +@@ -1420,6 +1470,8 @@ static PyMethodDef GdbMethods[] = "Get a value from history" }, { "execute", (PyCFunction) execute_gdb_command, METH_VARARGS | METH_KEYWORDS, "Execute a gdb command" }, @@ -5113,8 +8802,695 @@ index dd7066f..f0f6e90 100644 int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, +diff --git a/gdb/record.c b/gdb/record.c +index bb0fe52..ec42aac 100644 +--- a/gdb/record.c ++++ b/gdb/record.c +@@ -32,6 +32,7 @@ + #include "gcore.h" + #include "event-loop.h" + #include "inf-loop.h" ++#include "gdb_bfd.h" + + #include + +@@ -2638,7 +2639,7 @@ record_save_cleanups (void *data) + bfd *obfd = data; + char *pathname = xstrdup (bfd_get_filename (obfd)); + +- bfd_close (obfd); ++ gdb_bfd_unref (obfd); + unlink (pathname); + xfree (pathname); + } +@@ -2854,7 +2855,7 @@ cmd_record_save (char *args, int from_tty) + } + + do_cleanups (set_cleanups); +- bfd_close (obfd); ++ gdb_bfd_unref (obfd); + discard_cleanups (old_cleanups); + + /* Succeeded. */ +diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c +index 47f4405..85268b6 100644 +--- a/gdb/remote-m32r-sdi.c ++++ b/gdb/remote-m32r-sdi.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include "gdb_bfd.h" + + + #include "serial.h" +@@ -1257,13 +1258,13 @@ m32r_load (char *args, int from_tty) + if (!filename) + filename = get_exec_file (1); + +- pbfd = bfd_openr (filename, gnutarget); ++ pbfd = gdb_bfd_openr (filename, gnutarget); + if (pbfd == NULL) + { + perror_with_name (filename); + return; + } +- old_chain = make_cleanup_bfd_close (pbfd); ++ old_chain = make_cleanup_bfd_unref (pbfd); + + if (!bfd_check_format (pbfd, bfd_object)) + error (_("\"%s\" is not an object file: %s"), filename, +diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c +index babbf19..db4381b 100644 +--- a/gdb/remote-mips.c ++++ b/gdb/remote-mips.c +@@ -36,6 +36,7 @@ + #include + #include "mips-tdep.h" + #include "gdbthread.h" ++#include "gdb_bfd.h" + + + /* Breakpoint types. Values 0, 1, and 2 must agree with the watch +@@ -2783,20 +2784,23 @@ mips_load_srec (char *args) + unsigned int i; + unsigned int srec_frame = 200; + int reclen; ++ struct cleanup *cleanup; + static int hashmark = 1; + + buffer = alloca (srec_frame * 2 + 256); + +- abfd = bfd_openr (args, 0); ++ abfd = gdb_bfd_openr (args, 0); + if (!abfd) + { + printf_filtered ("Unable to open file %s\n", args); + return; + } + ++ cleanup = make_cleanup_bfd_unref (abfd); + if (bfd_check_format (abfd, bfd_object) == 0) + { + printf_filtered ("File is not an object file\n"); ++ do_cleanups (cleanup); + return; + } + +@@ -2850,6 +2854,7 @@ mips_load_srec (char *args) + send_srec (srec, reclen, abfd->start_address); + + serial_flush_input (mips_desc); ++ do_cleanups (cleanup); + } + + /* +@@ -3366,20 +3371,23 @@ pmon_load_fast (char *file) + int bintotal = 0; + int final = 0; + int finished = 0; ++ struct cleanup *cleanup; + + buffer = (char *) xmalloc (MAXRECSIZE + 1); + binbuf = (unsigned char *) xmalloc (BINCHUNK); + +- abfd = bfd_openr (file, 0); ++ abfd = gdb_bfd_openr (file, 0); + if (!abfd) + { + printf_filtered ("Unable to open file %s\n", file); + return; + } ++ cleanup = make_cleanup_bfd_unref (abfd); + + if (bfd_check_format (abfd, bfd_object) == 0) + { + printf_filtered ("File is not an object file\n"); ++ do_cleanups (cleanup); + return; + } + +@@ -3503,6 +3511,7 @@ pmon_load_fast (char *file) + pmon_end_download (final, bintotal); + } + ++ do_cleanups (cleanup); + return; + } + +diff --git a/gdb/remote.c b/gdb/remote.c +index 1c9367d..f2b5e7b 100644 +--- a/gdb/remote.c ++++ b/gdb/remote.c +@@ -42,6 +42,7 @@ + #include "cli/cli-decode.h" + #include "cli/cli-setshow.h" + #include "target-descriptions.h" ++#include "gdb_bfd.h" + + #include + #include +@@ -9823,11 +9824,13 @@ remote_filename_p (const char *filename) + bfd * + remote_bfd_open (const char *remote_file, const char *target) + { +- return bfd_openr_iovec (remote_file, target, +- remote_bfd_iovec_open, NULL, +- remote_bfd_iovec_pread, +- remote_bfd_iovec_close, +- remote_bfd_iovec_stat); ++ bfd *abfd = gdb_bfd_openr_iovec (remote_file, target, ++ remote_bfd_iovec_open, NULL, ++ remote_bfd_iovec_pread, ++ remote_bfd_iovec_close, ++ remote_bfd_iovec_stat); ++ ++ return abfd; + } + + void +diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c +index 0a2000a..9b8efd3 100644 +--- a/gdb/rs6000-nat.c ++++ b/gdb/rs6000-nat.c +@@ -730,7 +730,7 @@ static struct vmap * + add_vmap (LdInfo *ldi) + { + bfd *abfd, *last; +- char *mem, *objname, *filename; ++ char *mem, *filename; + struct objfile *obj; + struct vmap *vp; + int fd; +@@ -743,19 +743,18 @@ add_vmap (LdInfo *ldi) + filename = LDI_FILENAME (ldi, arch64); + mem = filename + strlen (filename) + 1; + mem = xstrdup (mem); +- objname = xstrdup (filename); + + fd = LDI_FD (ldi, arch64); + if (fd < 0) + /* Note that this opens it once for every member; a possible + enhancement would be to only open it once for every object. */ +- abfd = bfd_openr (objname, gnutarget); ++ abfd = gdb_bfd_openr (filename, gnutarget); + else +- abfd = bfd_fdopenr (objname, gnutarget, fd); ++ abfd = gdb_bfd_fdopenr (filename, gnutarget, fd); + if (!abfd) + { + warning (_("Could not open `%s' as an executable file: %s"), +- objname, bfd_errmsg (bfd_get_error ())); ++ filename, bfd_errmsg (bfd_get_error ())); + return NULL; + } + +@@ -766,35 +765,44 @@ add_vmap (LdInfo *ldi) + + else if (bfd_check_format (abfd, bfd_archive)) + { +- last = 0; +- /* FIXME??? am I tossing BFDs? bfd? */ +- while ((last = bfd_openr_next_archived_file (abfd, last))) +- if (strcmp (mem, last->filename) == 0) +- break; ++ last = gdb_bfd_openr_next_archived_file (abfd, NULL); ++ while (last != NULL) ++ { ++ bfd *next; ++ ++ if (strcmp (mem, last->filename) == 0) ++ break; ++ ++ next = gdb_bfd_openr_next_archived_file (abfd, last); ++ gdb_bfd_unref (last); ++ } + + if (!last) + { +- warning (_("\"%s\": member \"%s\" missing."), objname, mem); +- bfd_close (abfd); ++ warning (_("\"%s\": member \"%s\" missing."), filename, mem); ++ gdb_bfd_unref (abfd); + return NULL; + } + + if (!bfd_check_format (last, bfd_object)) + { + warning (_("\"%s\": member \"%s\" not in executable format: %s."), +- objname, mem, bfd_errmsg (bfd_get_error ())); +- bfd_close (last); +- bfd_close (abfd); ++ filename, mem, bfd_errmsg (bfd_get_error ())); ++ gdb_bfd_unref (last); ++ gdb_bfd_unref (abfd); + return NULL; + } + + vp = map_vmap (last, abfd); ++ /* map_vmap acquired a reference to LAST, so we can release ++ ours. */ ++ gdb_bfd_unref (last); + } + else + { + warning (_("\"%s\": not in executable format: %s."), +- objname, bfd_errmsg (bfd_get_error ())); +- bfd_close (abfd); ++ filename, bfd_errmsg (bfd_get_error ())); ++ gdb_bfd_unref (abfd); + return NULL; + } + obj = allocate_objfile (vp->bfd, 0); +@@ -803,6 +811,11 @@ add_vmap (LdInfo *ldi) + /* Always add symbols for the main objfile. */ + if (vp == vmap || auto_solib_add) + vmap_add_symbols (vp); ++ ++ /* Anything needing a reference to ABFD has already acquired it, so ++ release our local reference. */ ++ gdb_bfd_unref (abfd); ++ + return vp; + } + +diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c +index d52fb46..db8f187 100644 +--- a/gdb/solib-darwin.c ++++ b/gdb/solib-darwin.c +@@ -28,6 +28,7 @@ + #include "inferior.h" + #include "regcache.h" + #include "gdbthread.h" ++#include "gdb_bfd.h" + + #include "gdb_assert.h" + +@@ -356,6 +357,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) + gdb_byte *interp_name; + CORE_ADDR load_addr = 0; + bfd *dyld_bfd = NULL; ++ struct cleanup *cleanup; + + /* This method doesn't work with an attached process. */ + if (current_inferior ()->attach_flag) +@@ -366,24 +368,31 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) + if (!interp_name) + return; + ++ cleanup = make_cleanup (null_cleanup, NULL); ++ + /* Create a bfd for the interpreter. */ +- dyld_bfd = bfd_openr (interp_name, gnutarget); ++ dyld_bfd = gdb_bfd_openr (interp_name, gnutarget); + if (dyld_bfd) + { + bfd *sub; + ++ make_cleanup_bfd_unref (dyld_bfd); + sub = bfd_mach_o_fat_extract (dyld_bfd, bfd_object, + gdbarch_bfd_arch_info (target_gdbarch)); + if (sub) +- dyld_bfd = sub; +- else + { +- bfd_close (dyld_bfd); +- dyld_bfd = NULL; ++ dyld_bfd = sub; ++ gdb_bfd_ref (sub); ++ make_cleanup_bfd_unref (sub); + } ++ else ++ dyld_bfd = NULL; + } + if (!dyld_bfd) +- return; ++ { ++ do_cleanups (cleanup); ++ return; ++ } + + /* We find the dynamic linker's base address by examining + the current pc (which should point at the entry point for the +@@ -395,7 +404,7 @@ darwin_solib_get_all_image_info_addr_at_init (struct darwin_info *info) + info->all_image_addr = + lookup_symbol_from_bfd (dyld_bfd, "_dyld_all_image_infos"); + +- bfd_close (dyld_bfd); ++ do_cleanups (cleanup); + + if (info->all_image_addr == 0) + return; +@@ -509,17 +518,10 @@ darwin_bfd_open (char *pathname) + gdbarch_bfd_arch_info (target_gdbarch)); + if (!res) + { +- bfd_close (abfd); +- make_cleanup (xfree, found_pathname); ++ make_cleanup_bfd_unref (abfd); + error (_("`%s': not a shared-library: %s"), +- found_pathname, bfd_errmsg (bfd_get_error ())); ++ bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); + } +- +- /* Make sure that the filename is malloc'ed. The current filename +- for fat-binaries BFDs is a name that was generated by BFD, usually +- a static string containing the name of the architecture. */ +- res->filename = xstrdup (pathname); +- + return res; + } + +diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c +index 2500c1f..fcc01a8 100644 +--- a/gdb/solib-dsbt.c ++++ b/gdb/solib-dsbt.c +@@ -30,6 +30,7 @@ + #include "gdbcmd.h" + #include "elf-bfd.h" + #include "exceptions.h" ++#include "gdb_bfd.h" + + #define GOT_MODULE_OFFSET 4 + +@@ -899,7 +900,7 @@ enable_break2 (void) + { + warning (_("Could not find symbol _dl_debug_addr in dynamic linker")); + enable_break_failure_warning (); +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + return 0; + } + +@@ -948,13 +949,13 @@ enable_break2 (void) + "(at address %s) from dynamic linker"), + hex_string_custom (addr + 8, 8)); + enable_break_failure_warning (); +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + return 0; + } + addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order); + + /* We're done with the temporary bfd. */ +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + + /* We're also done with the loadmap. */ + xfree (ldm); +diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c +index 2f2c8b0..0f59535 100644 +--- a/gdb/solib-frv.c ++++ b/gdb/solib-frv.c +@@ -31,6 +31,7 @@ + #include "gdbcmd.h" + #include "elf/frv.h" + #include "exceptions.h" ++#include "gdb_bfd.h" + + /* Flag which indicates whether internal debug messages should be printed. */ + static int solib_frv_debug; +@@ -574,7 +575,7 @@ enable_break2 (void) + { + warning (_("Unable to determine dynamic linker loadmap address.")); + enable_break_failure_warning (); +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + return 0; + } + +@@ -589,7 +590,7 @@ enable_break2 (void) + warning (_("Unable to load dynamic linker loadmap at address %s."), + hex_string_custom (interp_loadmap_addr, 8)); + enable_break_failure_warning (); +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + return 0; + } + +@@ -623,7 +624,7 @@ enable_break2 (void) + warning (_("Could not find symbol _dl_debug_addr " + "in dynamic linker")); + enable_break_failure_warning (); +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + return 0; + } + +@@ -674,7 +675,7 @@ enable_break2 (void) + "(at address %s) from dynamic linker"), + hex_string_custom (addr + 8, 8)); + enable_break_failure_warning (); +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + return 0; + } + addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order); +@@ -686,13 +687,13 @@ enable_break2 (void) + "(at address %s) from dynamic linker"), + hex_string_custom (addr, 8)); + enable_break_failure_warning (); +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + return 0; + } + addr = extract_unsigned_integer (addr_buf, sizeof addr_buf, byte_order); + + /* We're done with the temporary bfd. */ +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + + /* We're also done with the loadmap. */ + xfree (ldm); +diff --git a/gdb/solib-pa64.c b/gdb/solib-pa64.c +index 2b8d061..00ed8a5 100644 +--- a/gdb/solib-pa64.c ++++ b/gdb/solib-pa64.c +@@ -362,7 +362,7 @@ manpage for methods to privately map shared library text.")); + to find any magic formula to find it for Solaris (appears to + be trivial on GNU/Linux). Therefore, we have to try an alternate + mechanism to find the dynamic linker's base address. */ +- tmp_bfd = bfd_openr (buf, gnutarget); ++ tmp_bfd = gdb_bfd_openr (buf, gnutarget); + if (tmp_bfd == NULL) + return; + +@@ -371,7 +371,7 @@ manpage for methods to privately map shared library text.")); + { + warning (_("Unable to grok dynamic linker %s as an object file"), + buf); +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + return; + } + +@@ -401,7 +401,7 @@ manpage for methods to privately map shared library text.")); + } + + /* We're done with the temporary bfd. */ +- bfd_close (tmp_bfd); ++ gdb_bfd_unref (tmp_bfd); + } + } + +diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c +index b5454e7..f62d96c 100644 +--- a/gdb/solib-spu.c ++++ b/gdb/solib-spu.c +@@ -36,6 +36,7 @@ + #include "breakpoint.h" + #include "gdbthread.h" + #include "exceptions.h" ++#include "gdb_bfd.h" + + #include "spu-tdep.h" + +@@ -325,16 +326,16 @@ spu_bfd_fopen (char *name, CORE_ADDR addr) + CORE_ADDR *open_closure = xmalloc (sizeof (CORE_ADDR)); + *open_closure = addr; + +- nbfd = bfd_openr_iovec (xstrdup (name), "elf32-spu", +- spu_bfd_iovec_open, open_closure, +- spu_bfd_iovec_pread, spu_bfd_iovec_close, +- spu_bfd_iovec_stat); ++ nbfd = gdb_bfd_openr_iovec (name, "elf32-spu", ++ spu_bfd_iovec_open, open_closure, ++ spu_bfd_iovec_pread, spu_bfd_iovec_close, ++ spu_bfd_iovec_stat); + if (!nbfd) + return NULL; + + if (!bfd_check_format (nbfd, bfd_object)) + { +- bfd_close (nbfd); ++ gdb_bfd_unref (nbfd); + return NULL; + } + +diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c +index 307e483..76bd872 100644 +--- a/gdb/solib-svr4.c ++++ b/gdb/solib-svr4.c +@@ -46,6 +46,7 @@ + #include "exec.h" + #include "auxv.h" + #include "exceptions.h" ++#include "gdb_bfd.h" + + static struct link_map_offsets *svr4_fetch_link_map_offsets (void); + static int svr4_have_link_map_offsets (void); +@@ -1558,9 +1559,11 @@ enable_break (struct svr4_info *info, int from_tty) + goto bkpt_at_symbol; + + /* Now convert the TMP_BFD into a target. That way target, as +- well as BFD operations can be used. Note that closing the +- target will also close the underlying bfd. */ ++ well as BFD operations can be used. */ + tmp_bfd_target = target_bfd_reopen (tmp_bfd); ++ /* target_bfd_reopen acquired its own reference, so we can ++ release ours now. */ ++ gdb_bfd_unref (tmp_bfd); + + /* On a running target, we can get the dynamic linker's base + address from the shared library table. */ +@@ -1670,8 +1673,9 @@ enable_break (struct svr4_info *info, int from_tty) + sym_addr, + tmp_bfd_target); + +- /* We're done with both the temporary bfd and target. Remember, +- closing the target closes the underlying bfd. */ ++ /* We're done with both the temporary bfd and target. Closing ++ the target closes the underlying bfd, because it holds the ++ only remaining reference. */ + target_close (tmp_bfd_target, 0); + + if (sym_addr != 0) +diff --git a/gdb/solib.c b/gdb/solib.c +index 90439ba..73773f1 100644 +--- a/gdb/solib.c ++++ b/gdb/solib.c +@@ -46,6 +46,7 @@ + #include "solib.h" + #include "interps.h" + #include "filesystem.h" ++#include "gdb_bfd.h" + + /* Architecture-specific operations. */ + +@@ -360,9 +361,9 @@ solib_find (char *in_pathname, int *fd) + it is used as file handle to open the file. Throws an error if the file + could not be opened. Handles both local and remote file access. + +- PATHNAME must be malloc'ed by the caller. If successful, the new BFD's +- name will point to it. If unsuccessful, PATHNAME will be freed and the +- FD will be closed (unless FD was -1). */ ++ PATHNAME must be malloc'ed by the caller. It will be freed by this ++ function. If unsuccessful, the FD will be closed (unless FD was ++ -1). */ + + bfd * + solib_bfd_fopen (char *pathname, int fd) +@@ -376,7 +377,7 @@ solib_bfd_fopen (char *pathname, int fd) + } + else + { +- abfd = bfd_fopen (pathname, gnutarget, FOPEN_RB, fd); ++ abfd = gdb_bfd_fopen (pathname, gnutarget, FOPEN_RB, fd); + + if (abfd) + bfd_set_cacheable (abfd, 1); +@@ -389,6 +390,8 @@ solib_bfd_fopen (char *pathname, int fd) + pathname, bfd_errmsg (bfd_get_error ())); + } + ++ xfree (pathname); ++ + return abfd; + } + +@@ -420,17 +423,16 @@ solib_bfd_open (char *pathname) + /* Check bfd format. */ + if (!bfd_check_format (abfd, bfd_object)) + { +- bfd_close (abfd); +- make_cleanup (xfree, found_pathname); ++ make_cleanup_bfd_unref (abfd); + error (_("`%s': not in executable format: %s"), +- found_pathname, bfd_errmsg (bfd_get_error ())); ++ bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ())); + } + + /* Check bfd arch. */ + b = gdbarch_bfd_arch_info (target_gdbarch); + if (!b->compatible (b, bfd_get_arch_info (abfd))) + warning (_("`%s': Shared library architecture %s is not compatible " +- "with target architecture %s."), found_pathname, ++ "with target architecture %s."), bfd_get_filename (abfd), + bfd_get_arch_info (abfd)->printable_name, b->printable_name); + + return abfd; +@@ -466,7 +468,7 @@ solib_map_sections (struct so_list *so) + return 0; + + /* Leave bfd open, core_xfer_memory and "info files" need it. */ +- so->abfd = gdb_bfd_ref (abfd); ++ so->abfd = abfd; + + /* copy full path name into so_name, so that later symbol_file_add + can find it. */ +@@ -1233,7 +1235,7 @@ reload_shared_libraries_1 (int from_tty) + { + found_pathname = xstrdup (bfd_get_filename (abfd)); + make_cleanup (xfree, found_pathname); +- gdb_bfd_close_or_warn (abfd); ++ gdb_bfd_unref (abfd); + } + + /* If this shared library is no longer associated with its previous +diff --git a/gdb/spu-linux-nat.c b/gdb/spu-linux-nat.c +index 2dfec8c..999f1ab 100644 +--- a/gdb/spu-linux-nat.c ++++ b/gdb/spu-linux-nat.c +@@ -315,16 +315,16 @@ spu_bfd_open (ULONGEST addr) + ULONGEST *open_closure = xmalloc (sizeof (ULONGEST)); + *open_closure = addr; + +- nbfd = bfd_openr_iovec (xstrdup (""), "elf32-spu", +- spu_bfd_iovec_open, open_closure, +- spu_bfd_iovec_pread, spu_bfd_iovec_close, +- spu_bfd_iovec_stat); ++ nbfd = gdb_bfd_openr_iovec ("", "elf32-spu", ++ spu_bfd_iovec_open, open_closure, ++ spu_bfd_iovec_pread, spu_bfd_iovec_close, ++ spu_bfd_iovec_stat); + if (!nbfd) + return NULL; + + if (!bfd_check_format (nbfd, bfd_object)) + { +- bfd_close (nbfd); ++ gdb_bfd_unref (nbfd); + return NULL; + } + +@@ -374,8 +374,13 @@ spu_symbol_file_add_from_memory (int inferior_fd) + /* Open BFD representing SPE executable and read its symbols. */ + nbfd = spu_bfd_open (addr); + if (nbfd) +- symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE, +- NULL, 0, NULL); ++ { ++ struct cleanup *cleanup = make_cleanup_bfd_unref (nbfd); ++ ++ symbol_file_add_from_bfd (nbfd, SYMFILE_VERBOSE | SYMFILE_MAINLINE, ++ NULL, 0, NULL); ++ do_cleanups (cleanup); ++ } + } + + diff --git a/gdb/stack.c b/gdb/stack.c -index 02e36ca..066407f 100644 +index 35d379d..04aab5e 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -509,6 +509,10 @@ print_frame_args (struct symbol *func, struct frame_info *frame, @@ -5128,6 +9504,285 @@ index 02e36ca..066407f 100644 if (func) { struct block *b = SYMBOL_BLOCK_VALUE (func); +diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c +index e80fd25..2e53be0 100644 +--- a/gdb/symfile-mem.c ++++ b/gdb/symfile-mem.c +@@ -54,6 +54,7 @@ + #include "observer.h" + #include "auxv.h" + #include "elf/common.h" ++#include "gdb_bfd.h" + + /* Verify parameters of target_read_memory_bfd and target_read_memory are + compatible. */ +@@ -100,23 +101,24 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr, char *name, + if (nbfd == NULL) + error (_("Failed to read a valid object file image from memory.")); + ++ gdb_bfd_ref (nbfd); + if (name == NULL) +- nbfd->filename = xstrdup ("shared object read from target memory"); ++ nbfd->filename = "shared object read from target memory"; + else +- nbfd->filename = name; +- +- if (!bfd_check_format (nbfd, bfd_object)) + { +- /* FIXME: should be checking for errors from bfd_close (for one thing, +- on error it does not free all the storage associated with the +- bfd). */ +- bfd_close (nbfd); +- error (_("Got object file from memory but can't read symbols: %s."), +- bfd_errmsg (bfd_get_error ())); ++ nbfd->filename = name; ++ gdb_bfd_stash_filename (nbfd); ++ xfree (name); + } + ++ cleanup = make_cleanup_bfd_unref (nbfd); ++ ++ if (!bfd_check_format (nbfd, bfd_object)) ++ error (_("Got object file from memory but can't read symbols: %s."), ++ bfd_errmsg (bfd_get_error ())); ++ + sai = alloc_section_addr_info (bfd_count_sections (nbfd)); +- cleanup = make_cleanup (xfree, sai); ++ make_cleanup (xfree, sai); + i = 0; + for (sec = nbfd->sections; sec != NULL; sec = sec->next) + if ((bfd_get_section_flags (nbfd, sec) & (SEC_ALLOC|SEC_LOAD)) != 0) +diff --git a/gdb/symfile.c b/gdb/symfile.c +index 01252e2..95ed480 100644 +--- a/gdb/symfile.c ++++ b/gdb/symfile.c +@@ -55,6 +55,7 @@ + #include "solib.h" + #include "remote.h" + #include "stack.h" ++#include "gdb_bfd.h" + + #include + #include +@@ -1036,7 +1037,7 @@ new_symfile_objfile (struct objfile *objfile, int add_flags) + loaded file. + + ABFD is a BFD already open on the file, as from symfile_bfd_open. +- This BFD will be closed on error, and is always consumed by this function. ++ A new reference is acquired by this function. + + ADD_FLAGS encodes verbosity, whether this is main symbol file or + extra, such as dynamically loaded code, and what to do with breakpoins. +@@ -1060,7 +1061,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, + int flags, struct objfile *parent) + { + struct objfile *objfile; +- struct cleanup *my_cleanups; + const char *name = bfd_get_filename (abfd); + const int from_tty = add_flags & SYMFILE_VERBOSE; + const int mainline = add_flags & SYMFILE_MAINLINE; +@@ -1074,8 +1074,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, + add_flags &= ~SYMFILE_NO_READ; + } + +- my_cleanups = make_cleanup_bfd_close (abfd); +- + /* Give user a chance to burp if we'd be + interactively wiping out any existing symbols. */ + +@@ -1086,7 +1084,6 @@ symbol_file_add_with_addrs_or_offsets (bfd *abfd, + error (_("Not confirmed.")); + + objfile = allocate_objfile (abfd, flags | (mainline ? OBJF_MAINLINE : 0)); +- discard_cleanups (my_cleanups); + + if (parent) + add_separate_debug_objfile (objfile, parent); +@@ -1207,8 +1204,13 @@ struct objfile * + symbol_file_add (char *name, int add_flags, struct section_addr_info *addrs, + int flags) + { +- return symbol_file_add_from_bfd (symfile_bfd_open (name), add_flags, addrs, +- flags, NULL); ++ bfd *bfd = symfile_bfd_open (name); ++ struct cleanup *cleanup = make_cleanup_bfd_unref (bfd); ++ struct objfile *objf; ++ ++ objf = symbol_file_add_from_bfd (bfd, add_flags, addrs, flags, NULL); ++ do_cleanups (cleanup); ++ return objf; + } + + +@@ -1350,7 +1352,7 @@ separate_debug_file_exists (const char *name, unsigned long crc, + if (filename_cmp (name, parent_objfile->name) == 0) + return 0; + +- abfd = bfd_open_maybe_remote (name); ++ abfd = gdb_bfd_open_maybe_remote (name); + + if (!abfd) + return 0; +@@ -1372,7 +1374,7 @@ separate_debug_file_exists (const char *name, unsigned long crc, + if (abfd_stat.st_dev == parent_stat.st_dev + && abfd_stat.st_ino == parent_stat.st_ino) + { +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return 0; + } + verified_as_different = 1; +@@ -1382,7 +1384,7 @@ separate_debug_file_exists (const char *name, unsigned long crc, + + file_crc_p = get_file_crc (abfd, &file_crc); + +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + + if (!file_crc_p) + return 0; +@@ -1690,15 +1692,20 @@ set_initial_language (void) + } + + /* If NAME is a remote name open the file using remote protocol, otherwise +- open it normally. */ ++ open it normally. Returns a new reference to the BFD. On error, ++ returns NULL with the BFD error set. */ + + bfd * +-bfd_open_maybe_remote (const char *name) ++gdb_bfd_open_maybe_remote (const char *name) + { ++ bfd *result; ++ + if (remote_filename_p (name)) +- return remote_bfd_open (name, gnutarget); ++ result = remote_bfd_open (name, gnutarget); + else +- return bfd_openr (name, gnutarget); ++ result = gdb_bfd_openr (name, gnutarget); ++ ++ return result; + } + + +@@ -1716,19 +1723,14 @@ symfile_bfd_open (char *name) + + if (remote_filename_p (name)) + { +- name = xstrdup (name); + sym_bfd = remote_bfd_open (name, gnutarget); + if (!sym_bfd) +- { +- make_cleanup (xfree, name); +- error (_("`%s': can't open to read symbols: %s."), name, +- bfd_errmsg (bfd_get_error ())); +- } ++ error (_("`%s': can't open to read symbols: %s."), name, ++ bfd_errmsg (bfd_get_error ())); + + if (!bfd_check_format (sym_bfd, bfd_object)) + { +- bfd_close (sym_bfd); +- make_cleanup (xfree, name); ++ make_cleanup_bfd_unref (sym_bfd); + error (_("`%s': can't read symbols: %s."), name, + bfd_errmsg (bfd_get_error ())); + } +@@ -1757,12 +1759,11 @@ symfile_bfd_open (char *name) + perror_with_name (name); + } + +- /* Free 1st new malloc'd copy, but keep the 2nd malloc'd copy in +- bfd. It'll be freed in free_objfile(). */ + xfree (name); + name = absolute_name; ++ make_cleanup (xfree, name); + +- sym_bfd = bfd_fopen (name, gnutarget, FOPEN_RB, desc); ++ sym_bfd = gdb_bfd_fopen (name, gnutarget, FOPEN_RB, desc); + if (!sym_bfd) + { + make_cleanup (xfree, name); +@@ -1773,18 +1774,11 @@ symfile_bfd_open (char *name) + + if (!bfd_check_format (sym_bfd, bfd_object)) + { +- /* FIXME: should be checking for errors from bfd_close (for one +- thing, on error it does not free all the storage associated +- with the bfd). */ +- bfd_close (sym_bfd); /* This also closes desc. */ +- make_cleanup (xfree, name); ++ make_cleanup_bfd_unref (sym_bfd); + error (_("`%s': can't read symbols: %s."), name, + bfd_errmsg (bfd_get_error ())); + } + +- /* bfd_usrdata exists for applications and libbfd must not touch it. */ +- gdb_assert (bfd_usrdata (sym_bfd) == NULL); +- + return sym_bfd; + } + +@@ -2109,17 +2103,14 @@ generic_load (char *args, int from_tty) + } + + /* Open the file for loading. */ +- loadfile_bfd = bfd_openr (filename, gnutarget); ++ loadfile_bfd = gdb_bfd_openr (filename, gnutarget); + if (loadfile_bfd == NULL) + { + perror_with_name (filename); + return; + } + +- /* FIXME: should be checking for errors from bfd_close (for one thing, +- on error it does not free all the storage associated with the +- bfd). */ +- make_cleanup_bfd_close (loadfile_bfd); ++ make_cleanup_bfd_unref (loadfile_bfd); + + if (!bfd_check_format (loadfile_bfd, bfd_object)) + { +@@ -2518,15 +2509,18 @@ reread_symbols (void) + /* Clean up any state BFD has sitting around. We don't need + to close the descriptor but BFD lacks a way of closing the + BFD without closing the descriptor. */ +- obfd_filename = bfd_get_filename (objfile->obfd); +- if (!bfd_close (objfile->obfd)) +- error (_("Can't close BFD for %s: %s"), objfile->name, +- bfd_errmsg (bfd_get_error ())); +- objfile->obfd = bfd_open_maybe_remote (obfd_filename); ++ { ++ struct bfd *obfd = objfile->obfd; ++ ++ obfd_filename = bfd_get_filename (objfile->obfd); ++ /* Open the new BFD before freeing the old one, so that ++ the filename remains live. */ ++ objfile->obfd = gdb_bfd_open_maybe_remote (obfd_filename); ++ gdb_bfd_unref (obfd); ++ } ++ + if (objfile->obfd == NULL) + error (_("Can't open %s to read symbols."), objfile->name); +- else +- objfile->obfd = gdb_bfd_ref (objfile->obfd); + /* bfd_openr sets cacheable to true, which is what we want. */ + if (!bfd_check_format (objfile->obfd, bfd_object)) + error (_("Can't read symbols from %s: %s."), objfile->name, +diff --git a/gdb/symfile.h b/gdb/symfile.h +index aca7359..184a83e 100644 +--- a/gdb/symfile.h ++++ b/gdb/symfile.h +@@ -553,7 +553,7 @@ extern void find_lowest_section (bfd *, asection *, void *); + + extern bfd *symfile_bfd_open (char *); + +-extern bfd *bfd_open_maybe_remote (const char *); ++extern bfd *gdb_bfd_open_maybe_remote (const char *); + + extern int get_section_index (struct objfile *, char *); + diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp index 678639c..47a2202 100644 --- a/gdb/testsuite/gdb.ada/packed_array.exp @@ -8601,7 +13256,7 @@ index 0000000..295602d + writeln(s); { set breakpoint 2 here } +end. diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp -index 83ff8fe..bddbf9f 100644 +index 993e774..52dbd17 100644 --- a/gdb/testsuite/gdb.python/py-frame.exp +++ b/gdb/testsuite/gdb.python/py-frame.exp @@ -74,8 +74,6 @@ gdb_test "python print bframe == gdb.newest_frame()" True \ @@ -8620,10 +13275,10 @@ index 83ff8fe..bddbf9f 100644 + +gdb_test "python print 'result =', f0.block ()" "" "test Frame.block" diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp -index c9d8c97..4324db0 100644 +index acfd89b..c77d9c2 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp -@@ -360,6 +360,15 @@ proc test_value_after_death {} { +@@ -358,6 +358,15 @@ proc test_value_after_death {} { "print value's type" } @@ -8639,7 +13294,7 @@ index c9d8c97..4324db0 100644 # 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. -@@ -496,6 +505,7 @@ test_value_in_inferior +@@ -494,6 +503,7 @@ test_value_in_inferior test_inferior_function_call test_lazy_strings test_value_after_death @@ -8648,7 +13303,7 @@ index c9d8c97..4324db0 100644 # Test either C or C++ values. test_subscript_regression "${binfile}" "c" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 1dfe564..186f9d7 100644 +index 4f2b7c9..0daef25 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -142,6 +142,11 @@ proc gdb_unload {} { @@ -8770,10 +13425,32 @@ index c25e705..498958a 100644 static void diff --git a/gdb/utils.c b/gdb/utils.c -index 2d607ef..d67e7dd 100644 +index 5566149..6e1aa34 100644 --- a/gdb/utils.c +++ b/gdb/utils.c -@@ -1737,6 +1737,36 @@ set_batch_flag_and_make_cleanup_restore_page_info (void) +@@ -27,6 +27,7 @@ + #include "exceptions.h" + #include "gdbthread.h" + #include "fnmatch.h" ++#include "gdb_bfd.h" + #ifdef HAVE_SYS_RESOURCE_H + #include + #endif /* HAVE_SYS_RESOURCE_H */ +@@ -198,11 +199,11 @@ make_cleanup_dyn_string_delete (dyn_string_t arg) + static void + do_bfd_close_cleanup (void *arg) + { +- bfd_close (arg); ++ gdb_bfd_unref (arg); + } + + struct cleanup * +-make_cleanup_bfd_close (bfd *abfd) ++make_cleanup_bfd_unref (bfd *abfd) + { + return make_cleanup (do_bfd_close_cleanup, abfd); + } +@@ -1738,6 +1739,36 @@ set_batch_flag_and_make_cleanup_restore_page_info (void) return back_to; } @@ -8811,7 +13488,7 @@ index 2d607ef..d67e7dd 100644 static void diff --git a/gdb/valarith.c b/gdb/valarith.c -index 0225339..f775bfc 100644 +index 96d5411..37bd464 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -197,7 +197,10 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) @@ -8838,7 +13515,7 @@ index 0225339..f775bfc 100644 } diff --git a/gdb/valops.c b/gdb/valops.c -index feb47f5..6d14eee 100644 +index 97d889b..6ae77b8 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -45,6 +45,7 @@ @@ -8955,7 +13632,7 @@ index feb47f5..6d14eee 100644 } else if (VALUE_LVAL (val) == lval_register) { -@@ -1532,7 +1605,18 @@ address_of_variable (struct symbol *var, struct block *b) +@@ -1530,7 +1603,18 @@ address_of_variable (struct symbol *var, struct block *b) if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) || TYPE_CODE (type) == TYPE_CODE_FUNC) { @@ -8975,7 +13652,7 @@ index feb47f5..6d14eee 100644 return value_from_pointer (lookup_pointer_type (type), addr); } -@@ -1639,6 +1723,7 @@ struct value * +@@ -1637,6 +1721,7 @@ struct value * value_coerce_array (struct value *arg1) { struct type *type = check_typedef (value_type (arg1)); @@ -8983,7 +13660,7 @@ index feb47f5..6d14eee 100644 /* If the user tries to do something requiring a pointer with an array that has not yet been pushed to the target, then this would -@@ -1648,8 +1733,12 @@ value_coerce_array (struct value *arg1) +@@ -1646,8 +1731,12 @@ value_coerce_array (struct value *arg1) if (VALUE_LVAL (arg1) != lval_memory) error (_("Attempt to take address of value not located in memory.")); @@ -8997,7 +13674,7 @@ index feb47f5..6d14eee 100644 } /* Given a value which is a function, return a value which is a pointer -@@ -3772,6 +3861,8 @@ value_slice (struct value *array, int lowbound, int length) +@@ -3769,6 +3858,8 @@ value_slice (struct value *array, int lowbound, int length) TYPE_TARGET_TYPE (range_type), lowbound, lowbound + length - 1); @@ -9080,7 +13757,7 @@ index fc5942d..8333eb4 100644 /* Read LEN bytes of target memory at address MEMADDR, placing the diff --git a/gdb/value.c b/gdb/value.c -index c64e55b..cd08a0b 100644 +index a6bb718..7b08d1f 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -42,6 +42,7 @@ @@ -9152,7 +13829,7 @@ index c64e55b..cd08a0b 100644 /* Internal variables. These are variables within the debugger that hold values assigned by debugger commands. -@@ -2095,6 +2130,38 @@ call_internal_function (struct gdbarch *gdbarch, +@@ -2118,6 +2153,38 @@ call_internal_function (struct gdbarch *gdbarch, return (*ifn->handler) (gdbarch, language, ifn->cookie, argc, argv); } @@ -9191,7 +13868,7 @@ index c64e55b..cd08a0b 100644 /* The 'function' command. This does nothing -- it is just a placeholder to let "help function NAME" work. This is also used as the implementation of the sub-command that is created when -@@ -2142,11 +2209,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, +@@ -2165,11 +2232,10 @@ preserve_one_value (struct value *value, struct objfile *objfile, htab_t copied_types) { if (TYPE_OBJFILE (value->type) == objfile) @@ -9205,7 +13882,7 @@ index c64e55b..cd08a0b 100644 copied_types); } -@@ -2161,7 +2227,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, +@@ -2184,7 +2250,7 @@ preserve_one_internalvar (struct internalvar *var, struct objfile *objfile, case INTERNALVAR_INTEGER: if (var->u.integer.type && TYPE_OBJFILE (var->u.integer.type) == objfile) var->u.integer.type @@ -9214,7 +13891,7 @@ index c64e55b..cd08a0b 100644 break; case INTERNALVAR_VALUE: -@@ -3253,10 +3319,27 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type, +@@ -3276,10 +3342,27 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type, struct value * coerce_ref (struct value *arg) { @@ -9243,7 +13920,7 @@ index c64e55b..cd08a0b 100644 retval = coerce_ref_if_computed (arg); if (retval) return retval; -@@ -3363,4 +3446,10 @@ VARIABLE is already initialized.")); +@@ -3386,4 +3469,10 @@ VARIABLE is already initialized.")); add_prefix_cmd ("function", no_class, function_command, _("\ Placeholder command for showing help on convenience functions."), &functionlist, "function ", 0, &cmdlist); @@ -9255,7 +13932,7 @@ index c64e55b..cd08a0b 100644 +#endif } diff --git a/gdb/value.h b/gdb/value.h -index b630fc7..2f95db2 100644 +index d8b157f..f49e827 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -533,6 +533,10 @@ extern struct value *value_from_decfloat (struct type *type, @@ -9269,3 +13946,34 @@ index b630fc7..2f95db2 100644 extern struct value *value_at (struct type *type, CORE_ADDR addr); extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr); +diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c +index f16588a..afef615 100644 +--- a/gdb/windows-nat.c ++++ b/gdb/windows-nat.c +@@ -752,7 +752,7 @@ windows_make_so (const char *name, LPVOID load_addr) + asection *text = NULL; + CORE_ADDR text_vma; + +- abfd = bfd_openr (so->so_name, "pei-i386"); ++ abfd = gdb_bfd_openr (so->so_name, "pei-i386"); + + if (!abfd) + return so; +@@ -762,7 +762,7 @@ windows_make_so (const char *name, LPVOID load_addr) + + if (!text) + { +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + return so; + } + +@@ -773,7 +773,7 @@ windows_make_so (const char *name, LPVOID load_addr) + load_addr + 0x1000); + cygwin_load_end = cygwin_load_start + bfd_section_size (abfd, text); + +- bfd_close (abfd); ++ gdb_bfd_unref (abfd); + } + #endif + diff --git a/gdb-attach-fail-reasons-5of5.patch b/gdb-attach-fail-reasons-5of5.patch index 48de42f..a845f6c 100644 --- a/gdb-attach-fail-reasons-5of5.patch +++ b/gdb-attach-fail-reasons-5of5.patch @@ -37,13 +37,13 @@ gdb/gdbserver/ (linux_create_inferior, linux_tracefork_child): Call it instead of direct ptrace. -Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.c +Index: gdb-7.5.0.20120926/gdb/common/linux-ptrace.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/common/linux-ptrace.c 2012-03-13 16:02:23.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/common/linux-ptrace.c 2012-06-02 20:37:53.933828570 +0200 -@@ -27,6 +27,10 @@ - #include "linux-procfs.h" +--- gdb-7.5.0.20120926.orig/gdb/common/linux-ptrace.c 2012-09-17 20:28:14.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/common/linux-ptrace.c 2012-09-26 19:13:53.508780239 +0200 +@@ -28,6 +28,10 @@ #include "buffer.h" + #include "gdb_assert.h" +#ifdef HAVE_SELINUX_SELINUX_H +# include @@ -52,13 +52,19 @@ Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.c /* Find all possible reasons we could fail to attach PID and append these newline terminated reason strings to initialized BUFFER. '\0' termination of BUFFER must be done by the caller. */ -@@ -46,4 +50,22 @@ linux_ptrace_attach_warnings (pid_t pid, +@@ -47,6 +51,8 @@ linux_ptrace_attach_warnings (pid_t pid, buffer_xml_printf (buffer, _("warning: process %d is a zombie " "- the process has already terminated\n"), (int) pid); + + linux_ptrace_create_warnings (buffer); -+} + } + + #if defined __i386__ || defined __x86_64__ +@@ -242,3 +248,19 @@ linux_ptrace_init_warnings (void) + + linux_ptrace_test_ret_to_nx (); + } + +/* Print all possible reasons we could fail to create a traced process. */ + @@ -74,23 +80,23 @@ Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.c + "you can disable this process attach protection by: " + "(gdb) shell sudo setsebool deny_ptrace=0")); +#endif /* HAVE_LIBSELINUX */ - } -Index: gdb-7.4.50.20120602/gdb/common/linux-ptrace.h ++} +Index: gdb-7.5.0.20120926/gdb/common/linux-ptrace.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/common/linux-ptrace.h 2012-03-13 16:02:23.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/common/linux-ptrace.h 2012-06-02 20:37:46.565831956 +0200 -@@ -68,5 +68,6 @@ struct buffer; - #endif +--- gdb-7.5.0.20120926.orig/gdb/common/linux-ptrace.h 2012-07-07 14:13:56.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/common/linux-ptrace.h 2012-09-26 19:13:28.358765406 +0200 +@@ -69,5 +69,6 @@ struct buffer; extern void linux_ptrace_attach_warnings (pid_t pid, struct buffer *buffer); + extern void linux_ptrace_init_warnings (void); +extern void linux_ptrace_create_warnings (struct buffer *buffer); #endif /* COMMON_LINUX_PTRACE_H */ -Index: gdb-7.4.50.20120602/gdb/configure.ac +Index: gdb-7.5.0.20120926/gdb/configure.ac =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/configure.ac 2012-06-02 20:05:08.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/configure.ac 2012-06-02 20:35:06.379798726 +0200 -@@ -2002,6 +2002,10 @@ then +--- gdb-7.5.0.20120926.orig/gdb/configure.ac 2012-09-26 19:13:24.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/configure.ac 2012-09-26 19:13:28.410765451 +0200 +@@ -2008,6 +2008,10 @@ then [Define if you support the personality syscall.]) fi @@ -101,10 +107,10 @@ Index: gdb-7.4.50.20120602/gdb/configure.ac dnl Handle optional features that can be enabled. # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, -Index: gdb-7.4.50.20120602/gdb/gdbserver/configure.ac +Index: gdb-7.5.0.20120926/gdb/gdbserver/configure.ac =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/gdbserver/configure.ac 2012-04-19 21:34:51.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/gdbserver/configure.ac 2012-06-02 20:35:06.408797663 +0200 +--- gdb-7.5.0.20120926.orig/gdb/gdbserver/configure.ac 2012-04-19 21:34:51.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/gdbserver/configure.ac 2012-09-26 19:13:28.446765428 +0200 @@ -438,6 +438,10 @@ if $want_ipa ; then fi fi @@ -116,10 +122,10 @@ Index: gdb-7.4.50.20120602/gdb/gdbserver/configure.ac AC_SUBST(GDBSERVER_DEPFILES) AC_SUBST(GDBSERVER_LIBS) AC_SUBST(USE_THREAD_DB) -Index: gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c +Index: gdb-7.5.0.20120926/gdb/gdbserver/linux-low.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/gdbserver/linux-low.c 2012-05-30 21:51:38.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c 2012-06-02 20:39:49.886785355 +0200 +--- gdb-7.5.0.20120926.orig/gdb/gdbserver/linux-low.c 2012-07-07 14:13:57.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/gdbserver/linux-low.c 2012-09-26 19:13:28.453765471 +0200 @@ -601,6 +601,28 @@ add_lwp (ptid_t ptid) return lwp; } @@ -158,7 +164,7 @@ Index: gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c #ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */ signal (__SIGRTMIN + 1, SIG_DFL); -@@ -4567,7 +4589,7 @@ linux_tracefork_grandchild (void *arg) +@@ -4572,7 +4594,7 @@ linux_tracefork_grandchild (void *arg) static int linux_tracefork_child (void *arg) { @@ -167,10 +173,10 @@ Index: gdb-7.4.50.20120602/gdb/gdbserver/linux-low.c kill (getpid (), SIGSTOP); #if !(defined(__UCLIBC__) && defined(HAS_NOMMU)) -Index: gdb-7.4.50.20120602/gdb/inf-ptrace.c +Index: gdb-7.5.0.20120926/gdb/inf-ptrace.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/inf-ptrace.c 2012-05-24 18:51:34.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/inf-ptrace.c 2012-06-02 20:35:06.428797311 +0200 +--- gdb-7.5.0.20120926.orig/gdb/inf-ptrace.c 2012-05-24 18:51:34.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/inf-ptrace.c 2012-09-26 19:13:28.458765461 +0200 @@ -105,7 +105,15 @@ static void inf_ptrace_me (void) { @@ -187,11 +193,11 @@ Index: gdb-7.4.50.20120602/gdb/inf-ptrace.c } /* Start a new inferior Unix child process. EXEC_FILE is the file to -Index: gdb-7.4.50.20120602/gdb/linux-nat.c +Index: gdb-7.5.0.20120926/gdb/linux-nat.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 20:01:38.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 20:41:18.101751186 +0200 -@@ -1572,6 +1572,7 @@ linux_nat_create_inferior (struct target +--- gdb-7.5.0.20120926.orig/gdb/linux-nat.c 2012-09-26 19:13:22.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/linux-nat.c 2012-09-26 19:13:28.468765469 +0200 +@@ -1574,6 +1574,7 @@ linux_nat_create_inferior (struct target #ifdef HAVE_PERSONALITY int personality_orig = 0, personality_set = 0; #endif /* HAVE_PERSONALITY */ @@ -199,7 +205,7 @@ Index: gdb-7.4.50.20120602/gdb/linux-nat.c /* The fork_child mechanism is synchronous and calls target_wait, so we have to mask the async mode. */ -@@ -1596,7 +1597,10 @@ linux_nat_create_inferior (struct target +@@ -1598,7 +1599,10 @@ linux_nat_create_inferior (struct target /* Make sure we report all signals during startup. */ linux_nat_pass_signals (0, NULL); @@ -211,7 +217,7 @@ Index: gdb-7.4.50.20120602/gdb/linux-nat.c #ifdef HAVE_PERSONALITY if (personality_set) -@@ -1608,6 +1612,24 @@ linux_nat_create_inferior (struct target +@@ -1610,6 +1614,24 @@ linux_nat_create_inferior (struct target safe_strerror (errno)); } #endif /* HAVE_PERSONALITY */ diff --git a/gdb-bz592031-siginfo-lost-4of5.patch b/gdb-bz592031-siginfo-lost-4of5.patch deleted file mode 100644 index 583771a..0000000 --- a/gdb-bz592031-siginfo-lost-4of5.patch +++ /dev/null @@ -1,994 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00360.html -Subject: [patch 3/4]#3 linux-nat: Do not respawn signals - -Hi, - -linux-nat.c is fixed to never respawn signals; possibly keeping SIGSTOP -pending, as is done in current in FSF gdbserver and as suggested by Pedro: - http://sourceware.org/ml/gdb-patches/2010-08/msg00544.html - -The last linux-nat.c removed patch chunk comes from the initial implementation -by Mark Kettenis: - [PATCH] New Linux threads support - http://sourceware.org/ml/gdb-patches/2000-09/msg00020.html - 92280a75e017683bf8e4f339f4f85640b0700509 -It gets in part reimplemented into the new stop_wait_callback step)> -part and partially just not needed as currently GDB never drops the signals as -it does not PTRACE_CONT the thread; signal is kept for processing: - "RC: Not resuming sibling %s (has pending)\n" - -In stop_wait_callback I believe breakpoints cancellation is not needed here, -it would be done later. - - -The testcase sigstep-threads.exp was written to catch a regression-like -appearance then the new step)> part of stop_wait_callback gets -removed. Still the tecase fails even with FSF HEAD: - -32 var++; /* step-1 */ -(gdb) step -Program received signal SIGUSR1, User defined signal 1. -Program received signal SIGUSR1, User defined signal 1. -31 { /* step-0 */ - -There is no reason why it shouldn't stop on line 33, between line 32 and line -33 no signal would occur. Stepping of the current thread should not be -affected by whatever happens in the other threads as select_event_lwp has: - /* Give preference to any LWP that is being single-stepped. */ - -There is a problem that with FSF HEAD GDB does PTRACE_SINGLESTEP for thread A, -PTRACE_CONT for thread B (because of set scheduler-locking off), thread B hits -SIGUSR1, so GDB tkills thread A with SIGSTOP and it can receive SIGSTOP for -thread A before the SIGTRAP for completed PTRACE_SINGLESTEP. At that moment -select_event_lwp. forgets it was stepping thread A because there is no pending -SIGTRAP event. currently_stepping still remembers thread A was stepping so it -will later stop but as thread A was PTRACE_CONT-ed in the meantime it is too -late. - -There is the new step)> part of stop_wait_callback to always track -thread A is stepping. Due to different scheduling without this part the -changed GDB would very rarely stop in this testcase otherwise, making it look -as a regression. - -I have some another patch I may post separately as if multiple signals happen -besides SIGTRAP GDB still may switch from thread A away (as not considering it -stepping) to thread B for SIGUSR and accidentally PTRACE_CONT thread A. -But I do not find this as a prerequisite for this patchset. - - - -Thanks, -Jan - - -gdb/ -2010-09-20 Jan Kratochvil - - * linux-nat.c (stop_wait_callback): New gdb_assert. Remove signals - respawning; keep TP with SIGNALLED. New debugging message "SWC: - Delayed SIGSTOP caught for %s.". Catch next signal if SIGSTOP has - been caught and LP->STEP is set. - (linux_nat_wait_1) signalled>: Remove. - -gdb/testsuite/ -2010-09-20 Jan Kratochvil - - * gdb.threads/siginfo-threads.exp: New file. - * gdb.threads/siginfo-threads.c: New file. - * gdb.threads/sigstep-threads.exp: New file. - * gdb.threads/sigstep-threads.c: New file. - -Index: gdb-7.4.50.20120602/gdb/linux-nat.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 21:34:51.999517510 +0200 -+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 21:35:59.930491577 +0200 -@@ -2856,6 +2856,8 @@ stop_wait_callback (struct lwp_info *lp, - { - int status; - -+ gdb_assert (lp->resumed); -+ - status = wait_lwp (lp); - if (status == 0) - return 0; -@@ -2881,110 +2883,61 @@ stop_wait_callback (struct lwp_info *lp, - - if (WSTOPSIG (status) != SIGSTOP) - { -- if (linux_nat_status_is_event (status)) -- { -- /* If a LWP other than the LWP that we're reporting an -- event for has hit a GDB breakpoint (as opposed to -- some random trap signal), then just arrange for it to -- hit it again later. We don't keep the SIGTRAP status -- and don't forward the SIGTRAP signal to the LWP. We -- will handle the current event, eventually we will -- resume all LWPs, and this one will get its breakpoint -- trap again. -- -- If we do not do this, then we run the risk that the -- user will delete or disable the breakpoint, but the -- thread will have already tripped on it. */ -- -- /* Save the trap's siginfo in case we need it later. */ -- save_siginfo (lp); -- -- save_sigtrap (lp); -- -- /* Now resume this LWP and get the SIGSTOP event. */ -- errno = 0; -- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0); -- if (debug_linux_nat) -- { -- fprintf_unfiltered (gdb_stdlog, -- "PTRACE_CONT %s, 0, 0 (%s)\n", -- target_pid_to_str (lp->ptid), -- errno ? safe_strerror (errno) : "OK"); -- -- fprintf_unfiltered (gdb_stdlog, -- "SWC: Candidate SIGTRAP event in %s\n", -- target_pid_to_str (lp->ptid)); -- } -- /* Hold this event/waitstatus while we check to see if -- there are any more (we still want to get that SIGSTOP). */ -- stop_wait_callback (lp, NULL); -+ /* The thread was stopped with a signal other than SIGSTOP. */ - -- /* Hold the SIGTRAP for handling by linux_nat_wait. If -- there's another event, throw it back into the -- queue. */ -- if (lp->status) -- { -- if (debug_linux_nat) -- fprintf_unfiltered (gdb_stdlog, -- "SWC: kill %s, %s\n", -- target_pid_to_str (lp->ptid), -- status_to_str ((int) status)); -- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status)); -- } -- -- /* Save the sigtrap event. */ -- lp->status = status; -- return 0; -- } -- else -- { -- /* The thread was stopped with a signal other than -- SIGSTOP, and didn't accidentally trip a breakpoint. */ -+ /* Save the trap's siginfo in case we need it later. */ -+ save_siginfo (lp); - -- if (debug_linux_nat) -- { -- fprintf_unfiltered (gdb_stdlog, -- "SWC: Pending event %s in %s\n", -- status_to_str ((int) status), -- target_pid_to_str (lp->ptid)); -- } -- /* Now resume this LWP and get the SIGSTOP event. */ -- errno = 0; -- ptrace (PTRACE_CONT, GET_LWP (lp->ptid), 0, 0); -- if (debug_linux_nat) -- fprintf_unfiltered (gdb_stdlog, -- "SWC: PTRACE_CONT %s, 0, 0 (%s)\n", -- target_pid_to_str (lp->ptid), -- errno ? safe_strerror (errno) : "OK"); -+ save_sigtrap (lp); - -- /* Hold this event/waitstatus while we check to see if -- there are any more (we still want to get that SIGSTOP). */ -- stop_wait_callback (lp, NULL); -+ if (debug_linux_nat) -+ fprintf_unfiltered (gdb_stdlog, -+ "SWC: Pending event %s in %s\n", -+ status_to_str ((int) status), -+ target_pid_to_str (lp->ptid)); - -- /* If the lp->status field is still empty, use it to -- hold this event. If not, then this event must be -- returned to the event queue of the LWP. */ -- if (lp->status) -- { -- if (debug_linux_nat) -- { -- fprintf_unfiltered (gdb_stdlog, -- "SWC: kill %s, %s\n", -- target_pid_to_str (lp->ptid), -- status_to_str ((int) status)); -- } -- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (status)); -- } -- else -- lp->status = status; -- return 0; -- } -+ /* Save the sigtrap event. */ -+ lp->status = status; -+ gdb_assert (! lp->stopped); -+ gdb_assert (lp->signalled); -+ lp->stopped = 1; - } - else - { - /* We caught the SIGSTOP that we intended to catch, so - there's no SIGSTOP pending. */ -- lp->stopped = 1; -+ -+ if (debug_linux_nat) -+ fprintf_unfiltered (gdb_stdlog, -+ "SWC: Delayed SIGSTOP caught for %s.\n", -+ target_pid_to_str (lp->ptid)); -+ -+ if (lp->step) -+ { -+ /* LP->STATUS is 0 here. That means SIGTRAP from -+ PTRACE_SINGLESTEP still has to be delivered for this inferior -+ stop. Catching the SIGTRAP event is important to prevent -+ starvation in select_event_lwp. */ -+ -+ registers_changed (); -+ linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)), -+ 1, GDB_SIGNAL_0); -+ if (debug_linux_nat) -+ fprintf_unfiltered (gdb_stdlog, -+ "SWC: %s %s, 0, 0 (discard SIGSTOP)\n", -+ "PTRACE_SINGLESTEP", -+ target_pid_to_str (lp->ptid)); -+ -+ lp->stopped = 0; -+ gdb_assert (lp->resumed); -+ stop_wait_callback (lp, NULL); -+ gdb_assert (lp->stopped); -+ } -+ else -+ lp->stopped = 1; -+ -+ /* Reset SIGNALLED only after the stop_wait_callback call above as -+ it does gdb_assert on SIGNALLED. */ - lp->signalled = 0; - } - } -@@ -3616,54 +3569,6 @@ retry: - lp = NULL; - } - -- if (lp && lp->signalled && lp->last_resume_kind != resume_stop) -- { -- /* A pending SIGSTOP may interfere with the normal stream of -- events. In a typical case where interference is a problem, -- we have a SIGSTOP signal pending for LWP A while -- single-stepping it, encounter an event in LWP B, and take the -- pending SIGSTOP while trying to stop LWP A. After processing -- the event in LWP B, LWP A is continued, and we'll never see -- the SIGTRAP associated with the last time we were -- single-stepping LWP A. */ -- -- /* Resume the thread. It should halt immediately returning the -- pending SIGSTOP. */ -- registers_changed (); -- if (linux_nat_prepare_to_resume != NULL) -- linux_nat_prepare_to_resume (lp); -- linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)), -- lp->step, GDB_SIGNAL_0); -- if (debug_linux_nat) -- fprintf_unfiltered (gdb_stdlog, -- "LLW: %s %s, 0, 0 (expect SIGSTOP)\n", -- lp->step ? "PTRACE_SINGLESTEP" : "PTRACE_CONT", -- target_pid_to_str (lp->ptid)); -- lp->stopped = 0; -- gdb_assert (lp->resumed); -- -- /* Catch the pending SIGSTOP. */ -- status = lp->status; -- lp->status = 0; -- -- stop_wait_callback (lp, NULL); -- -- /* If the lp->status field isn't empty, we caught another signal -- while flushing the SIGSTOP. Return it back to the event -- queue of the LWP, as we already have an event to handle. */ -- if (lp->status) -- { -- if (debug_linux_nat) -- fprintf_unfiltered (gdb_stdlog, -- "LLW: kill %s, %s\n", -- target_pid_to_str (lp->ptid), -- status_to_str (lp->status)); -- kill_lwp (GET_LWP (lp->ptid), WSTOPSIG (lp->status)); -- } -- -- lp->status = status; -- } -- - if (!target_can_async_p ()) - { - /* Causes SIGINT to be passed on to the attached process. */ -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.c 2012-06-02 21:35:40.268499060 +0200 -@@ -0,0 +1,447 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+#define _GNU_SOURCE -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#define gettid() syscall (__NR_gettid) -+#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, tgid, tid, sig) -+ -+/* Terminate always in the main task, it can lock up with SIGSTOPped GDB -+ otherwise. */ -+#define TIMEOUT (gettid () == getpid() ? 10 : 15) -+ -+static pid_t thread1_tid; -+static pthread_cond_t thread1_tid_cond = PTHREAD_COND_INITIALIZER; -+static pthread_mutex_t thread1_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -+static int thread1_sigusr1_hit; -+static int thread1_sigusr2_hit; -+ -+static pid_t thread2_tid; -+static pthread_cond_t thread2_tid_cond = PTHREAD_COND_INITIALIZER; -+static pthread_mutex_t thread2_tid_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -+static int thread2_sigusr1_hit; -+static int thread2_sigusr2_hit; -+ -+static pthread_mutex_t terminate_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -+ -+/* Do not use alarm as it would create a ptrace event which would hang up us if -+ we are being traced by GDB which we stopped ourselves. */ -+ -+static void timed_mutex_lock (pthread_mutex_t *mutex) -+{ -+ int i; -+ struct timespec start, now; -+ -+ i = clock_gettime (CLOCK_MONOTONIC, &start); -+ assert (i == 0); -+ -+ do -+ { -+ i = pthread_mutex_trylock (mutex); -+ if (i == 0) -+ return; -+ assert (i == EBUSY); -+ -+ i = clock_gettime (CLOCK_MONOTONIC, &now); -+ assert (i == 0); -+ assert (now.tv_sec >= start.tv_sec); -+ } -+ while (now.tv_sec - start.tv_sec < TIMEOUT); -+ -+ fprintf (stderr, "Timed out waiting for internal lock!\n"); -+ exit (EXIT_FAILURE); -+} -+ -+static void -+handler (int signo, siginfo_t *siginfo, void *exception) -+{ -+ int *varp; -+ -+ assert (siginfo->si_signo == signo); -+ assert (siginfo->si_code == SI_TKILL); -+ assert (siginfo->si_pid == getpid ()); -+ -+ if (gettid () == thread1_tid) -+ { -+ if (signo == SIGUSR1) -+ varp = &thread1_sigusr1_hit; -+ else if (signo == SIGUSR2) -+ varp = &thread1_sigusr2_hit; -+ else -+ assert (0); -+ } -+ else if (gettid () == thread2_tid) -+ { -+ if (signo == SIGUSR1) -+ varp = &thread2_sigusr1_hit; -+ else if (signo == SIGUSR2) -+ varp = &thread2_sigusr2_hit; -+ else -+ assert (0); -+ } -+ else -+ assert (0); -+ -+ if (*varp) -+ { -+ fprintf (stderr, "Signal %d for TID %lu has been already hit!\n", signo, -+ (unsigned long) gettid ()); -+ exit (EXIT_FAILURE); -+ } -+ *varp = 1; -+} -+ -+static void * -+thread1_func (void *unused) -+{ -+ int i; -+ -+ timed_mutex_lock (&thread1_tid_mutex); -+ -+ /* THREAD1_TID_MUTEX must be already locked to avoid race. */ -+ thread1_tid = gettid (); -+ -+ i = pthread_cond_signal (&thread1_tid_cond); -+ assert (i == 0); -+ i = pthread_mutex_unlock (&thread1_tid_mutex); -+ assert (i == 0); -+ -+ /* Be sure the "t (tracing stop)" test can proceed for both threads. */ -+ timed_mutex_lock (&terminate_mutex); -+ i = pthread_mutex_unlock (&terminate_mutex); -+ assert (i == 0); -+ -+ if (! thread1_sigusr1_hit) -+ { -+ fprintf (stderr, "Thread 1 signal SIGUSR1 not hit!\n"); -+ exit (EXIT_FAILURE); -+ } -+ if (! thread1_sigusr2_hit) -+ { -+ fprintf (stderr, "Thread 1 signal SIGUSR2 not hit!\n"); -+ exit (EXIT_FAILURE); -+ } -+ -+ return NULL; -+} -+ -+static void * -+thread2_func (void *unused) -+{ -+ int i; -+ -+ timed_mutex_lock (&thread2_tid_mutex); -+ -+ /* THREAD2_TID_MUTEX must be already locked to avoid race. */ -+ thread2_tid = gettid (); -+ -+ i = pthread_cond_signal (&thread2_tid_cond); -+ assert (i == 0); -+ i = pthread_mutex_unlock (&thread2_tid_mutex); -+ assert (i == 0); -+ -+ /* Be sure the "t (tracing stop)" test can proceed for both threads. */ -+ timed_mutex_lock (&terminate_mutex); -+ i = pthread_mutex_unlock (&terminate_mutex); -+ assert (i == 0); -+ -+ if (! thread2_sigusr1_hit) -+ { -+ fprintf (stderr, "Thread 2 signal SIGUSR1 not hit!\n"); -+ exit (EXIT_FAILURE); -+ } -+ if (! thread2_sigusr2_hit) -+ { -+ fprintf (stderr, "Thread 2 signal SIGUSR2 not hit!\n"); -+ exit (EXIT_FAILURE); -+ } -+ -+ return NULL; -+} -+ -+static const char * -+proc_string (const char *filename, const char *line) -+{ -+ FILE *f; -+ static char buf[LINE_MAX]; -+ size_t line_len = strlen (line); -+ -+ f = fopen (filename, "r"); -+ if (f == NULL) -+ { -+ fprintf (stderr, "fopen (\"%s\") for \"%s\": %s\n", filename, line, -+ strerror (errno)); -+ exit (EXIT_FAILURE); -+ } -+ while (errno = 0, fgets (buf, sizeof (buf), f)) -+ { -+ char *s; -+ -+ s = strchr (buf, '\n'); -+ assert (s != NULL); -+ *s = 0; -+ -+ if (strncmp (buf, line, line_len) != 0) -+ continue; -+ -+ if (fclose (f)) -+ { -+ fprintf (stderr, "fclose (\"%s\") for \"%s\": %s\n", filename, line, -+ strerror (errno)); -+ exit (EXIT_FAILURE); -+ } -+ -+ return &buf[line_len]; -+ } -+ if (errno != 0) -+ { -+ fprintf (stderr, "fgets (\"%s\": %s\n", filename, strerror (errno)); -+ exit (EXIT_FAILURE); -+ } -+ fprintf (stderr, "\"%s\": No line \"%s\" found.\n", filename, line); -+ exit (EXIT_FAILURE); -+} -+ -+static unsigned long -+proc_ulong (const char *filename, const char *line) -+{ -+ const char *s = proc_string (filename, line); -+ long retval; -+ char *end; -+ -+ errno = 0; -+ retval = strtol (s, &end, 10); -+ if (retval < 0 || retval >= LONG_MAX || (end && *end)) -+ { -+ fprintf (stderr, "\"%s\":\"%s\": %ld, %s\n", filename, line, retval, -+ strerror (errno)); -+ exit (EXIT_FAILURE); -+ } -+ return retval; -+} -+ -+static void -+state_wait (pid_t process, const char *wanted) -+{ -+ char *filename; -+ int i; -+ struct timespec start, now; -+ const char *state; -+ -+ i = asprintf (&filename, "/proc/%lu/status", (unsigned long) process); -+ assert (i > 0); -+ -+ i = clock_gettime (CLOCK_MONOTONIC, &start); -+ assert (i == 0); -+ -+ do -+ { -+ state = proc_string (filename, "State:\t"); -+ -+ /* torvalds/linux-2.6.git 464763cf1c6df632dccc8f2f4c7e50163154a2c0 -+ has changed "T (tracing stop)" to "t (tracing stop)". Make the GDB -+ testcase backward compatible with older Linux kernels. */ -+ if (strcmp (state, "T (tracing stop)") == 0) -+ state = "t (tracing stop)"; -+ -+ if (strcmp (state, wanted) == 0) -+ { -+ free (filename); -+ return; -+ } -+ -+ if (sched_yield ()) -+ { -+ perror ("sched_yield()"); -+ exit (EXIT_FAILURE); -+ } -+ -+ i = clock_gettime (CLOCK_MONOTONIC, &now); -+ assert (i == 0); -+ assert (now.tv_sec >= start.tv_sec); -+ } -+ while (now.tv_sec - start.tv_sec < TIMEOUT); -+ -+ fprintf (stderr, "Timed out waiting for PID %lu \"%s\" (now it is \"%s\")!\n", -+ (unsigned long) process, wanted, state); -+ exit (EXIT_FAILURE); -+} -+ -+static volatile pid_t tracer = 0; -+static pthread_t thread1, thread2; -+ -+static void -+cleanup (void) -+{ -+ printf ("Resuming GDB PID %lu.\n", (unsigned long) tracer); -+ -+ if (tracer) -+ { -+ int i; -+ int tracer_save = tracer; -+ -+ tracer = 0; -+ -+ i = kill (tracer_save, SIGCONT); -+ assert (i == 0); -+ } -+} -+ -+int -+main (int argc, char **argv) -+{ -+ int i; -+ int standalone = 0; -+ struct sigaction act; -+ -+ if (argc == 2 && strcmp (argv[1], "-s") == 0) -+ standalone = 1; -+ else -+ assert (argc == 1); -+ -+ setbuf (stdout, NULL); -+ -+ timed_mutex_lock (&thread1_tid_mutex); -+ timed_mutex_lock (&thread2_tid_mutex); -+ -+ timed_mutex_lock (&terminate_mutex); -+ -+ errno = 0; -+ memset (&act, 0, sizeof (act)); -+ act.sa_sigaction = handler; -+ act.sa_flags = SA_RESTART | SA_SIGINFO; -+ i = sigemptyset (&act.sa_mask); -+ assert_perror (errno); -+ assert (i == 0); -+ i = sigaction (SIGUSR1, &act, NULL); -+ assert_perror (errno); -+ assert (i == 0); -+ i = sigaction (SIGUSR2, &act, NULL); -+ assert_perror (errno); -+ assert (i == 0); -+ -+ i = pthread_create (&thread1, NULL, thread1_func, NULL); -+ assert (i == 0); -+ -+ i = pthread_create (&thread2, NULL, thread2_func, NULL); -+ assert (i == 0); -+ -+ if (!standalone) -+ { -+ tracer = proc_ulong ("/proc/self/status", "TracerPid:\t"); -+ if (tracer == 0) -+ { -+ fprintf (stderr, "The testcase must be run by GDB!\n"); -+ exit (EXIT_FAILURE); -+ } -+ if (tracer != getppid ()) -+ { -+ fprintf (stderr, "The testcase parent must be our GDB tracer!\n"); -+ exit (EXIT_FAILURE); -+ } -+ } -+ -+ /* SIGCONT our debugger in the case of our crash as we would deadlock -+ otherwise. */ -+ -+ atexit (cleanup); -+ -+ printf ("Stopping GDB PID %lu.\n", (unsigned long) tracer); -+ -+ if (tracer) -+ { -+ i = kill (tracer, SIGSTOP); -+ assert (i == 0); -+ state_wait (tracer, "T (stopped)"); -+ } -+ -+ /* Threads are now waiting at timed_mutex_lock (thread1_tid_mutex) and so -+ they could not trigger the signals before GDB gets unstopped later. -+ Threads get resumed at pthread_cond_wait below. Use `while' loops for -+ protection against spurious pthread_cond_wait wakeups. */ -+ -+ printf ("Waiting till the threads initialize their TIDs.\n"); -+ -+ while (thread1_tid == 0) -+ { -+ i = pthread_cond_wait (&thread1_tid_cond, &thread1_tid_mutex); -+ assert (i == 0); -+ } -+ -+ while (thread2_tid == 0) -+ { -+ i = pthread_cond_wait (&thread2_tid_cond, &thread2_tid_mutex); -+ assert (i == 0); -+ } -+ -+ printf ("Thread 1 TID = %lu, thread 2 TID = %lu, PID = %lu.\n", -+ (unsigned long) thread1_tid, (unsigned long) thread2_tid, -+ (unsigned long) getpid ()); -+ -+ errno = 0; -+ i = tgkill (getpid (), thread1_tid, SIGUSR1); -+ assert_perror (errno); -+ assert (i == 0); -+ i = tgkill (getpid (), thread1_tid, SIGUSR2); -+ assert_perror (errno); -+ assert (i == 0); -+ i = tgkill (getpid (), thread2_tid, SIGUSR1); -+ assert_perror (errno); -+ assert (i == 0); -+ i = tgkill (getpid (), thread2_tid, SIGUSR2); -+ assert_perror (errno); -+ assert (i == 0); -+ -+ printf ("Waiting till the threads get trapped by the signals.\n"); -+ -+ if (tracer) -+ { -+ /* s390x-unknown-linux-gnu will fail with "R (running)". */ -+ -+ state_wait (thread1_tid, "t (tracing stop)"); -+ -+ state_wait (thread2_tid, "t (tracing stop)"); -+ } -+ -+ cleanup (); -+ -+ printf ("Joining the threads.\n"); -+ -+ i = pthread_mutex_unlock (&terminate_mutex); -+ assert (i == 0); -+ -+ i = pthread_join (thread1, NULL); -+ assert (i == 0); -+ -+ i = pthread_join (thread2, NULL); -+ assert (i == 0); -+ -+ printf ("Exiting.\n"); /* break-at-exit */ -+ -+ return EXIT_SUCCESS; -+} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/siginfo-threads.exp 2012-06-02 21:35:40.296499050 +0200 -@@ -0,0 +1,94 @@ -+# Copyright 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 . -+ -+set testfile "siginfo-threads" -+set srcfile ${testfile}.c -+set binfile ${objdir}/${subdir}/${testfile} -+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } { -+ return -1 -+} -+ -+clean_restart $testfile -+ -+if ![runto_main] { -+ return -1 -+} -+ -+# `nostop noprint pass' could in some cases report false PASS due to the -+# (preempt 'handle') code path. -+ -+gdb_test "handle SIGUSR1 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR1\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*" -+gdb_test "handle SIGUSR2 stop print pass" "Signal\[ \t\]+Stop\[ \t\]+Print\[ \t\]+Pass to program\[ \t\]+Description\r\nSIGUSR2\[ \t\]+Yes\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*" -+ -+gdb_breakpoint [gdb_get_line_number "break-at-exit"] -+ -+set test "get pid" -+gdb_test_multiple "p getpid ()" $test { -+ -re " = (\[0-9\]+)\r\n$gdb_prompt $" { -+ set pid $expect_out(1,string) -+ pass $test -+ } -+} -+ -+for {set sigcount 0} {$sigcount < 4} {incr sigcount} { -+ set test "catch signal $sigcount" -+ set sigusr "" -+ gdb_test_multiple "continue" $test { -+ -re "Program received signal SIGUSR(\[12\]), User defined signal \[12\]\\.\r\n.*\r\n$gdb_prompt $" { -+ set sigusr $expect_out(1,string) -+ pass $test -+ } -+ } -+ if {$sigusr == ""} { -+ return -1 -+ } -+ -+ set test "signal $sigcount si_signo" -+ if {$sigusr == 1} { -+ set signo 10 -+ } else { -+ set signo 12 -+ } -+ gdb_test_multiple {p $_siginfo.si_signo} $test { -+ -re " = $signo\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" { -+ unsupported $test -+ } -+ } -+ -+ set test "signal $sigcount si_code is SI_TKILL" -+ gdb_test_multiple {p $_siginfo.si_code} $test { -+ -re " = -6\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" { -+ unsupported $test -+ } -+ } -+ -+ set test "signal $sigcount si_pid" -+ gdb_test_multiple {p $_siginfo._sifields._kill.si_pid} $test { -+ -re " = $pid\r\n$gdb_prompt $" { -+ pass $test -+ } -+ -re "Attempt to extract a component of a value that is not a structure\\.\r\n$gdb_prompt $" { -+ unsupported $test -+ } -+ } -+} -+ -+gdb_continue_to_breakpoint break-at-exit ".*break-at-exit.*" -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.c -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.c 2012-06-02 21:35:40.297499050 +0200 -@@ -0,0 +1,54 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 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 . */ -+ -+#include -+#include -+#include -+ -+#include -+#include -+#define tgkill(tgid, tid, sig) syscall (__NR_tgkill, (tgid), (tid), (sig)) -+#define gettid() syscall (__NR_gettid) -+ -+static volatile int var; -+ -+static void -+handler (int signo) /* step-0 */ -+{ /* step-0 */ -+ var++; /* step-1 */ -+ tgkill (getpid (), gettid (), SIGUSR1); /* step-2 */ -+} -+ -+static void * -+start (void *arg) -+{ -+ signal (SIGUSR1, handler); -+ tgkill (getpid (), gettid (), SIGUSR1); -+ assert (0); -+ -+ return NULL; -+} -+ -+int -+main (void) -+{ -+ pthread_t thread; -+ -+ pthread_create (&thread, NULL, start, NULL); -+ start (NULL); /* main-start */ -+ return 0; -+} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.exp -=================================================================== ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/sigstep-threads.exp 2012-06-02 21:35:40.297499050 +0200 -@@ -0,0 +1,74 @@ -+# Copyright 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 . -+ -+set testfile sigstep-threads -+set srcfile ${testfile}.c -+set executable ${testfile} -+set binfile ${objdir}/${subdir}/${executable} -+ -+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { -+ untested ${testfile}.exp -+ return -1 -+} -+ -+clean_restart $executable -+ -+if ![runto_main] { -+ return -1; -+} -+ -+# `noprint' would not test the full logic of GDB. -+gdb_test "handle SIGUSR1 nostop print pass" "\r\nSIGUSR1\[ \t\]+No\[ \t\]+Yes\[ \t\]+Yes\[ \t\].*" -+ -+gdb_test_no_output "set scheduler-locking off" -+ -+gdb_breakpoint [gdb_get_line_number "step-1"] -+gdb_test_no_output {set $step1=$bpnum} -+gdb_continue_to_breakpoint "step-1" ".* step-1 .*" -+gdb_test_no_output {disable $step1} -+ -+# 1 as we are now stopped at the `step-1' label. -+set step_at 1 -+for {set i 0} {$i < 100} {incr i} { -+ set test "step $i" -+ # Presume this step failed - as in the case of a timeout. -+ set failed 1 -+ gdb_test_multiple "step" $test { -+ -re "\r\nProgram received signal SIGUSR1, User defined signal 1.\r\n" { -+ exp_continue -continue_timer -+ } -+ -re "step-(\[012\]).*\r\n$gdb_prompt $" { -+ set now $expect_out(1,string) -+ if {$step_at == 2 && $now == 1} { -+ set failed 0 -+ } elseif {$step_at == 1 && $now == 2} { -+ set failed 0 -+ # Continue over the re-signalling back to the handle entry. -+ gdb_test_no_output {enable $step1} "" -+ gdb_test "continue" " step-1 .*" "" -+ set now 1 -+ gdb_test_no_output {disable $step1} "" -+ } else { -+ fail $test -+ } -+ set step_at $now -+ } -+ } -+ if $failed { -+ return -+ } -+} -+# We can never reliably say the racy problematic case has been tested. -+pass "step" diff --git a/gdb-bz592031-siginfo-lost-5of5.patch b/gdb-bz592031-siginfo-lost-5of5.patch deleted file mode 100644 index cc6accc..0000000 --- a/gdb-bz592031-siginfo-lost-5of5.patch +++ /dev/null @@ -1,141 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2010-09/msg00361.html -Subject: [patch 4/4]#3 Remove redundant lp->siginfo - -Hi, - -this is a simplification which should not affect GDB behavior. As linux-nat -now stops on each received signal without any reordering of them then -PTRACE_GETSIGINFO is enough to access siginfo, without any need to copy it in -advance. - - -Thanks, -Jan - - -gdb/ -2010-09-20 Jan Kratochvil - - * linux-nat.c (resume_callback) stopped && lp->status == 0> - (linux_nat_resume): Remove LP->SIGINFO clearing. - (save_siginfo): Remove. - (stop_wait_callback) - (linux_nat_filter_event) : Remove - the save_siginfo call. - (resume_stopped_resumed_lwps): Remove LP->SIGINFO clearing. - (linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO. - * linux-nat.h (struct lwp_info) : Remove. - -Index: gdb-7.4.50.20120602/gdb/linux-nat.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/linux-nat.c 2012-06-02 21:36:21.067483466 +0200 -+++ gdb-7.4.50.20120602/gdb/linux-nat.c 2012-06-02 21:37:55.345447402 +0200 -@@ -1929,7 +1929,6 @@ resume_lwp (struct lwp_info *lp, int ste - step, GDB_SIGNAL_0); - lp->stopped = 0; - lp->step = step; -- memset (&lp->siginfo, 0, sizeof (lp->siginfo)); - lp->stopped_by_watchpoint = 0; - } - else -@@ -2071,7 +2070,6 @@ linux_nat_resume (struct target_ops *ops - if (linux_nat_prepare_to_resume != NULL) - linux_nat_prepare_to_resume (lp); - linux_ops->to_resume (linux_ops, ptid, step, signo); -- memset (&lp->siginfo, 0, sizeof (lp->siginfo)); - lp->stopped_by_watchpoint = 0; - - if (debug_linux_nat) -@@ -2625,22 +2623,6 @@ wait_lwp (struct lwp_info *lp) - return status; - } - --/* Save the most recent siginfo for LP. This is currently only called -- for SIGTRAP; some ports use the si_addr field for -- target_stopped_data_address. In the future, it may also be used to -- restore the siginfo of requeued signals. */ -- --static void --save_siginfo (struct lwp_info *lp) --{ -- errno = 0; -- ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid), -- (PTRACE_TYPE_ARG3) 0, &lp->siginfo); -- -- if (errno != 0) -- memset (&lp->siginfo, 0, sizeof (lp->siginfo)); --} -- - /* Send a SIGSTOP to LP. */ - - static int -@@ -2885,9 +2867,6 @@ stop_wait_callback (struct lwp_info *lp, - { - /* The thread was stopped with a signal other than SIGSTOP. */ - -- /* Save the trap's siginfo in case we need it later. */ -- save_siginfo (lp); -- - save_sigtrap (lp); - - if (debug_linux_nat) -@@ -3291,12 +3270,7 @@ linux_nat_filter_event (int lwpid, int s - } - - if (linux_nat_status_is_event (status)) -- { -- /* Save the trap's siginfo in case we need it later. */ -- save_siginfo (lp); -- -- save_sigtrap (lp); -- } -+ save_sigtrap (lp); - - /* Check if the thread has exited. */ - if ((WIFEXITED (status) || WIFSIGNALED (status)) -@@ -3950,7 +3924,6 @@ resume_stopped_resumed_lwps (struct lwp_ - linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)), - lp->step, GDB_SIGNAL_0); - lp->stopped = 0; -- memset (&lp->siginfo, 0, sizeof (lp->siginfo)); - lp->stopped_by_watchpoint = 0; - } - -@@ -5227,11 +5200,19 @@ linux_nat_set_prepare_to_resume (struct - siginfo_t * - linux_nat_get_siginfo (ptid_t ptid) - { -- struct lwp_info *lp = find_lwp_pid (ptid); -+ static siginfo_t siginfo; -+ int pid; - -- gdb_assert (lp != NULL); -+ pid = GET_LWP (ptid); -+ if (pid == 0) -+ pid = GET_PID (ptid); -+ -+ errno = 0; -+ ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo); -+ if (errno != 0) -+ memset (&siginfo, 0, sizeof (siginfo)); - -- return &lp->siginfo; -+ return &siginfo; - } - - /* Provide a prototype to silence -Wmissing-prototypes. */ -Index: gdb-7.4.50.20120602/gdb/linux-nat.h -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/linux-nat.h 2012-06-02 21:36:21.067483466 +0200 -+++ gdb-7.4.50.20120602/gdb/linux-nat.h 2012-06-02 21:36:27.140481144 +0200 -@@ -76,10 +76,6 @@ struct lwp_info - /* The kind of stepping of this LWP. */ - enum resume_step step; - -- /* Non-zero si_signo if this LWP stopped with a trap. si_addr may -- be the address of a hardware watchpoint. */ -- siginfo_t siginfo; -- - /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data - watchpoint trap. */ - int stopped_by_watchpoint; diff --git a/gdb-check-type.patch b/gdb-check-type.patch new file mode 100644 index 0000000..0bb241b --- /dev/null +++ b/gdb-check-type.patch @@ -0,0 +1,1002 @@ +http://sourceware.org/ml/gdb-cvs/2012-08/msg00133.html + +### src/gdb/ChangeLog 2012/08/17 03:06:10 1.14599 +### src/gdb/ChangeLog 2012/08/17 17:36:56 1.14600 +## -1,3 +1,48 @@ ++2012-08-17 Keith Seitz ++ ++ PR c++/13356 ++ * gdbtypes.c (strict_type_checking): New variable. ++ (show_strict_type_checking): New function. ++ (rank_one_type): Return NS_POINTER_INTEGER_CONVERSION_BADNESS ++ if strict type checking is disabled. ++ (_initialize_gdbtypes): Add "check type" subcommand. ++ * gdbtypes.h (NS_INTEGER_POINTER_CONVERSION_BADNESS): New struct. ++ ++2012-08-17 Keith Seitz ++ ++ * language.h (type_mode): Remove. ++ (type_check): Remove. ++ (struct language_defn): Remove la_type_check. ++ (STRICT_TYPE): Remove unused macro. ++ (type_error): Remove. ++ * language.c (set_type_range_case): Renamed to ... ++ (set_range_case): ... this. Update all callers. ++ Remove type_mode/type_check. ++ (type_mode): Remove. ++ (type_check): Remove. ++ (show_type_command): Remove. ++ (set_type_command): Remove. ++ (language_info): Remove type checking output. ++ (type_error): Remove unused function. ++ (range_error): Update comment. ++ (unknown_language_defn): Remove la_type_check. ++ (auto_language_defn): Likewise. ++ (local_language_defn): Likewise. ++ (_initialize_language): Remove "check type" subcommand. ++ * ada-lang.c (ada_language_defn): Remove la_type_check. ++ * c-lang.c (c_language_defn): Likewise. ++ (cplus_language_defn): Likewise. ++ (asm_language_defn): Likewise. ++ (minimal_language_defn): Likewise. ++ * d-lang.c (d_language_defn): Likewise. ++ * f-lang.c (f_language_defn): Likewise. ++ * go-lang.c (go_language_defn): Likewise. ++ * jv-lang.c (java_language_defn): Likewise. ++ * m2-lang.c (m2_language_defn): Likewise. ++ * objc-lang.c (objc_language_defn): Likewise. ++ * opencl-lang.c (opencl_language_defn): Likewise. ++ * p-lang.c (pascal_language_defn): Likewise. ++ + 2012-08-16 Mike Frysinger + + * infcmd.c (_initialize_infcmd): Remove trailing ) in next help text. +Index: gdb-7.5.0.20120926/gdb/gdbtypes.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.c 2012-09-27 22:14:21.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/gdbtypes.c 2012-09-27 22:15:05.807706105 +0200 +@@ -62,6 +62,7 @@ const struct rank BASE_CONVERSION_BADNES + const struct rank REFERENCE_CONVERSION_BADNESS = {2,0}; + const struct rank NULL_POINTER_CONVERSION_BADNESS = {2,0}; + const struct rank NS_POINTER_CONVERSION_BADNESS = {10,0}; ++const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS = {3,0}; + + /* Floatformat pairs. */ + const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN] = { +@@ -134,6 +135,19 @@ show_overload_debug (struct ui_file *fil + value); + } + ++/* A flag to enable strict type checking. */ ++ ++static int strict_type_checking = 1; ++ ++/* A function to show the status of strict type checking. */ ++ ++static void ++show_strict_type_checking (struct ui_file *file, int from_tty, ++ struct cmd_list_element *c, const char *value) ++{ ++ fprintf_filtered (file, _("Strict type checking is %s.\n"), value); ++} ++ + struct extra + { + char str[128]; +@@ -2649,12 +2663,20 @@ rank_one_type (struct type *parm, struct + case TYPE_CODE_FUNC: + return rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL); + case TYPE_CODE_INT: +- if (value != NULL && TYPE_CODE (value_type (value)) == TYPE_CODE_INT +- && value_as_long (value) == 0) ++ if (value != NULL && TYPE_CODE (value_type (value)) == TYPE_CODE_INT) + { +- /* Null pointer conversion: allow it to be cast to a pointer. +- [4.10.1 of C++ standard draft n3290] */ +- return NULL_POINTER_CONVERSION_BADNESS; ++ if (value_as_long (value) == 0) ++ { ++ /* Null pointer conversion: allow it to be cast to a pointer. ++ [4.10.1 of C++ standard draft n3290] */ ++ return NULL_POINTER_CONVERSION_BADNESS; ++ } ++ else ++ { ++ /* If type checking is disabled, allow the conversion. */ ++ if (!strict_type_checking) ++ return NS_INTEGER_POINTER_CONVERSION_BADNESS; ++ } + } + /* fall through */ + case TYPE_CODE_ENUM: +@@ -4637,4 +4659,13 @@ _initialize_gdbtypes (void) + NULL, NULL, + show_opaque_type_resolution, + &setlist, &showlist); ++ ++ /* Add an option to permit non-strict type checking. */ ++ add_setshow_boolean_cmd ("type", class_support, ++ &strict_type_checking, ++ _("Set strict type checking."), ++ _("Show strict type checking."), ++ NULL, NULL, ++ show_strict_type_checking, ++ &setchecklist, &showchecklist); + } +Index: gdb-7.5.0.20120926/gdb/gdbtypes.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.h 2012-09-27 22:14:23.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/gdbtypes.h 2012-09-27 22:14:40.690695059 +0200 +@@ -1745,6 +1745,9 @@ extern const struct rank NULL_POINTER_CO + /* Converting a pointer to an int is usually OK. */ + extern const struct rank NS_POINTER_CONVERSION_BADNESS; + ++/* Badness of converting a (non-zero) integer constant ++ to a pointer. */ ++extern const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS; + + extern struct rank sum_ranks (struct rank a, struct rank b); + extern int compare_ranks (struct rank a, struct rank b); +Index: gdb-7.5.0.20120926/gdb/language.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/language.h 2012-06-13 17:47:14.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/language.h 2012-09-27 22:14:40.834695121 +0200 +@@ -55,27 +55,6 @@ extern enum range_check + } + range_check; + +-/* type_mode == +- type_mode_auto: type_check set automatically to default of language. +- type_mode_manual: type_check set manually by user. */ +- +-extern enum type_mode +- { +- type_mode_auto, type_mode_manual +- } +-type_mode; +- +-/* type_check == +- type_check_on: Types are checked in GDB expressions, producing errors. +- type_check_warn: Types are checked, producing warnings. +- type_check_off: Types are not checked in GDB expressions. */ +- +-extern enum type_check +- { +- type_check_off, type_check_warn, type_check_on +- } +-type_check; +- + /* case_mode == + case_mode_auto: case_sensitivity set upon selection of scope. + case_mode_manual: case_sensitivity set only by user. */ +@@ -162,10 +141,6 @@ struct language_defn + + enum range_check la_range_check; + +- /* Default type checking. */ +- +- enum type_check la_type_check; +- + /* Default case sensitivity. */ + enum case_sensitivity la_case_sensitivity; + +@@ -422,9 +397,6 @@ struct type *language_lookup_primitive_t + /* These macros define the behaviour of the expression + evaluator. */ + +-/* Should we strictly type check expressions? */ +-#define STRICT_TYPE (type_check != type_check_off) +- + /* Should we range check values against the domain of their type? */ + #define RANGE_CHECK (range_check != range_check_off) + +@@ -496,8 +468,6 @@ extern void binop_type_check (struct val + + /* Error messages */ + +-extern void type_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2); +- + extern void range_error (const char *, ...) ATTRIBUTE_PRINTF (1, 2); + + /* Data: Does this value represent "truth" to the current language? */ +Index: gdb-7.5.0.20120926/gdb/language.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/language.c 2012-03-02 20:29:01.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/language.c 2012-09-27 22:14:40.922695162 +0200 +@@ -55,7 +55,7 @@ static void show_check (char *, int); + + static void set_check (char *, int); + +-static void set_type_range_case (void); ++static void set_range_case (void); + + static void unk_lang_emit_char (int c, struct type *type, + struct ui_file *stream, int quoter); +@@ -81,8 +81,6 @@ extern const struct language_defn unknow + + enum range_mode range_mode = range_mode_auto; + enum range_check range_check = range_check_off; +-enum type_mode type_mode = type_mode_auto; +-enum type_check type_check = type_check_off; + enum case_mode case_mode = case_mode_auto; + enum case_sensitivity case_sensitivity = case_sensitive_on; + +@@ -174,7 +172,7 @@ set_language_command (char *ignore, int + /* Enter manual mode. Set the specified language. */ + language_mode = language_mode_manual; + current_language = languages[i]; +- set_type_range_case (); ++ set_range_case (); + expected_language = current_language; + return; + } +@@ -186,79 +184,6 @@ set_language_command (char *ignore, int + language); + } + +-/* Show command. Display a warning if the type setting does +- not match the current language. */ +-static void +-show_type_command (struct ui_file *file, int from_tty, +- struct cmd_list_element *c, const char *value) +-{ +- if (type_mode == type_mode_auto) +- { +- char *tmp = NULL; +- +- switch (type_check) +- { +- case type_check_on: +- tmp = "on"; +- break; +- case type_check_off: +- tmp = "off"; +- break; +- case type_check_warn: +- tmp = "warn"; +- break; +- default: +- internal_error (__FILE__, __LINE__, +- "Unrecognized type check setting."); +- } +- +- fprintf_filtered (gdb_stdout, +- _("Type checking is \"auto; currently %s\".\n"), +- tmp); +- } +- else +- fprintf_filtered (gdb_stdout, _("Type checking is \"%s\".\n"), +- value); +- +- if (type_check != current_language->la_type_check) +- warning (_("the current type check setting" +- " does not match the language.\n")); +-} +- +-/* Set command. Change the setting for type checking. */ +-static void +-set_type_command (char *ignore, int from_tty, struct cmd_list_element *c) +-{ +- if (strcmp (type, "on") == 0) +- { +- type_check = type_check_on; +- type_mode = type_mode_manual; +- } +- else if (strcmp (type, "warn") == 0) +- { +- type_check = type_check_warn; +- type_mode = type_mode_manual; +- } +- else if (strcmp (type, "off") == 0) +- { +- type_check = type_check_off; +- type_mode = type_mode_manual; +- } +- else if (strcmp (type, "auto") == 0) +- { +- type_mode = type_mode_auto; +- set_type_range_case (); +- return; +- } +- else +- internal_error (__FILE__, __LINE__, +- _("Unrecognized type check setting: \"%s\""), type); +- +- if (type_check != current_language->la_type_check) +- warning (_("the current type check setting" +- " does not match the language.\n")); +-} +- + /* Show command. Display a warning if the range setting does + not match the current language. */ + static void +@@ -320,7 +245,7 @@ set_range_command (char *ignore, int fro + else if (strcmp (range, "auto") == 0) + { + range_mode = range_mode_auto; +- set_type_range_case (); ++ set_range_case (); + return; + } + else +@@ -389,7 +314,7 @@ set_case_command (char *ignore, int from + else if (strcmp (case_sensitive, "auto") == 0) + { + case_mode = case_mode_auto; +- set_type_range_case (); ++ set_range_case (); + return; + } + else +@@ -409,14 +334,11 @@ set_case_command (char *ignore, int from + If SHOW is non-zero, then print out the current language, + type and range checking status. */ + static void +-set_type_range_case (void) ++set_range_case (void) + { + if (range_mode == range_mode_auto) + range_check = current_language->la_range_check; + +- if (type_mode == type_mode_auto) +- type_check = current_language->la_type_check; +- + if (case_mode == case_mode_auto) + case_sensitivity = current_language->la_case_sensitivity; + } +@@ -437,7 +359,7 @@ set_language (enum language lang) + if (languages[i]->la_language == lang) + { + current_language = languages[i]; +- set_type_range_case (); ++ set_range_case (); + break; + } + } +@@ -461,8 +383,6 @@ language_info (int quietly) + + if (!quietly) + { +- printf_unfiltered (_("Type checking: %s\n"), type); +- show_type_command (NULL, 1, NULL, NULL); + printf_unfiltered (_("Range checking: %s\n"), range); + show_range_command (NULL, 1, NULL, NULL); + printf_unfiltered (_("Case sensitivity: %s\n"), case_sensitive); +@@ -500,38 +420,11 @@ value_true (struct value *val) + error messages that occur during type- and range- + checking. */ + +-/* These are called when a language fails a type- or range-check. The ++/* This is called when a language fails a range-check. The + first argument should be a printf()-style format string, and the +- rest of the arguments should be its arguments. If +- [type|range]_check is [type|range]_check_on, an error is printed; +- if [type|range]_check_warn, a warning; otherwise just the +- message. */ +- +-void +-type_error (const char *string,...) +-{ +- va_list args; +- +- va_start (args, string); +- switch (type_check) +- { +- case type_check_warn: +- vwarning (string, args); +- break; +- case type_check_on: +- verror (string, args); +- break; +- case type_check_off: +- /* FIXME: cagney/2002-01-30: Should this function print anything +- when type error is off? */ +- vfprintf_filtered (gdb_stderr, string, args); +- fprintf_filtered (gdb_stderr, "\n"); +- break; +- default: +- internal_error (__FILE__, __LINE__, _("bad switch")); +- } +- va_end (args); +-} ++ rest of the arguments should be its arguments. If range_check is ++ range_check_on, an error is printed; if range_check_warn, a warning; ++ otherwise just the message. */ + + void + range_error (const char *string,...) +@@ -902,7 +795,6 @@ const struct language_defn unknown_langu + "unknown", + language_unknown, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_no, +@@ -946,7 +838,6 @@ const struct language_defn auto_language + "auto", + language_auto, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_no, +@@ -988,7 +879,6 @@ const struct language_defn local_languag + "local", + language_auto, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_no, +@@ -1135,13 +1025,6 @@ _initialize_language (void) + add_alias_cmd ("c", "check", no_class, 1, &showlist); + add_alias_cmd ("ch", "check", no_class, 1, &showlist); + +- add_setshow_enum_cmd ("type", class_support, type_or_range_names, &type, +- _("Set type checking. (on/warn/off/auto)"), +- _("Show type checking. (on/warn/off/auto)"), +- NULL, set_type_command, +- show_type_command, +- &setchecklist, &showchecklist); +- + add_setshow_enum_cmd ("range", class_support, type_or_range_names, + &range, + _("Set range checking. (on/warn/off/auto)"), +Index: gdb-7.5.0.20120926/gdb/ada-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ada-lang.c 2012-09-27 22:14:17.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ada-lang.c 2012-09-27 22:14:41.112695245 +0200 +@@ -12503,7 +12503,6 @@ const struct language_defn ada_language_ + "ada", /* Language name */ + language_ada, + range_check_off, +- type_check_off, + case_sensitive_on, /* Yes, Ada is case-insensitive, but + that's not quite what this means. */ + array_row_major, +Index: gdb-7.5.0.20120926/gdb/c-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/c-lang.c 2012-07-06 07:46:04.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/c-lang.c 2012-09-27 22:14:41.141695257 +0200 +@@ -831,7 +831,6 @@ const struct language_defn c_language_de + "c", /* Language name */ + language_c, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_c, +@@ -955,7 +954,6 @@ const struct language_defn cplus_languag + "c++", /* Language name */ + language_cplus, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_c, +@@ -997,7 +995,6 @@ const struct language_defn asm_language_ + "asm", /* Language name */ + language_asm, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_c, +@@ -1044,7 +1041,6 @@ const struct language_defn minimal_langu + "minimal", /* Language name */ + language_minimal, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_c, +Index: gdb-7.5.0.20120926/gdb/d-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/d-lang.c 2012-03-15 15:06:20.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/d-lang.c 2012-09-27 22:14:41.143695257 +0200 +@@ -240,7 +240,6 @@ static const struct language_defn d_lang + "d", + language_d, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_c, +Index: gdb-7.5.0.20120926/gdb/f-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/f-lang.c 2012-09-27 22:14:23.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/f-lang.c 2012-09-27 22:14:41.151695260 +0200 +@@ -260,7 +260,6 @@ const struct language_defn f_language_de + "fortran", + language_fortran, + range_check_on, +- type_check_on, + case_sensitive_off, + array_column_major, + macro_expansion_no, +Index: gdb-7.5.0.20120926/gdb/go-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/go-lang.c 2012-04-25 16:07:20.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/go-lang.c 2012-09-27 22:14:41.152695261 +0200 +@@ -562,7 +562,6 @@ static const struct language_defn go_lan + "go", + language_go, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_no, +Index: gdb-7.5.0.20120926/gdb/jv-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/jv-lang.c 2012-09-27 22:14:23.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/jv-lang.c 2012-09-27 22:14:41.154695263 +0200 +@@ -1169,7 +1169,6 @@ const struct language_defn java_language + "java", /* Language name */ + language_java, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_no, +Index: gdb-7.5.0.20120926/gdb/m2-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m2-lang.c 2012-03-02 20:29:01.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/m2-lang.c 2012-09-27 22:14:41.161695266 +0200 +@@ -370,7 +370,6 @@ const struct language_defn m2_language_d + "modula-2", + language_m2, + range_check_on, +- type_check_on, + case_sensitive_on, + array_row_major, + macro_expansion_no, +Index: gdb-7.5.0.20120926/gdb/objc-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/objc-lang.c 2012-03-02 20:29:01.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/objc-lang.c 2012-09-27 22:14:41.163695268 +0200 +@@ -509,7 +509,6 @@ const struct language_defn objc_language + "objective-c", /* Language name */ + language_objc, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_c, +Index: gdb-7.5.0.20120926/gdb/opencl-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/opencl-lang.c 2012-03-02 20:29:01.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/opencl-lang.c 2012-09-27 22:14:41.165695268 +0200 +@@ -993,7 +993,6 @@ const struct language_defn opencl_langua + "opencl", /* Language name */ + language_opencl, + range_check_off, +- type_check_off, + case_sensitive_on, + array_row_major, + macro_expansion_c, +Index: gdb-7.5.0.20120926/gdb/p-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/p-lang.c 2012-03-02 20:29:01.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/p-lang.c 2012-09-27 22:14:41.170695270 +0200 +@@ -429,7 +429,6 @@ const struct language_defn pascal_langua + "pascal", /* Language name */ + language_pascal, + range_check_on, +- type_check_on, + case_sensitive_on, + array_row_major, + macro_expansion_no, +Index: gdb-7.5.0.20120926/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/doc/gdb.texinfo 2012-09-27 22:14:23.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/doc/gdb.texinfo 2012-09-27 22:14:41.188695279 +0200 +@@ -12648,29 +12648,18 @@ List all the filename extensions and the + @node Checks + @section Type and Range Checking + +-@quotation +-@emph{Warning:} In this release, the @value{GDBN} commands for type and range +-checking are included, but they do not yet have any effect. This +-section documents the intended facilities. +-@end quotation +-@c FIXME remove warning when type/range code added +- + Some languages are designed to guard you against making seemingly common + errors through a series of compile- and run-time checks. These include +-checking the type of arguments to functions and operators, and making ++checking the type of arguments to functions and operators and making + sure mathematical overflows are caught at run time. Checks such as + these help to ensure a program's correctness once it has been compiled +-by eliminating type mismatches, and providing active checks for range ++by eliminating type mismatches and providing active checks for range + errors when your program is running. + +-@value{GDBN} can check for conditions like the above if you wish. +-Although @value{GDBN} does not check the statements in your program, +-it can check expressions entered directly into @value{GDBN} for +-evaluation via the @code{print} command, for example. As with the +-working language, @value{GDBN} can also decide whether or not to check +-automatically based on your program's source language. +-@xref{Supported Languages, ,Supported Languages}, for the default +-settings of supported languages. ++By default @value{GDBN} checks for these errors according to the ++rules of the current source language. Although @value{GDBN} does not check ++the statements in your program, it can check expressions entered directly ++into @value{GDBN} for evaluation via the @code{print} command, for example. + + @menu + * Type Checking:: An overview of type checking +@@ -12682,69 +12671,51 @@ settings of supported languages. + @node Type Checking + @subsection An Overview of Type Checking + +-Some languages, such as Modula-2, are strongly typed, meaning that the ++Some languages, such as C and C@t{++}, are strongly typed, meaning that the + arguments to operators and functions have to be of the correct type, + otherwise an error occurs. These checks prevent type mismatch + errors from ever causing any run-time problems. For example, + + @smallexample +-1 + 2 @result{} 3 ++int klass::my_method(char *b) @{ return b ? 1 : 2; @} ++ ++(@value{GDBP}) print obj.my_method (0) ++$1 = 2 + @exdent but +-@error{} 1 + 2.3 ++(@value{GDBP}) print obj.my_method (0x1234) ++Cannot resolve method klass::my_method to any overloaded instance + @end smallexample + +-The second example fails because the @code{CARDINAL} 1 is not +-type-compatible with the @code{REAL} 2.3. ++The second example fails because in C@t{++} the integer constant ++@samp{0x1234} is not type-compatible with the pointer parameter type. + +-For the expressions you use in @value{GDBN} commands, you can tell the +-@value{GDBN} type checker to skip checking; ++For the expressions you use in @value{GDBN} commands, you can tell ++@value{GDBN} to not enforce strict type checking or + to treat any mismatches as errors and abandon the expression; +-or to only issue warnings when type mismatches occur, +-but evaluate the expression anyway. When you choose the last of +-these, @value{GDBN} evaluates expressions like the second example above, but +-also issues a warning. ++When type checking is disabled, @value{GDBN} successfully evaluates ++expressions like the second example above. + +-Even if you turn type checking off, there may be other reasons ++Even if type checking is off, there may be other reasons + related to type that prevent @value{GDBN} from evaluating an expression. + For instance, @value{GDBN} does not know how to add an @code{int} and + a @code{struct foo}. These particular type errors have nothing to do +-with the language in use, and usually arise from expressions, such as +-the one described above, which make little sense to evaluate anyway. +- +-Each language defines to what degree it is strict about type. For +-instance, both Modula-2 and C require the arguments to arithmetical +-operators to be numbers. In C, enumerated types and pointers can be +-represented as numbers, so that they are valid arguments to mathematical +-operators. @xref{Supported Languages, ,Supported Languages}, for further +-details on specific languages. ++with the language in use and usually arise from expressions which make ++little sense to evaluate anyway. + +-@value{GDBN} provides some additional commands for controlling the type checker: ++@value{GDBN} provides some additional commands for controlling type checking: + + @kindex set check type + @kindex show check type + @table @code +-@item set check type auto +-Set type checking on or off based on the current working language. +-@xref{Supported Languages, ,Supported Languages}, for the default settings for +-each language. +- + @item set check type on + @itemx set check type off +-Set type checking on or off, overriding the default setting for the +-current working language. Issue a warning if the setting does not +-match the language default. If any type mismatches occur in ++Set strict type checking on or off. If any type mismatches occur in + evaluating an expression while type checking is on, @value{GDBN} prints a + message and aborts evaluation of the expression. + +-@item set check type warn +-Cause the type checker to issue warnings, but to always attempt to +-evaluate the expression. Evaluating the expression may still +-be impossible for other reasons. For example, @value{GDBN} cannot add +-numbers and structures. +- +-@item show type +-Show the current setting of the type checker, and whether or not @value{GDBN} +-is setting it automatically. ++@item show check type ++Show the current setting of type checking and whether @value{GDBN} ++is enforcing strict type checking rules. + @end table + + @cindex range checking +@@ -13195,8 +13166,8 @@ specification. + + @cindex C and C@t{++} defaults + +-If you allow @value{GDBN} to set type and range checking automatically, they +-both default to @code{off} whenever the working language changes to ++If you allow @value{GDBN} to set range checking automatically, it ++defaults to @code{off} whenever the working language changes to + C or C@t{++}. This happens regardless of whether you or @value{GDBN} + selects the working language. + +@@ -13207,37 +13178,15 @@ these files, it sets the working languag + @xref{Automatically, ,Having @value{GDBN} Infer the Source Language}, + for further details. + +-@c Type checking is (a) primarily motivated by Modula-2, and (b) +-@c unimplemented. If (b) changes, it might make sense to let this node +-@c appear even if Mod-2 does not, but meanwhile ignore it. roland 16jul93. +- + @node C Checks + @subsubsection C and C@t{++} Type and Range Checks + + @cindex C and C@t{++} checks + +-By default, when @value{GDBN} parses C or C@t{++} expressions, type checking +-is not used. However, if you turn type checking on, @value{GDBN} +-considers two variables type equivalent if: +- +-@itemize @bullet +-@item +-The two variables are structured and have the same structure, union, or +-enumerated tag. +- +-@item +-The two variables have the same type name, or types that have been +-declared equivalent through @code{typedef}. +- +-@ignore +-@c leaving this out because neither J Gilmore nor R Pesch understand it. +-@c FIXME--beers? +-@item +-The two @code{struct}, @code{union}, or @code{enum} variables are +-declared in the same declaration. (Note: this may not be true for all C +-compilers.) +-@end ignore +-@end itemize ++By default, when @value{GDBN} parses C or C@t{++} expressions, strict type ++checking is used. However, if you turn type checking off, @value{GDBN} ++will allow certain non-standard conversions, such as promoting integer ++constants to pointers. + + Range checking, if turned on, is done on mathematical operations. Array + indices are not checked, since they are often used to index a pointer +Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/default.exp +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/default.exp 2012-04-27 22:52:06.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/default.exp 2012-09-27 22:14:41.312695333 +0200 +@@ -495,12 +495,13 @@ gdb_test "section" "Must specify section + gdb_test "set annotate" "Argument required .integer to set it to.*" "set annotate" + #test set args + gdb_test_no_output "set args" "set args" +-#test set check "c" abbreviation +-gdb_test "set c" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"c\" abbreviation" +-#test set check "ch" abbreviation +-gdb_test "set ch" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check \"ch\" abbreviation" +-#test set check +-gdb_test "set check" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." "set check" ++ ++# Test set check abbreviations ++foreach x {"c" "ch" "check"} { ++ gdb_test "set $x" "\"set check\" must be followed by the name of a check subcommand.(\[^\r\n\]*\[\r\n\])+List of set check subcommands:(\[^\r\n\]*\[\r\n\])+set check range -- Set range checking(\[^\r\n\]*\[\r\n\])+set check type -- Set strict type checking(\[^\r\n\]*\[\r\n\])+Type \"help set check\" followed by set check subcommand name for full documentation.(\[^\r\n\]*\[\r\n\])+Command name abbreviations are allowed if unambiguous." \ ++ "set check \"$x\" abbreviation" ++} ++ + #test set check range + gdb_test "set check range" ".*" "set check range" + #test set check type +@@ -577,16 +578,17 @@ gdb_test "shell echo Hi dad!" "Hi dad!" + gdb_test "show annotate" "Annotation_level is 0." "show annotate" + #test show args + gdb_test "show args" "Argument list to give program being debugged when it is started is \"\"." "show args" +-#test show check "c" abbreviation +-gdb_test "show c" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\".*" "show check \"c\" abbreviation" +-#test show check "ch" abbreviation +-gdb_test "show ch" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\"." "show check \"ch\" abbreviation" +-#test show check +-gdb_test "show check" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Type checking is \"auto; currently off\"." "show check" ++ ++# test show check abbreviations ++foreach x {"c" "ch" "check"} { ++ gdb_test "show $x" "range: *Range checking is \"auto; currently off\".(\[^\r\n\]*\[\r\n\])+type: *Strict type checking is on\..*" \ ++ "show check \"$x\" abbreviation" ++} ++ + #test show check range + gdb_test "show check range" "Range checking is \"auto; currently off\"." "show check range" + #test show check type +-gdb_test "show check type" "Type checking is \"auto; currently off\"." "show check type" ++gdb_test "show check type" "Strict type checking is on\." "show check type" + #test show commands + gdb_test "show commands" ".*" "show commands" + #test show complaints +Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/help.exp +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/help.exp 2012-07-02 19:53:19.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/help.exp 2012-09-27 22:14:41.315695333 +0200 +@@ -376,22 +376,26 @@ gdb_test "help section" "Change the base + gdb_test "help set annotate" "Set annotation_level\.\[\r\n\]+0 == normal; 1 == fullname \\(for use when running under emacs\\)\[\r\n\]+2 == output annotated suitably for use by programs that control GDB\." "help set annotate" + # test help set args + gdb_test "help set args" "Set argument list to give program being debugged when it is started\.\[\r\n\]+Follow this command with any number of args, to be passed to the program\." +-# test help set check "c" abbreviation +-test_prefix_command_help {"set c" "set check"} { +- "Set the status of the type/range checker\.\[\r\n\]+" +-} "help set check \"c\" abbreviation" +-# test help set check "ch" abbreviation +-test_prefix_command_help {"set ch" "set check"} { +- "Set the status of the type/range checker\.\[\r\n\]+" +-} "help set check \"ch\" abbreviation" +-# test help set check ++ ++# Test help set check abbreviations ++foreach x {"c" "ch"} { ++ test_prefix_command_help [list "set $x" "set check"] { ++ "Set the status of the type/range checker\.\[\r\n\]+" ++ } "help set check \"$x\" abbreviation" ++} ++ ++# Test help set check + test_prefix_command_help {"set check"} { + "Set the status of the type/range checker\.\[\r\n\]+" + } ++ + # test help set check range + gdb_test "help set check range" "Set range checking\. \\(on/warn/off/auto\\)" "help set check range" +-# test help set check type +-gdb_test "help set check type" "Set type checking\. \\(on/warn/off/auto\\)." "help set check type" ++ ++# Test help set check type ++gdb_test "help set check type" "Set strict type checking\." \ ++ "help set check type" ++ + # test help set complaints + gdb_test "help set complaints" "Set max number of complaints about incorrect symbols\." "help set complaints" + # test help set confirm +@@ -487,18 +491,25 @@ gdb_test "help shell" "Execute the rest + gdb_test "help show annotate" "Show annotation_level\.\[\r\n\]+0 == normal; 1 == fullname \\(for use when running under emacs\\)\[\r\n\]+2 == output annotated suitably for use by programs that control GDB\." "help show annotate" + # test help show args + gdb_test "help show args" "Show argument list to give program being debugged when it is started\.\[\r\n\]+Follow this command with any number of args, to be passed to the program\." +-# test help show check "c" abbreviation +-test_prefix_command_help {"show c" "show check"} { +- "Show the status of the type/range checker\.\[\r\n\]+" +-} "help show check \"c\" abbreviation" ++ ++# Test help show check abbreviations ++foreach x {"c" "check"} { ++ test_prefix_command_help [list "show $x" "show check"] { ++ "Show the status of the type/range checker\.\[\r\n\]+" ++ } "help show check \"$x\" abbreviation" ++} ++ + # test help show check + test_prefix_command_help {"show check"} { + "Show the status of the type/range checker\.\[\r\n\]+" + } + # test help show check range + gdb_test "help show check range" "Show range checking\. \\(on/warn/off/auto\\)" "help show check range" ++ + # test help show check type +-gdb_test "help show check type" "Show type checking\. \\(on/warn/off/auto\\)" "help show check type" ++gdb_test "help show check type" "Show strict type checking\." \ ++ "help show check type" ++ + # test help show commands + gdb_test "help show commands" "Show the history of commands you typed\.\[\r\n\]+You can supply a command number to start with, or a `\[+\]' to start after\[\r\n\]+the previous command number shown\." "help show commands" + # test help show complaints +Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.base/setshow.exp +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.base/setshow.exp 2012-03-13 22:02:40.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.base/setshow.exp 2012-09-27 22:14:41.320695336 +0200 +@@ -110,19 +110,22 @@ gdb_test "show check range" "Range check + #test set check range auto + gdb_test_no_output "set check range auto" "set check range auto" + #test show check range auto +-gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)" +-#test set check type on +-gdb_test "set check type on" ".*" "set check type on" +-#test show check type on +-gdb_test "show check type" "Type checking is \"on\"..*" "show check type (on)" +-#test set check type off with trailing space +-gdb_test_no_output "set check type off " "set check type off" +-#test show check type off +-gdb_test "show check type" "Type checking is \"off\"..*" "show check type (off)" +-#test set check type auto +-gdb_test_no_output "set check type auto" "set check type auto" +-#test show check type +-gdb_test "show check type" "Type checking is \"auto; currently .*" "show check type (auto)" ++gdb_test "show check range" "Range checking is \"auto; currently .*" "show check range (auto)" ++ ++# Test set check type on ++gdb_test "set check type on" ".*" "set check type on" ++ ++# Test show check type on ++gdb_test "show check type" "Strict type checking is on\..*" \ ++ "show check type (on)" ++ ++# Test set check type off with trailing space ++gdb_test_no_output "set check type off " "set check type off" ++ ++# Test show check type off ++gdb_test "show check type" "Strict type checking is off\..*" \ ++ "show check type (off)" ++ + #test set complaints 100 + gdb_test_no_output "set complaints 100" "set complaints 100" + #test show complaints 100 +Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.exp +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.cp/converts.exp 2012-07-10 17:18:18.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.exp 2012-09-27 22:14:41.321695337 +0200 +@@ -70,9 +70,37 @@ gdb_test_multiple "p foo3_1 (0, 0)" $t { + pass $t + } + } ++ + gdb_test "p foo3_1 (0, 1)" \ + "Cannot resolve function foo3_1 to any overloaded instance" + gdb_test "p foo3_1 (0, (const char**) 1)" " = 31" + gdb_test "p foo3_2 (0, 0)" "= 32" + gdb_test "p foo3_2 (0, (char const**) 0)" " = 320" + ++# Test for strict type checking ++set error_str "Cannot resolve function %s to any overloaded instance" ++gdb_test "show check type" "Strict type checking is on\." ++gdb_test "p foo1_type_check (123)" [format $error_str "foo1_type_check"] ++gdb_test "p foo2_type_check (0, 1)" [format $error_str "foo2_type_check"] ++gdb_test "p foo2_type_check (1, 0)" [format $error_str "foo2_type_check"] ++gdb_test "p foo2_type_check (1, 1)" [format $error_str "foo2_type_check"] ++gdb_test "p foo3_type_check (0, 0, 1)" [format $error_str "foo3_type_check"] ++gdb_test "p foo3_type_check (0, 1, 0)" [format $error_str "foo3_type_check"] ++gdb_test "p foo3_type_check (1, 0, 0)" [format $error_str "foo3_type_check"] ++gdb_test "p foo3_type_check (0, 1, 1)" [format $error_str "foo3_type_check"] ++gdb_test "p foo3_type_check (1, 1, 0)" [format $error_str "foo3_type_check"] ++gdb_test "p foo3_type_check (1, 1, 1)" [format $error_str "foo3_type_check"] ++ ++gdb_test_no_output "set check type off" ++gdb_test "show check type" "Strict type checking is off\." ++gdb_test "p foo1_type_check (123)" " = 1000" ++gdb_test "p foo2_type_check (0, 1)" " = 1001" ++gdb_test "p foo2_type_check (1, 0)" " = 1001" ++gdb_test "p foo2_type_check (1, 1)" " = 1001" ++gdb_test "p foo3_type_check (0, 0, 1)" " = 1002" ++gdb_test "p foo3_type_check (0, 1, 0)" " = 1002" ++gdb_test "p foo3_type_check (1, 0, 0)" " = 1002" ++gdb_test "p foo3_type_check (0, 1, 1)" " = 1002" ++gdb_test "p foo3_type_check (1, 1, 0)" " = 1002" ++gdb_test "p foo3_type_check (1, 1, 1)" " = 1002" ++gdb_test "p foo3_2 (1,1)" " = 32" +Index: gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.cc +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/testsuite/gdb.cp/converts.cc 2011-10-14 22:22:50.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/testsuite/gdb.cp/converts.cc 2012-09-27 22:14:41.322695337 +0200 +@@ -27,6 +27,10 @@ int foo3_1 (int a, const char **b) { ret + int foo3_2 (int a, int b) { return 32; } + int foo3_2 (int a, const char **b) { return 320; } + ++int foo1_type_check (char *a) { return 1000; } ++int foo2_type_check (char *a, char *b) { return 1001; } ++int foo3_type_check (char *a, char *b, char *c) { return 1002; } ++ + int main() + { + +@@ -62,5 +66,9 @@ int main() + foo3_2 (0, static_cast (0)); + foo3_2 (0, 0); + ++ foo1_type_check (a); ++ foo2_type_check (a, a); ++ foo3_type_check (a, a, a); ++ + return 0; // end of main + } diff --git a/gdb-core-open-vdso-warning.patch b/gdb-core-open-vdso-warning.patch index 90527e7..ff60be4 100644 --- a/gdb-core-open-vdso-warning.patch +++ b/gdb-core-open-vdso-warning.patch @@ -1,43 +1,13 @@ 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. -Hi, +[ New patch variant. ] -GDB currently always prints on loading a core file: - warning: Can't read pathname for load map: Input/output error. - -The patch is not nice but it was WONTFIXed on the glibc side in: - http://sourceware.org/ml/libc-alpha/2009-10/msg00001.html - -The same message in GDB PR 8882 and glibc PR 387 was for ld-linux.so.2 l_name -but that one is now ignored thanks to IGNORE_FIRST_LINK_MAP_ENTRY. - -This fix is intended for Linux system vDSO l_name which is a second entry in -the DSO list. - -Regression tested on {x86_86,x86_64-m32,i686}-fedora11-linux-gnu. - - -Thanks, -Jan - - -gdb/ -2009-10-06 Jan Kratochvil - - Do not print false warning on reading core file with vDSO on GNU/Linux. - * solib-svr4.c (svr4_current_sos): Suppress the warning if - MASTER_SO_LIST is still NULL. - * solib.c (update_solib_list): New variable saved_so_list_head. - Conditionally restart the function. - -[ Context backport. ] - -Index: gdb-7.4.50.20111218/gdb/solib-svr4.c +Index: gdb-7.4.50.20120703/gdb/solib-svr4.c =================================================================== ---- gdb-7.4.50.20111218.orig/gdb/solib-svr4.c 2011-12-19 01:14:31.000000000 +0100 -+++ gdb-7.4.50.20111218/gdb/solib-svr4.c 2011-12-19 01:31:10.106752164 +0100 -@@ -1222,8 +1222,17 @@ svr4_read_so_list (CORE_ADDR lm, struct +--- gdb-7.4.50.20120703.orig/gdb/solib-svr4.c 2012-07-06 15:39:57.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/solib-svr4.c 2012-07-06 15:40:01.124816148 +0200 +@@ -1221,8 +1221,17 @@ svr4_read_so_list (CORE_ADDR lm, struct SO_NAME_MAX_PATH_SIZE - 1, &errcode); if (errcode != 0) { @@ -57,28 +27,105 @@ Index: gdb-7.4.50.20111218/gdb/solib-svr4.c do_cleanups (old_chain); continue; } -Index: gdb-7.4.50.20111218/gdb/solib.c +Index: gdb-7.4.50.20120703/gdb/solib.c =================================================================== ---- gdb-7.4.50.20111218.orig/gdb/solib.c 2011-09-12 21:00:22.000000000 +0200 -+++ gdb-7.4.50.20111218/gdb/solib.c 2011-12-19 01:29:04.815227898 +0100 -@@ -676,6 +676,7 @@ update_solib_list (int from_tty, struct +--- gdb-7.4.50.20120703.orig/gdb/solib.c 2012-07-06 15:38:39.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/solib.c 2012-07-06 15:40:01.125816147 +0200 +@@ -672,7 +672,7 @@ solib_used (const struct so_list *const + processes we've just attached to, so that's okay. */ + + static void +-update_solib_list (int from_tty, struct target_ops *target) ++update_solib_list_1 (int from_tty, struct target_ops *target) + { struct target_so_ops *ops = solib_ops (target_gdbarch); struct so_list *inferior = ops->current_sos(); - struct so_list *gdb, **gdb_link; +@@ -843,6 +843,21 @@ Do you need \"set solib-search-path\" or + } + } + ++/* Wrapper for Fedora: gdb-core-open-vdso-warning.patch */ ++ ++static void ++update_solib_list (int from_tty, struct target_ops *target) ++{ + struct so_list *saved_so_list_head = so_list_head; - - /* We can reach here due to changing solib-search-path or the - sysroot, before having any inferior. */ -@@ -817,6 +818,12 @@ update_solib_list (int from_tty, struct - observer_notify_solib_loaded (i); - } - -+ /* If this was the very first DSO list scan and we possibly read in ld.so -+ recheck all the formerly unreadable DSO names strings. */ + -+ if (saved_so_list_head == NULL && so_list_head != NULL) -+ return update_solib_list (from_tty, target); ++ update_solib_list_1 (from_tty, target); + - /* If a library was not found, issue an appropriate warning - message. We have to use a single call to warning in case the - front end does something special with warnings, e.g., pop up ++ /* If this was the very first DSO list scan and we possibly read in ld.so ++ recheck all the formerly unreadable DSO names strings. */ ++ ++ if (saved_so_list_head == NULL && so_list_head != NULL) ++ update_solib_list_1 (from_tty, target); ++} + + /* Return non-zero if NAME is the libpthread shared library. + +Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp +=================================================================== +--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:39:41.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:40:10.322805539 +0200 +@@ -286,3 +286,19 @@ if {$buildid == ""} { + gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*" + pass $wholetest + } ++ ++ ++# Test Linux specific vDSO warning: ++# warning: Can't read pathname for load map: Input/output error. ++ ++clean_restart ${testfile} ++ ++set test "core-file vdso warning" ++gdb_test_multiple "core-file $corefile" $test { ++ -re "warning: Can't read pathname for load map: Input/output error\\.\r\n.*\r\n$gdb_prompt $" { ++ fail $test ++ } ++ -re "\r\n$gdb_prompt $" { ++ pass $test ++ } ++} +Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp +=================================================================== +--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-06 15:38:39.000000000 +0200 ++++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-06 15:40:01.127816145 +0200 +@@ -27,7 +27,8 @@ set lib_flags [list debug ldflags=-Wl,-B + # Binary file. + set testfile "solib-symbol-main" + set srcfile ${srcdir}/${subdir}/${testfile}.c +-set binfile ${objdir}/${subdir}/${testfile} ++set executable ${testfile} ++set binfile ${objdir}/${subdir}/${executable} + set bin_flags [list debug shlib=${binfile_lib}] + + if [get_compiler_info] { +@@ -72,8 +73,26 @@ gdb_test "br foo2" \ + "Breakpoint.*: foo2. .2 locations..*" \ + "foo2 in mdlib" + +-gdb_exit ++# Test GDB warns for shared libraris which have not been found. + +-return 0 ++gdb_test "info sharedlibrary" "/${libname}.*" + ++clean_restart ${executable} ++gdb_breakpoint "main" ++gdb_run_cmd ++set test "no warning for missing libraries" ++gdb_test_multiple "" $test { ++ -re "warning: Could not load shared library symbols for \[0-9\]+ libraries,.*\r\n$gdb_prompt $" { ++ fail $test ++ } ++ -re "Breakpoint \[0-9\]+, main .*\r\n$gdb_prompt $" { ++ pass $test ++ } ++} + ++clean_restart ${executable} ++gdb_test_no_output "set solib-absolute-prefix /doESnotEXIST" ++gdb_breakpoint "main" ++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-dejagnu-go.patch b/gdb-dejagnu-go.patch deleted file mode 100644 index 3e809f4..0000000 --- a/gdb-dejagnu-go.patch +++ /dev/null @@ -1,42 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-06/msg00050.html -Subject: [patch] dejagnu compat. - missing find_go_linker [Re: [patch, doc RFA] Go language support] - -On Wed, 25 Apr 2012 04:17:35 +0200, Doug Evans wrote: -> +if {[info procs find_go_linker] == ""} { -> + rename gdb_find_go find_go -> + rename gdb_find_go_linker find_go_linker -> + # No need to set use_gdb_compile. -> +} - -Is there a reason for it? With recent Fedora 17 update - https://bugzilla.redhat.com/show_bug.cgi?id=635651 - -dejagnu has started to support 'find_gfortran'. But it still does not support -'find_go_linker'. This has resulted in regression failing to compile any -gdb.go/*.exp files. - - -Thanks, -Jan - - -gdb/testsuite/ -2012-06-02 Jan Kratochvil - - * lib/future.exp: Set $use_gdb_compile even if only find_go_linker is - missing. - -diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp -index 40456c0..bf47988 100644 ---- a/gdb/testsuite/lib/future.exp -+++ b/gdb/testsuite/lib/future.exp -@@ -514,7 +514,7 @@ if {[info procs find_gfortran] == ""} { - if {[info procs find_go_linker] == ""} { - rename gdb_find_go find_go - rename gdb_find_go_linker find_go_linker -- # No need to set use_gdb_compile. -+ set use_gdb_compile 1 - } - - if {$use_gdb_compile} { - diff --git a/gdb-disable-mcheck.patch b/gdb-disable-mcheck.patch deleted file mode 100644 index 39188fc..0000000 --- a/gdb-disable-mcheck.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff -dup -rup gdb-7.4.50.20120603-orig/gdb/configure gdb-7.4.50.20120603/gdb/configure ---- gdb-7.4.50.20120603-orig/gdb/configure 2012-06-06 19:08:32.824824699 +0200 -+++ gdb-7.4.50.20120603/gdb/configure 2012-06-06 19:12:12.346992423 +0200 -@@ -2706,7 +2706,7 @@ fi - # Provide more thorough testing by -lmcheck. - # Set it to 'true' for development snapshots, 'false' for releases or - # pre-releases. --development=true -+development=false - - ac_ext=c - ac_cpp='$CPP $CPPFLAGS' -diff -dup -rup gdb-7.4.50.20120603-orig/gdb/configure.ac gdb-7.4.50.20120603/gdb/configure.ac ---- gdb-7.4.50.20120603-orig/gdb/configure.ac 2012-06-06 19:08:32.817824693 +0200 -+++ gdb-7.4.50.20120603/gdb/configure.ac 2012-06-06 19:12:05.545987227 +0200 -@@ -26,7 +26,7 @@ AM_MAINTAINER_MODE - # Provide more thorough testing by -lmcheck. - # Set it to 'true' for development snapshots, 'false' for releases or - # pre-releases. --development=true -+development=false - - AC_PROG_CC - AC_USE_SYSTEM_EXTENSIONS diff --git a/gdb-dlopen-stap-probe-1of7.patch b/gdb-dlopen-stap-probe-1of7.patch new file mode 100644 index 0000000..12af182 --- /dev/null +++ b/gdb-dlopen-stap-probe-1of7.patch @@ -0,0 +1,795 @@ +http://sourceware.org/ml/gdb-cvs/2012-07/msg00123.html + +### src/gdb/ChangeLog 2012/07/18 04:36:15 1.14473 +### src/gdb/ChangeLog 2012/07/18 16:12:15 1.14474 +## -1,3 +1,37 @@ ++2012-07-18 Sergio Durigan Junior ++ ++ * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. ++ (elf_compile_to_ax): Likewise. ++ * infrun.c (insert_exception_resume_from_probe): Likewise. ++ (check_exception_resume): Remove `objfile' variable. ++ * probe.c (find_probe_by_pc): Remove `objfile' argument. ++ (struct probe_and_objfile, probe_and_objfile_s): Delete. ++ (collect_probes): Adjust return value to `VEC (probe_p) *'. ++ (compare_entries): Rename to... ++ (compare_probes): ...this. Adjust function to work with ++ `struct probe *'. Rename variables `ea' and `eb' to `pa' and `pb' ++ respectively. ++ (gen_ui_out_table_header_info): Adjust `probes' argument to be ++ `VEC (probe_p) *'. ++ (print_ui_out_info): Adjust argument to be `struct probe *'. ++ (info_probes_for_ops): Adjust internal computations to use ++ `VEC (probe_p) *'. ++ (probe_safe_evaluate_at_pc): Refactor to not pass `objfile' anymore. ++ * probe.h (struct probe_ops) : Remove `objfile' argument. ++ (struct probe) : New field. ++ (find_probe_by_pc): Remove `objfile' argument. ++ * stap-probe.c (stap_parse_probe_arguments): Likewise. ++ (stap_get_probe_argument_count): Likewise. ++ (stap_get_arg): Likewise. ++ (stap_evaluate_probe_argument): Likewise. ++ (stap_compile_to_ax): Likewise. ++ (compile_probe_arg): Refactor not to pass `objfile' anymore. ++ (handle_stap_probe): Fill `objfile' field from `struct probe'. ++ (stap_gen_info_probes_table_header): Remove `objfile' argument. ++ * symfile.h (struct sym_probe_fns) : Likewise. ++ + 2012-07-18 Terry Guo + + PR 14329 +--- src/gdb/elfread.c 2012/06/26 20:14:01 1.133 ++++ src/gdb/elfread.c 2012/07/18 16:12:15 1.134 +@@ -1635,33 +1635,29 @@ + symfile.h. */ + + static unsigned +-elf_get_probe_argument_count (struct objfile *objfile, +- struct probe *probe) ++elf_get_probe_argument_count (struct probe *probe) + { +- return probe->pops->get_probe_argument_count (probe, objfile); ++ return probe->pops->get_probe_argument_count (probe); + } + + /* Implementation of `sym_evaluate_probe_argument', as documented in + symfile.h. */ + + static struct value * +-elf_evaluate_probe_argument (struct objfile *objfile, +- struct probe *probe, +- unsigned n) ++elf_evaluate_probe_argument (struct probe *probe, unsigned n) + { +- return probe->pops->evaluate_probe_argument (probe, objfile, n); ++ return probe->pops->evaluate_probe_argument (probe, n); + } + + /* Implementation of `sym_compile_to_ax', as documented in symfile.h. */ + + static void +-elf_compile_to_ax (struct objfile *objfile, +- struct probe *probe, ++elf_compile_to_ax (struct probe *probe, + struct agent_expr *expr, + struct axs_value *value, + unsigned n) + { +- probe->pops->compile_to_ax (probe, objfile, expr, value, n); ++ probe->pops->compile_to_ax (probe, expr, value, n); + } + + /* Implementation of `sym_relocate_probe', as documented in symfile.h. */ +--- src/gdb/infrun.c 2012/07/01 10:37:04 1.549 ++++ src/gdb/infrun.c 2012/07/18 16:12:16 1.550 +@@ -5518,7 +5518,6 @@ + static void + insert_exception_resume_from_probe (struct thread_info *tp, + const struct probe *probe, +- struct objfile *objfile, + struct frame_info *frame) + { + struct value *arg_value; +@@ -5534,7 +5533,7 @@ + if (debug_infrun) + fprintf_unfiltered (gdb_stdlog, + "infrun: exception resume at %s\n", +- paddress (get_objfile_arch (objfile), ++ paddress (get_objfile_arch (probe->objfile), + handler)); + + bp = set_momentary_breakpoint_at_pc (get_frame_arch (frame), +@@ -5552,7 +5551,6 @@ + struct frame_info *frame) + { + volatile struct gdb_exception e; +- struct objfile *objfile; + const struct probe *probe; + struct symbol *func; + +@@ -5560,11 +5558,10 @@ + SystemTap probe point. If so, the probe has two arguments: the + CFA and the HANDLER. We ignore the CFA, extract the handler, and + set a breakpoint there. */ +- probe = find_probe_by_pc (get_frame_pc (frame), &objfile); ++ probe = find_probe_by_pc (get_frame_pc (frame)); + if (probe) + { +- insert_exception_resume_from_probe (ecs->event_thread, probe, +- objfile, frame); ++ insert_exception_resume_from_probe (ecs->event_thread, probe, frame); + return; + } + +--- src/gdb/probe.c 2012/05/08 01:35:34 1.3 ++++ src/gdb/probe.c 2012/07/18 16:12:17 1.4 +@@ -204,7 +204,7 @@ + /* See definition in probe.h. */ + + struct probe * +-find_probe_by_pc (CORE_ADDR pc, struct objfile **objfile_out) ++find_probe_by_pc (CORE_ADDR pc) + { + struct objfile *objfile; + +@@ -221,10 +221,7 @@ + probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile); + for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++) + if (probe->address == pc) +- { +- *objfile_out = objfile; +- return probe; +- } ++ return probe; + } + + return NULL; +@@ -232,21 +229,6 @@ + + + +-/* A utility structure. A VEC of these is built when handling "info +- probes". */ +- +-struct probe_and_objfile +-{ +- /* The probe. */ +- struct probe *probe; +- +- /* The probe's objfile. */ +- struct objfile *objfile; +-}; +- +-typedef struct probe_and_objfile probe_and_objfile_s; +-DEF_VEC_O (probe_and_objfile_s); +- + /* A helper function for collect_probes that compiles a regexp and + throws an exception on error. This installs a cleanup to free the + resulting pattern on success. If RX is NULL, this does nothing. */ +@@ -275,16 +257,16 @@ + If POPS is not NULL, only probes of this certain probe_ops will match. + Each argument is a regexp, or NULL, which matches anything. */ + +-static VEC (probe_and_objfile_s) * ++static VEC (probe_p) * + collect_probes (char *objname, char *provider, char *probe_name, + const struct probe_ops *pops) + { + struct objfile *objfile; +- VEC (probe_and_objfile_s) *result = NULL; ++ VEC (probe_p) *result = NULL; + struct cleanup *cleanup, *cleanup_temps; + regex_t obj_pat, prov_pat, probe_pat; + +- cleanup = make_cleanup (VEC_cleanup (probe_and_objfile_s), &result); ++ cleanup = make_cleanup (VEC_cleanup (probe_p), &result); + + cleanup_temps = make_cleanup (null_cleanup, NULL); + compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp")); +@@ -310,8 +292,6 @@ + + for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++) + { +- probe_and_objfile_s entry; +- + if (pops != NULL && probe->pops != pops) + continue; + +@@ -323,9 +303,7 @@ + && regexec (&probe_pat, probe->name, 0, NULL, 0) != 0) + continue; + +- entry.probe = probe; +- entry.objfile = objfile; +- VEC_safe_push (probe_and_objfile_s, result, &entry); ++ VEC_safe_push (probe_p, result, probe); + } + } + +@@ -334,36 +312,36 @@ + return result; + } + +-/* A qsort comparison function for probe_and_objfile_s objects. */ ++/* A qsort comparison function for probe_p objects. */ + + static int +-compare_entries (const void *a, const void *b) ++compare_probes (const void *a, const void *b) + { +- const probe_and_objfile_s *ea = a; +- const probe_and_objfile_s *eb = b; ++ const struct probe *pa = *((const struct probe **) a); ++ const struct probe *pb = *((const struct probe **) b); + int v; + +- v = strcmp (ea->probe->provider, eb->probe->provider); ++ v = strcmp (pa->provider, pb->provider); + if (v) + return v; + +- v = strcmp (ea->probe->name, eb->probe->name); ++ v = strcmp (pa->name, pb->name); + if (v) + return v; + +- if (ea->probe->address < eb->probe->address) ++ if (pa->address < pb->address) + return -1; +- if (ea->probe->address > eb->probe->address) ++ if (pa->address > pb->address) + return 1; + +- return strcmp (ea->objfile->name, eb->objfile->name); ++ return strcmp (pa->objfile->name, pb->objfile->name); + } + + /* Helper function that generate entries in the ui_out table being + crafted by `info_probes_for_ops'. */ + + static void +-gen_ui_out_table_header_info (VEC (probe_and_objfile_s) *probes, ++gen_ui_out_table_header_info (VEC (probe_p) *probes, + const struct probe_ops *p) + { + /* `headings' refers to the names of the columns when printing `info +@@ -392,11 +370,11 @@ + VEC_iterate (info_probe_column_s, headings, ix, column); + ++ix) + { +- probe_and_objfile_s *entry; ++ struct probe *probe; + int jx; + size_t size_max = strlen (column->print_name); + +- for (jx = 0; VEC_iterate (probe_and_objfile_s, probes, jx, entry); ++jx) ++ for (jx = 0; VEC_iterate (probe_p, probes, jx, probe); ++jx) + { + /* `probe_fields' refers to the values of each new field that this + probe will display. */ +@@ -405,12 +383,11 @@ + const char *val; + int kx; + +- if (entry->probe->pops != p) ++ if (probe->pops != p) + continue; + + c2 = make_cleanup (VEC_cleanup (const_char_ptr), &probe_fields); +- p->gen_info_probes_table_values (entry->probe, entry->objfile, +- &probe_fields); ++ p->gen_info_probes_table_values (probe, &probe_fields); + + gdb_assert (VEC_length (const_char_ptr, probe_fields) + == headings_size); +@@ -437,10 +414,10 @@ + } + + /* Helper function to print extra information about a probe and an objfile +- represented by ENTRY. */ ++ represented by PROBE. */ + + static void +-print_ui_out_info (probe_and_objfile_s *entry) ++print_ui_out_info (struct probe *probe) + { + int ix; + int j = 0; +@@ -451,23 +428,21 @@ + info_probe_column_s *column; + struct cleanup *c; + +- gdb_assert (entry != NULL); +- gdb_assert (entry->probe != NULL); +- gdb_assert (entry->probe->pops != NULL); ++ gdb_assert (probe != NULL); ++ gdb_assert (probe->pops != NULL); + +- if (entry->probe->pops->gen_info_probes_table_header == NULL +- && entry->probe->pops->gen_info_probes_table_values == NULL) ++ if (probe->pops->gen_info_probes_table_header == NULL ++ && probe->pops->gen_info_probes_table_values == NULL) + return; + +- gdb_assert (entry->probe->pops->gen_info_probes_table_header != NULL +- && entry->probe->pops->gen_info_probes_table_values != NULL); ++ gdb_assert (probe->pops->gen_info_probes_table_header != NULL ++ && probe->pops->gen_info_probes_table_values != NULL); + + c = make_cleanup (VEC_cleanup (info_probe_column_s), &headings); + make_cleanup (VEC_cleanup (const_char_ptr), &values); + +- entry->probe->pops->gen_info_probes_table_header (&headings); +- entry->probe->pops->gen_info_probes_table_values (entry->probe, +- entry->objfile, &values); ++ probe->pops->gen_info_probes_table_header (&headings); ++ probe->pops->gen_info_probes_table_values (probe, &values); + + gdb_assert (VEC_length (info_probe_column_s, headings) + == VEC_length (const_char_ptr, values)); +@@ -515,16 +490,16 @@ + void + info_probes_for_ops (char *arg, int from_tty, const struct probe_ops *pops) + { +- char *provider, *probe = NULL, *objname = NULL; ++ char *provider, *probe_name = NULL, *objname = NULL; + struct cleanup *cleanup = make_cleanup (null_cleanup, NULL); +- VEC (probe_and_objfile_s) *items; ++ VEC (probe_p) *probes; + int i, any_found; + int ui_out_extra_fields = 0; + size_t size_addr; + size_t size_name = strlen ("Name"); + size_t size_objname = strlen ("Object"); + size_t size_provider = strlen ("Provider"); +- probe_and_objfile_s *entry; ++ struct probe *probe; + struct gdbarch *gdbarch = get_current_arch (); + + /* Do we have a `provider:probe:objfile' style of linespec? */ +@@ -533,10 +508,10 @@ + { + make_cleanup (xfree, provider); + +- probe = extract_arg (&arg); +- if (probe) ++ probe_name = extract_arg (&arg); ++ if (probe_name) + { +- make_cleanup (xfree, probe); ++ make_cleanup (xfree, probe_name); + + objname = extract_arg (&arg); + if (objname) +@@ -564,28 +539,27 @@ + else + ui_out_extra_fields = get_number_extra_fields (pops); + +- items = collect_probes (objname, provider, probe, pops); +- make_cleanup (VEC_cleanup (probe_and_objfile_s), &items); ++ probes = collect_probes (objname, provider, probe_name, pops); ++ make_cleanup (VEC_cleanup (probe_p), &probes); + make_cleanup_ui_out_table_begin_end (current_uiout, + 4 + ui_out_extra_fields, +- VEC_length (probe_and_objfile_s, items), ++ VEC_length (probe_p, probes), + "StaticProbes"); + +- if (!VEC_empty (probe_and_objfile_s, items)) +- qsort (VEC_address (probe_and_objfile_s, items), +- VEC_length (probe_and_objfile_s, items), +- sizeof (probe_and_objfile_s), compare_entries); ++ if (!VEC_empty (probe_p, probes)) ++ qsort (VEC_address (probe_p, probes), VEC_length (probe_p, probes), ++ sizeof (probe_p), compare_probes); + + /* What's the size of an address in our architecture? */ + size_addr = gdbarch_addr_bit (gdbarch) == 64 ? 18 : 10; + + /* Determining the maximum size of each field (`provider', `name' and + `objname'). */ +- for (i = 0; VEC_iterate (probe_and_objfile_s, items, i, entry); ++i) ++ for (i = 0; VEC_iterate (probe_p, probes, i, probe); ++i) + { +- size_name = max (strlen (entry->probe->name), size_name); +- size_provider = max (strlen (entry->probe->provider), size_provider); +- size_objname = max (strlen (entry->objfile->name), size_objname); ++ size_name = max (strlen (probe->name), size_name); ++ size_provider = max (strlen (probe->provider), size_provider); ++ size_objname = max (strlen (probe->objfile->name), size_objname); + } + + ui_out_table_header (current_uiout, size_provider, ui_left, "provider", +@@ -601,26 +575,26 @@ + /* We have to generate the table header for each new probe type that we + will print. */ + for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po); ++ix) +- gen_ui_out_table_header_info (items, po); ++ gen_ui_out_table_header_info (probes, po); + } + else +- gen_ui_out_table_header_info (items, pops); ++ gen_ui_out_table_header_info (probes, pops); + + ui_out_table_header (current_uiout, size_objname, ui_left, "object", + _("Object")); + ui_out_table_body (current_uiout); + +- for (i = 0; VEC_iterate (probe_and_objfile_s, items, i, entry); ++i) ++ for (i = 0; VEC_iterate (probe_p, probes, i, probe); ++i) + { + struct cleanup *inner; + + inner = make_cleanup_ui_out_tuple_begin_end (current_uiout, "probe"); + +- ui_out_field_string (current_uiout, "provider", entry->probe->provider); +- ui_out_field_string (current_uiout, "name", entry->probe->name); ++ ui_out_field_string (current_uiout, "provider", probe->provider); ++ ui_out_field_string (current_uiout, "name", probe->name); + ui_out_field_core_addr (current_uiout, "addr", +- get_objfile_arch (entry->objfile), +- entry->probe->address); ++ get_objfile_arch (probe->objfile), ++ probe->address); + + if (pops == NULL) + { +@@ -629,19 +603,19 @@ + + for (ix = 0; VEC_iterate (probe_ops_cp, all_probe_ops, ix, po); + ++ix) +- if (entry->probe->pops == po) +- print_ui_out_info (entry); ++ if (probe->pops == po) ++ print_ui_out_info (probe); + } + else +- print_ui_out_info (entry); ++ print_ui_out_info (probe); + +- ui_out_field_string (current_uiout, "object", entry->objfile->name); ++ ui_out_field_string (current_uiout, "object", probe->objfile->name); + ui_out_text (current_uiout, "\n"); + + do_cleanups (inner); + } + +- any_found = !VEC_empty (probe_and_objfile_s, items); ++ any_found = !VEC_empty (probe_p, probes); + do_cleanups (cleanup); + + if (!any_found) +@@ -662,23 +636,24 @@ + probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n) + { + struct probe *probe; +- struct objfile *objfile; ++ const struct sym_probe_fns *probe_fns; + unsigned n_probes; + +- probe = find_probe_by_pc (get_frame_pc (frame), &objfile); ++ probe = find_probe_by_pc (get_frame_pc (frame)); + if (!probe) + return NULL; +- gdb_assert (objfile->sf && objfile->sf->sym_probe_fns); + +- n_probes +- = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile, +- probe); ++ gdb_assert (probe->objfile != NULL); ++ gdb_assert (probe->objfile->sf != NULL); ++ gdb_assert (probe->objfile->sf->sym_probe_fns != NULL); ++ ++ probe_fns = probe->objfile->sf->sym_probe_fns; ++ n_probes = probe_fns->sym_get_probe_argument_count (probe); ++ + if (n >= n_probes) + return NULL; + +- return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile, +- probe, +- n); ++ return probe_fns->sym_evaluate_probe_argument (probe, n); + } + + /* See comment in probe.h. */ +--- src/gdb/probe.h 2012/04/27 20:47:55 1.1 ++++ src/gdb/probe.h 2012/07/18 16:12:17 1.2 +@@ -66,21 +66,18 @@ + + /* Return the number of arguments of PROBE. */ + +- unsigned (*get_probe_argument_count) (struct probe *probe, +- struct objfile *objfile); ++ unsigned (*get_probe_argument_count) (struct probe *probe); + + /* Evaluate the Nth argument from the PROBE, returning a value + corresponding to it. The argument number is represented N. */ + + struct value *(*evaluate_probe_argument) (struct probe *probe, +- struct objfile *objfile, + unsigned n); + + /* Compile the Nth argument of the PROBE to an agent expression. + The argument number is represented by N. */ + +- void (*compile_to_ax) (struct probe *probe, struct objfile *objfile, +- struct agent_expr *aexpr, ++ void (*compile_to_ax) (struct probe *probe, struct agent_expr *aexpr, + struct axs_value *axs_value, unsigned n); + + /* Set the semaphore associated with the PROBE. This function only makes +@@ -108,8 +105,8 @@ + void (*gen_info_probes_table_header) (VEC (info_probe_column_s) **heads); + + /* Function that will fill VALUES with the values of the extra fields +- to be printed for PROBE and OBJFILE. If the backend implements +- the `gen_ui_out_table_header' method, then it should implement ++ to be printed for PROBE. If the backend implements the ++ `gen_ui_out_table_header' method, then it should implement + this method as well. The backend should also guarantee that the + order and the number of values in the vector is exactly the same + as the order of the extra fields provided in the method +@@ -118,7 +115,6 @@ + position in the vector. */ + + void (*gen_info_probes_table_values) (struct probe *probe, +- struct objfile *objfile, + VEC (const_char_ptr) **values); + }; + +@@ -157,6 +153,11 @@ + /* The operations associated with this probe. */ + const struct probe_ops *pops; + ++ /* The objfile which contains this probe. Even if the probe is also ++ present in a separate debug objfile, this variable always points to ++ the non-separate debug objfile. */ ++ struct objfile *objfile; ++ + /* The name of the probe. */ + const char *name; + +@@ -181,11 +182,9 @@ + extern void register_probe_ops (struct probe *probe); + + /* Given a PC, find an associated probe with type PTYPE. If a probe is +- found, set *OBJFILE_OUT to the probe's objfile, and return the +- probe. If no probe is found, return NULL. */ ++ found, return it. If no probe is found, return NULL. */ + +-extern struct probe *find_probe_by_pc (CORE_ADDR pc, +- struct objfile **objfile_out); ++extern struct probe *find_probe_by_pc (CORE_ADDR pc); + + /* Search OBJFILE for a probe with the given PROVIDER, NAME and PTYPE. + Return a VEC of all probes that were found. If no matching probe +--- src/gdb/stap-probe.c 2012/05/08 01:35:35 1.4 ++++ src/gdb/stap-probe.c 2012/07/18 16:12:17 1.5 +@@ -903,10 +903,10 @@ + this information. */ + + static void +-stap_parse_probe_arguments (struct stap_probe *probe, struct objfile *objfile) ++stap_parse_probe_arguments (struct stap_probe *probe) + { + const char *cur; +- struct gdbarch *gdbarch = get_objfile_arch (objfile); ++ struct gdbarch *gdbarch = get_objfile_arch (probe->p.objfile); + + gdb_assert (!probe->args_parsed); + cur = probe->args_u.text; +@@ -991,15 +991,14 @@ + argument string. */ + + static unsigned +-stap_get_probe_argument_count (struct probe *probe_generic, +- struct objfile *objfile) ++stap_get_probe_argument_count (struct probe *probe_generic) + { + struct stap_probe *probe = (struct stap_probe *) probe_generic; + + gdb_assert (probe_generic->pops == &stap_probe_ops); + + if (!probe->args_parsed) +- stap_parse_probe_arguments (probe, objfile); ++ stap_parse_probe_arguments (probe); + + gdb_assert (probe->args_parsed); + return VEC_length (stap_probe_arg_s, probe->args_u.vec); +@@ -1042,10 +1041,10 @@ + } + + static struct stap_probe_arg * +-stap_get_arg (struct stap_probe *probe, struct objfile *objfile, unsigned n) ++stap_get_arg (struct stap_probe *probe, unsigned n) + { + if (!probe->args_parsed) +- stap_parse_probe_arguments (probe, objfile); ++ stap_parse_probe_arguments (probe); + + return VEC_index (stap_probe_arg_s, probe->args_u.vec, n); + } +@@ -1054,8 +1053,7 @@ + corresponding to it. Assertion is thrown if N does not exist. */ + + static struct value * +-stap_evaluate_probe_argument (struct probe *probe_generic, +- struct objfile *objfile, unsigned n) ++stap_evaluate_probe_argument (struct probe *probe_generic, unsigned n) + { + struct stap_probe *stap_probe = (struct stap_probe *) probe_generic; + struct stap_probe_arg *arg; +@@ -1063,7 +1061,7 @@ + + gdb_assert (probe_generic->pops == &stap_probe_ops); + +- arg = stap_get_arg (stap_probe, objfile, n); ++ arg = stap_get_arg (stap_probe, n); + return evaluate_subexp_standard (arg->atype, arg->aexpr, &pos, EVAL_NORMAL); + } + +@@ -1071,9 +1069,8 @@ + Assertion is thrown if N does not exist. */ + + static void +-stap_compile_to_ax (struct probe *probe_generic, struct objfile *objfile, +- struct agent_expr *expr, struct axs_value *value, +- unsigned n) ++stap_compile_to_ax (struct probe *probe_generic, struct agent_expr *expr, ++ struct axs_value *value, unsigned n) + { + struct stap_probe *stap_probe = (struct stap_probe *) probe_generic; + struct stap_probe_arg *arg; +@@ -1081,7 +1078,7 @@ + + gdb_assert (probe_generic->pops == &stap_probe_ops); + +- arg = stap_get_arg (stap_probe, objfile, n); ++ arg = stap_get_arg (stap_probe, n); + + pc = arg->aexpr->elts; + gen_expr (arg->aexpr, &pc, expr, value); +@@ -1124,20 +1121,24 @@ + struct frame_info *frame = get_selected_frame (_("No frame selected")); + CORE_ADDR pc = get_frame_pc (frame); + int sel = (int) (uintptr_t) data; +- struct objfile *objfile; + struct probe *pc_probe; ++ const struct sym_probe_fns *pc_probe_fns; + unsigned n_args; + + /* SEL == -1 means "_probe_argc". */ + gdb_assert (sel >= -1); + +- pc_probe = find_probe_by_pc (pc, &objfile); ++ pc_probe = find_probe_by_pc (pc); + if (pc_probe == NULL) + error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc)); + +- n_args +- = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile, +- pc_probe); ++ gdb_assert (pc_probe->objfile != NULL); ++ gdb_assert (pc_probe->objfile->sf != NULL); ++ gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL); ++ ++ pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns; ++ ++ n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe); + if (sel == -1) + return value_from_longest (builtin_type (arch)->builtin_int, n_args); + +@@ -1145,9 +1146,7 @@ + error (_("Invalid probe argument %d -- probe has %u arguments available"), + sel, n_args); + +- return objfile->sf->sym_probe_fns->sym_evaluate_probe_argument (objfile, +- pc_probe, +- sel); ++ return pc_probe_fns->sym_evaluate_probe_argument (pc_probe, sel); + } + + /* This is called to compile one of the $_probe_arg* convenience +@@ -1159,20 +1158,25 @@ + { + CORE_ADDR pc = expr->scope; + int sel = (int) (uintptr_t) data; +- struct objfile *objfile; + struct probe *pc_probe; ++ const struct sym_probe_fns *pc_probe_fns; + int n_probes; + + /* SEL == -1 means "_probe_argc". */ + gdb_assert (sel >= -1); + +- pc_probe = find_probe_by_pc (pc, &objfile); ++ pc_probe = find_probe_by_pc (pc); + if (pc_probe == NULL) + error (_("No SystemTap probe at PC %s"), core_addr_to_string (pc)); + +- n_probes +- = objfile->sf->sym_probe_fns->sym_get_probe_argument_count (objfile, +- pc_probe); ++ gdb_assert (pc_probe->objfile != NULL); ++ gdb_assert (pc_probe->objfile->sf != NULL); ++ gdb_assert (pc_probe->objfile->sf->sym_probe_fns != NULL); ++ ++ pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns; ++ ++ n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe); ++ + if (sel == -1) + { + value->kind = axs_rvalue; +@@ -1186,8 +1190,7 @@ + error (_("Invalid probe argument %d -- probe has %d arguments available"), + sel, n_probes); + +- objfile->sf->sym_probe_fns->sym_compile_to_ax (objfile, pc_probe, +- expr, value, sel); ++ pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel); + } + + +@@ -1297,6 +1300,7 @@ + + ret = obstack_alloc (&objfile->objfile_obstack, sizeof (*ret)); + ret->p.pops = &stap_probe_ops; ++ ret->p.objfile = objfile; + + /* Provider and the name of the probe. */ + ret->p.provider = &el->data[3 * size]; +@@ -1481,15 +1485,16 @@ + + static void + stap_gen_info_probes_table_values (struct probe *probe_generic, +- struct objfile *objfile, + VEC (const_char_ptr) **ret) + { + struct stap_probe *probe = (struct stap_probe *) probe_generic; +- struct gdbarch *gdbarch = get_objfile_arch (objfile); ++ struct gdbarch *gdbarch; + const char *val = NULL; + + gdb_assert (probe_generic->pops == &stap_probe_ops); + ++ gdbarch = get_objfile_arch (probe->p.objfile); ++ + if (probe->sem_addr) + val = print_core_address (gdbarch, probe->sem_addr); + +--- src/gdb/symfile.h 2012/05/24 22:14:35 1.109 ++++ src/gdb/symfile.h 2012/07/18 16:12:17 1.110 +@@ -320,8 +320,7 @@ + have come from a call to this objfile's sym_get_probes method. + If you provide an implementation of sym_get_probes, you must + implement this method as well. */ +- unsigned (*sym_get_probe_argument_count) (struct objfile *objfile, +- struct probe *probe); ++ unsigned (*sym_get_probe_argument_count) (struct probe *probe); + + /* Evaluate the Nth argument available to PROBE. PROBE will have + come from a call to this objfile's sym_get_probes method. N will +@@ -330,8 +329,7 @@ + PC will match the address of the probe. If you provide an + implementation of sym_get_probes, you must implement this method + as well. */ +- struct value *(*sym_evaluate_probe_argument) (struct objfile *objfile, +- struct probe *probe, ++ struct value *(*sym_evaluate_probe_argument) (struct probe *probe, + unsigned n); + + /* Compile the Nth probe argument to an agent expression. PROBE +@@ -339,8 +337,7 @@ + method. N will be between 0 and the number of arguments + available to this probe. EXPR and VALUE are the agent expression + that is being updated. */ +- void (*sym_compile_to_ax) (struct objfile *objfile, +- struct probe *probe, ++ void (*sym_compile_to_ax) (struct probe *probe, + struct agent_expr *expr, + struct axs_value *value, + unsigned n); diff --git a/gdb-dlopen-stap-probe-2of7.patch b/gdb-dlopen-stap-probe-2of7.patch new file mode 100644 index 0000000..9becd65 --- /dev/null +++ b/gdb-dlopen-stap-probe-2of7.patch @@ -0,0 +1,74 @@ +http://sourceware.org/ml/gdb-cvs/2012-07/msg00124.html + +### src/gdb/ChangeLog 2012/07/18 16:12:15 1.14474 +### src/gdb/ChangeLog 2012/07/18 16:20:36 1.14475 +## -1,5 +1,10 @@ + 2012-07-18 Sergio Durigan Junior + ++ * probe.c (probe_safe_evaluate_at_pc): Rename variable `n_probes'. ++ * stap-probe.c (compile_probe_arg): Likewise. ++ ++2012-07-18 Sergio Durigan Junior ++ + * elfread.c (elf_get_probe_argument_count): Remove `objfile' argument. + (elf_compile_to_ax): Likewise. + * infrun.c (insert_exception_resume_from_probe): Likewise. +--- src/gdb/probe.c 2012/07/18 16:12:17 1.4 ++++ src/gdb/probe.c 2012/07/18 16:20:43 1.5 +@@ -637,7 +637,7 @@ + { + struct probe *probe; + const struct sym_probe_fns *probe_fns; +- unsigned n_probes; ++ unsigned n_args; + + probe = find_probe_by_pc (get_frame_pc (frame)); + if (!probe) +@@ -648,9 +648,9 @@ + gdb_assert (probe->objfile->sf->sym_probe_fns != NULL); + + probe_fns = probe->objfile->sf->sym_probe_fns; +- n_probes = probe_fns->sym_get_probe_argument_count (probe); ++ n_args = probe_fns->sym_get_probe_argument_count (probe); + +- if (n >= n_probes) ++ if (n >= n_args) + return NULL; + + return probe_fns->sym_evaluate_probe_argument (probe, n); +--- src/gdb/stap-probe.c 2012/07/18 16:12:17 1.5 ++++ src/gdb/stap-probe.c 2012/07/18 16:20:43 1.6 +@@ -1160,7 +1160,7 @@ + int sel = (int) (uintptr_t) data; + struct probe *pc_probe; + const struct sym_probe_fns *pc_probe_fns; +- int n_probes; ++ int n_args; + + /* SEL == -1 means "_probe_argc". */ + gdb_assert (sel >= -1); +@@ -1175,20 +1175,20 @@ + + pc_probe_fns = pc_probe->objfile->sf->sym_probe_fns; + +- n_probes = pc_probe_fns->sym_get_probe_argument_count (pc_probe); ++ n_args = pc_probe_fns->sym_get_probe_argument_count (pc_probe); + + if (sel == -1) + { + value->kind = axs_rvalue; + value->type = builtin_type (expr->gdbarch)->builtin_int; +- ax_const_l (expr, n_probes); ++ ax_const_l (expr, n_args); + return; + } + + gdb_assert (sel >= 0); +- if (sel >= n_probes) ++ if (sel >= n_args) + error (_("Invalid probe argument %d -- probe has %d arguments available"), +- sel, n_probes); ++ sel, n_args); + + pc_probe_fns->sym_compile_to_ax (pc_probe, expr, value, sel); + } diff --git a/gdb-dlopen-stap-probe-3of7.patch b/gdb-dlopen-stap-probe-3of7.patch new file mode 100644 index 0000000..4a34589 --- /dev/null +++ b/gdb-dlopen-stap-probe-3of7.patch @@ -0,0 +1,98 @@ +2012-07-19 Gary Benson + + * probe.h (get_probe_argument_count): New declaration. + (evaluate_probe_argument): Likewise. + * probe.c (get_probe_argument_count): New function. + (evaluate_probe_argument): Likewise. + (probe_safe_evaluate_at_pc): Use the above new functions. + +diff --git a/gdb/probe.h b/gdb/probe.h +index 8d44ca2..1d29b87 100644 +--- a/gdb/probe.h ++++ b/gdb/probe.h +@@ -214,6 +214,16 @@ extern void info_probes_for_ops (char *arg, int from_tty, + + extern struct cmd_list_element **info_probes_cmdlist_get (void); + ++/* Return the argument count of the specified probe. */ ++ ++extern unsigned get_probe_argument_count (struct probe *probe); ++ ++/* Evaluate argument N of the specified probe. N must be between 0 ++ inclusive and get_probe_argument_count exclusive. */ ++ ++extern struct value *evaluate_probe_argument (struct probe *probe, ++ unsigned n); ++ + /* A convenience function that finds a probe at the PC in FRAME and + evaluates argument N, with 0 <= N < number_of_args. If there is no + probe at that location, or if the probe does not have enough arguments, +diff --git a/gdb/probe.c b/gdb/probe.c +index 77f3b13..a61f4ea 100644 +--- a/gdb/probe.c ++++ b/gdb/probe.c +@@ -632,28 +632,55 @@ info_probes_command (char *arg, int from_tty) + + /* See comments in probe.h. */ + ++unsigned ++get_probe_argument_count (struct probe *probe) ++{ ++ const struct sym_probe_fns *probe_fns; ++ ++ gdb_assert (probe->objfile != NULL); ++ gdb_assert (probe->objfile->sf != NULL); ++ ++ probe_fns = probe->objfile->sf->sym_probe_fns; ++ ++ gdb_assert (probe_fns != NULL); ++ ++ return probe_fns->sym_get_probe_argument_count (probe); ++} ++ ++/* See comments in probe.h. */ ++ ++struct value * ++evaluate_probe_argument (struct probe *probe, unsigned n) ++{ ++ const struct sym_probe_fns *probe_fns; ++ ++ gdb_assert (probe->objfile != NULL); ++ gdb_assert (probe->objfile->sf != NULL); ++ ++ probe_fns = probe->objfile->sf->sym_probe_fns; ++ ++ gdb_assert (probe_fns != NULL); ++ ++ return probe_fns->sym_evaluate_probe_argument (probe, n); ++} ++ ++/* See comments in probe.h. */ ++ + struct value * + probe_safe_evaluate_at_pc (struct frame_info *frame, unsigned n) + { + struct probe *probe; +- const struct sym_probe_fns *probe_fns; + unsigned n_args; + + probe = find_probe_by_pc (get_frame_pc (frame)); + if (!probe) + return NULL; + +- gdb_assert (probe->objfile != NULL); +- gdb_assert (probe->objfile->sf != NULL); +- gdb_assert (probe->objfile->sf->sym_probe_fns != NULL); +- +- probe_fns = probe->objfile->sf->sym_probe_fns; +- n_args = probe_fns->sym_get_probe_argument_count (probe); +- ++ n_args = get_probe_argument_count (probe); + if (n >= n_args) + return NULL; + +- return probe_fns->sym_evaluate_probe_argument (probe, n); ++ return evaluate_probe_argument (probe, n); + } + + /* See comment in probe.h. */ diff --git a/gdb-dlopen-stap-probe-4of7.patch b/gdb-dlopen-stap-probe-4of7.patch new file mode 100644 index 0000000..fb99f07 --- /dev/null +++ b/gdb-dlopen-stap-probe-4of7.patch @@ -0,0 +1,131 @@ +2012-07-19 Gary Benson + + * solib-svr4.c (svr4_info): Move earlier. + (solib_svr4_pspace_data): Likewise. + (svr4_pspace_data_cleanup): Likewise. + (get_svr4_info): Likewise. + +diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c +index 307e483..c88b9cb 100644 +--- a/gdb/solib-svr4.c ++++ b/gdb/solib-svr4.c +@@ -106,6 +106,59 @@ static const char * const main_name_list[] = + NULL + }; + ++/* Per pspace SVR4 specific data. */ ++ ++struct svr4_info ++{ ++ CORE_ADDR debug_base; /* Base of dynamic linker structures. */ ++ ++ /* Validity flag for debug_loader_offset. */ ++ int debug_loader_offset_p; ++ ++ /* Load address for the dynamic linker, inferred. */ ++ CORE_ADDR debug_loader_offset; ++ ++ /* Name of the dynamic linker, valid if debug_loader_offset_p. */ ++ char *debug_loader_name; ++ ++ /* Load map address for the main executable. */ ++ CORE_ADDR main_lm_addr; ++ ++ CORE_ADDR interp_text_sect_low; ++ CORE_ADDR interp_text_sect_high; ++ CORE_ADDR interp_plt_sect_low; ++ CORE_ADDR interp_plt_sect_high; ++}; ++ ++/* Per-program-space data key. */ ++static const struct program_space_data *solib_svr4_pspace_data; ++ ++static void ++svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) ++{ ++ struct svr4_info *info; ++ ++ info = program_space_data (pspace, solib_svr4_pspace_data); ++ xfree (info); ++} ++ ++/* Get the current svr4 data. If none is found yet, add it now. This ++ function always returns a valid object. */ ++ ++static struct svr4_info * ++get_svr4_info (void) ++{ ++ struct svr4_info *info; ++ ++ info = program_space_data (current_program_space, solib_svr4_pspace_data); ++ if (info != NULL) ++ return info; ++ ++ info = XZALLOC (struct svr4_info); ++ set_program_space_data (current_program_space, solib_svr4_pspace_data, info); ++ return info; ++} ++ + /* Return non-zero if GDB_SO_NAME and INFERIOR_SO_NAME represent + the same shared library. */ + +@@ -291,59 +344,6 @@ lm_addr_check (struct so_list *so, bfd *abfd) + return so->lm_info->l_addr; + } + +-/* Per pspace SVR4 specific data. */ +- +-struct svr4_info +-{ +- CORE_ADDR debug_base; /* Base of dynamic linker structures. */ +- +- /* Validity flag for debug_loader_offset. */ +- int debug_loader_offset_p; +- +- /* Load address for the dynamic linker, inferred. */ +- CORE_ADDR debug_loader_offset; +- +- /* Name of the dynamic linker, valid if debug_loader_offset_p. */ +- char *debug_loader_name; +- +- /* Load map address for the main executable. */ +- CORE_ADDR main_lm_addr; +- +- CORE_ADDR interp_text_sect_low; +- CORE_ADDR interp_text_sect_high; +- CORE_ADDR interp_plt_sect_low; +- CORE_ADDR interp_plt_sect_high; +-}; +- +-/* Per-program-space data key. */ +-static const struct program_space_data *solib_svr4_pspace_data; +- +-static void +-svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) +-{ +- struct svr4_info *info; +- +- info = program_space_data (pspace, solib_svr4_pspace_data); +- xfree (info); +-} +- +-/* Get the current svr4 data. If none is found yet, add it now. This +- function always returns a valid object. */ +- +-static struct svr4_info * +-get_svr4_info (void) +-{ +- struct svr4_info *info; +- +- info = program_space_data (current_program_space, solib_svr4_pspace_data); +- if (info != NULL) +- return info; +- +- info = XZALLOC (struct svr4_info); +- set_program_space_data (current_program_space, solib_svr4_pspace_data, info); +- return info; +-} +- + /* Local function prototypes */ + + static int match_main (const char *); diff --git a/gdb-dlopen-stap-probe-5of7.patch b/gdb-dlopen-stap-probe-5of7.patch new file mode 100644 index 0000000..eee8d93 --- /dev/null +++ b/gdb-dlopen-stap-probe-5of7.patch @@ -0,0 +1,17 @@ +2012-07-19 Gary Benson + + * solib-svr4.c (svr4_info): Made debug_loader_offset_p a bitfield. + +diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c +index c88b9cb..8e41f19 100644 +--- a/gdb/solib-svr4.c ++++ b/gdb/solib-svr4.c +@@ -113,7 +113,7 @@ struct svr4_info + CORE_ADDR debug_base; /* Base of dynamic linker structures. */ + + /* Validity flag for debug_loader_offset. */ +- int debug_loader_offset_p; ++ unsigned int debug_loader_offset_p : 1; + + /* Load address for the dynamic linker, inferred. */ + CORE_ADDR debug_loader_offset; diff --git a/gdb-dlopen-stap-probe-6of7.patch b/gdb-dlopen-stap-probe-6of7.patch new file mode 100644 index 0000000..cd0c585 --- /dev/null +++ b/gdb-dlopen-stap-probe-6of7.patch @@ -0,0 +1,1989 @@ +gdb/ +2012-07-30 Gary Benson + + * breakpoint.h (handle_solib_event): Moved function definition + to solib.h, and added a new parameter. + * breakpoint.c (handle_solib_event): Moved function to solib.c + and added a new parameter. + (bpstat_stop_status): Pass new argument to handle_solib_event. + * solib.h (breakpoint.h): New include. + (handle_solib_event): Moved function definition from breakpoint.h + and added a new parameter. + (update_solib_breakpoints): New function definition. + * solib.c (handle_solib_event): Moved function from breakpoint.c + and added a new parameter. + (update_solib_breakpoints): New function. + * solist.h (breakpoint.h): New include. + (target_so_ops): New fields "handle_solib_event" and + "update_breakpoints". + * infrun.c (set_stop_on_solib_events): New function. + (_initialize_infrun): Use the above for "set stop-on-solib-events". + (handle_inferior_event): Pass new argument to handle_solib_event. + * solib-svr4.c (probe.h): New include. + (namespace_table_flatten): New forward declaration. + (lm_info): New fields "lmid" and "in_initial_ns". + (probe_action): New enum. + (probe_info): New struct. + (probe_info): New static variable. + (NUM_PROBES): New definition. + (svr4_info): New fields "using_probes", "probes" and + "namespace_table". + (free_probes): New function. + (free_namespace_table): Likewise. + (svr4_pspace_data_cleanup): Free probes and namespace table. + (svr4_same): Also compare namespaces if using probes. + (lm_addr_check): Only print .dynamic section at wrong address + warning for initial namespace if using probes. + (r_map_from_debug_base): New function. + (solib_svr4_r_map): Call the above. + (svr4_read_so_list): New parameter "prev_lm". + Changed return type from void to int. + Return nonzero on success, zero on error. + (svr4_current_sos_from_debug_base): New function. + (svr4_current_sos): Create result from namespace table if available. + Use svr4_current_sos_from_debug_base to generate list otherwise. + (probe_and_info): New struct. + (solib_event_probe_at): New function. + (solib_event_probe_action): Likewise. + (namespace): New struct. + (hash_namespace): New function. + (equal_namespace): Likewise. + (free_namespace): Likewise. + (namespace_update_full): Likewise. + (namespace_update_incremental): Likewise. + (svr4_handle_solib_event): Likewise. + (namespace_table_flatten_helper): Likewise. + (namespace_table_flatten): Likewise. + (svr4_update_solib_event_breakpoint): Likewise. + (svr4_update_solib_event_breakpoints): Likewise. + (svr4_create_solib_event_breakpoints): Likewise. + (enable_break): Free probes before creating breakpoints. + Use svr4_create_solib_event_breakpoints to create breakpoints. + (svr4_solib_create_inferior_hook): Free the namespace table. + (_initialize_svr4_solib): Initialise svr4_so_ops.handle_solib_event + and svr4_so_ops.update_breakpoints. + +gdb/testsuite +2012-07-30 Gary Benson + + * gdb.base/break-interp.exp (solib_bp): New constant. + (reach_1): Use the above instead of "_dl_debug_state". + (test_attach): Likewise. + (test_ld): Likewise. + * gdb.base/break-probes.exp: New file. + * gdb.base/break-probes.c: Likewise. + * gdb.base/break-probes-solib.c: Likewise. + * gdb.base/info-shared.exp: New file. + * gdb.base/info-shared.c: Likewise. + * gdb.base/info-shared-solib1.c: Likewise. + * gdb.base/info-shared-solib2.c: Likewise. + * gdb.base/break-dlmopen.exp: Likewise. + * gdb.base/break-dlmopen.c: Likewise. + * gdb.base/break-dlmopen-solib.c: Likewise. + +Index: gdb-7.4.91.20120814/gdb/breakpoint.h +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/breakpoint.h 2012-08-14 17:31:37.050984427 +0200 ++++ gdb-7.4.91.20120814/gdb/breakpoint.h 2012-08-14 17:34:44.203746601 +0200 +@@ -1515,8 +1515,6 @@ extern int user_breakpoint_p (struct bre + /* Attempt to determine architecture of location identified by SAL. */ + extern struct gdbarch *get_sal_arch (struct symtab_and_line sal); + +-extern void handle_solib_event (void); +- + extern void breakpoints_relocate (struct objfile *objfile, + struct section_offsets *delta); + +Index: gdb-7.4.91.20120814/gdb/breakpoint.c +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/breakpoint.c 2012-08-14 17:31:37.128984404 +0200 ++++ gdb-7.4.91.20120814/gdb/breakpoint.c 2012-08-14 17:34:44.211746597 +0200 +@@ -5205,7 +5205,7 @@ bpstat_stop_status (struct address_space + { + if (bs->breakpoint_at && bs->breakpoint_at->type == bp_shlib_event) + { +- handle_solib_event (); ++ handle_solib_event (bs); + break; + } + } +@@ -5301,25 +5301,6 @@ handle_jit_event (void) + target_terminal_inferior (); + } + +-/* Handle an solib event by calling solib_add. */ +- +-void +-handle_solib_event (void) +-{ +- clear_program_space_solib_cache (current_inferior ()->pspace); +- +- /* Check for any newly added shared libraries if we're supposed to +- be adding them automatically. Switch terminal for any messages +- produced by breakpoint_re_set. */ +- target_terminal_ours_for_output (); +-#ifdef SOLIB_ADD +- SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add); +-#else +- solib_add (NULL, 0, ¤t_target, auto_solib_add); +-#endif +- target_terminal_inferior (); +-} +- + /* Prepare WHAT final decision for infrun. */ + + /* Decide what infrun needs to do with this bpstat. */ +Index: gdb-7.4.91.20120814/gdb/solib.h +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/solib.h 2012-02-03 16:19:37.000000000 +0100 ++++ gdb-7.4.91.20120814/gdb/solib.h 2012-08-14 17:34:44.257746587 +0200 +@@ -21,6 +21,9 @@ + #ifndef SOLIB_H + #define SOLIB_H + ++/* For bpstat. */ ++#include "breakpoint.h" ++ + /* Forward decl's for prototypes */ + struct so_list; + struct target_ops; +@@ -91,4 +94,15 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_f + void *), + void *data); + ++/* Handle an solib event by calling solib_add. Targets which handle ++ solib events using breakpoints must pass a valid bpstat. Targets ++ which handle solib events using some other mechanism should pass ++ NULL. */ ++ ++extern void handle_solib_event (bpstat bs); ++ ++/* Enable or disable optional solib event breakpoints as appropriate. */ ++ ++extern void update_solib_breakpoints (void); ++ + #endif /* SOLIB_H */ +Index: gdb-7.4.91.20120814/gdb/solib.c +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/solib.c 2012-08-14 17:31:36.832984492 +0200 ++++ gdb-7.4.91.20120814/gdb/solib.c 2012-08-14 17:34:44.272746583 +0200 +@@ -1226,6 +1226,42 @@ no_shared_libraries (char *ignored, int + objfile_purge_solibs (); + } + ++/* See solib.h. */ ++ ++void ++handle_solib_event (bpstat bs) ++{ ++ struct target_so_ops *ops = solib_ops (target_gdbarch); ++ ++ if (ops->handle_solib_event != NULL) ++ ops->handle_solib_event (bs); ++ ++ clear_program_space_solib_cache (current_inferior ()->pspace); ++ ++ /* Check for any newly added shared libraries if we're supposed to ++ be adding them automatically. Switch terminal for any messages ++ produced by breakpoint_re_set. */ ++ target_terminal_ours_for_output (); ++#ifdef SOLIB_ADD ++ SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add); ++#else ++ solib_add (NULL, 0, ¤t_target, auto_solib_add); ++#endif ++ target_terminal_inferior (); ++} ++ ++/* See solib.h. */ ++ ++void ++update_solib_breakpoints (void) ++{ ++ struct target_so_ops *ops = solib_ops (target_gdbarch); ++ ++ if (ops->update_breakpoints != NULL) ++ ops->update_breakpoints (); ++} ++ ++ + /* Reload shared libraries, but avoid reloading the same symbol file + we already have loaded. */ + +Index: gdb-7.4.91.20120814/gdb/solist.h +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/solist.h 2012-01-04 09:17:11.000000000 +0100 ++++ gdb-7.4.91.20120814/gdb/solist.h 2012-08-14 17:34:44.273746584 +0200 +@@ -23,6 +23,8 @@ + #define SO_NAME_MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */ + /* For domain_enum domain. */ + #include "symtab.h" ++/* For bpstat. */ ++#include "breakpoint.h" + + /* Forward declaration for target specific link map information. This + struct is opaque to all but the target specific file. */ +@@ -149,6 +151,20 @@ struct target_so_ops + core file (in particular, for readonly sections). */ + int (*keep_data_in_core) (CORE_ADDR vaddr, + unsigned long size); ++ ++ /* Target-specific handling of solib events. For targets which ++ handle solib events using breakpoints a valid bpstat must be ++ passed. Targets which handle solib events using some other ++ mechanism should pass NULL. This pointer can be NULL, in which ++ case no specific handling is necessary for this target. */ ++ void (*handle_solib_event) (bpstat bs); ++ ++ /* Enable or disable optional solib event breakpoints as ++ appropriate. This should be called whenever ++ stop_on_solib_events is changed. This pointer can be ++ NULL, in which case no enabling or disabling is necessary ++ for this target. */ ++ void (*update_breakpoints) (void); + }; + + /* Free the memory associated with a (so_list *). */ +Index: gdb-7.4.91.20120814/gdb/infrun.c +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/infrun.c 2012-08-14 17:33:16.249955007 +0200 ++++ gdb-7.4.91.20120814/gdb/infrun.c 2012-08-14 17:34:44.276746583 +0200 +@@ -361,6 +361,16 @@ static struct symbol *step_start_functio + /* Nonzero if we want to give control to the user when we're notified + of shared library events by the dynamic linker. */ + int stop_on_solib_events; ++ ++/* Enable or disable optional shared library event breakpoints ++ as appropriate when the above flag is changed. */ ++ ++static void ++set_stop_on_solib_events (char *args, int from_tty, struct cmd_list_element *c) ++{ ++ update_solib_breakpoints (); ++} ++ + static void + show_stop_on_solib_events (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +@@ -3321,7 +3331,7 @@ handle_inferior_event (struct execution_ + context_switch (ecs->ptid); + regcache = get_thread_regcache (ecs->ptid); + +- handle_solib_event (); ++ handle_solib_event (NULL); + + ecs->event_thread->control.stop_bpstat + = bpstat_stop_status (get_regcache_aspace (regcache), +@@ -7226,7 +7236,7 @@ Show stopping for shared library events. + If nonzero, gdb will give control to the user when the dynamic linker\n\ + notifies gdb of shared library events. The most common event of interest\n\ + to the user would be loading/unloading of a new library."), +- NULL, ++ set_stop_on_solib_events, + show_stop_on_solib_events, + &setlist, &showlist); + +Index: gdb-7.4.91.20120814/gdb/solib-svr4.c +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/solib-svr4.c 2012-08-14 17:34:39.346752840 +0200 ++++ gdb-7.4.91.20120814/gdb/solib-svr4.c 2012-08-14 17:35:42.635732596 +0200 +@@ -47,10 +47,12 @@ + #include "auxv.h" + #include "exceptions.h" + #include "gdb_bfd.h" ++#include "probe.h" + + static struct link_map_offsets *svr4_fetch_link_map_offsets (void); + static int svr4_have_link_map_offsets (void); + static void svr4_relocate_main_executable (void); ++static struct so_list *namespace_table_flatten (htab_t namespace_table); + + /* Link map info to include in an allocated so_list entry. */ + +@@ -71,6 +73,16 @@ struct lm_info + + /* Values read in from inferior's fields of the same name. */ + CORE_ADDR l_ld, l_next, l_prev, l_name; ++ ++ /* Numeric link-map ID of the namespace this object is loaded ++ into. This value is only valid when using the probes-based ++ interface. */ ++ LONGEST lmid; ++ ++ /* Nonzero if the namespace list this object is loaded into is the ++ application's initial namespace (LM_ID_BASE). This value is ++ only valid when using the probes-based interface. */ ++ unsigned int in_initial_ns : 1; + }; + + /* On SVR4 systems, a list of symbols in the dynamic linker where +@@ -107,6 +119,53 @@ static const char * const main_name_lis + NULL + }; + ++/* What to do with the namespace table when a probe stop occurs. */ ++ ++enum probe_action ++ { ++ /* Something went seriously wrong. Stop using probes and ++ revert to using the older interface. */ ++ NAMESPACE_TABLE_INVALIDATE, ++ ++ /* No action is required. This namespace is still valid. */ ++ NAMESPACE_NO_ACTION, ++ ++ /* This namespace should be reloaded entirely. */ ++ NAMESPACE_RELOAD, ++ ++ /* Attempt to incrementally update this namespace. If the ++ update fails or is not possible, fall back to reloading ++ the namespace in full. */ ++ NAMESPACE_UPDATE_OR_RELOAD, ++ }; ++ ++/* A probe's name and its associated action. */ ++ ++struct probe_info ++{ ++ /* The name of the probe. */ ++ const char *name; ++ ++ /* What to do with the namespace table when a probe stop occurs. */ ++ enum probe_action action; ++}; ++ ++/* A list of named probes and their associated actions. If all ++ probes are present in the dynamic linker then the probes-based ++ interface will be used. */ ++ ++static const struct probe_info probe_info[] = ++{ ++ { "init_start", NAMESPACE_NO_ACTION }, ++ { "init_complete", NAMESPACE_RELOAD }, ++ { "map_start", NAMESPACE_NO_ACTION }, ++ { "reloc_complete", NAMESPACE_UPDATE_OR_RELOAD }, ++ { "unmap_start", NAMESPACE_NO_ACTION }, ++ { "unmap_complete", NAMESPACE_RELOAD }, ++}; ++ ++#define NUM_PROBES ARRAY_SIZE (probe_info) ++ + /* Per pspace SVR4 specific data. */ + + struct svr4_info +@@ -129,17 +188,58 @@ struct svr4_info + CORE_ADDR interp_text_sect_high; + CORE_ADDR interp_plt_sect_low; + CORE_ADDR interp_plt_sect_high; ++ ++ /* Nonzero if we are using the probes-based interface. */ ++ unsigned int using_probes : 1; ++ ++ /* Named probes in the dynamic linker. */ ++ VEC (probe_p) *probes[NUM_PROBES]; ++ ++ /* Table of dynamic linker namespaces, used by the probes-based ++ interface. */ ++ htab_t namespace_table; + }; + + /* Per-program-space data key. */ + static const struct program_space_data *solib_svr4_pspace_data; + ++/* Free any allocated probe vectors. */ ++ ++static void ++free_probes (struct svr4_info *info) ++{ ++ int i; ++ ++ for (i = 0; i < NUM_PROBES; i++) ++ VEC_free (probe_p, info->probes[i]); ++ ++ memset (info->probes, 0, sizeof (info->probes)); ++} ++ ++/* Free the namespace table. */ ++ ++static void ++free_namespace_table (struct svr4_info *info) ++{ ++ if (info->namespace_table == NULL) ++ return; ++ ++ htab_delete (info->namespace_table); ++ info->namespace_table = NULL; ++} ++ + static void + svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) + { + struct svr4_info *info; + + info = program_space_data (pspace, solib_svr4_pspace_data); ++ if (info == NULL) ++ return; ++ ++ free_probes (info); ++ free_namespace_table (info); ++ + xfree (info); + } + +@@ -188,10 +288,21 @@ svr4_same_1 (const char *gdb_so_name, co + return 0; + } + ++/* Return non-zero if GDB and INFERIOR represent the same shared ++ library. */ ++ + static int + svr4_same (struct so_list *gdb, struct so_list *inferior) + { +- return (svr4_same_1 (gdb->so_original_name, inferior->so_original_name)); ++ struct svr4_info *info = get_svr4_info (); ++ ++ if (info->using_probes) ++ { ++ if (gdb->lm_info->lmid != inferior->lm_info->lmid) ++ return 0; ++ } ++ ++ return svr4_same_1 (gdb->so_original_name, inferior->so_original_name); + } + + static struct lm_info * +@@ -322,18 +433,26 @@ lm_addr_check (struct so_list *so, bfd * + } + else + { +- /* There is no way to verify the library file matches. prelink +- can during prelinking of an unprelinked file (or unprelinking +- of a prelinked file) shift the DYNAMIC segment by arbitrary +- offset without any page size alignment. There is no way to +- find out the ELF header and/or Program Headers for a limited +- verification if it they match. One could do a verification +- of the DYNAMIC segment. Still the found address is the best +- one GDB could find. */ +- +- warning (_(".dynamic section for \"%s\" " +- "is not at the expected address " +- "(wrong library or version mismatch?)"), so->so_name); ++ struct svr4_info *info = get_svr4_info (); ++ ++ if (!info->using_probes || so->lm_info->in_initial_ns) ++ { ++ /* There is no way to verify the library file ++ matches. prelink can during prelinking of an ++ unprelinked file (or unprelinking of a prelinked ++ file) shift the DYNAMIC segment by arbitrary ++ offset without any page size alignment. There is ++ no way to find out the ELF header and/or Program ++ Headers for a limited verification if it they ++ match. One could do a verification of the ++ DYNAMIC segment. Still the found address is the ++ best one GDB could find. */ ++ ++ warning (_(".dynamic section for \"%s\" " ++ "is not at the expected address " ++ "(wrong library or version mismatch?)"), ++ so->so_name); ++ } + } + } + +@@ -775,16 +894,10 @@ locate_base (struct svr4_info *info) + return info->debug_base; + } + +-/* Find the first element in the inferior's dynamic link map, and +- return its address in the inferior. Return zero if the address +- could not be determined. +- +- FIXME: Perhaps we should validate the info somehow, perhaps by +- checking r_version for a known version number, or r_state for +- RT_CONSISTENT. */ ++/* Read the r_map field from the supplied r_debug structure. */ + + static CORE_ADDR +-solib_svr4_r_map (struct svr4_info *info) ++r_map_from_debug_base (CORE_ADDR debug_base) + { + struct link_map_offsets *lmo = svr4_fetch_link_map_offsets (); + struct type *ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr; +@@ -793,13 +906,27 @@ solib_svr4_r_map (struct svr4_info *info + + TRY_CATCH (ex, RETURN_MASK_ERROR) + { +- addr = read_memory_typed_address (info->debug_base + lmo->r_map_offset, ++ addr = read_memory_typed_address (debug_base + lmo->r_map_offset, + ptr_type); + } + exception_print (gdb_stderr, ex); + return addr; + } + ++/* Find the first element in the inferior's dynamic link map, and ++ return its address in the inferior. Return zero if the address ++ could not be determined. ++ ++ FIXME: Perhaps we should validate the info somehow, perhaps by ++ checking r_version for a known version number, or r_state for ++ RT_CONSISTENT. */ ++ ++static CORE_ADDR ++solib_svr4_r_map (struct svr4_info *info) ++{ ++ return r_map_from_debug_base (info->debug_base); ++} ++ + /* Find r_brk from the inferior's debug base. */ + + static CORE_ADDR +@@ -1164,15 +1291,17 @@ svr4_default_sos (void) + return new; + } + +-/* Read the whole inferior libraries chain starting at address LM. Add the +- entries to the tail referenced by LINK_PTR_PTR. Ignore the first entry if +- IGNORE_FIRST and set global MAIN_LM_ADDR according to it. */ ++/* Read the whole inferior libraries chain starting at address LM. ++ Expect the first entry in the chain's previous entry to be PREV_LM. ++ Add the entries to the tail referenced by LINK_PTR_PTR. Ignore the ++ first entry if IGNORE_FIRST and set global MAIN_LM_ADDR according ++ to it. Returns nonzero upon success. */ + +-static void +-svr4_read_so_list (CORE_ADDR lm, struct so_list ***link_ptr_ptr, +- int ignore_first) ++static int ++svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm, ++ struct so_list ***link_ptr_ptr, int ignore_first) + { +- CORE_ADDR prev_lm = 0, next_lm; ++ CORE_ADDR next_lm; + + for (; lm != 0; prev_lm = lm, lm = next_lm) + { +@@ -1189,7 +1318,7 @@ svr4_read_so_list (CORE_ADDR lm, struct + if (new->lm_info == NULL) + { + do_cleanups (old_chain); +- break; ++ return 0; + } + + next_lm = new->lm_info->l_next; +@@ -1200,7 +1329,7 @@ svr4_read_so_list (CORE_ADDR lm, struct + paddress (target_gdbarch, prev_lm), + paddress (target_gdbarch, new->lm_info->l_prev)); + do_cleanups (old_chain); +- break; ++ return 0; + } + + /* For SVR4 versions, the first entry in the link map is for the +@@ -1295,20 +1424,61 @@ svr4_read_so_list (CORE_ADDR lm, struct + **link_ptr_ptr = new; + *link_ptr_ptr = &new->next; + } ++ ++ return 1; + } + +-/* Implement the "current_sos" target_so_ops method. */ ++/* Read the list of loaded libraries from the dynamic linker's base ++ structure. */ + + static struct so_list * +-svr4_current_sos (void) ++svr4_current_sos_from_debug_base (void) + { ++ struct svr4_info *info = get_svr4_info (); + CORE_ADDR lm; + struct so_list *head = NULL; + struct so_list **link_ptr = &head; +- struct svr4_info *info; + struct cleanup *back_to; + int ignore_first; ++ ++ gdb_assert (info->debug_base); ++ ++ /* Assume that everything is a library if the dynamic loader was loaded ++ late by a static executable. */ ++ if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL) ++ ignore_first = 0; ++ else ++ ignore_first = 1; ++ ++ back_to = make_cleanup (svr4_free_library_list, &head); ++ ++ /* Walk the inferior's link map list, and build our list of ++ `struct so_list' nodes. */ ++ lm = solib_svr4_r_map (info); ++ if (lm) ++ svr4_read_so_list (lm, 0, &link_ptr, ignore_first); ++ ++ /* On Solaris, the dynamic linker is not in the normal list of ++ shared objects, so make sure we pick it up too. Having ++ symbol information for the dynamic linker is quite crucial ++ for skipping dynamic linker resolver code. */ ++ lm = solib_svr4_r_ldsomap (info); ++ if (lm) ++ svr4_read_so_list (lm, 0, &link_ptr, 0); ++ ++ discard_cleanups (back_to); ++ ++ return head; ++} ++ ++/* Implement the "current_sos" target_so_ops method. */ ++ ++static struct so_list * ++svr4_current_sos (void) ++{ ++ struct svr4_info *info; + struct svr4_library_list library_list; ++ struct so_list *result; + + /* Fall back to manual examination of the target if the packet is not + supported or gdbserver failed to find DT_DEBUG. gdb.server/solib-list.exp +@@ -1331,6 +1501,10 @@ svr4_current_sos (void) + + info = get_svr4_info (); + ++ /* If we have a namespace table then return a flattened copy. */ ++ if (info->namespace_table != NULL) ++ return namespace_table_flatten (info->namespace_table); ++ + /* Always locate the debug struct, in case it has moved. */ + info->debug_base = 0; + locate_base (info); +@@ -1340,35 +1514,12 @@ svr4_current_sos (void) + if (! info->debug_base) + return svr4_default_sos (); + +- /* Assume that everything is a library if the dynamic loader was loaded +- late by a static executable. */ +- if (exec_bfd && bfd_get_section_by_name (exec_bfd, ".dynamic") == NULL) +- ignore_first = 0; +- else +- ignore_first = 1; +- +- back_to = make_cleanup (svr4_free_library_list, &head); +- +- /* Walk the inferior's link map list, and build our list of +- `struct so_list' nodes. */ +- lm = solib_svr4_r_map (info); +- if (lm) +- svr4_read_so_list (lm, &link_ptr, ignore_first); +- +- /* On Solaris, the dynamic linker is not in the normal list of +- shared objects, so make sure we pick it up too. Having +- symbol information for the dynamic linker is quite crucial +- for skipping dynamic linker resolver code. */ +- lm = solib_svr4_r_ldsomap (info); +- if (lm) +- svr4_read_so_list (lm, &link_ptr, 0); +- +- discard_cleanups (back_to); ++ result = svr4_current_sos_from_debug_base (); + +- if (head == NULL) ++ if (result == NULL) + return svr4_default_sos (); + +- return head; ++ return result; + } + + /* Get the address of the link_map for a given OBJFILE. */ +@@ -1450,6 +1601,498 @@ exec_entry_point (struct bfd *abfd, stru + targ); + } + ++/* A probe and its associated information structure. */ ++ ++struct probe_and_info ++{ ++ /* The probe. */ ++ struct probe *probe; ++ ++ /* The probe_info from which the probe was created. */ ++ const struct probe_info *info; ++}; ++ ++/* Get the solib event probe at the specified location, and the ++ probe_info the probe was created with. Fills in RESULT and ++ returns nonzero if a solib event probe was found at the ++ specified location. Returns zero if no solib event probe ++ was found. */ ++ ++static int ++solib_event_probe_at (struct svr4_info *info, struct bp_location *loc, ++ struct probe_and_info *result) ++{ ++ int i; ++ ++ for (i = 0; i < NUM_PROBES; i++) ++ { ++ struct probe *probe; ++ int ix; ++ ++ for (ix = 0; VEC_iterate (probe_p, info->probes[i], ix, probe); ++ix) ++ { ++ if (loc->pspace == current_program_space ++ && loc->address == probe->address) ++ { ++ result->info = &probe_info[i]; ++ result->probe = probe; ++ ++ return 1; ++ } ++ } ++ } ++ ++ return 0; ++} ++ ++/* Decide what action to take when the specified solib event probe is ++ hit. */ ++ ++static enum probe_action ++solib_event_probe_action (struct probe_and_info *pi) ++{ ++ enum probe_action action; ++ unsigned probe_argc; ++ ++ action = pi->info->action; ++ if (action == NAMESPACE_NO_ACTION || action == NAMESPACE_TABLE_INVALIDATE) ++ return action; ++ ++ gdb_assert (action == NAMESPACE_RELOAD ++ || action == NAMESPACE_UPDATE_OR_RELOAD); ++ ++ /* Check that an appropriate number of arguments has been supplied. ++ We expect: ++ arg0: Lmid_t lmid (mandatory) ++ arg1: struct r_debug *debug_base (mandatory) ++ arg2: struct link_map *new (optional, for incremental updates) */ ++ probe_argc = get_probe_argument_count (pi->probe); ++ if (probe_argc == 2) ++ action = NAMESPACE_RELOAD; ++ else if (probe_argc < 2) ++ action = NAMESPACE_TABLE_INVALIDATE; ++ ++ return action; ++} ++ ++/* A namespace in the dynamic linker. */ ++ ++struct namespace ++{ ++ /* Numeric link-map ID of the namespace. */ ++ LONGEST lmid; ++ ++ /* List of objects loaded into the namespace. */ ++ struct so_list *solist; ++}; ++ ++/* Returns a hash code for the namespace referenced by p. */ ++ ++static hashval_t ++hash_namespace (const void *p) ++{ ++ const struct namespace *ns = p; ++ ++ return (hashval_t) ns->lmid; ++} ++ ++/* Returns non-zero if the namespaces referenced by p1 and p2 ++ are equal. */ ++ ++static int ++equal_namespace (const void *p1, const void *p2) ++{ ++ const struct namespace *ns1 = p1; ++ const struct namespace *ns2 = p2; ++ ++ return ns1->lmid == ns2->lmid; ++} ++ ++/* Free a namespace. */ ++ ++static void ++free_namespace (void *p) ++{ ++ struct namespace *ns = p; ++ ++ svr4_free_library_list (ns->solist); ++ xfree (ns); ++} ++ ++/* Populate this namespace by reading the entire list of shared ++ objects from the inferior. Returns nonzero on success. */ ++ ++static int ++namespace_update_full (struct svr4_info *info, LONGEST lmid, ++ CORE_ADDR debug_base, int is_initial_ns) ++{ ++ struct so_list *result = NULL, *so; ++ struct namespace lookup, *ns; ++ void **slot; ++ ++ /* Read the list of shared objects from the inferior. The ++ initial namespace requires extra processing and is handled ++ separately. */ ++ if (is_initial_ns) ++ { ++ result = svr4_current_sos_from_debug_base (); ++ } ++ else ++ { ++ CORE_ADDR lm = r_map_from_debug_base (debug_base); ++ struct so_list **link_ptr = &result; ++ ++ if (!svr4_read_so_list (lm, 0, &link_ptr, 0)) ++ return 0; ++ } ++ ++ /* If the namespace is empty then delete it from the table. */ ++ if (result == NULL) ++ { ++ if (info->namespace_table != NULL) ++ { ++ lookup.lmid = lmid; ++ htab_remove_elt (info->namespace_table, &lookup); ++ } ++ ++ return 1; ++ } ++ ++ /* Fill in the link-map IDs and initial namespace flags. */ ++ for (so = result; so; so = so->next) ++ { ++ so->lm_info->lmid = lmid; ++ so->lm_info->in_initial_ns = is_initial_ns; ++ } ++ ++ /* Create the namespace table, if necessary. */ ++ if (info->namespace_table == NULL) ++ { ++ info->namespace_table = htab_create_alloc (1, hash_namespace, ++ equal_namespace, ++ free_namespace, ++ xcalloc, xfree); ++ } ++ ++ /* Update the namespace table with our new list. */ ++ lookup.lmid = lmid; ++ slot = htab_find_slot (info->namespace_table, &lookup, INSERT); ++ if (*slot == HTAB_EMPTY_ENTRY) ++ { ++ ns = XCNEW (struct namespace); ++ ns->lmid = lmid; ++ *slot = ns; ++ } ++ else ++ { ++ ns = *slot; ++ svr4_free_library_list (ns->solist); ++ } ++ ns->solist = result; ++ ++ return 1; ++} ++ ++/* Update this namespace starting from the link-map entry passed by ++ the linker in the probe's third argument. Returns nonzero if the ++ list was successfully updated, or zero to indicate failure. */ ++ ++static int ++namespace_update_incremental (struct svr4_info *info, LONGEST lmid, ++ CORE_ADDR lm, int is_initial_ns) ++{ ++ struct namespace lookup, *ns; ++ struct so_list *tail, **link, *so; ++ struct value *val; ++ ++ /* Find our namespace in the table. */ ++ if (info->namespace_table == NULL) ++ return 0; ++ ++ lookup.lmid = lmid; ++ ns = htab_find (info->namespace_table, &lookup); ++ if (ns == NULL) ++ return 0; ++ ++ /* Walk to the end of the list. */ ++ tail = ns->solist; ++ if (tail == NULL) ++ return 0; ++ ++ while (tail->next) ++ tail = tail->next; ++ link = &tail->next; ++ ++ /* Read the new objects. */ ++ if (!svr4_read_so_list (lm, tail->lm_info->lm_addr, &link, 0)) ++ return 0; ++ ++ /* Fill in the link-map IDs and initial namespace flags. */ ++ for (so = tail; so; so = so->next) ++ { ++ so->lm_info->lmid = lmid; ++ so->lm_info->in_initial_ns = is_initial_ns; ++ } ++ ++ return 1; ++} ++ ++/* Update the namespace table as appropriate when using the ++ probes-based linker interface. Do nothing if using the ++ standard interface. */ ++ ++static void ++svr4_handle_solib_event (bpstat bs) ++{ ++ struct svr4_info *info = get_svr4_info (); ++ struct probe_and_info buf, *pi = &buf; ++ enum probe_action action; ++ struct value *val; ++ LONGEST lmid; ++ CORE_ADDR debug_base, lm = 0; ++ int is_initial_ns; ++ ++ /* It is possible that this function will be called incorrectly ++ by the handle_solib_event in handle_inferior_event if GDB goes ++ fully multi-target. */ ++ gdb_assert (bs != NULL); ++ ++ if (!info->using_probes) ++ return; ++ ++ if (!solib_event_probe_at (info, bs->bp_location_at, pi)) ++ goto error; ++ ++ action = solib_event_probe_action (pi); ++ if (action == NAMESPACE_TABLE_INVALIDATE) ++ goto error; ++ ++ if (action == NAMESPACE_NO_ACTION) ++ return; ++ ++ val = evaluate_probe_argument (pi->probe, 0); ++ if (val == NULL) ++ goto error; ++ ++ lmid = value_as_long (val); ++ ++ val = evaluate_probe_argument (pi->probe, 1); ++ if (val == NULL) ++ goto error; ++ ++ debug_base = value_as_address (val); ++ if (debug_base == 0) ++ goto error; ++ ++ /* Always locate the debug struct, in case it moved. */ ++ info->debug_base = 0; ++ if (locate_base (info) == 0) ++ goto error; ++ ++ is_initial_ns = (debug_base == info->debug_base); ++ ++ if (action == NAMESPACE_UPDATE_OR_RELOAD) ++ { ++ val = evaluate_probe_argument (pi->probe, 2); ++ if (val != NULL) ++ lm = value_as_address (val); ++ ++ if (lm == 0) ++ action = NAMESPACE_RELOAD; ++ } ++ ++ if (action == NAMESPACE_UPDATE_OR_RELOAD) ++ { ++ if (namespace_update_incremental (info, lmid, lm, is_initial_ns)) ++ return; ++ ++ action = NAMESPACE_RELOAD; ++ } ++ ++ gdb_assert (action == NAMESPACE_RELOAD); ++ ++ if (namespace_update_full (info, lmid, debug_base, is_initial_ns)) ++ return; ++ ++ error: ++ ++ /* We should never reach here, but if we do we disable the ++ probes interface and revert to the original interface. ++ We don't reset the breakpoints as the ones we've set up ++ are adequate. */ ++ warning (_("Probes-based dynamic linker interface failed.\n" ++ "Reverting to original interface.\n")); ++ ++ free_namespace_table (info); ++ free_probes (info); ++ info->using_probes = 0; ++} ++ ++/* Helper function for namespace_table_flatten. */ ++ ++static int ++namespace_table_flatten_helper (void **slot, void *arg) ++{ ++ struct namespace *ns = (struct namespace *) *slot; ++ struct so_list *src = ns->solist; ++ struct so_list **link = (struct so_list **) arg; ++ ++ while (*link) ++ link = &(*link)->next; ++ ++ while (src != NULL) ++ { ++ struct so_list *dst; ++ ++ dst = xmalloc (sizeof (struct so_list)); ++ memcpy (dst, src, sizeof (struct so_list)); ++ ++ dst->lm_info = xmalloc (sizeof (struct lm_info)); ++ memcpy (dst->lm_info, src->lm_info, sizeof (struct lm_info)); ++ ++ *link = dst; ++ link = &dst->next; ++ ++ src = src->next; ++ } ++ ++ *link = NULL; ++ ++ return 1; /* Continue traversal. */ ++} ++ ++/* Flatten the namespace table into a single list. */ ++ ++static struct so_list * ++namespace_table_flatten (htab_t namespace_table) ++{ ++ struct so_list *dst = NULL; ++ ++ htab_traverse (namespace_table, namespace_table_flatten_helper, &dst); ++ ++ return dst; ++} ++ ++/* Helper function for svr4_update_solib_event_breakpoints. */ ++ ++static int ++svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg) ++{ ++ struct svr4_info *info = get_svr4_info (); ++ struct bp_location *loc; ++ ++ if (b->type != bp_shlib_event) ++ return 0; /* Continue iterating. */ ++ ++ for (loc = b->loc; loc; loc = loc->next) ++ { ++ struct probe_and_info buf, *pi = &buf; ++ ++ if (solib_event_probe_at (info, loc, pi)) ++ { ++ if (pi->info->action == NAMESPACE_NO_ACTION) ++ b->enable_state = (stop_on_solib_events ++ ? bp_enabled : bp_disabled); ++ ++ return 0; /* Continue iterating. */ ++ } ++ } ++ ++ return 0; /* Continue iterating. */ ++} ++ ++/* Enable or disable optional solib event breakpoints as appropriate. ++ Called whenever stop_on_solib_events is changed. */ ++ ++static void ++svr4_update_solib_event_breakpoints (void) ++{ ++ struct svr4_info *info = get_svr4_info (); ++ ++ if (info->using_probes) ++ iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL); ++} ++ ++/* Both the SunOS and the SVR4 dynamic linkers call a marker function ++ before and after mapping and unmapping shared libraries. The sole ++ purpose of this method is to allow debuggers to set a breakpoint so ++ they can track these changes. ++ ++ Some versions of the glibc dynamic linker contain named probes ++ to allow more fine grained stopping. Given the address of the ++ original marker function, this function attempts to find these ++ probes, and if found, sets breakpoints on those instead. If the ++ probes aren't found, a single breakpoint is set on the original ++ marker function. */ ++ ++static void ++svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch, ++ CORE_ADDR address) ++{ ++ struct svr4_info *info = get_svr4_info (); ++ struct obj_section *os; ++ ++ os = find_pc_section (address); ++ if (os != NULL) ++ { ++ int with_prefix; ++ ++ for (with_prefix = 0; with_prefix <= 1; with_prefix++) ++ { ++ int all_probes_found = 1; ++ int i; ++ ++ for (i = 0; i < NUM_PROBES; i++) ++ { ++ char name[32] = { '\0' }; ++ ++ /* Fedora 17, RHEL 6.2, and RHEL 6.3 shipped with an ++ early version of the probes code in which the probes' ++ names were prefixed with "rtld_". The locations and ++ arguments of the probes are otherwise the same, so we ++ check for the prefixed version if the unprefixed ++ probes are not found. */ ++ ++ if (with_prefix) ++ strncat (name, "rtld_", sizeof (name)); ++ ++ strncat (name, probe_info[i].name, sizeof (name) - sizeof ("rtld_")); ++ ++ info->probes[i] = find_probes_in_objfile (os->objfile, "rtld", ++ name); ++ ++ if (!VEC_length (probe_p, info->probes[i])) ++ { ++ free_probes (info); ++ all_probes_found = 0; ++ break; ++ } ++ } ++ ++ if (all_probes_found) ++ { ++ info->using_probes = 1; ++ ++ for (i = 0; i < NUM_PROBES; i++) ++ { ++ struct probe *probe; ++ int ix; ++ ++ for (ix = 0; ++ VEC_iterate (probe_p, info->probes[i], ix, probe); ++ ++ix) ++ create_solib_event_breakpoint (gdbarch, probe->address); ++ } ++ ++ svr4_update_solib_event_breakpoints (); ++ return; ++ } ++ } ++ } ++ ++ create_solib_event_breakpoint (gdbarch, address); ++} ++ + /* Helper function for gdb_bfd_lookup_symbol. */ + + static int +@@ -1502,6 +2145,9 @@ enable_break (struct svr4_info *info, in + info->interp_text_sect_low = info->interp_text_sect_high = 0; + info->interp_plt_sect_low = info->interp_plt_sect_high = 0; + ++ free_probes (info); ++ info->using_probes = 0; ++ + /* If we already have a shared library list in the target, and + r_debug contains r_brk, set the breakpoint there - this should + mean r_brk has already been relocated. Assume the dynamic linker +@@ -1533,7 +2179,7 @@ enable_break (struct svr4_info *info, in + That knowledge is encoded in the address, if it's Thumb the low bit + is 1. However, we've stripped that info above and it's not clear + what all the consequences are of passing a non-addr_bits_remove'd +- address to create_solib_event_breakpoint. The call to ++ address to svr4_create_solib_event_breakpoints. The call to + find_pc_section verifies we know about the address and have some + hope of computing the right kind of breakpoint to use (via + symbol info). It does mean that GDB needs to be pointed at a +@@ -1571,7 +2217,7 @@ enable_break (struct svr4_info *info, in + + bfd_section_size (tmp_bfd, interp_sect); + } + +- create_solib_event_breakpoint (target_gdbarch, sym_addr); ++ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); + return 1; + } + } +@@ -1729,7 +2375,8 @@ enable_break (struct svr4_info *info, in + + if (sym_addr != 0) + { +- create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr); ++ svr4_create_solib_event_breakpoints (target_gdbarch, ++ load_addr + sym_addr); + xfree (interp_name); + return 1; + } +@@ -1755,7 +2402,7 @@ enable_break (struct svr4_info *info, in + sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, + sym_addr, + ¤t_target); +- create_solib_event_breakpoint (target_gdbarch, sym_addr); ++ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); + return 1; + } + } +@@ -1771,7 +2418,7 @@ enable_break (struct svr4_info *info, in + sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, + sym_addr, + ¤t_target); +- create_solib_event_breakpoint (target_gdbarch, sym_addr); ++ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); + return 1; + } + } +@@ -2281,6 +2928,9 @@ svr4_solib_create_inferior_hook (int fro + + info = get_svr4_info (); + ++ /* Free the probes-based interface's namespace table. */ ++ free_namespace_table (info); ++ + /* Relocate the main executable if necessary. */ + svr4_relocate_main_executable (); + +@@ -2547,4 +3197,6 @@ _initialize_svr4_solib (void) + svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol; + svr4_so_ops.same = svr4_same; + svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core; ++ svr4_so_ops.handle_solib_event = svr4_handle_solib_event; ++ svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints; + } +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen-solib.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen-solib.c 2012-08-14 17:34:44.330746591 +0200 +@@ -0,0 +1,24 @@ ++/* 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 . */ ++ ++#include ++ ++int ++foo (int n) ++{ ++ printf ("foo %d\n", n); ++ ++ return 0; ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.c 2012-08-14 17:34:44.339746576 +0200 +@@ -0,0 +1,58 @@ ++/* 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 . */ ++ ++#define _GNU_SOURCE ++#include ++ ++void ++stop () ++{ ++} ++ ++int ++main () ++{ ++ void *handle1, *handle2, *handle3; ++ void (*func)(int); ++ ++ handle1 = dlmopen (LM_ID_NEWLM, SHLIB_NAME, RTLD_LAZY); ++ stop (); ++ ++ func = (void (*)(int)) dlsym (handle1, "foo"); ++ func (1); ++ ++ handle2 = dlmopen (LM_ID_NEWLM, SHLIB_NAME, RTLD_LAZY); ++ stop (); ++ ++ func = (void (*)(int)) dlsym (handle2, "foo"); ++ func (2); ++ ++ handle3 = dlopen (SHLIB_NAME, RTLD_LAZY); ++ stop (); ++ ++ func = (void (*)(int)) dlsym (handle3, "foo"); ++ func (3); ++ ++ dlclose (handle1); ++ stop (); ++ ++ dlclose (handle2); ++ stop (); ++ ++ dlclose (handle3); ++ stop (); ++ ++ return 0; ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-dlmopen.exp 2012-08-14 17:34:44.343746563 +0200 +@@ -0,0 +1,125 @@ ++# 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 . ++ ++if { [skip_shlib_tests] || [is_remote target] } { ++ return 0 ++} ++ ++standard_testfile ++ ++set libname $testfile-solib ++set srcfile_lib $srcdir/$subdir/$libname.c ++set binfile_lib [standard_output_file $libname.so] ++ ++set normal_bp "_dl_debug_state" ++set probes_bp "dl_main" ++ ++if { [gdb_compile_shlib $srcfile_lib $binfile_lib \ ++ [list additional_flags=-fPIC]] != "" } { ++ untested "Could not compile $binfile_lib." ++ return -1 ++} ++ ++if { [prepare_for_testing $testfile.exp $testfile $srcfile \ ++ [list additional_flags=-DSHLIB_NAME\=\"$binfile_lib\" libs=-ldl]] } { ++ return -1 ++} ++ ++# Run "info sharedlibrary" and check our library is shown the expected ++# number of times. ++proc check_info_shared { test expect } { ++ global libname ++ global gdb_prompt ++ ++ set actual 0 ++ ++ gdb_test_multiple "info sharedlibrary" $test { ++ -re $libname { ++ incr actual 1 ++ exp_continue ++ } ++ -re "\r\n$gdb_prompt $" { ++ if { $actual == $expect } { ++ pass $test ++ } else { ++ fail $test ++ } ++ } ++ } ++} ++ ++# Enable stop-on-solib-events ++gdb_test_no_output "set stop-on-solib-events 1" ++ ++# Run to the first stop ++gdb_test "run" ".*Stopped due to shared library event.*" ++ ++# XFAIL if we are not using probes ++set test "ensure using probes" ++set using_probes 0 ++gdb_test_multiple "bt" $test { ++ -re "#0 +\[^\r\n\]*\\m(__GI_)?$normal_bp\\M.*$gdb_prompt $" { ++ xfail $test ++ } ++ -re "#0 +\[^\r\n\]*\\m(__GI_)?$probes_bp\\M.*$gdb_prompt $" { ++ pass $test ++ set using_probes 1 ++ } ++} ++ ++if { $using_probes } { ++ # Set up breakpoints. ++ gdb_test_no_output "set stop-on-solib-events 0" ++ gdb_test "break stop" {Breakpoint [0-9]+ at .*} ++ gdb_test_no_output "set breakpoint pending on" ++ gdb_test "break foo" {Breakpoint [0-9]+ \(foo\) pending\.} ++ ++ # Check our library isn't loaded. ++ check_info_shared "info sharedlibrary #1" 0 ++ ++ # Run to the first stop and check our library loaded. ++ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++ check_info_shared "info sharedlibrary #2" 1 ++ ++ # The next stop should be the function in the library. ++ gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} ++ ++ # Run to the next stop and check our library is now loaded twice. ++ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++ check_info_shared "info sharedlibrary #3" 2 ++ ++ # The next stop should be the function in the library. ++ gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} ++ ++ # Run to the next stop and check our library is now loaded three ++ # times. ++ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++ check_info_shared "info sharedlibrary #4" 3 ++ ++ # The next stop should be the function in the library. ++ gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} ++ ++ # Run to the next stop and check our library is now loaded twice. ++ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++ check_info_shared "info sharedlibrary #5" 2 ++ ++ # Run to the next stop and check our library is now loaded once. ++ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++ check_info_shared "info sharedlibrary #6" 1 ++ ++ # Run to the next stop and check our library is not loaded. ++ gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++ check_info_shared "info sharedlibrary #7" 0 ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-interp.exp +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/testsuite/gdb.base/break-interp.exp 2012-06-21 22:46:21.000000000 +0200 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-interp.exp 2012-08-14 17:34:44.344746565 +0200 +@@ -109,12 +109,19 @@ proc strip_debug {dest} { + } + } + ++# The marker function for the standard runtime linker interface is ++# _dl_debug_state. The probes-based interface has no specific marker ++# function; the probe we will stop on (init_start) is in dl_main so we ++# check for that. ++ ++set solib_bp {(_dl_debug_state|dl_main)} ++ + # Implementation of reach. + + proc reach_1 {func command displacement} { +- global gdb_prompt expect_out ++ global gdb_prompt expect_out solib_bp + +- if {$func == "_dl_debug_state"} { ++ if {$func == $solib_bp} { + # Breakpoint on _dl_debug_state can have problems due to its overlap + # with the existing internal breakpoint from GDB. + gdb_test_no_output "set stop-on-solib-events 1" +@@ -142,21 +149,21 @@ proc reach_1 {func command displacement} + exp_continue + } + -re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" { +- if {$func == "_dl_debug_state"} { ++ if {$func == $solib_bp} { + fail $test + } else { + pass $test + } + } + -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n$gdb_prompt $" { +- if {$func == "_dl_debug_state"} { ++ if {$func == $solib_bp} { + fail $test + } else { + pass $test + } + } + -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" { +- if {$func == "_dl_debug_state"} { ++ if {$func == $solib_bp} { + if {$debug_state_count == 0} { + # First stop does not yet relocate the _start function + # descriptor on ppc64. +@@ -175,7 +182,7 @@ proc reach_1 {func command displacement} + fail $test_displacement + } + +- if {$func == "_dl_debug_state"} { ++ if {$func == $solib_bp} { + gdb_test_no_output "set stop-on-solib-events 0" + } + } +@@ -357,7 +364,7 @@ proc test_attach {file displacement {rel + } + + proc test_ld {file ifmain trynosym displacement} { +- global srcdir subdir gdb_prompt expect_out inferior_exited_re ++ global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp + + # First test normal `file'-command loaded $FILE with symbols. + +@@ -385,9 +392,9 @@ proc test_ld {file ifmain trynosym displ + gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test" + } + +- reach "_dl_debug_state" "run" $displacement ++ reach $solib_bp "run" $displacement + +- gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?_dl_debug_state\\M.*" "dl bt" ++ gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt" + + if $ifmain { + reach "main" continue "NONE" +@@ -399,7 +406,7 @@ proc test_ld {file ifmain trynosym displ + + # Try re-run if the new PIE displacement takes effect. + gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y" +- reach "_dl_debug_state" "run" $displacement ++ reach $solib_bp "run" $displacement + + if $ifmain { + test_core $file $displacement +@@ -431,7 +438,7 @@ proc test_ld {file ifmain trynosym displ + gdb_test "exec-file $file" "exec-file $escapedfile" "load" + + if $ifmain { +- reach "_dl_debug_state" run $displacement ++ reach $solib_bp run $displacement + + # Use two separate gdb_test_multiple statements to avoid timeouts due + # to slow processing of wildcard capturing long output +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes-solib.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes-solib.c 2012-08-14 17:34:44.355746561 +0200 +@@ -0,0 +1,24 @@ ++/* 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 . */ ++ ++#include ++ ++int ++foo (int n) ++{ ++ printf ("foo %d\n", n); ++ ++ return 0; ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.c 2012-08-14 17:34:44.362746561 +0200 +@@ -0,0 +1,26 @@ ++/* 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 . */ ++ ++#include ++ ++int ++main () ++{ ++ void *handle = dlopen (SHLIB_NAME, RTLD_LAZY); ++ ++ dlclose (handle); ++ ++ return 0; ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/break-probes.exp 2012-08-14 17:34:44.363746561 +0200 +@@ -0,0 +1,76 @@ ++# 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 . ++ ++if { [skip_shlib_tests] || [is_remote target] } { ++ return 0 ++} ++ ++standard_testfile ++ ++set libname $testfile-solib ++set srcfile_lib $srcdir/$subdir/$libname.c ++set binfile_lib [standard_output_file $libname.so] ++ ++set normal_bp "_dl_debug_state" ++set probes_bp "dl_main" ++ ++if { [gdb_compile_shlib $srcfile_lib $binfile_lib \ ++ [list additional_flags=-fPIC]] != "" } { ++ untested "Could not compile $binfile_lib." ++ return -1 ++} ++ ++if { [prepare_for_testing $testfile.exp $testfile $srcfile \ ++ [list additional_flags=-DSHLIB_NAME\=\"$binfile_lib\" libs=-ldl]] } { ++ return -1 ++} ++ ++# Enable stop-on-solib-events ++gdb_test_no_output "set stop-on-solib-events 1" ++ ++# Run to the first stop ++gdb_test "run" ".*Stopped due to shared library event.*" ++ ++# XFAIL if we are not using probes ++set test "ensure using probes" ++set using_probes 0 ++gdb_test_multiple "bt" $test { ++ -re "#0 +\[^\r\n\]*\\m(__GI_)?$normal_bp\\M.*$gdb_prompt $" { ++ xfail $test ++ } ++ -re "#0 +\[^\r\n\]*\\m(__GI_)?$probes_bp\\M.*$gdb_prompt $" { ++ pass $test ++ set using_probes 1 ++ } ++} ++ ++if { $using_probes } { ++ # Run til it loads our library ++ set test "run til our library loads" ++ set loaded_library 0 ++ while { !$loaded_library } { ++ gdb_test_multiple "c" $test { ++ -re "Inferior loaded $binfile_lib\\M.*$gdb_prompt $" { ++ pass $test ++ set loaded_library 1 ++ } ++ -re "Stopped due to shared library event\\M.*$gdb_prompt $" { ++ } ++ } ++ } ++ ++ # Call something to ensure that relocation occurred ++ gdb_test "call foo(23)" "foo 23.*\\\$.* = .*" ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib1.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib1.c 2012-08-14 17:34:44.365746561 +0200 +@@ -0,0 +1,24 @@ ++/* 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 . */ ++ ++#include ++ ++int ++foo (int n) ++{ ++ printf ("foo %d\n", n); ++ ++ return 0; ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib2.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared-solib2.c 2012-08-14 17:34:44.365746561 +0200 +@@ -0,0 +1,24 @@ ++/* 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 . */ ++ ++#include ++ ++int ++bar (int n) ++{ ++ printf ("bar %d\n", n); ++ ++ return 0; ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.c 2012-08-14 17:34:44.366746561 +0200 +@@ -0,0 +1,48 @@ ++/* 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 . */ ++ ++#include ++ ++void ++stop () ++{ ++} ++ ++int ++main () ++{ ++ void *handle1, *handle2; ++ void (*func)(int); ++ ++ handle1 = dlopen (SHLIB1_NAME, RTLD_LAZY); ++ stop (); ++ ++ handle2 = dlopen (SHLIB2_NAME, RTLD_LAZY); ++ stop (); ++ ++ func = (void (*)(int)) dlsym (handle1, "foo"); ++ func (1); ++ ++ func = (void (*)(int)) dlsym (handle2, "bar"); ++ func (2); ++ ++ dlclose (handle1); ++ stop (); ++ ++ dlclose (handle2); ++ stop (); ++ ++ return 0; ++} +Index: gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120814/gdb/testsuite/gdb.base/info-shared.exp 2012-08-14 17:34:44.367746561 +0200 +@@ -0,0 +1,139 @@ ++# 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 . ++ ++if { [skip_shlib_tests] || [is_remote target] } { ++ return 0 ++} ++ ++standard_testfile ++ ++set lib1name $testfile-solib1 ++set srcfile_lib1 $srcdir/$subdir/$lib1name.c ++set binfile_lib1 [standard_output_file $lib1name.so] ++set define1 -DSHLIB1_NAME\=\"$binfile_lib1\" ++ ++set lib2name $testfile-solib2 ++set srcfile_lib2 $srcdir/$subdir/$lib2name.c ++set binfile_lib2 [standard_output_file $lib2name.so] ++set define2 -DSHLIB2_NAME\=\"$binfile_lib2\" ++ ++if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 \ ++ [list additional_flags=-fPIC]] != "" } { ++ untested "Could not compile $binfile_lib1." ++ return -1 ++} ++ ++if { [gdb_compile_shlib $srcfile_lib2 $binfile_lib2 \ ++ [list additional_flags=-fPIC]] != "" } { ++ untested "Could not compile $binfile_lib2." ++ return -1 ++} ++ ++set cflags "$define1 $define2" ++if { [prepare_for_testing $testfile.exp $testfile $srcfile \ ++ [list additional_flags=$cflags libs=-ldl]] } { ++ return -1 ++} ++ ++# Run "info sharedlibrary" and check for the presence or absence of ++# our libraries. ++proc check_info_shared { test expect1 expect2 } { ++ global lib1name ++ global lib2name ++ global gdb_prompt ++ ++ set actual1 0 ++ set actual2 0 ++ ++ gdb_test_multiple "info sharedlibrary" $test { ++ -re $lib1name { ++ set actual1 1 ++ exp_continue ++ } ++ -re $lib2name { ++ set actual2 1 ++ exp_continue ++ } ++ -re "\r\n$gdb_prompt $" { ++ if { $actual1 == $expect1 && $actual2 == $expect2 } { ++ pass $test ++ } else { ++ fail $test ++ } ++ } ++ } ++} ++ ++# Set up breakpoints. ++gdb_test "break stop" {Breakpoint [0-9]+ at .*} ++gdb_test_no_output "set breakpoint pending on" ++gdb_test "break foo" {Breakpoint [0-9]+ \(foo\) pending\.} ++gdb_test "break bar" {Breakpoint [0-9]+ \(bar\) pending\.} ++ ++# Check neither of the libraries are loaded at the start. ++gdb_test "start" {Temporary breakpoint [0-9]+, .* in main \(\)} ++check_info_shared "info sharedlibrary #1" 0 0 ++ ++# Run to the first stop and check that only the first library is loaded. ++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++check_info_shared "info sharedlibrary #2" 1 0 ++ ++# Run to the second stop and check that both libraries are loaded. ++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++check_info_shared "info sharedlibrary #3" 1 1 ++ ++# Check that the next stop is in foo. ++gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} ++ ++# Check that the next stop is in bar. ++gdb_test "c" {Breakpoint [0-9]+, .* in bar \(\) from .*} ++ ++# Restart the inferior and make sure there are no breakpoint reset ++# errors. These can happen with the probes-based runtime linker ++# interface if the cache is not cleared correctly. ++set test "restart" ++gdb_test_multiple "run" $test { ++ -re {Start it from the beginning\? \(y or n\) } { ++ send_gdb "y\n" ++ exp_continue ++ } ++ -re {Error in re-setting breakpoint} { ++ fail $test ++ } ++ -re "\r\n$gdb_prompt $" { ++ pass $test ++ } ++} ++ ++# We're at the first stop. Check that only the first library is loaded. ++check_info_shared "info sharedlibrary #4" 1 0 ++ ++# Run to the second stop and check that both libraries are loaded. ++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++check_info_shared "info sharedlibrary #5" 1 1 ++ ++# Check that the next stop is in foo. ++gdb_test "c" {Breakpoint [0-9]+, .* in foo \(\) from .*} ++ ++# Check that the next stop is in bar. ++gdb_test "c" {Breakpoint [0-9]+, .* in bar \(\) from .*} ++ ++# Run to the next stop and check that the first library has been unloaded. ++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++check_info_shared "info sharedlibrary #6" 0 1 ++ ++# Run to the last stop and check that both libraries are gone. ++gdb_test "c" {Breakpoint [0-9]+, .* in stop \(\)} ++check_info_shared "info sharedlibrary #7" 0 0 diff --git a/gdb-dlopen-stap-probe-7of7.patch b/gdb-dlopen-stap-probe-7of7.patch new file mode 100644 index 0000000..3fab183 --- /dev/null +++ b/gdb-dlopen-stap-probe-7of7.patch @@ -0,0 +1,147 @@ +2012-07-30 Gary Benson + + * objfiles.h (inhibit_section_map_updates): New function + declaration. + (resume_section_map_updates): Likewise. + (resume_section_map_updates_cleanup): Likewise. + * objfiles.c (objfile_pspace_info): New field "inhibit_updates". + (find_pc_section): Do not update the section map if + inhibit_updates is set. + (inhibit_section_map_updates): New function. + (resume_section_map_updates): Likewise. + (resume_section_map_updates_cleanup): Likewise. + * solib-svr4.c (svr4_handle_solib_event): Inhibit section map + updates for calls to evaluate_probe_argument. + +Index: gdb-7.4.91.20120814/gdb/objfiles.h +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/objfiles.h 2012-08-14 17:16:54.000000000 +0200 ++++ gdb-7.4.91.20120814/gdb/objfiles.h 2012-08-14 17:20:55.913174609 +0200 +@@ -526,6 +526,22 @@ extern void set_objfile_data (struct obj + extern void *objfile_data (struct objfile *objfile, + const struct objfile_data *data); + ++/* In normal use, the section map will be rebuilt by FIND_PC_SECTION ++ if objfiles have been added, removed or relocated since it was last ++ called. Calling INHIBIT_SECTION_MAP_UPDATES will inhibit this ++ behavior until RESUME_SECTION_MAP_UPDATES is called. If you call ++ INHIBIT_SECTION_MAP_UPDATES you must ensure that every call to ++ FIND_PC_SECTION in the inhibited region relates to a section that ++ is already in the section map and has not since been removed or ++ relocated. */ ++extern void inhibit_section_map_updates (void); ++ ++/* Resume automatically rebuilding the section map as required. */ ++extern void resume_section_map_updates (void); ++ ++/* Version of the above suitable for use as a cleanup. */ ++extern void resume_section_map_updates_cleanup (void *arg); ++ + extern void default_iterate_over_objfiles_in_search_order + (struct gdbarch *gdbarch, + iterate_over_objfiles_in_search_order_cb_ftype *cb, +Index: gdb-7.4.91.20120814/gdb/objfiles.c +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/objfiles.c 2012-08-14 17:16:55.000000000 +0200 ++++ gdb-7.4.91.20120814/gdb/objfiles.c 2012-08-14 17:20:55.915174609 +0200 +@@ -70,6 +70,9 @@ struct objfile_pspace_info + int objfiles_changed_p; + struct obj_section **sections; + int num_sections; ++ ++ /* Nonzero if section map updates should be inhibited. */ ++ int inhibit_updates; + }; + + /* Per-program-space data key. */ +@@ -1295,7 +1298,7 @@ find_pc_section (CORE_ADDR pc) + return s; + + pspace_info = get_objfile_pspace_data (current_program_space); +- if (pspace_info->objfiles_changed_p != 0) ++ if (pspace_info->objfiles_changed_p && !pspace_info->inhibit_updates) + { + update_section_map (current_program_space, + &pspace_info->sections, +@@ -1463,6 +1466,30 @@ objfiles_changed (void) + get_objfile_pspace_data (current_program_space)->objfiles_changed_p = 1; + } + ++/* See comments in objfiles.h. */ ++ ++void ++inhibit_section_map_updates (void) ++{ ++ get_objfile_pspace_data (current_program_space)->inhibit_updates = 1; ++} ++ ++/* See comments in objfiles.h. */ ++ ++void ++resume_section_map_updates (void) ++{ ++ get_objfile_pspace_data (current_program_space)->inhibit_updates = 0; ++} ++ ++/* See comments in objfiles.h. */ ++ ++void ++resume_section_map_updates_cleanup (void *arg) ++{ ++ resume_section_map_updates (); ++} ++ + /* The default implementation for the "iterate_over_objfiles_in_search_order" + gdbarch method. It is equivalent to use the ALL_OBJFILES macro, + searching the objfiles in the order they are stored internally, +Index: gdb-7.4.91.20120814/gdb/solib-svr4.c +=================================================================== +--- gdb-7.4.91.20120814.orig/gdb/solib-svr4.c 2012-08-14 17:20:42.000000000 +0200 ++++ gdb-7.4.91.20120814/gdb/solib-svr4.c 2012-08-14 17:21:14.090169216 +0200 +@@ -1847,6 +1847,7 @@ svr4_handle_solib_event (bpstat bs) + struct svr4_info *info = get_svr4_info (); + struct probe_and_info buf, *pi = &buf; + enum probe_action action; ++ struct cleanup *cleanups = NULL; + struct value *val; + LONGEST lmid; + CORE_ADDR debug_base, lm = 0; +@@ -1870,6 +1871,19 @@ svr4_handle_solib_event (bpstat bs) + if (action == NAMESPACE_NO_ACTION) + return; + ++ /* EVALUATE_PROBE_ARGUMENT looks up symbols in the dynamic linker ++ using FIND_PC_SECTION. FIND_PC_SECTION is accelerated by a cache ++ called the section map. The section map is invalidated every ++ time a shared library is loaded or unloaded, and if the inferior ++ is generating a lot of shared library events then the section map ++ will be updated every time SVR4_HANDLE_SOLIB_EVENT is called. ++ We called FIND_PC_SECTION in SVR4_CREATE_SOLIB_EVENT_BREAKPOINTS, ++ so we can guarantee that the dynamic linker's sections are in the ++ section map. We can therefore inhibit section map updates across ++ these calls to EVALUATE_PROBE_ARGUMENT and save a lot of time. */ ++ inhibit_section_map_updates (); ++ cleanups = make_cleanup (resume_section_map_updates_cleanup, NULL); ++ + val = evaluate_probe_argument (pi->probe, 0); + if (val == NULL) + goto error; +@@ -1901,6 +1915,9 @@ svr4_handle_solib_event (bpstat bs) + action = NAMESPACE_RELOAD; + } + ++ do_cleanups (cleanups); ++ cleanups = NULL; ++ + if (action == NAMESPACE_UPDATE_OR_RELOAD) + { + if (namespace_update_incremental (info, lmid, lm, is_initial_ns)) +@@ -1923,6 +1940,8 @@ svr4_handle_solib_event (bpstat bs) + warning (_("Probes-based dynamic linker interface failed.\n" + "Reverting to original interface.\n")); + ++ if (cleanups != NULL) ++ do_cleanups (cleanups); + free_namespace_table (info); + free_probes (info); + info->using_probes = 0; diff --git a/gdb-dlopen-stap-probe-test.patch b/gdb-dlopen-stap-probe-test.patch index a68f3bc..87702d8 100644 --- a/gdb-dlopen-stap-probe-test.patch +++ b/gdb-dlopen-stap-probe-test.patch @@ -4,10 +4,10 @@ Date: Mon Aug 8 12:08:53 2011 +0200 +testcase -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c +Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2012-06-02 20:03:42.711393776 +0200 ++++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c 2012-07-15 08:51:38.238701282 +0200 @@ -0,0 +1,40 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -49,10 +49,10 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread-lib.c + i = pthread_join (t, NULL); + assert (i == 0); +} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.c +Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2012-06-02 20:03:42.712393775 +0200 ++++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.c 2012-07-15 08:51:38.239701277 +0200 @@ -0,0 +1,46 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -100,10 +100,10 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.c + + return 0; +} -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.exp +Index: gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2012-06-02 20:03:42.724393771 +0200 ++++ gdb-7.4.50.20120714/gdb/testsuite/gdb.threads/dlopen-libpthread.exp 2012-07-15 09:08:01.760258588 +0200 @@ -0,0 +1,74 @@ +# Copyright 2011 Free Software Foundation, Inc. +# @@ -148,12 +148,12 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.exp + return -1 +} + -+set test "print _dl_debug_notify" ++set test "info probes all rtld rtld_map_complete" +gdb_test_multiple $test $test { -+ -re " 0x\[0-9a-f\]+ <_dl_debug_notify>\r\n$gdb_prompt $" { ++ -re "\[ \t\]rtld_map_complete\[ \t\]+0x\[0-9a-f\]+.*\r\n$gdb_prompt $" { + pass $test + } -+ -re "No symbol \"_dl_debug_notify\" in current context\\.\r\n$gdb_prompt $" { ++ -re "No probes matched\\.\r\n$gdb_prompt $" { + xfail $test + untested ${testfile}.exp + return @@ -179,81 +179,80 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.threads/dlopen-libpthread.exp +gdb_continue_to_breakpoint "notify" ".* notify-here .*" + +gdb_test "info sharedlibrary" {/libpthread\.so.*} "libpthread.so found" -Index: gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp +Index: gdb-7.4.50.20120714/gdb/testsuite/lib/gdb.exp =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/gdb.exp 2012-06-02 19:11:56.000000000 +0200 -+++ gdb-7.4.50.20120602/gdb/testsuite/lib/gdb.exp 2012-06-02 20:03:42.727393770 +0200 -@@ -3693,30 +3693,49 @@ proc build_executable { testname executa - set sources ${executable}.c - } +--- gdb-7.4.50.20120714.orig/gdb/testsuite/lib/gdb.exp 2012-07-15 08:51:36.803709222 +0200 ++++ gdb-7.4.50.20120714/gdb/testsuite/lib/gdb.exp 2012-07-15 09:02:41.983028197 +0200 +@@ -3774,22 +3774,6 @@ proc build_executable_from_specs {testna + + set binfile [standard_output_file $executable] -- set binfile ${objdir}/${subdir}/${executable} -- - set objects {} -- for {set i 0} "\$i<[llength $sources]" {incr i} { -- set s [lindex $sources $i] -- if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $options] != "" } { +- set i 0 +- foreach {s local_options} $args { +- if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } { - untested $testname - return -1 - } - lappend objects "${binfile}${i}.o" -+ # get_compiler_info by gdb_compile_shlib and gdb_compile_shlib_pthreads. -+ set info_options "" -+ if { [lsearch -exact $options "c++"] >= 0 } { -+ set info_options "c++" - } +- incr i +- } - - if { [gdb_compile $objects "${binfile}" executable $options] != "" } { - untested $testname -+ if [get_compiler_info binfile_unused ${info_options}] { +- return -1 +- } +- + set info_options "" + if { [lsearch -exact $options "c++"] >= 0 } { + set info_options "c++" +@@ -3797,6 +3781,42 @@ proc build_executable_from_specs {testna + if [get_compiler_info ${info_options}] { return -1 } - -- set info_options "" -- if { [lsearch -exact $options "c++"] >= 0 } { -- set info_options "c++" -+ set binfile ${objdir}/${subdir}/${executable} ++ ++ set binfile [standard_output_file $executable] + + set func gdb_compile + set func_index [lsearch -regexp $options {^(pthreads|shlib|shlib_pthreads)$}] + if {$func_index != -1} { + set func "${func}_[lindex $options $func_index]" - } -- if [get_compiler_info ${binfile} ${info_options}] { ++ } + + # gdb_compile_shlib and gdb_compile_shlib_pthreads do not use the 3rd + # parameter. They also requires $sources while gdb_compile and -+ # gdb_compile_pthreads require $objects. ++ # gdb_compile_pthreads require $objects. Moreover they ignore any options. + if [string match gdb_compile_shlib* $func] { + set sources_path {} -+ foreach s $sources { ++ foreach {s local_options} $args { + lappend sources_path "${srcdir}/${subdir}/${s}" + } + set ret [$func $sources_path "${binfile}" $options] + } else { + set objects {} -+ for {set i 0} "\$i<[llength $sources]" {incr i} { -+ set s [lindex $sources $i] -+ if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $options] != "" } { ++ set i 0 ++ foreach {s local_options} $args { ++ if { [gdb_compile "${srcdir}/${subdir}/${s}" "${binfile}${i}.o" object $local_options] != "" } { + untested $testname + return -1 + } + lappend objects "${binfile}${i}.o" ++ incr i + } + set ret [$func $objects "${binfile}" executable $options] + } + if { $ret != "" } { + untested $testname - return -1 - } ++ return -1 ++ } + return 0 } -Index: gdb-7.4.50.20120602/gdb/testsuite/lib/prelink-support.exp +Index: gdb-7.4.50.20120714/gdb/testsuite/lib/prelink-support.exp =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/lib/prelink-support.exp 2012-01-04 09:27:56.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/testsuite/lib/prelink-support.exp 2012-06-02 20:03:42.733393768 +0200 +--- gdb-7.4.50.20120714.orig/gdb/testsuite/lib/prelink-support.exp 2012-01-04 09:27:56.000000000 +0100 ++++ gdb-7.4.50.20120714/gdb/testsuite/lib/prelink-support.exp 2012-07-15 08:51:38.243701254 +0200 @@ -95,8 +95,9 @@ proc file_copy {src dest} { # Wrap function build_executable so that the resulting executable is fully # self-sufficient (without dependencies on system libraries). Parameter @@ -306,104 +305,3 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/lib/prelink-support.exp return $prelink_args } -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/break-interp.exp -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/break-interp.exp 2012-02-24 15:09:08.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/break-interp.exp 2012-06-02 20:04:56.135369687 +0200 -@@ -109,14 +109,21 @@ proc strip_debug {dest} { - } - } - -+# Former symbol for solib changes notifications was _dl_debug_state, newer one -+# is dl_main (in fact _dl_debug_notify but it is inlined without any extra -+# debug info), the right one one traps by `set stop-on-solib-events 1'. -+ -+set solib_bp {(_dl_debug_state|dl_main)} -+ - # Implementation of reach. - - proc reach_1 {func command displacement} { -- global gdb_prompt expect_out -+ global gdb_prompt expect_out solib_bp - -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - # Breakpoint on _dl_debug_state can have problems due to its overlap - # with the existing internal breakpoint from GDB. -+ # With also _dl_debug_notify we would need even two breakpoints. - gdb_test_no_output "set stop-on-solib-events 1" - } elseif {! [gdb_breakpoint $func allow-pending]} { - return -@@ -142,21 +149,21 @@ proc reach_1 {func command displacement} - exp_continue - } - -re "Breakpoint \[0-9\]+, \\.?(__GI_)?$func \\(.*\\) at .*:\[0-9\]+\r\n.*$gdb_prompt $" { -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - fail $test - } else { - pass $test - } - } - -re "Breakpoint \[0-9\]+, \[0-9xa-f\]+ in \\.?(__GI_)?$func \\(\\).*\r\n$gdb_prompt $" { -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - fail $test - } else { - pass $test - } - } - -re "Stopped due to (spurious )?shared library event.*\r\n$gdb_prompt $" { -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - if {$debug_state_count == 0} { - # First stop does not yet relocate the _start function - # descriptor on ppc64. -@@ -175,7 +182,7 @@ proc reach_1 {func command displacement} - fail $test_displacement - } - -- if {$func == "_dl_debug_state"} { -+ if {$func == $solib_bp} { - gdb_test_no_output "set stop-on-solib-events 0" - } - } -@@ -357,7 +364,7 @@ proc test_attach {file displacement {rel - } - - proc test_ld {file ifmain trynosym displacement} { -- global srcdir subdir gdb_prompt expect_out inferior_exited_re -+ global srcdir subdir gdb_prompt expect_out inferior_exited_re solib_bp - - # First test normal `file'-command loaded $FILE with symbols. - -@@ -385,9 +392,9 @@ proc test_ld {file ifmain trynosym displ - gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test" - } - -- reach "_dl_debug_state" "run" $displacement -+ reach $solib_bp "run" $displacement - -- gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?_dl_debug_state\\M.*" "dl bt" -+ gdb_test "bt" "#0 +\[^\r\n\]*\\m(__GI_)?$solib_bp\\M.*" "dl bt" - - if $ifmain { - reach "main" continue "NONE" -@@ -399,7 +406,7 @@ proc test_ld {file ifmain trynosym displ - - # Try re-run if the new PIE displacement takes effect. - gdb_test "kill" "" "kill" {Kill the program being debugged\? \(y or n\) } "y" -- reach "_dl_debug_state" "run" $displacement -+ reach $solib_bp "run" $displacement - - if $ifmain { - test_core $file $displacement -@@ -431,7 +438,7 @@ proc test_ld {file ifmain trynosym displ - gdb_test "exec-file $file" "exec-file $escapedfile" "load" - - if $ifmain { -- reach "_dl_debug_state" run $displacement -+ reach $solib_bp run $displacement - - # Use two separate gdb_test_multiple statements to avoid timeouts due - # to slow processing of wildcard capturing long output diff --git a/gdb-dlopen-stap-probe-test2.patch b/gdb-dlopen-stap-probe-test2.patch new file mode 100644 index 0000000..894c067 --- /dev/null +++ b/gdb-dlopen-stap-probe-test2.patch @@ -0,0 +1,69 @@ +http://sourceware.org/ml/gdb-patches/2012-08/msg00500.html +Subject: [patch] testsuite: Make solib-corrupted.exp untested for probes [Re: [RFA 0/4 take 2] Improved linker-debugger interface] + +On Fri, 17 Aug 2012 22:53:53 +0200, Jan Kratochvil wrote: +> It regresses with glibc-debuginfo installed: +> +> info sharedlibrary^M +> From To Syms Read Shared Object Library^M +> 0x00007ffff7ddcb20 0x00007ffff7df63d9 Yes /lib64/ld-linux-x86-64.so.2^M +> 0x00007ffff7ae05b0 0x00007ffff7b4ad78 Yes /lib64/libm.so.6^M +> 0x00007ffff77431a0 0x00007ffff7883cf0 Yes /lib64/libc.so.6^M +> (gdb) FAIL: gdb.base/solib-corrupted.exp: corrupted list +> +> But I guess there is no longer a way to test it with probes so it should just +> run some 'info probes' and make this test UNTESTED if rtld probes are +> available. + +I had to implement it for Fedora already anyway. + + +Regards, +Jan + + +gdb/testsuite/ +2012-08-18 Jan Kratochvil + + * gdb.base/solib-corrupted.exp: New variable probes. + (info probes): New test. + +diff --git a/gdb/testsuite/gdb.base/solib-corrupted.exp b/gdb/testsuite/gdb.base/solib-corrupted.exp +index 84b3b0c..c9f55d6 100644 +--- a/gdb/testsuite/gdb.base/solib-corrupted.exp ++++ b/gdb/testsuite/gdb.base/solib-corrupted.exp +@@ -36,6 +36,33 @@ if ![runto_main] { + return + } + ++# With probes interface GDB no longer scans the inferior library list so its ++# corruption cannot be tested. There is no way to disable the probes ++# interface. ++ ++set probes { init_start init_complete map_start reloc_complete unmap_start ++ unmap_complete } ++set test "info probes" ++gdb_test_multiple $test $test { ++ -re "^rtld\[ \t\]+(?:rtld_)?(\[a-z_\]+)\[ \t\]" { ++ set idx [lsearch -exact $probes $expect_out(1,string)] ++ if { $idx >= 0 } { ++ set probes [lreplace $probes $idx $idx] ++ } ++ exp_continue ++ } ++ -re "^\[^\r\n\]*\r\n" { ++ exp_continue ++ } ++ -re "^$gdb_prompt $" { ++ } ++} ++if { [llength $probes] == 0 } { ++ xfail $test ++ untested "GDB is using probes" ++ return ++} ++ + gdb_test "info sharedlibrary" "From * To .*" "normal list" + + # GDB checks there for matching L_PREV. + diff --git a/gdb-dlopen-stap-probe.patch b/gdb-dlopen-stap-probe.patch deleted file mode 100644 index f4085d5..0000000 --- a/gdb-dlopen-stap-probe.patch +++ /dev/null @@ -1,358 +0,0 @@ -From: Gary Benson -To: Jan Kratochvil -Message-ID: <20110810133605.GB7294@redhat.com> - -Index: gdb-7.4.50.20120602/gdb/infrun.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/infrun.c 2012-06-02 21:38:07.236442883 +0200 -+++ gdb-7.4.50.20120602/gdb/infrun.c 2012-06-02 21:38:13.450440507 +0200 -@@ -361,6 +361,13 @@ static struct symbol *step_start_functio - /* Nonzero if we want to give control to the user when we're notified - of shared library events by the dynamic linker. */ - int stop_on_solib_events; -+ -+static void -+set_stop_on_solib_events (char *args, int from_tty, struct cmd_list_element *c) -+{ -+ update_solib_breakpoints (); -+} -+ - static void - show_stop_on_solib_events (struct ui_file *file, int from_tty, - struct cmd_list_element *c, const char *value) -@@ -7267,7 +7274,7 @@ Show stopping for shared library events. - If nonzero, gdb will give control to the user when the dynamic linker\n\ - notifies gdb of shared library events. The most common event of interest\n\ - to the user would be loading/unloading of a new library."), -- NULL, -+ set_stop_on_solib_events, - show_stop_on_solib_events, - &setlist, &showlist); - -Index: gdb-7.4.50.20120602/gdb/solib-svr4.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/solib-svr4.c 2012-06-02 21:38:07.236442883 +0200 -+++ gdb-7.4.50.20120602/gdb/solib-svr4.c 2012-06-02 21:44:23.973298737 +0200 -@@ -47,6 +47,8 @@ - #include "auxv.h" - #include "exceptions.h" - -+#include "probe.h" -+ - static struct link_map_offsets *svr4_fetch_link_map_offsets (void); - static int svr4_have_link_map_offsets (void); - static void svr4_relocate_main_executable (void); -@@ -92,6 +94,32 @@ static const char * const solib_break_na - NULL - }; - -+/* A list of SystemTap probes which, if present in the dynamic linker, -+ allow more fine-grained breakpoints to be placed on shared library -+ events. */ -+ -+struct probe_info -+ { -+ /* The name of the probe. */ -+ const char *name; -+ -+ /* Nonzero if this probe must be stopped at even when -+ stop-on-solib-events is off. */ -+ int mandatory; -+ }; -+ -+static const struct probe_info probe_info[] = -+{ -+ {"rtld_init_start", 0}, -+ {"rtld_init_complete", 1}, -+ {"rtld_map_start", 0}, -+ {"rtld_reloc_complete", 1}, -+ {"rtld_unmap_start", 0}, -+ {"rtld_unmap_complete", 1}, -+}; -+ -+#define NUM_PROBES (sizeof(probe_info) / sizeof(probe_info[0])) -+ - static const char * const bkpt_names[] = - { - "_start", -@@ -313,6 +341,12 @@ struct svr4_info - CORE_ADDR interp_text_sect_high; - CORE_ADDR interp_plt_sect_low; - CORE_ADDR interp_plt_sect_high; -+ -+ /* SystemTap probes. */ -+ VEC (probe_p) *probes[NUM_PROBES]; -+ -+ /* Nonzero if we are using the SystemTap interface. */ -+ int using_probes; - }; - - /* Per-program-space data key. */ -@@ -322,8 +356,15 @@ static void - svr4_pspace_data_cleanup (struct program_space *pspace, void *arg) - { - struct svr4_info *info; -+ int i; - - info = program_space_data (pspace, solib_svr4_pspace_data); -+ if (info == NULL) -+ return; -+ -+ for (i = 0; i < NUM_PROBES; i++) -+ VEC_free (probe_p, info->probes[i]); -+ - xfree (info); - } - -@@ -1449,6 +1490,126 @@ exec_entry_point (struct bfd *abfd, stru - targ); - } - -+/* Helper function for svr4_update_solib_event_breakpoints. */ -+ -+static int -+svr4_update_solib_event_breakpoint (struct breakpoint *b, void *arg) -+{ -+ struct svr4_info *info = get_svr4_info (); -+ struct bp_location *loc; -+ -+ if (b->type != bp_shlib_event) -+ return 0; -+ -+ for (loc = b->loc; loc; loc = loc->next) -+ { -+ int i; -+ -+ for (i = 0; i < NUM_PROBES; i++) -+ { -+ if (!probe_info[i].mandatory) -+ { -+ struct probe *probe; -+ int ix; -+ -+ for (ix = 0; -+ VEC_iterate (probe_p, info->probes[i], ix, probe); -+ ++ix) -+ { -+ if (loc->pspace == current_program_space -+ && loc->address == probe->address) -+ { -+ b->enable_state = -+ stop_on_solib_events ? bp_enabled : bp_disabled; -+ return 0; -+ } -+ } -+ } -+ } -+ } -+ -+ return 0; -+} -+ -+/* Enable or disable optional solib event breakpoints as appropriate. -+ Called whenever stop_on_solib_events is changed. */ -+ -+static void -+svr4_update_solib_event_breakpoints (void) -+{ -+ struct svr4_info *info = get_svr4_info (); -+ -+ if (info->using_probes) -+ iterate_over_breakpoints (svr4_update_solib_event_breakpoint, NULL); -+} -+ -+/* Both the SunOS and the SVR4 dynamic linkers call a marker function -+ before and after mapping and unmapping shared libraries. The sole -+ purpose of this method is to allow debuggers to set a breakpoint so -+ they can track these changes. -+ -+ Some versions of the glibc dynamic linker contain SystemTap probes -+ to allow more fine grained stopping. Given the address of the -+ original marker function, this function attempts to find these -+ probes, and if found, sets breakpoints on those instead. If the -+ probes aren't found, a single breakpoint is set on the original -+ SVR4 marker function. */ -+ -+static void -+svr4_create_solib_event_breakpoints (struct gdbarch *gdbarch, CORE_ADDR address) -+{ -+ struct svr4_info *info = get_svr4_info (); -+ struct obj_section *os; -+ -+ os = find_pc_section (address); -+ if (os != NULL) -+ { -+ int all_probes_found = 1; -+ int i; -+ -+ for (i = 0; i < NUM_PROBES; i++) -+ { -+ info->probes[i] = find_probes_in_objfile (os->objfile, "rtld", -+ probe_info[i].name); -+ -+ if (!VEC_length(probe_p, info->probes[i])) -+ { -+ int j; -+ -+ for (j = i - 1; j >= 0; j--) -+ { -+ VEC_free (probe_p, info->probes[j]); -+ info->probes[j] = NULL; -+ } -+ -+ all_probes_found = 0; -+ break; -+ } -+ } -+ -+ if (all_probes_found) -+ { -+ info->using_probes = 1; -+ -+ for (i = 0; i < NUM_PROBES; i++) -+ { -+ struct probe *probe; -+ int ix; -+ -+ for (ix = 0; -+ VEC_iterate (probe_p, info->probes[i], ix, probe); -+ ++ix) -+ create_solib_event_breakpoint (gdbarch, probe->address); -+ } -+ -+ svr4_update_solib_event_breakpoints (); -+ return; -+ } -+ } -+ -+ create_solib_event_breakpoint (gdbarch, address); -+} -+ - /* Helper function for gdb_bfd_lookup_symbol. */ - - static int -@@ -1497,10 +1658,18 @@ enable_break (struct svr4_info *info, in - asection *interp_sect; - gdb_byte *interp_name; - CORE_ADDR sym_addr; -+ int i; - - info->interp_text_sect_low = info->interp_text_sect_high = 0; - info->interp_plt_sect_low = info->interp_plt_sect_high = 0; - -+ for (i = 0; i < NUM_PROBES; i++) -+ { -+ VEC_free (probe_p, info->probes[i]); -+ info->probes[i] = NULL; -+ } -+ info->using_probes = 0; -+ - /* If we already have a shared library list in the target, and - r_debug contains r_brk, set the breakpoint there - this should - mean r_brk has already been relocated. Assume the dynamic linker -@@ -1532,7 +1701,7 @@ enable_break (struct svr4_info *info, in - That knowledge is encoded in the address, if it's Thumb the low bit - is 1. However, we've stripped that info above and it's not clear - what all the consequences are of passing a non-addr_bits_remove'd -- address to create_solib_event_breakpoint. The call to -+ address to svr4_create_solib_event_breakpoints. The call to - find_pc_section verifies we know about the address and have some - hope of computing the right kind of breakpoint to use (via - symbol info). It does mean that GDB needs to be pointed at a -@@ -1570,7 +1739,7 @@ enable_break (struct svr4_info *info, in - + bfd_section_size (tmp_bfd, interp_sect); - } - -- create_solib_event_breakpoint (target_gdbarch, sym_addr); -+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); - return 1; - } - } -@@ -1725,7 +1894,8 @@ enable_break (struct svr4_info *info, in - - if (sym_addr != 0) - { -- create_solib_event_breakpoint (target_gdbarch, load_addr + sym_addr); -+ svr4_create_solib_event_breakpoints (target_gdbarch, -+ load_addr + sym_addr); - xfree (interp_name); - return 1; - } -@@ -1751,7 +1921,7 @@ enable_break (struct svr4_info *info, in - sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, - sym_addr, - ¤t_target); -- create_solib_event_breakpoint (target_gdbarch, sym_addr); -+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); - return 1; - } - } -@@ -1767,7 +1937,7 @@ enable_break (struct svr4_info *info, in - sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, - sym_addr, - ¤t_target); -- create_solib_event_breakpoint (target_gdbarch, sym_addr); -+ svr4_create_solib_event_breakpoints (target_gdbarch, sym_addr); - return 1; - } - } -@@ -2543,4 +2713,5 @@ _initialize_svr4_solib (void) - svr4_so_ops.lookup_lib_global_symbol = elf_lookup_lib_symbol; - svr4_so_ops.same = svr4_same; - svr4_so_ops.keep_data_in_core = svr4_keep_data_in_core; -+ svr4_so_ops.update_breakpoints = svr4_update_solib_event_breakpoints; - } -Index: gdb-7.4.50.20120602/gdb/solib.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/solib.c 2012-06-02 21:38:07.236442883 +0200 -+++ gdb-7.4.50.20120602/gdb/solib.c 2012-06-02 21:38:13.455440507 +0200 -@@ -1216,6 +1216,18 @@ no_shared_libraries (char *ignored, int - objfile_purge_solibs (); - } - -+/* Enable or disable optional solib event breakpoints as appropriate. */ -+ -+void -+update_solib_breakpoints (void) -+{ -+ struct target_so_ops *ops = solib_ops (target_gdbarch); -+ -+ if (ops->update_breakpoints != NULL) -+ ops->update_breakpoints (); -+} -+ -+ - /* Reload shared libraries, but avoid reloading the same symbol file - we already have loaded. */ - -Index: gdb-7.4.50.20120602/gdb/solib.h -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/solib.h 2012-06-02 21:38:07.236442883 +0200 -+++ gdb-7.4.50.20120602/gdb/solib.h 2012-06-02 21:38:13.464440503 +0200 -@@ -91,4 +91,8 @@ extern CORE_ADDR gdb_bfd_lookup_symbol_f - void *), - void *data); - -+/* Enable or disable optional solib event breakpoints as appropriate. */ -+ -+extern void update_solib_breakpoints (void); -+ - #endif /* SOLIB_H */ -Index: gdb-7.4.50.20120602/gdb/solist.h -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/solist.h 2012-06-02 21:38:07.236442883 +0200 -+++ gdb-7.4.50.20120602/gdb/solist.h 2012-06-02 21:38:13.465440503 +0200 -@@ -149,6 +149,13 @@ struct target_so_ops - core file (in particular, for readonly sections). */ - int (*keep_data_in_core) (CORE_ADDR vaddr, - unsigned long size); -+ -+ /* Enable or disable optional solib event breakpoints as -+ appropriate. This should be called whenever -+ stop_on_solib_events is changed. This pointer can be -+ NULL, in which case no enabling or disabling is necessary -+ for this target. */ -+ void (*update_breakpoints) (void); - }; - - /* Free the memory associated with a (so_list *). */ diff --git a/gdb-entryval-inlined.patch b/gdb-entryval-inlined.patch new file mode 100644 index 0000000..ac610da --- /dev/null +++ b/gdb-entryval-inlined.patch @@ -0,0 +1,888 @@ +http://sourceware.org/ml/gdb-patches/2012-10/msg00095.html +Subject: [patch] entry values: Fix resolving in inlined frames + +Hi, + +Breakpoint 1, fn2 (y=, x=6) at gdb.arch/amd64-entry-value-inline.c:32 +32 y = -2 + x; /* break-here */ +(gdb) info addr y +(gdb) bt +#0 fn2 (y=, x=6) at gdb.arch/amd64-entry-value-inline.c:32 +#1 fn3 (x=x@entry=6, y=y@entry=25) at gdb.arch/amd64-entry-value-inline.c:42 +#2 0x00000000004004af in main () at gdb.arch/amd64-entry-value-inline.c:48 +(gdb) info frame +Stack level 0, frame at 0x7fffffffdb68: + rip = 0x4005bc in fn2 (gdb.arch/amd64-entry-value-inline.c:32); saved rip 0x4004af + inlined into frame 1 +[...] +(gdb) set debug entry-values 1 +(gdb) p y +DW_OP_GNU_entry_value resolving expects callee fn1 at 0x4005a0 but the called frame is for fn3 at 0x4005b0 + +FAIL: +----- +$1 = +PASS: +----- +$1 = 25 + +(gdb) p/x $pc +$2 = 0x4005bc +(gdb) up +#1 fn3 (x=x@entry=6, y=y@entry=25) at gdb.arch/amd64-entry-value-inline.c:42 +(gdb) p/x $pc +$3 = 0x4005bc + +The problem is that DW_TAG_GNU_call_site <-> DW_OP_GNU_entry_value binding +exists between DW_TAG_subprogram, nor DW_TAG_inlined_subroutine as described +by Jakub Jelinek. This makes sense, when we look at DW_TAG_GNU_call_site and +we just unwind the current inlined frame we get the same PC - this is no new +information. + +TAILCALL_FRAME is a different case, while also an artificial frame the +sequence cannot be determined at compile time and the binding +DW_TAG_GNU_call_site <-> DW_OP_GNU_entry_value exists also for +TAILCALL_FRAMEs. + +I will check it in. + +No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu. + + +Thanks, +Jan + + +gdb/ +2012-10-05 Jan Kratochvil + + Fix entry values resolving in inlined frames. + * dwarf2loc.c (dwarf_expr_reg_to_entry_parameter): Move func_addr, + gdbarch and caller_frame initialization later. Skip INLINE_FRAME + entries of FRAME. + +gdb/testsuite/ +2012-10-05 Jan Kratochvil + + Fix entry values resolving in inlined frames. + * gdb.arch/amd64-entry-value-inline.S: New file. + * gdb.arch/amd64-entry-value-inline.c: New file. + * gdb.arch/amd64-entry-value-inline.exp: New file. + +diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c +index e8d39fe..0bdc042 100644 +--- a/gdb/dwarf2loc.c ++++ b/gdb/dwarf2loc.c +@@ -980,16 +980,27 @@ dwarf_expr_reg_to_entry_parameter (struct frame_info *frame, + union call_site_parameter_u kind_u, + struct dwarf2_per_cu_data **per_cu_return) + { +- CORE_ADDR func_addr = get_frame_func (frame); +- CORE_ADDR caller_pc; +- struct gdbarch *gdbarch = get_frame_arch (frame); +- struct frame_info *caller_frame = get_prev_frame (frame); ++ CORE_ADDR func_addr, caller_pc; ++ struct gdbarch *gdbarch; ++ struct frame_info *caller_frame; + struct call_site *call_site; + int iparams; + /* Initialize it just to avoid a GCC false warning. */ + struct call_site_parameter *parameter = NULL; + CORE_ADDR target_addr; + ++ /* Skip any inlined frames, entry value call sites work between real ++ functions. They do not make sense between inline functions as even PC ++ does not change there. */ ++ while (get_frame_type (frame) == INLINE_FRAME) ++ { ++ frame = get_prev_frame (frame); ++ gdb_assert (frame != NULL); ++ } ++ ++ func_addr = get_frame_func (frame); ++ gdbarch = get_frame_arch (frame); ++ caller_frame = get_prev_frame (frame); + if (gdbarch != frame_unwind_arch (frame)) + { + struct minimal_symbol *msym = lookup_minimal_symbol_by_pc (func_addr); +diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S +new file mode 100644 +index 0000000..5f353f5 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.S +@@ -0,0 +1,672 @@ ++/* 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 . */ ++ ++/* This file is compiled from gdb.arch/amd64-entry-value-inline.c ++ using -g -dA -S -O2. */ ++ ++ .file "amd64-entry-value-inline.c" ++ .text ++.Ltext0: ++ .p2align 4,,15 ++ .type fn1, @function ++fn1: ++.LFB0: ++ .file 1 "gdb.arch/amd64-entry-value-inline.c" ++ # gdb.arch/amd64-entry-value-inline.c:22 ++ .loc 1 22 0 ++ .cfi_startproc ++.LVL0: ++# BLOCK 2 freq:10000 seq:0 ++# PRED: ENTRY [100.0%] (FALLTHRU) ++ # gdb.arch/amd64-entry-value-inline.c:23 ++ .loc 1 23 0 ++ movl v(%rip), %eax ++ addl $1, %eax ++ movl %eax, v(%rip) ++# SUCC: EXIT [100.0%] ++ ret ++ .cfi_endproc ++.LFE0: ++ .size fn1, .-fn1 ++ .p2align 4,,15 ++ .globl fn3 ++ .type fn3, @function ++fn3: ++.LFB2: ++ # gdb.arch/amd64-entry-value-inline.c:41 ++ .loc 1 41 0 ++ .cfi_startproc ++.LVL1: ++# BLOCK 2 freq:10000 seq:0 ++# PRED: ENTRY [100.0%] (FALLTHRU) ++.LBB4: ++.LBB5: ++ # gdb.arch/amd64-entry-value-inline.c:29 ++ .loc 1 29 0 ++ testl %esi, %esi ++.LBE5: ++.LBE4: ++ # gdb.arch/amd64-entry-value-inline.c:41 ++ .loc 1 41 0 ++ pushq %rbx ++ .cfi_def_cfa_offset 16 ++ .cfi_offset 3, -16 ++ # gdb.arch/amd64-entry-value-inline.c:41 ++ .loc 1 41 0 ++ movl %edi, %ebx ++.LBB7: ++.LBB6: ++# SUCC: 3 [39.0%] (FALLTHRU,CAN_FALLTHRU) 4 [61.0%] (CAN_FALLTHRU) ++ # gdb.arch/amd64-entry-value-inline.c:29 ++ .loc 1 29 0 ++ je .L3 ++# BLOCK 3 freq:3898 seq:1 ++# PRED: 2 [39.0%] (FALLTHRU,CAN_FALLTHRU) ++ # gdb.arch/amd64-entry-value-inline.c:31 ++ .loc 1 31 0 ++ call fn1 ++.LVL2: ++ # gdb.arch/amd64-entry-value-inline.c:32 ++ .loc 1 32 0 ++ leal -2(%rbx), %eax ++.LVL3: ++ # gdb.arch/amd64-entry-value-inline.c:33 ++ .loc 1 33 0 ++ movl %eax, %edi ++ imull %eax, %edi ++ addl $1, %edi ++.LVL4: ++ imull %edi, %eax ++.LVL5: ++ # gdb.arch/amd64-entry-value-inline.c:34 ++ .loc 1 34 0 ++ leal (%rbx,%rax), %edi ++ call fn1 ++.LVL6: ++# SUCC: 4 [100.0%] (FALLTHRU,CAN_FALLTHRU) ++# BLOCK 4 freq:10000 seq:2 ++# PRED: 2 [61.0%] (CAN_FALLTHRU) 3 [100.0%] (FALLTHRU,CAN_FALLTHRU) ++.L3: ++.LBE6: ++.LBE7: ++ # gdb.arch/amd64-entry-value-inline.c:43 ++ .loc 1 43 0 ++ movl %ebx, %eax ++ popq %rbx ++ .cfi_def_cfa_offset 8 ++.LVL7: ++# SUCC: EXIT [100.0%] ++ ret ++ .cfi_endproc ++.LFE2: ++ .size fn3, .-fn3 ++ .section .text.startup,"ax",@progbits ++ .p2align 4,,15 ++ .globl main ++ .type main, @function ++main: ++.LFB3: ++ # gdb.arch/amd64-entry-value-inline.c:47 ++ .loc 1 47 0 ++ .cfi_startproc ++# BLOCK 2 freq:10000 seq:0 ++# PRED: ENTRY [100.0%] (FALLTHRU) ++ # gdb.arch/amd64-entry-value-inline.c:48 ++ .loc 1 48 0 ++ movl $25, %esi ++ movl $6, %edi ++ call fn3 ++.LVL8: ++ # gdb.arch/amd64-entry-value-inline.c:50 ++ .loc 1 50 0 ++ xorl %eax, %eax ++# SUCC: EXIT [100.0%] ++ ret ++ .cfi_endproc ++.LFE3: ++ .size main, .-main ++ .local v ++ .comm v,4,4 ++ .text ++.Letext0: ++ .section .debug_info,"",@progbits ++.Ldebug_info0: ++ .long 0x164 # Length of Compilation Unit Info ++ .value 0x4 # DWARF version number ++ .long .Ldebug_abbrev0 # Offset Into Abbrev. Section ++ .byte 0x8 # Pointer Size (in bytes) ++ .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) ++ .long .LASF0 # DW_AT_producer: "GNU C 4.8.0 20121005 (experimental) -mtune=generic -march=x86-64 -g -O2" ++ .byte 0x1 # DW_AT_language ++ .long .LASF1 # DW_AT_name: "gdb.arch/amd64-entry-value-inline.c" ++ .long .LASF2 # DW_AT_comp_dir: "" ++ .long .Ldebug_ranges0+0x30 # DW_AT_ranges ++ .quad 0 # DW_AT_low_pc ++ .long .Ldebug_line0 # DW_AT_stmt_list ++ .uleb128 0x2 # (DIE (0x29) DW_TAG_subprogram) ++ .ascii "fn1\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x15 # DW_AT_decl_line ++ # DW_AT_prototyped ++ .quad .LFB0 # DW_AT_low_pc ++ .quad .LFE0-.LFB0 # DW_AT_high_pc ++ .uleb128 0x1 # DW_AT_frame_base ++ .byte 0x9c # DW_OP_call_frame_cfa ++ # DW_AT_GNU_all_call_sites ++ .long 0x52 # DW_AT_sibling ++ .uleb128 0x3 # (DIE (0x46) DW_TAG_formal_parameter) ++ .ascii "x\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x15 # DW_AT_decl_line ++ .long 0x52 # DW_AT_type ++ .uleb128 0x1 # DW_AT_location ++ .byte 0x55 # DW_OP_reg5 ++ .byte 0 # end of children of DIE 0x29 ++ .uleb128 0x4 # (DIE (0x52) DW_TAG_base_type) ++ .byte 0x4 # DW_AT_byte_size ++ .byte 0x5 # DW_AT_encoding ++ .ascii "int\0" # DW_AT_name ++ .uleb128 0x5 # (DIE (0x59) DW_TAG_subprogram) ++ .ascii "fn2\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x1b # DW_AT_decl_line ++ # DW_AT_prototyped ++ .long 0x52 # DW_AT_type ++ .byte 0x1 # DW_AT_inline ++ .long 0x7c # DW_AT_sibling ++ .uleb128 0x6 # (DIE (0x69) DW_TAG_formal_parameter) ++ .ascii "x\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x1b # DW_AT_decl_line ++ .long 0x52 # DW_AT_type ++ .uleb128 0x6 # (DIE (0x72) DW_TAG_formal_parameter) ++ .ascii "y\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x1b # DW_AT_decl_line ++ .long 0x52 # DW_AT_type ++ .byte 0 # end of children of DIE 0x59 ++ .uleb128 0x7 # (DIE (0x7c) DW_TAG_subprogram) ++ # DW_AT_external ++ .ascii "fn3\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x28 # DW_AT_decl_line ++ # DW_AT_prototyped ++ .long 0x52 # DW_AT_type ++ .quad .LFB2 # DW_AT_low_pc ++ .quad .LFE2-.LFB2 # DW_AT_high_pc ++ .uleb128 0x1 # DW_AT_frame_base ++ .byte 0x9c # DW_OP_call_frame_cfa ++ # DW_AT_GNU_all_call_sites ++ .long 0x115 # DW_AT_sibling ++ .uleb128 0x8 # (DIE (0x9d) DW_TAG_formal_parameter) ++ .ascii "x\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x28 # DW_AT_decl_line ++ .long 0x52 # DW_AT_type ++ .long .LLST0 # DW_AT_location ++ .uleb128 0x8 # (DIE (0xaa) DW_TAG_formal_parameter) ++ .ascii "y\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x28 # DW_AT_decl_line ++ .long 0x52 # DW_AT_type ++ .long .LLST1 # DW_AT_location ++ .uleb128 0x9 # (DIE (0xb7) DW_TAG_inlined_subroutine) ++ .long 0x59 # DW_AT_abstract_origin ++ .quad .LBB4 # DW_AT_entry_pc ++ .long .Ldebug_ranges0+0 # DW_AT_ranges ++ .byte 0x1 # DW_AT_call_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x2a # DW_AT_call_line ++ .uleb128 0xa # (DIE (0xca) DW_TAG_formal_parameter) ++ .long 0x72 # DW_AT_abstract_origin ++ .long .LLST2 # DW_AT_location ++ .uleb128 0xa # (DIE (0xd3) DW_TAG_formal_parameter) ++ .long 0x69 # DW_AT_abstract_origin ++ .long .LLST0 # DW_AT_location ++ .uleb128 0xb # (DIE (0xdc) DW_TAG_GNU_call_site) ++ .quad .LVL2 # DW_AT_low_pc ++ .long 0x29 # DW_AT_abstract_origin ++ .long 0xf4 # DW_AT_sibling ++ .uleb128 0xc # (DIE (0xed) DW_TAG_GNU_call_site_parameter) ++ .uleb128 0x1 # DW_AT_location ++ .byte 0x55 # DW_OP_reg5 ++ .uleb128 0x2 # DW_AT_GNU_call_site_value ++ .byte 0x73 # DW_OP_breg3 ++ .sleb128 0 ++ .byte 0 # end of children of DIE 0xdc ++ .uleb128 0xd # (DIE (0xf4) DW_TAG_GNU_call_site) ++ .quad .LVL6 # DW_AT_low_pc ++ .long 0x29 # DW_AT_abstract_origin ++ .uleb128 0xc # (DIE (0x101) DW_TAG_GNU_call_site_parameter) ++ .uleb128 0x1 # DW_AT_location ++ .byte 0x55 # DW_OP_reg5 ++ .uleb128 0xd # DW_AT_GNU_call_site_value ++ .byte 0x73 # DW_OP_breg3 ++ .sleb128 -2 ++ .byte 0x73 # DW_OP_breg3 ++ .sleb128 -2 ++ .byte 0x73 # DW_OP_breg3 ++ .sleb128 -2 ++ .byte 0x1e # DW_OP_mul ++ .byte 0x23 # DW_OP_plus_uconst ++ .uleb128 0x1 ++ .byte 0x1e # DW_OP_mul ++ .byte 0x73 # DW_OP_breg3 ++ .sleb128 0 ++ .byte 0x22 # DW_OP_plus ++ .byte 0 # end of children of DIE 0xf4 ++ .byte 0 # end of children of DIE 0xb7 ++ .byte 0 # end of children of DIE 0x7c ++ .uleb128 0xe # (DIE (0x115) DW_TAG_subprogram) ++ # DW_AT_external ++ .long .LASF3 # DW_AT_name: "main" ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x2e # DW_AT_decl_line ++ .long 0x52 # DW_AT_type ++ .quad .LFB3 # DW_AT_low_pc ++ .quad .LFE3-.LFB3 # DW_AT_high_pc ++ .uleb128 0x1 # DW_AT_frame_base ++ .byte 0x9c # DW_OP_call_frame_cfa ++ # DW_AT_GNU_all_call_sites ++ .long 0x14f # DW_AT_sibling ++ .uleb128 0xd # (DIE (0x136) DW_TAG_GNU_call_site) ++ .quad .LVL8 # DW_AT_low_pc ++ .long 0x7c # DW_AT_abstract_origin ++ .uleb128 0xc # (DIE (0x143) DW_TAG_GNU_call_site_parameter) ++ .uleb128 0x1 # DW_AT_location ++ .byte 0x55 # DW_OP_reg5 ++ .uleb128 0x1 # DW_AT_GNU_call_site_value ++ .byte 0x36 # DW_OP_lit6 ++ .uleb128 0xc # (DIE (0x148) DW_TAG_GNU_call_site_parameter) ++ .uleb128 0x1 # DW_AT_location ++ .byte 0x54 # DW_OP_reg4 ++ .uleb128 0x1 # DW_AT_GNU_call_site_value ++ .byte 0x49 # DW_OP_lit25 ++ .byte 0 # end of children of DIE 0x136 ++ .byte 0 # end of children of DIE 0x115 ++ .uleb128 0xf # (DIE (0x14f) DW_TAG_variable) ++ .ascii "v\0" # DW_AT_name ++ .byte 0x1 # DW_AT_decl_file (gdb.arch/amd64-entry-value-inline.c) ++ .byte 0x12 # DW_AT_decl_line ++ .long 0x162 # DW_AT_type ++ .uleb128 0x9 # DW_AT_location ++ .byte 0x3 # DW_OP_addr ++ .quad v ++ .uleb128 0x10 # (DIE (0x162) DW_TAG_volatile_type) ++ .long 0x52 # 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 0x55 # (DW_AT_ranges) ++ .uleb128 0x17 # (DW_FORM_sec_offset) ++ .uleb128 0x11 # (DW_AT_low_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .uleb128 0x10 # (DW_AT_stmt_list) ++ .uleb128 0x17 # (DW_FORM_sec_offset) ++ .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 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 0x27 # (DW_AT_prototyped) ++ .uleb128 0x19 # (DW_FORM_flag_present) ++ .uleb128 0x11 # (DW_AT_low_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .uleb128 0x12 # (DW_AT_high_pc) ++ .uleb128 0x7 # (DW_FORM_data8) ++ .uleb128 0x40 # (DW_AT_frame_base) ++ .uleb128 0x18 # (DW_FORM_exprloc) ++ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) ++ .uleb128 0x19 # (DW_FORM_flag_present) ++ .uleb128 0x1 # (DW_AT_sibling) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x3 # (abbrev code) ++ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) ++ .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 0x18 # (DW_FORM_exprloc) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x4 # (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 0x8 # (DW_FORM_string) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x5 # (abbrev code) ++ .uleb128 0x2e # (TAG: DW_TAG_subprogram) ++ .byte 0x1 # DW_children_yes ++ .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 0x27 # (DW_AT_prototyped) ++ .uleb128 0x19 # (DW_FORM_flag_present) ++ .uleb128 0x49 # (DW_AT_type) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .uleb128 0x20 # (DW_AT_inline) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x1 # (DW_AT_sibling) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x6 # (abbrev code) ++ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) ++ .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) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x7 # (abbrev code) ++ .uleb128 0x2e # (TAG: DW_TAG_subprogram) ++ .byte 0x1 # DW_children_yes ++ .uleb128 0x3f # (DW_AT_external) ++ .uleb128 0x19 # (DW_FORM_flag_present) ++ .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 0x27 # (DW_AT_prototyped) ++ .uleb128 0x19 # (DW_FORM_flag_present) ++ .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 0x7 # (DW_FORM_data8) ++ .uleb128 0x40 # (DW_AT_frame_base) ++ .uleb128 0x18 # (DW_FORM_exprloc) ++ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) ++ .uleb128 0x19 # (DW_FORM_flag_present) ++ .uleb128 0x1 # (DW_AT_sibling) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x8 # (abbrev code) ++ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) ++ .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 0x17 # (DW_FORM_sec_offset) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x9 # (abbrev code) ++ .uleb128 0x1d # (TAG: DW_TAG_inlined_subroutine) ++ .byte 0x1 # DW_children_yes ++ .uleb128 0x31 # (DW_AT_abstract_origin) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .uleb128 0x52 # (DW_AT_entry_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .uleb128 0x55 # (DW_AT_ranges) ++ .uleb128 0x17 # (DW_FORM_sec_offset) ++ .uleb128 0x58 # (DW_AT_call_file) ++ .uleb128 0xb # (DW_FORM_data1) ++ .uleb128 0x59 # (DW_AT_call_line) ++ .uleb128 0xb # (DW_FORM_data1) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xa # (abbrev code) ++ .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) ++ .byte 0 # DW_children_no ++ .uleb128 0x31 # (DW_AT_abstract_origin) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .uleb128 0x2 # (DW_AT_location) ++ .uleb128 0x17 # (DW_FORM_sec_offset) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xb # (abbrev code) ++ .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site) ++ .byte 0x1 # DW_children_yes ++ .uleb128 0x11 # (DW_AT_low_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .uleb128 0x31 # (DW_AT_abstract_origin) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .uleb128 0x1 # (DW_AT_sibling) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xc # (abbrev code) ++ .uleb128 0x410a # (TAG: DW_TAG_GNU_call_site_parameter) ++ .byte 0 # DW_children_no ++ .uleb128 0x2 # (DW_AT_location) ++ .uleb128 0x18 # (DW_FORM_exprloc) ++ .uleb128 0x2111 # (DW_AT_GNU_call_site_value) ++ .uleb128 0x18 # (DW_FORM_exprloc) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xd # (abbrev code) ++ .uleb128 0x4109 # (TAG: DW_TAG_GNU_call_site) ++ .byte 0x1 # DW_children_yes ++ .uleb128 0x11 # (DW_AT_low_pc) ++ .uleb128 0x1 # (DW_FORM_addr) ++ .uleb128 0x31 # (DW_AT_abstract_origin) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xe # (abbrev code) ++ .uleb128 0x2e # (TAG: DW_TAG_subprogram) ++ .byte 0x1 # DW_children_yes ++ .uleb128 0x3f # (DW_AT_external) ++ .uleb128 0x19 # (DW_FORM_flag_present) ++ .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 0x7 # (DW_FORM_data8) ++ .uleb128 0x40 # (DW_AT_frame_base) ++ .uleb128 0x18 # (DW_FORM_exprloc) ++ .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) ++ .uleb128 0x19 # (DW_FORM_flag_present) ++ .uleb128 0x1 # (DW_AT_sibling) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .uleb128 0xf # (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 0x18 # (DW_FORM_exprloc) ++ .byte 0 ++ .byte 0 ++ .uleb128 0x10 # (abbrev code) ++ .uleb128 0x35 # (TAG: DW_TAG_volatile_type) ++ .byte 0 # DW_children_no ++ .uleb128 0x49 # (DW_AT_type) ++ .uleb128 0x13 # (DW_FORM_ref4) ++ .byte 0 ++ .byte 0 ++ .byte 0 ++ .section .debug_loc,"",@progbits ++.Ldebug_loc0: ++.LLST0: ++ .quad .LVL1 # Location list begin address (*.LLST0) ++ .quad .LVL2-1 # Location list end address (*.LLST0) ++ .value 0x1 # Location expression size ++ .byte 0x55 # DW_OP_reg5 ++ .quad .LVL2-1 # Location list begin address (*.LLST0) ++ .quad .LVL7 # Location list end address (*.LLST0) ++ .value 0x1 # Location expression size ++ .byte 0x53 # DW_OP_reg3 ++ .quad .LVL7 # Location list begin address (*.LLST0) ++ .quad .LFE2 # Location list end address (*.LLST0) ++ .value 0x1 # Location expression size ++ .byte 0x50 # DW_OP_reg0 ++ .quad 0 # Location list terminator begin (*.LLST0) ++ .quad 0 # Location list terminator end (*.LLST0) ++.LLST1: ++ .quad .LVL1 # Location list begin address (*.LLST1) ++ .quad .LVL2-1 # Location list end address (*.LLST1) ++ .value 0x1 # Location expression size ++ .byte 0x54 # DW_OP_reg4 ++ .quad .LVL2-1 # Location list begin address (*.LLST1) ++ .quad .LFE2 # Location list end address (*.LLST1) ++ .value 0x4 # Location expression size ++ .byte 0xf3 # DW_OP_GNU_entry_value ++ .uleb128 0x1 ++ .byte 0x54 # DW_OP_reg4 ++ .byte 0x9f # DW_OP_stack_value ++ .quad 0 # Location list terminator begin (*.LLST1) ++ .quad 0 # Location list terminator end (*.LLST1) ++.LLST2: ++ .quad .LVL1 # Location list begin address (*.LLST2) ++ .quad .LVL2-1 # Location list end address (*.LLST2) ++ .value 0x1 # Location expression size ++ .byte 0x54 # DW_OP_reg4 ++ .quad .LVL2-1 # Location list begin address (*.LLST2) ++ .quad .LVL3 # Location list end address (*.LLST2) ++ .value 0x4 # Location expression size ++ .byte 0xf3 # DW_OP_GNU_entry_value ++ .uleb128 0x1 ++ .byte 0x54 # DW_OP_reg4 ++ .byte 0x9f # DW_OP_stack_value ++ .quad .LVL3 # Location list begin address (*.LLST2) ++ .quad .LVL4 # Location list end address (*.LLST2) ++ .value 0x1 # Location expression size ++ .byte 0x50 # DW_OP_reg0 ++ .quad .LVL4 # Location list begin address (*.LLST2) ++ .quad .LVL5 # Location list end address (*.LLST2) ++ .value 0x6 # Location expression size ++ .byte 0x70 # DW_OP_breg0 ++ .sleb128 0 ++ .byte 0x75 # DW_OP_breg5 ++ .sleb128 0 ++ .byte 0x1e # DW_OP_mul ++ .byte 0x9f # DW_OP_stack_value ++ .quad .LVL5 # Location list begin address (*.LLST2) ++ .quad .LVL6-1 # Location list end address (*.LLST2) ++ .value 0x1 # Location expression size ++ .byte 0x50 # DW_OP_reg0 ++ .quad .LVL6-1 # Location list begin address (*.LLST2) ++ .quad .LVL6 # Location list end address (*.LLST2) ++ .value 0xb # Location expression size ++ .byte 0x73 # DW_OP_breg3 ++ .sleb128 -2 ++ .byte 0x73 # DW_OP_breg3 ++ .sleb128 -2 ++ .byte 0x73 # DW_OP_breg3 ++ .sleb128 -2 ++ .byte 0x1e # DW_OP_mul ++ .byte 0x23 # DW_OP_plus_uconst ++ .uleb128 0x1 ++ .byte 0x1e # DW_OP_mul ++ .byte 0x9f # DW_OP_stack_value ++ .quad 0 # Location list terminator begin (*.LLST2) ++ .quad 0 # Location list terminator end (*.LLST2) ++ .section .debug_aranges,"",@progbits ++ .long 0x3c # Length of Address Ranges Info ++ .value 0x2 # DWARF Version ++ .long .Ldebug_info0 # Offset of Compilation Unit Info ++ .byte 0x8 # Size of Address ++ .byte 0 # Size of Segment Descriptor ++ .value 0 # Pad to 16 byte boundary ++ .value 0 ++ .quad .Ltext0 # Address ++ .quad .Letext0-.Ltext0 # Length ++ .quad .LFB3 # Address ++ .quad .LFE3-.LFB3 # Length ++ .quad 0 ++ .quad 0 ++ .section .debug_ranges,"",@progbits ++.Ldebug_ranges0: ++ .quad .LBB4 # Offset 0 ++ .quad .LBE4 ++ .quad .LBB7 ++ .quad .LBE7 ++ .quad 0 ++ .quad 0 ++ .quad .Ltext0 # Offset 0x30 ++ .quad .Letext0 ++ .quad .LFB3 # Offset 0x40 ++ .quad .LFE3 ++ .quad 0 ++ .quad 0 ++ .section .debug_line,"",@progbits ++.Ldebug_line0: ++ .section .debug_str,"MS",@progbits,1 ++.LASF0: ++ .string "GNU C 4.8.0 20121005+patches (experimental) -mtune=generic -march=x86-64 -g -O2" ++.LASF1: ++ .string "gdb.arch/amd64-entry-value-inline.c" ++.LASF2: ++ .string "" ++.LASF3: ++ .string "main" ++ .ident "GCC: (GNU) 4.8.0 20121005 (experimental)" ++ .section .note.GNU-stack,"",@progbits +diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c +new file mode 100644 +index 0000000..f7fefb8 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.c +@@ -0,0 +1,50 @@ ++/* 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 . */ ++ ++static volatile int v; ++ ++static __attribute__((noinline, noclone)) void ++fn1 (int x) ++{ ++ v++; ++} ++ ++static int ++fn2 (int x, int y) ++{ ++ if (y) ++ { ++ fn1 (x); ++ y = -2 + x; /* break-here */ ++ y = y * y * y + y; ++ fn1 (x + y); ++ } ++ return x; ++} ++ ++__attribute__((noinline, noclone)) int ++fn3 (int x, int y) ++{ ++ return fn2 (x, y); ++} ++ ++int ++main () ++{ ++ fn3 (6, 25); ++ return 0; ++} +diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp +new file mode 100644 +index 0000000..6aa92c1 +--- /dev/null ++++ b/gdb/testsuite/gdb.arch/amd64-entry-value-inline.exp +@@ -0,0 +1,40 @@ ++# Copyright (C) 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 . ++ ++set opts {} ++standard_testfile .S ++ ++if [info exists COMPILE] { ++ # make check RUNTESTFLAGS="gdb.arch/amd64-entry-value-inline.exp COMPILE=1" ++ standard_testfile ++ lappend opts debug optimize=-O2 ++} elseif { ![istarget x86_64-*-* ] || ![is_lp64_target] } { ++ verbose "Skipping ${testfile}." ++ return ++} ++ ++if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} $opts] } { ++ return -1 ++} ++ ++if ![runto_main] { ++ return -1 ++} ++ ++set srcfile $testfile.c ++gdb_breakpoint [gdb_get_line_number "break-here"] ++ ++gdb_continue_to_breakpoint "break-here" ".* break-here .*" ++gdb_test "p y" " = 25" + diff --git a/gdb-fortran-common.patch b/gdb-fortran-common.patch index 9da3724..0ad7ce5 100644 --- a/gdb-fortran-common.patch +++ b/gdb-fortran-common.patch @@ -1,8 +1,8 @@ -Index: gdb-7.4.50.20120602/gdb/dwarf2read.c +Index: gdb-7.4.91.20120801/gdb/dwarf2read.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/dwarf2read.c 2012-06-02 21:32:41.746567299 +0200 -+++ gdb-7.4.50.20120602/gdb/dwarf2read.c 2012-06-02 21:32:54.304562500 +0200 -@@ -9736,12 +9736,14 @@ read_set_type (struct die_info *die, str +--- gdb-7.4.91.20120801.orig/gdb/dwarf2read.c 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/dwarf2read.c 2012-08-01 18:38:54.201540500 +0200 +@@ -11073,12 +11073,14 @@ read_set_type (struct die_info *die, str return set_die_type (die, set_type, cu); } @@ -19,7 +19,7 @@ Index: gdb-7.4.50.20120602/gdb/dwarf2read.c struct attribute *attr; struct symbol *sym; CORE_ADDR base = (CORE_ADDR) 0; -@@ -9766,20 +9768,67 @@ read_common_block (struct die_info *die, +@@ -11103,20 +11105,67 @@ read_common_block (struct die_info *die, } if (die->child != NULL) { @@ -87,7 +87,7 @@ Index: gdb-7.4.50.20120602/gdb/dwarf2read.c } } -@@ -13661,6 +13710,13 @@ new_symbol_full (struct die_info *die, s +@@ -15155,6 +15204,13 @@ new_symbol_full (struct die_info *die, s { var_decode_location (attr, sym, cu); attr2 = dwarf2_attr (die, DW_AT_external, cu); @@ -101,7 +101,7 @@ Index: gdb-7.4.50.20120602/gdb/dwarf2read.c if (SYMBOL_CLASS (sym) == LOC_STATIC && SYMBOL_VALUE_ADDRESS (sym) == 0 && !dwarf2_per_objfile->has_section_at_zero) -@@ -13825,6 +13881,11 @@ new_symbol_full (struct die_info *die, s +@@ -15319,6 +15375,11 @@ new_symbol_full (struct die_info *die, s SYMBOL_CLASS (sym) = LOC_TYPEDEF; list_to_add = &global_symbols; break; @@ -113,10 +113,10 @@ Index: gdb-7.4.50.20120602/gdb/dwarf2read.c default: /* Not a tag we recognize. Hopefully we aren't processing trash data, but since we must specifically ignore things -Index: gdb-7.4.50.20120602/gdb/f-lang.c +Index: gdb-7.4.91.20120801/gdb/f-lang.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/f-lang.c 2012-06-02 21:32:41.746567299 +0200 -+++ gdb-7.4.50.20120602/gdb/f-lang.c 2012-06-02 21:32:54.305562499 +0200 +--- gdb-7.4.91.20120801.orig/gdb/f-lang.c 2012-08-01 18:38:24.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/f-lang.c 2012-08-01 18:38:54.202540495 +0200 @@ -370,27 +370,3 @@ _initialize_f_language (void) add_language (&f_language_defn); @@ -145,10 +145,10 @@ Index: gdb-7.4.50.20120602/gdb/f-lang.c - } - return (NULL); -} -Index: gdb-7.4.50.20120602/gdb/f-lang.h +Index: gdb-7.4.91.20120801/gdb/f-lang.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/f-lang.h 2012-06-02 21:32:41.746567299 +0200 -+++ gdb-7.4.50.20120602/gdb/f-lang.h 2012-06-02 21:32:54.322562493 +0200 +--- gdb-7.4.91.20120801.orig/gdb/f-lang.h 2012-08-01 18:38:24.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/f-lang.h 2012-08-01 18:38:54.203540489 +0200 @@ -52,37 +52,8 @@ enum f90_range_type NONE_BOUND_DEFAULT /* "(low:high)" */ }; @@ -187,10 +187,10 @@ Index: gdb-7.4.50.20120602/gdb/f-lang.h /* When reasonable array bounds cannot be fetched, such as when you ask to 'mt print symbols' and there is no stack frame and -Index: gdb-7.4.50.20120602/gdb/f-valprint.c +Index: gdb-7.4.91.20120801/gdb/f-valprint.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/f-valprint.c 2012-06-02 21:32:41.746567299 +0200 -+++ gdb-7.4.50.20120602/gdb/f-valprint.c 2012-06-02 21:33:50.514541286 +0200 +--- gdb-7.4.91.20120801.orig/gdb/f-valprint.c 2012-08-01 18:38:24.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/f-valprint.c 2012-08-01 18:41:26.411698186 +0200 @@ -34,10 +34,11 @@ #include "gdbcore.h" #include "command.h" @@ -204,15 +204,14 @@ Index: gdb-7.4.50.20120602/gdb/f-valprint.c static void f77_create_arrayprint_offset_tbl (struct type *, struct ui_file *); static void f77_get_dynamic_length_of_aggregate (struct type *); -@@ -420,22 +421,54 @@ f_val_print (struct type *type, const gd +@@ -420,22 +421,53 @@ f_val_print (struct type *type, const gd gdb_flush (stream); } -static void -list_all_visible_commons (const char *funname) +static int -+info_common_command_for_block (struct block *block, struct frame_info *frame, -+ const char *comname) ++info_common_command_for_block (struct block *block, const char *comname) { - SAVED_F77_COMMON_PTR tmp; - @@ -258,21 +257,21 @@ Index: gdb-7.4.50.20120602/gdb/f-valprint.c + } - printf_filtered (_("All COMMON blocks visible at this level:\n\n")); -+ putchar_filtered ('\n'); -+ } - +- - while (tmp != NULL) - { - if (strcmp (tmp->owning_function, funname) == 0) - printf_filtered ("%s\n", tmp->name); -- ++ putchar_filtered ('\n'); ++ } + - tmp = tmp->next; - } + return values_printed; } /* This function is used to print out the values in a given COMMON -@@ -445,11 +478,9 @@ list_all_visible_commons (const char *fu +@@ -445,11 +477,9 @@ list_all_visible_commons (const char *fu static void info_common_command (char *comname, int from_tty) { @@ -286,7 +285,7 @@ Index: gdb-7.4.50.20120602/gdb/f-valprint.c /* We have been told to display the contents of F77 COMMON block supposedly visible in this function. Let us -@@ -461,74 +492,31 @@ info_common_command (char *comname, int +@@ -461,87 +491,31 @@ info_common_command (char *comname, int /* The following is generally ripped off from stack.c's routine print_frame_info(). */ @@ -340,7 +339,7 @@ Index: gdb-7.4.50.20120602/gdb/f-valprint.c { - list_all_visible_commons (funname); - return; -+ if (info_common_command_for_block (block, fi, comname)) ++ if (info_common_command_for_block (block, comname)) + values_printed = 1; + /* After handling the function's top-level block, stop. Don't + continue to its superblock, the block of per-file symbols. */ @@ -354,6 +353,8 @@ Index: gdb-7.4.50.20120602/gdb/f-valprint.c - if (the_common) + if (!values_printed) { +- struct frame_id frame_id = get_frame_id (fi); +- - if (strcmp (comname, BLANK_COMMON_NAME_LOCAL) == 0) - printf_filtered (_("Contents of blank COMMON block:\n")); + if (comname) @@ -366,7 +367,18 @@ Index: gdb-7.4.50.20120602/gdb/f-valprint.c - - while (entry != NULL) - { +- fi = frame_find_by_id (frame_id); +- if (fi == NULL) +- { +- warning (_("Unable to restore previously selected frame.")); +- break; +- } +- - print_variable_and_value (NULL, entry->symbol, fi, gdb_stdout, 0); +- +- /* print_variable_and_value invalidates FI. */ +- fi = NULL; +- - entry = entry->next; - } + printf_filtered (_("No common blocks.\n")); @@ -377,11 +389,11 @@ Index: gdb-7.4.50.20120602/gdb/f-valprint.c } void -Index: gdb-7.4.50.20120602/gdb/stack.c +Index: gdb-7.4.91.20120801/gdb/stack.c =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/stack.c 2012-06-02 21:32:41.746567299 +0200 -+++ gdb-7.4.50.20120602/gdb/stack.c 2012-06-02 21:32:54.335562488 +0200 -@@ -1838,6 +1838,8 @@ iterate_over_block_locals (struct block +--- gdb-7.4.91.20120801.orig/gdb/stack.c 2012-08-01 18:36:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/stack.c 2012-08-01 18:38:54.206540471 +0200 +@@ -1851,6 +1851,8 @@ iterate_over_block_locals (struct block case LOC_COMPUTED: if (SYMBOL_IS_ARGUMENT (sym)) break; @@ -390,11 +402,11 @@ Index: gdb-7.4.50.20120602/gdb/stack.c (*cb) (SYMBOL_PRINT_NAME (sym), sym, cb_data); break; -Index: gdb-7.4.50.20120602/gdb/symtab.h +Index: gdb-7.4.91.20120801/gdb/symtab.h =================================================================== ---- gdb-7.4.50.20120602.orig/gdb/symtab.h 2012-06-02 21:32:41.746567299 +0200 -+++ gdb-7.4.50.20120602/gdb/symtab.h 2012-06-02 21:32:54.342562486 +0200 -@@ -389,7 +389,10 @@ typedef enum domain_enum_tag +--- gdb-7.4.91.20120801.orig/gdb/symtab.h 2012-06-30 00:46:46.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/symtab.h 2012-08-01 18:38:54.206540471 +0200 +@@ -394,7 +394,10 @@ typedef enum domain_enum_tag /* LABEL_DOMAIN may be used for names of labels (for gotos). */ @@ -406,10 +418,10 @@ Index: gdb-7.4.50.20120602/gdb/symtab.h } domain_enum; /* Searching domains, used for `search_symbols'. Element numbers are -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.exp +Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.exp 2012-06-02 21:32:54.344562484 +0200 ++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.exp 2012-08-01 18:38:54.207540465 +0200 @@ -0,0 +1,101 @@ +# Copyright 2008 Free Software Foundation, Inc. + @@ -512,10 +524,10 @@ Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.exp +gdb_test "p ix_x" " = 1 *" "p ix_x in" +gdb_test "p iy_y" " = 2 *" "p iy_y in" +gdb_test "p iz_z2" " = 3 *" "p iz_z2 in" -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.f90 +Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.f90 =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.fortran/common-block.f90 2012-06-02 21:32:54.345562483 +0200 ++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.fortran/common-block.f90 2012-08-01 18:38:54.207540465 +0200 @@ -0,0 +1,67 @@ +! Copyright 2008 Free Software Foundation, Inc. +! diff --git a/gdb-index-assert.patch b/gdb-index-assert.patch deleted file mode 100644 index 0cfb208..0000000 --- a/gdb-index-assert.patch +++ /dev/null @@ -1,60 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-06/msg00109.html -Subject: [RFA] Fix inconsistency in blockvector addrmap vs non-addrmap handling - -Hi. - -I was seeing the assert in dw2_find_pc_sect_psymtab trigger -and traced it to the fact that when pending_addrmap_interesting gets -set blockvector.map is used instead of blockvector.block. -The difference is that blockvector.block contains entries for the global -and static blocks whereas pending_addrmap doesn't. - -This patch fixes this by making them consistent. -I suspect more work is necessary (e.g. can symtabs "overlap" even though -the individual pieces do not?). -But I first want to fix the regression introduced by the change -to dw2_find_pc_sect_psymtab: There is more code in a symtab than is -documented by function and lexical block pc ranges (e.g. C++ method thunks). - -Regression tested on amd64-linux, and by verifying the assert no longer -triggers in the testcase I was using. - -Ok to commit? - -Note that this obviates the need for the patch in: -http://sourceware.org/ml/gdb-patches/2012-05/msg00958.html - -Also note that this accompanies this patch: -http://sourceware.org/ml/gdb-patches/2012-06/msg00105.html - -2012-06-04 Doug Evans - - * buildsym.c (end_symtab): Add the range of the static block to - the pending addrmap. - -Index: buildsym.c -=================================================================== -RCS file: /cvs/src/src/gdb/buildsym.c,v -retrieving revision 1.97 -diff -u -p -r1.97 buildsym.c ---- ./gdb/buildsym.c 29 May 2012 20:23:17 -0000 1.97 -+++ ./gdb/buildsym.c 5 Jun 2012 00:26:01 -0000 -@@ -1024,8 +1027,15 @@ end_symtab (CORE_ADDR end_addr, struct o - { - /* Define the STATIC_BLOCK & GLOBAL_BLOCK, and build the - blockvector. */ -- finish_block (0, &file_symbols, 0, last_source_start_addr, -- end_addr, objfile); -+ struct block *static_block; -+ -+ static_block = finish_block (0, &file_symbols, 0, -+ last_source_start_addr, end_addr, -+ objfile); -+ /* Mark the range of the static block so that if we end up using -+ blockvector.map then find_block_in_blockvector behaves identically -+ regardless of whether the addrmap is present. */ -+ record_block_range (static_block, last_source_start_addr, end_addr - 1); - finish_block_internal (0, &global_symbols, 0, last_source_start_addr, - end_addr, objfile, 1); - blockvector = make_blockvector (objfile); - diff --git a/gdb-minidebuginfo.patch b/gdb-minidebuginfo.patch new file mode 100644 index 0000000..1a534d2 --- /dev/null +++ b/gdb-minidebuginfo.patch @@ -0,0 +1,1056 @@ +http://fedoraproject.org/wiki/Features/MiniDebugInfo +https://bugzilla.redhat.com/show_bug.cgi?id=834068 + +Patch by Alexander Larsson. +Review/modifications and testfile by Jan Kratochvil. + +Index: gdb-7.4.91.20120801/gdb/Makefile.in +=================================================================== +--- gdb-7.4.91.20120801.orig/gdb/Makefile.in 2012-08-01 18:44:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/Makefile.in 2012-08-01 18:47:05.701820594 +0200 +@@ -151,6 +151,9 @@ READLINE_CFLAGS = @READLINE_CFLAGS@ + # Where is expat? This will be empty if expat was not available. + LIBEXPAT = @LIBEXPAT@ + ++# Where is lzma? This will be empty if lzma was not available. ++LIBLZMA = @LIBLZMA@ ++ + WARN_CFLAGS = @WARN_CFLAGS@ + WERROR_CFLAGS = @WERROR_CFLAGS@ + GDB_WARN_CFLAGS = $(WARN_CFLAGS) +@@ -467,7 +470,7 @@ INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CF + # LIBIBERTY appears twice on purpose. + CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \ + $(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ @PYTHON_LIBS@ \ +- $(LIBEXPAT) \ ++ $(LIBEXPAT) $(LIBLZMA) \ + $(LIBIBERTY) $(WIN32LIBS) $(LIBGNU) + CDEPS = $(XM_CDEPS) $(NAT_CDEPS) $(SIM) $(BFD) $(READLINE_DEPS) \ + $(OPCODES) $(INTL_DEPS) $(LIBIBERTY) $(CONFIG_DEPS) $(LIBGNU) +Index: gdb-7.4.91.20120801/gdb/config.in +=================================================================== +--- gdb-7.4.91.20120801.orig/gdb/config.in 2012-08-01 18:45:21.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/config.in 2012-08-01 18:47:05.701820594 +0200 +@@ -198,6 +198,9 @@ + /* Define to 1 if you have the `libiconvlist' function. */ + #undef HAVE_LIBICONVLIST + ++/* Define if you have the lzma library. */ ++#undef HAVE_LIBLZMA ++ + /* Define to 1 if you have the `m' library (-lm). */ + #undef HAVE_LIBM + +Index: gdb-7.4.91.20120801/gdb/configure +=================================================================== +--- gdb-7.4.91.20120801.orig/gdb/configure 2012-08-01 18:45:21.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/configure 2012-08-01 18:47:05.703820583 +0200 +@@ -641,6 +641,9 @@ TCL_VERSION + WIN32LDAPP + GUI_CFLAGS_X + LIBGUI ++LTLIBLZMA ++LIBLZMA ++HAVE_LIBLZMA + WIN32LIBS + SER_HARDWIRE + WERROR_CFLAGS +@@ -813,6 +816,8 @@ with_system_gdbinit + enable_werror + enable_build_warnings + enable_gdb_build_warnings ++with_lzma ++with_liblzma_prefix + with_tcl + with_tk + with_x +@@ -1532,6 +1537,9 @@ Optional Packages: + --with-sysroot[=DIR] search for usr/lib et al within DIR + --with-system-gdbinit=PATH + automatically load a system-wide gdbinit file ++ --with-lzma support lzma compression (auto/yes/no) ++ --with-liblzma-prefix[=DIR] search for liblzma in DIR/include and DIR/lib ++ --without-liblzma-prefix don't search for liblzma in includedir and libdir + --with-tcl directory containing tcl configuration (tclConfig.sh) + --with-tk directory containing tk configuration (tkConfig.sh) + --with-x use the X Window System +@@ -13151,6 +13159,494 @@ LIBS=$OLD_LIBS + # Add any host-specific objects to GDB. + CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}" + ++# If building on ELF, look for lzma support for embedded compressed debug info. ++if test $gdb_cv_var_elf = yes; then ++ ++# Check whether --with-lzma was given. ++if test "${with_lzma+set}" = set; then : ++ withval=$with_lzma; ++else ++ with_lzma=auto ++fi ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use lzma" >&5 ++$as_echo_n "checking whether to use lzma... " >&6; } ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_lzma" >&5 ++$as_echo "$with_lzma" >&6; } ++ ++ if test "${with_lzma}" != no; then ++ ++ ++ ++ ++ ++ ++ ++ ++ use_additional=yes ++ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ ++ eval additional_includedir=\"$includedir\" ++ eval additional_libdir=\"$libdir\" ++ ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++ ++ ++# Check whether --with-liblzma-prefix was given. ++if test "${with_liblzma_prefix+set}" = set; then : ++ withval=$with_liblzma_prefix; ++ if test "X$withval" = "Xno"; then ++ use_additional=no ++ else ++ if test "X$withval" = "X"; then ++ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ ++ eval additional_includedir=\"$includedir\" ++ eval additional_libdir=\"$libdir\" ++ ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++ ++ else ++ additional_includedir="$withval/include" ++ additional_libdir="$withval/lib" ++ fi ++ fi ++ ++fi ++ ++ LIBLZMA= ++ LTLIBLZMA= ++ INCLZMA= ++ rpathdirs= ++ ltrpathdirs= ++ names_already_handled= ++ names_next_round='lzma ' ++ while test -n "$names_next_round"; do ++ names_this_round="$names_next_round" ++ names_next_round= ++ for name in $names_this_round; do ++ already_handled= ++ for n in $names_already_handled; do ++ if test "$n" = "$name"; then ++ already_handled=yes ++ break ++ fi ++ done ++ if test -z "$already_handled"; then ++ names_already_handled="$names_already_handled $name" ++ uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` ++ eval value=\"\$HAVE_LIB$uppername\" ++ if test -n "$value"; then ++ if test "$value" = yes; then ++ eval value=\"\$LIB$uppername\" ++ test -z "$value" || LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$value" ++ eval value=\"\$LTLIB$uppername\" ++ test -z "$value" || LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }$value" ++ else ++ : ++ fi ++ else ++ found_dir= ++ found_la= ++ found_so= ++ found_a= ++ if test $use_additional = yes; then ++ if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then ++ found_dir="$additional_libdir" ++ found_so="$additional_libdir/lib$name.$shlibext" ++ if test -f "$additional_libdir/lib$name.la"; then ++ found_la="$additional_libdir/lib$name.la" ++ fi ++ else ++ if test -f "$additional_libdir/lib$name.$libext"; then ++ found_dir="$additional_libdir" ++ found_a="$additional_libdir/lib$name.$libext" ++ if test -f "$additional_libdir/lib$name.la"; then ++ found_la="$additional_libdir/lib$name.la" ++ fi ++ fi ++ fi ++ fi ++ if test "X$found_dir" = "X"; then ++ for x in $LDFLAGS $LTLIBLZMA; do ++ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ eval x=\"$x\" ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++ ++ case "$x" in ++ -L*) ++ dir=`echo "X$x" | sed -e 's/^X-L//'` ++ if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then ++ found_dir="$dir" ++ found_so="$dir/lib$name.$shlibext" ++ if test -f "$dir/lib$name.la"; then ++ found_la="$dir/lib$name.la" ++ fi ++ else ++ if test -f "$dir/lib$name.$libext"; then ++ found_dir="$dir" ++ found_a="$dir/lib$name.$libext" ++ if test -f "$dir/lib$name.la"; then ++ found_la="$dir/lib$name.la" ++ fi ++ fi ++ fi ++ ;; ++ esac ++ if test "X$found_dir" != "X"; then ++ break ++ fi ++ done ++ fi ++ if test "X$found_dir" != "X"; then ++ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-L$found_dir -l$name" ++ if test "X$found_so" != "X"; then ++ if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so" ++ else ++ haveit= ++ for x in $ltrpathdirs; do ++ if test "X$x" = "X$found_dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ ltrpathdirs="$ltrpathdirs $found_dir" ++ fi ++ if test "$hardcode_direct" = yes; then ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so" ++ else ++ if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so" ++ haveit= ++ for x in $rpathdirs; do ++ if test "X$x" = "X$found_dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ rpathdirs="$rpathdirs $found_dir" ++ fi ++ else ++ haveit= ++ for x in $LDFLAGS $LIBLZMA; do ++ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ eval x=\"$x\" ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++ ++ if test "X$x" = "X-L$found_dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$found_dir" ++ fi ++ if test "$hardcode_minus_L" != no; then ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_so" ++ else ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-l$name" ++ fi ++ fi ++ fi ++ fi ++ else ++ if test "X$found_a" != "X"; then ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$found_a" ++ else ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$found_dir -l$name" ++ fi ++ fi ++ additional_includedir= ++ case "$found_dir" in ++ */lib | */lib/) ++ basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` ++ additional_includedir="$basedir/include" ++ ;; ++ esac ++ if test "X$additional_includedir" != "X"; then ++ if test "X$additional_includedir" != "X/usr/include"; then ++ haveit= ++ if test "X$additional_includedir" = "X/usr/local/include"; then ++ if test -n "$GCC"; then ++ case $host_os in ++ linux*) haveit=yes;; ++ esac ++ fi ++ fi ++ if test -z "$haveit"; then ++ for x in $CPPFLAGS $INCLZMA; do ++ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ eval x=\"$x\" ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++ ++ if test "X$x" = "X-I$additional_includedir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ if test -d "$additional_includedir"; then ++ INCLZMA="${INCLZMA}${INCLZMA:+ }-I$additional_includedir" ++ fi ++ fi ++ fi ++ fi ++ fi ++ if test -n "$found_la"; then ++ save_libdir="$libdir" ++ case "$found_la" in ++ */* | *\\*) . "$found_la" ;; ++ *) . "./$found_la" ;; ++ esac ++ libdir="$save_libdir" ++ for dep in $dependency_libs; do ++ case "$dep" in ++ -L*) ++ additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` ++ if test "X$additional_libdir" != "X/usr/lib"; then ++ haveit= ++ if test "X$additional_libdir" = "X/usr/local/lib"; then ++ if test -n "$GCC"; then ++ case $host_os in ++ linux*) haveit=yes;; ++ esac ++ fi ++ fi ++ if test -z "$haveit"; then ++ haveit= ++ for x in $LDFLAGS $LIBLZMA; do ++ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ eval x=\"$x\" ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++ ++ if test "X$x" = "X-L$additional_libdir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ if test -d "$additional_libdir"; then ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-L$additional_libdir" ++ fi ++ fi ++ haveit= ++ for x in $LDFLAGS $LTLIBLZMA; do ++ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ eval x=\"$x\" ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++ ++ if test "X$x" = "X-L$additional_libdir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ if test -d "$additional_libdir"; then ++ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-L$additional_libdir" ++ fi ++ fi ++ fi ++ fi ++ ;; ++ -R*) ++ dir=`echo "X$dep" | sed -e 's/^X-R//'` ++ if test "$enable_rpath" != no; then ++ haveit= ++ for x in $rpathdirs; do ++ if test "X$x" = "X$dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ rpathdirs="$rpathdirs $dir" ++ fi ++ haveit= ++ for x in $ltrpathdirs; do ++ if test "X$x" = "X$dir"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ ltrpathdirs="$ltrpathdirs $dir" ++ fi ++ fi ++ ;; ++ -l*) ++ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ++ ;; ++ *.la) ++ names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ++ ;; ++ *) ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$dep" ++ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }$dep" ++ ;; ++ esac ++ done ++ fi ++ else ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }-l$name" ++ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-l$name" ++ fi ++ fi ++ fi ++ done ++ done ++ if test "X$rpathdirs" != "X"; then ++ if test -n "$hardcode_libdir_separator"; then ++ alldirs= ++ for found_dir in $rpathdirs; do ++ alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" ++ done ++ acl_save_libdir="$libdir" ++ libdir="$alldirs" ++ eval flag=\"$hardcode_libdir_flag_spec\" ++ libdir="$acl_save_libdir" ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$flag" ++ else ++ for found_dir in $rpathdirs; do ++ acl_save_libdir="$libdir" ++ libdir="$found_dir" ++ eval flag=\"$hardcode_libdir_flag_spec\" ++ libdir="$acl_save_libdir" ++ LIBLZMA="${LIBLZMA}${LIBLZMA:+ }$flag" ++ done ++ fi ++ fi ++ if test "X$ltrpathdirs" != "X"; then ++ for found_dir in $ltrpathdirs; do ++ LTLIBLZMA="${LTLIBLZMA}${LTLIBLZMA:+ }-R$found_dir" ++ done ++ fi ++ ++ ++ ac_save_CPPFLAGS="$CPPFLAGS" ++ ++ for element in $INCLZMA; do ++ haveit= ++ for x in $CPPFLAGS; do ++ ++ acl_save_prefix="$prefix" ++ prefix="$acl_final_prefix" ++ acl_save_exec_prefix="$exec_prefix" ++ exec_prefix="$acl_final_exec_prefix" ++ eval x=\"$x\" ++ exec_prefix="$acl_save_exec_prefix" ++ prefix="$acl_save_prefix" ++ ++ if test "X$x" = "X$element"; then ++ haveit=yes ++ break ++ fi ++ done ++ if test -z "$haveit"; then ++ CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" ++ fi ++ done ++ ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for liblzma" >&5 ++$as_echo_n "checking for liblzma... " >&6; } ++if test "${ac_cv_liblzma+set}" = set; then : ++ $as_echo_n "(cached) " >&6 ++else ++ ++ ac_save_LIBS="$LIBS" ++ LIBS="$LIBS $LIBLZMA" ++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext ++/* end confdefs.h. */ ++#include "lzma.h" ++int ++main () ++{ ++lzma_index_iter iter; ++ lzma_index_iter_init (&iter, 0); ++ lzma_mf_is_supported (LZMA_MF_HC3); ++ ; ++ return 0; ++} ++_ACEOF ++if ac_fn_c_try_link "$LINENO"; then : ++ ac_cv_liblzma=yes ++else ++ ac_cv_liblzma=no ++fi ++rm -f core conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++ LIBS="$ac_save_LIBS" ++ ++fi ++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_liblzma" >&5 ++$as_echo "$ac_cv_liblzma" >&6; } ++ if test "$ac_cv_liblzma" = yes; then ++ HAVE_LIBLZMA=yes ++ ++$as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h ++ ++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with liblzma" >&5 ++$as_echo_n "checking how to link with liblzma... " >&6; } ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBLZMA" >&5 ++$as_echo "$LIBLZMA" >&6; } ++ else ++ HAVE_LIBLZMA=no ++ CPPFLAGS="$ac_save_CPPFLAGS" ++ LIBLZMA= ++ LTLIBLZMA= ++ fi ++ ++ ++ ++ ++ ++ ++ if test "$HAVE_LIBLZMA" != yes; then ++ if test "$with_lzma" = yes; then ++ as_fn_error "missing liblzma for --with-lzma" "$LINENO" 5 ++ fi ++ fi ++ fi ++fi ++ + LIBGUI="../libgui/src/libgui.a" + GUI_CFLAGS_X="-I${srcdir}/../libgui/src" + +Index: gdb-7.4.91.20120801/gdb/configure.ac +=================================================================== +--- gdb-7.4.91.20120801.orig/gdb/configure.ac 2012-08-01 18:45:21.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/configure.ac 2012-08-01 18:47:05.704820577 +0200 +@@ -2196,6 +2196,27 @@ LIBS=$OLD_LIBS + # Add any host-specific objects to GDB. + CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}" + ++# If building on ELF, look for lzma support for embedded compressed debug info. ++if test $gdb_cv_var_elf = yes; then ++ AC_ARG_WITH(lzma, ++ AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]), ++ [], [with_lzma=auto]) ++ AC_MSG_CHECKING([whether to use lzma]) ++ AC_MSG_RESULT([$with_lzma]) ++ ++ if test "${with_lzma}" != no; then ++ AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include "lzma.h"], ++ [lzma_index_iter iter; ++ lzma_index_iter_init (&iter, 0); ++ lzma_mf_is_supported (LZMA_MF_HC3);]) ++ if test "$HAVE_LIBLZMA" != yes; then ++ if test "$with_lzma" = yes; then ++ AC_MSG_ERROR([missing liblzma for --with-lzma]) ++ fi ++ fi ++ fi ++fi ++ + LIBGUI="../libgui/src/libgui.a" + GUI_CFLAGS_X="-I${srcdir}/../libgui/src" + AC_SUBST(LIBGUI) +Index: gdb-7.4.91.20120801/gdb/elfread.c +=================================================================== +--- gdb-7.4.91.20120801.orig/gdb/elfread.c 2012-08-01 18:44:51.000000000 +0200 ++++ gdb-7.4.91.20120801/gdb/elfread.c 2012-08-01 18:57:59.528202398 +0200 +@@ -51,6 +51,10 @@ + #include "observer.h" + #include "elf/external.h" + #include ++#include "gdbcore.h" ++#ifdef HAVE_LIBLZMA ++# include ++#endif + + extern void _initialize_elfread (void); + +@@ -2210,6 +2214,262 @@ find_separate_debug_file_by_buildid (str + return NULL; + } + ++#ifdef HAVE_LIBLZMA ++ ++/* Custom lzma_allocator.alloc so they use the gdb ones. */ ++ ++static void * ++alloc_lzma (void *opaque, size_t nmemb, size_t size) ++{ ++ return xmalloc (nmemb * size); ++} ++ ++/* Custom lzma_allocator.free so they use the gdb ones. */ ++ ++static void ++free_lzma (void *opaque, void *ptr) ++{ ++ xfree (ptr); ++} ++ ++/* It cannot be const due to the lzma library function prototypes. */ ++ ++static lzma_allocator gdb_lzma_allocator = { alloc_lzma, free_lzma, NULL}; ++ ++/* Custom bfd_openr_iovec implementation to read compressed data from a ++ section. This keeps only the last decompressed block in memory to ++ allow larger data without using to much memory. */ ++ ++struct lzma_stream ++{ ++ /* Section of input BFD we are decoding data from. */ ++ asection *section; ++ ++ /* lzma library decompression state. */ ++ lzma_index *index; ++ ++ /* Currently decoded block. */ ++ bfd_size_type data_start; ++ bfd_size_type data_end; ++ gdb_byte *data; ++}; ++ ++/* bfd_openr_iovec OPEN_P implementation for ++ find_separate_debug_file_in_section. OPEN_CLOSURE is 'asection *' of the ++ section to decompress. ++ ++ Return 'struct lzma_stream *' must be freed by caller by xfree, together ++ with its INDEX lzma data. */ ++ ++static void * ++lzma_open (struct bfd *nbfd, void *open_closure) ++{ ++ asection *section = open_closure; ++ bfd_size_type size, offset; ++ lzma_stream_flags options; ++ gdb_byte footer[LZMA_STREAM_HEADER_SIZE]; ++ gdb_byte *indexdata; ++ lzma_index *index; ++ int ret; ++ uint64_t memlimit = UINT64_MAX; ++ struct lzma_stream *lstream; ++ size_t pos; ++ ++ size = bfd_get_section_size (section); ++ offset = section->filepos + size - LZMA_STREAM_HEADER_SIZE; ++ if (size < LZMA_STREAM_HEADER_SIZE ++ || bfd_seek (section->owner, offset, SEEK_SET) != 0 ++ || bfd_bread (footer, LZMA_STREAM_HEADER_SIZE, section->owner) ++ != LZMA_STREAM_HEADER_SIZE ++ || lzma_stream_footer_decode (&options, footer) != LZMA_OK ++ || offset < options.backward_size) ++ { ++ bfd_set_error (bfd_error_wrong_format); ++ return NULL; ++ } ++ ++ offset -= options.backward_size; ++ indexdata = xmalloc (options.backward_size); ++ index = NULL; ++ pos = 0; ++ if (bfd_seek (section->owner, offset, SEEK_SET) != 0 ++ || bfd_bread (indexdata, options.backward_size, section->owner) ++ != options.backward_size ++ || lzma_index_buffer_decode (&index, &memlimit, &gdb_lzma_allocator, ++ indexdata, &pos, options.backward_size) ++ != LZMA_OK ++ || lzma_index_size (index) != options.backward_size) ++ { ++ xfree (indexdata); ++ bfd_set_error (bfd_error_wrong_format); ++ return NULL; ++ } ++ xfree (indexdata); ++ ++ lstream = xzalloc (sizeof (struct lzma_stream)); ++ lstream->section = section; ++ lstream->index = index; ++ ++ return lstream; ++} ++ ++/* bfd_openr_iovec PREAD_P implementation for ++ find_separate_debug_file_in_section. Passed STREAM ++ is 'struct lzma_stream *'. */ ++ ++static file_ptr ++lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes, ++ file_ptr offset) ++{ ++ struct lzma_stream *lstream = stream; ++ bfd_size_type chunk_size; ++ lzma_index_iter iter; ++ gdb_byte *compressed, *uncompressed; ++ file_ptr block_offset; ++ lzma_filter filters[LZMA_FILTERS_MAX + 1]; ++ lzma_block block; ++ size_t compressed_pos, uncompressed_pos; ++ file_ptr res; ++ ++ res = 0; ++ while (nbytes > 0) ++ { ++ if (lstream->data == NULL ++ || lstream->data_start > offset || offset >= lstream->data_end) ++ { ++ asection *section = lstream->section; ++ ++ lzma_index_iter_init (&iter, lstream->index); ++ if (lzma_index_iter_locate (&iter, offset)) ++ break; ++ ++ compressed = xmalloc (iter.block.total_size); ++ block_offset = section->filepos + iter.block.compressed_file_offset; ++ if (bfd_seek (section->owner, block_offset, SEEK_SET) != 0 ++ || bfd_bread (compressed, iter.block.total_size, section->owner) ++ != iter.block.total_size) ++ { ++ xfree (compressed); ++ break; ++ } ++ ++ uncompressed = xmalloc (iter.block.uncompressed_size); ++ ++ memset (&block, 0, sizeof (block)); ++ block.filters = filters; ++ block.header_size = lzma_block_header_size_decode (compressed[0]); ++ if (lzma_block_header_decode (&block, &gdb_lzma_allocator, compressed) ++ != LZMA_OK) ++ { ++ xfree (compressed); ++ xfree (uncompressed); ++ break; ++ } ++ ++ compressed_pos = block.header_size; ++ uncompressed_pos = 0; ++ if (lzma_block_buffer_decode (&block, &gdb_lzma_allocator, ++ compressed, &compressed_pos, ++ iter.block.total_size, ++ uncompressed, &uncompressed_pos, ++ iter.block.uncompressed_size) ++ != LZMA_OK) ++ { ++ xfree (compressed); ++ xfree (uncompressed); ++ break; ++ } ++ ++ xfree (compressed); ++ ++ xfree (lstream->data); ++ lstream->data = uncompressed; ++ lstream->data_start = iter.block.uncompressed_file_offset; ++ lstream->data_end = (iter.block.uncompressed_file_offset ++ + iter.block.uncompressed_size); ++ } ++ ++ chunk_size = min (nbytes, lstream->data_end - offset); ++ memcpy (buf, lstream->data + offset - lstream->data_start, chunk_size); ++ buf = (gdb_byte *) buf + chunk_size; ++ offset += chunk_size; ++ nbytes -= chunk_size; ++ res += chunk_size; ++ } ++ ++ return res; ++} ++ ++/* bfd_openr_iovec CLOSE_P implementation for ++ find_separate_debug_file_in_section. Passed STREAM ++ is 'struct lzma_stream *'. */ ++ ++static int ++lzma_close (struct bfd *nbfd, ++ void *stream) ++{ ++ struct lzma_stream *lstream = stream; ++ ++ lzma_index_end (lstream->index, &gdb_lzma_allocator); ++ xfree (lstream->data); ++ xfree (lstream); ++ return 0; ++} ++ ++/* bfd_openr_iovec STAT_P implementation for ++ find_separate_debug_file_in_section. Passed STREAM ++ is 'struct lzma_stream *'. */ ++ ++static int ++lzma_stat (struct bfd *abfd, ++ void *stream, ++ struct stat *sb) ++{ ++ struct lzma_stream *lstream = stream; ++ ++ sb->st_size = lzma_index_uncompressed_size (lstream->index); ++ return 0; ++} ++ ++/* This looks for a xz compressed separate debug info object file embedded ++ in a section called .gnu_debugdata. If we find one we create a iovec ++ based bfd that decompresses the object data on demand. */ ++ ++static bfd * ++find_separate_debug_file_in_section (struct objfile *objfile) ++{ ++ asection *section; ++ bfd *abfd; ++ ++ section = bfd_get_section_by_name (objfile->obfd, ".gnu_debugdata"); ++ if (section == NULL) ++ return NULL; ++ ++ /* objfile->NAME lifetime is longer than the ABFD's lifetime. */ ++ abfd = gdb_bfd_openr_iovec (objfile->name, gnutarget, lzma_open, section, ++ lzma_pread, lzma_close, lzma_stat); ++ if (abfd == NULL) ++ return NULL; ++ ++ if (!bfd_check_format (abfd, bfd_object)) ++ { ++ gdb_bfd_unref (abfd); ++ return NULL; ++ } ++ ++ return abfd; ++} ++ ++#else /* !HAVE_LIBLZMA */ ++ ++static bfd * ++find_separate_debug_file_in_section (struct objfile *objfile) ++{ ++ return NULL; ++} ++ ++#endif /* !HAVE_LIBLZMA */ ++ + /* Scan and build partial symbols for a symbol file. + We have been initialized by a call to elf_symfile_init, which + currently does nothing. +@@ -2433,6 +2693,8 @@ elf_symfile_read (struct objfile *objfil + else if (!objfile_has_partial_symbols (objfile)) + { + char *debugfile, *build_id_filename; ++ bfd *abfd = NULL; ++ struct cleanup *cleanup; + + debugfile = find_separate_debug_file_by_buildid (objfile, + &build_id_filename); +@@ -2440,14 +2702,11 @@ elf_symfile_read (struct objfile *objfil + if (debugfile == NULL) + debugfile = find_separate_debug_file_by_debuglink (objfile); + ++ cleanup = make_cleanup (xfree, debugfile); + if (debugfile) + { +- struct cleanup *cleanup = make_cleanup (xfree, debugfile); +- bfd *abfd = symfile_bfd_open (debugfile); +- ++ abfd = symfile_bfd_open (debugfile); + make_cleanup_bfd_unref (abfd); +- symbol_file_add_separate (abfd, symfile_flags, objfile); +- do_cleanups (cleanup); + } + /* Check if any separate debug info has been extracted out. */ + else if (bfd_get_section_by_name (objfile->obfd, ".gnu_debuglink") +@@ -2455,6 +2714,17 @@ elf_symfile_read (struct objfile *objfil + debug_print_missing (objfile->name, build_id_filename); + + xfree (build_id_filename); ++ ++ if (abfd == NULL) ++ { ++ abfd = find_separate_debug_file_in_section (objfile); ++ make_cleanup_bfd_unref (abfd); ++ } ++ ++ if (abfd != NULL) ++ symbol_file_add_separate (abfd, symfile_flags, objfile); ++ ++ do_cleanups (cleanup); + } + + if (symtab_create_debug) +Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.c 2012-08-01 18:47:05.705820572 +0200 +@@ -0,0 +1,30 @@ ++/* 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 . */ ++ ++#include ++ ++static int ++debugdata_function (void) ++{ ++ return raise (SIGSEGV) + 1; ++} ++ ++int ++main (void) ++{ ++ return debugdata_function () + 1; ++} +Index: gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.4.91.20120801/gdb/testsuite/gdb.dwarf2/dw2-gnu-debugdata.exp 2012-08-01 18:47:05.705820572 +0200 +@@ -0,0 +1,91 @@ ++# 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 ++ ++load_lib dwarf.exp ++if ![dwarf2_support] { ++ return 0 ++} ++ ++if [build_executable ${testfile}.exp $testfile] { ++ return -1 ++} ++ ++proc run { test cmdline } { ++ verbose "cmdline is $cmdline" ++ set result [catch "exec $cmdline" output] ++ verbose "result is $result" ++ verbose "output is $output" ++ if {$result == 0} { ++ pass $test ++ return 0 ++ } else { ++ fail $test ++ return -1 ++ } ++} ++ ++set strip_program [transform strip] ++set nm_program [transform nm] ++ ++# Extract the dynamic symbols from the main binary, there is no need to also have these ++# in the normal symbol table ++file delete -- ${binfile}.dynsyms ++if [run "nm -D" "[transform nm] -D ${binfile} --format=posix --defined-only | awk \\{print\\ \\\$1\\} | sort > ${binfile}.dynsyms"] { ++ return -1 ++} ++ ++# Extract all the text (i.e. function) symbols from the debuginfo ++file delete -- ${binfile}.funcsyms ++if [run "nm" "[transform nm] ${binfile} --format=posix --defined-only | awk \\{if(\\\$2==\"T\"||\\\$2==\"t\")print\\ \\\$1\\} | sort > ${binfile}.funcsyms"] { ++ return -1 ++} ++ ++# Keep all the function symbols not already in the dynamic symbol table ++file delete -- ${binfile}.keep_symbols ++if [run "comm" "comm -13 ${binfile}.dynsyms ${binfile}.funcsyms > ${binfile}.keep_symbols"] { ++ return -1 ++} ++ ++# Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections ++file delete -- ${binfile}.mini_debuginfo ++if [run "objcopy 1" "[transform objcopy] -S --remove-section .gdb_index --remove-section .comment --keep-symbols=${binfile}.keep_symbols ${binfile} ${binfile}.mini_debuginfo"] { ++ return -1 ++} ++ ++# GDB specific - we do not have split executable in advance. ++file delete -- ${binfile}.strip ++if [run "strip" "[transform strip] --strip-all -o ${binfile}.strip ${binfile}"] { ++ return -1 ++} ++ ++# Inject the compressed data into the .gnu_debugdata section of the original binary ++file delete -- ${binfile}.mini_debuginfo.xz ++if [run "xz" "xz ${binfile}.mini_debuginfo"] { ++ return -1 ++} ++file delete -- ${binfile}.test ++if [run "objcopy 2" "[transform objcopy] --add-section .gnu_debugdata=${binfile}.mini_debuginfo.xz ${binfile}.strip ${binfile}.test"] { ++ return -1 ++} ++ ++clean_restart "$testfile.strip" ++ ++gdb_test "p debugdata_function" {No symbol table is loaded\. Use the "file" command\.} "no symtab" ++ ++clean_restart "$testfile.test" ++ ++gdb_test "p debugdata_function" { = {} 0x[0-9a-f]+ } "have symtab" diff --git a/gdb-objfile-order.patch b/gdb-objfile-order.patch deleted file mode 100644 index 90aca1e..0000000 --- a/gdb-objfile-order.patch +++ /dev/null @@ -1,215 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-05/msg01105.html -Subject: [RFA/commit 1/3] Revert "Search global symbols from the expression's block objfile first." - -The search order used in this patch breaks global symbol lookups -for certain symbols when copy-relocation is used. A slightly different -search order will be implemented later. - -gdb/ChangeLog: - - Revert the following patch: - * findvar.c (default_read_var_value): For LOC_UNRESOLVED symbols, - try locating the symbol in the symbol's own objfile first, before - extending the search to all objfiles. - * symtab.c (lookup_symbol_aux_objfile): New function, extracted - out of lookup_symbol_aux_symtabs. - (lookup_symbol_aux_symtabs): Add new parameter "exclude_objfile". - Replace extracted-out code by call to lookup_symbol_aux_objfile. - Do not search EXCLUDE_OBJFILE. - (lookup_static_symbol_aux): Update call to lookup_symbol_aux_symtabs. - (lookup_symbol_global): Search for matches in the block's objfile - first, before searching all other objfiles. - -Will commit if patches #2 & #3 are OK. - ---- - gdb/findvar.c | 10 +----- - gdb/symtab.c | 108 +++++++++++++++++---------------------------------------- - 2 files changed, 33 insertions(+), 85 deletions(-) - -diff --git a/gdb/findvar.c b/gdb/findvar.c -index ed7903c..9009e6f 100644 ---- a/gdb/findvar.c -+++ b/gdb/findvar.c -@@ -562,15 +562,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame) - struct minimal_symbol *msym; - struct obj_section *obj_section; - -- /* First, try locating the associated minimal symbol within -- the same objfile. This prevents us from selecting another -- symbol with the same name but located in a different objfile. */ -- msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, -- SYMBOL_SYMTAB (var)->objfile); -- /* If the lookup failed, try expanding the search to all -- objfiles. */ -- if (msym == NULL) -- msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL); -+ msym = lookup_minimal_symbol (SYMBOL_LINKAGE_NAME (var), NULL, NULL); - if (msym == NULL) - error (_("No global symbol \"%s\"."), SYMBOL_LINKAGE_NAME (var)); - if (overlay_debugging) -diff --git a/gdb/symtab.c b/gdb/symtab.c -index 85ddd1d..39d8c6f 100644 ---- a/gdb/symtab.c -+++ b/gdb/symtab.c -@@ -95,8 +95,7 @@ struct symbol *lookup_symbol_aux_local (const char *name, - static - struct symbol *lookup_symbol_aux_symtabs (int block_index, - const char *name, -- const domain_enum domain, -- struct objfile *exclude_objfile); -+ const domain_enum domain); - - static - struct symbol *lookup_symbol_aux_quick (struct objfile *objfile, -@@ -1360,7 +1359,7 @@ lookup_static_symbol_aux (const char *name, const domain_enum domain) - struct objfile *objfile; - struct symbol *sym; - -- sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain, NULL); -+ sym = lookup_symbol_aux_symtabs (STATIC_BLOCK, name, domain); - if (sym != NULL) - return sym; - -@@ -1499,61 +1498,40 @@ lookup_global_symbol_from_objfile (const struct objfile *main_objfile, - return NULL; - } - --/* Check to see if the symbol is defined in one of the OBJFILE's -- symtabs. BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK, -+/* Check to see if the symbol is defined in one of the symtabs. -+ BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK, - depending on whether or not we want to search global symbols or - static symbols. */ - - static struct symbol * --lookup_symbol_aux_objfile (struct objfile *objfile, int block_index, -- const char *name, const domain_enum domain) --{ -- struct symbol *sym = NULL; -- struct blockvector *bv; -- const struct block *block; -- struct symtab *s; -- -- if (objfile->sf) -- objfile->sf->qf->pre_expand_symtabs_matching (objfile, block_index, -- name, domain); -- -- ALL_OBJFILE_SYMTABS (objfile, s) -- if (s->primary) -- { -- bv = BLOCKVECTOR (s); -- block = BLOCKVECTOR_BLOCK (bv, block_index); -- sym = lookup_block_symbol (block, name, domain); -- if (sym) -- { -- block_found = block; -- return fixup_symbol_section (sym, objfile); -- } -- } -- -- return NULL; --} -- --/* Same as lookup_symbol_aux_objfile, except that it searches all -- objfiles except for EXCLUDE_OBJFILE. Return the first match found. -- -- If EXCLUDE_OBJFILE is NULL, then all objfiles are searched. */ -- --static struct symbol * - lookup_symbol_aux_symtabs (int block_index, const char *name, -- const domain_enum domain, -- struct objfile *exclude_objfile) -+ const domain_enum domain) - { - struct symbol *sym; - struct objfile *objfile; -+ struct blockvector *bv; -+ const struct block *block; -+ struct symtab *s; - - ALL_OBJFILES (objfile) - { -- if (objfile != exclude_objfile) -- { -- sym = lookup_symbol_aux_objfile (objfile, block_index, name, domain); -- if (sym) -- return sym; -- } -+ if (objfile->sf) -+ objfile->sf->qf->pre_expand_symtabs_matching (objfile, -+ block_index, -+ name, domain); -+ -+ ALL_OBJFILE_SYMTABS (objfile, s) -+ if (s->primary) -+ { -+ bv = BLOCKVECTOR (s); -+ block = BLOCKVECTOR_BLOCK (bv, block_index); -+ sym = lookup_block_symbol (block, name, domain); -+ if (sym) -+ { -+ block_found = block; -+ return fixup_symbol_section (sym, objfile); -+ } -+ } - } - - return NULL; -@@ -1679,46 +1657,24 @@ lookup_symbol_global (const char *name, - const domain_enum domain) - { - struct symbol *sym = NULL; -- struct objfile *block_objfile = NULL; - struct objfile *objfile = NULL; - - /* Call library-specific lookup procedure. */ -- block_objfile = lookup_objfile_from_block (block); -- if (block_objfile != NULL) -- sym = solib_global_lookup (block_objfile, name, domain); -+ objfile = lookup_objfile_from_block (block); -+ if (objfile != NULL) -+ sym = solib_global_lookup (objfile, name, domain); - if (sym != NULL) - return sym; - -- /* If BLOCK_OBJFILE is not NULL, then search this objfile first. -- In case the global symbol is defined in multiple objfiles, -- we have a better chance of finding the most relevant symbol. */ -- -- if (block_objfile != NULL) -- { -- sym = lookup_symbol_aux_objfile (block_objfile, GLOBAL_BLOCK, -- name, domain); -- if (sym == NULL) -- sym = lookup_symbol_aux_quick (block_objfile, GLOBAL_BLOCK, -- name, domain); -- if (sym != NULL) -- return sym; -- } -- -- /* Symbol not found in the BLOCK_OBJFILE, so try all the other -- objfiles, starting with symtabs first, and then partial symtabs. */ -- -- sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, domain, block_objfile); -+ sym = lookup_symbol_aux_symtabs (GLOBAL_BLOCK, name, domain); - if (sym != NULL) - return sym; - - ALL_OBJFILES (objfile) - { -- if (objfile != block_objfile) -- { -- sym = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK, name, domain); -- if (sym) -- return sym; -- } -+ sym = lookup_symbol_aux_quick (objfile, GLOBAL_BLOCK, name, domain); -+ if (sym) -+ return sym; - } - - return NULL; --- -1.7.1 - diff --git a/gdb-print-class.patch b/gdb-print-class.patch new file mode 100644 index 0000000..0c41f82 --- /dev/null +++ b/gdb-print-class.patch @@ -0,0 +1,110 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00169.html + +### src/gdb/ChangeLog 2012/09/27 12:53:57 1.14718 +### src/gdb/ChangeLog 2012/09/27 16:04:18 1.14719 +## -1,3 +1,8 @@ ++2012-09-27 Tom Tromey ++ ++ Fix https://bugzilla.redhat.com/show_bug.cgi?id=849357 ++ * cp-valprint.c (cp_print_value_fields): Use get_vptr_fieldno. ++ + 2012-09-27 Joel Brobecker + + * sol-thread.c (sol_thread_fetch_registers) +--- src/gdb/cp-valprint.c 2012/07/06 05:36:07 1.85 ++++ src/gdb/cp-valprint.c 2012/09/27 16:04:22 1.86 +@@ -210,7 +210,9 @@ + { + int statmem_obstack_initial_size = 0; + int stat_array_obstack_initial_size = 0; +- ++ struct type *vptr_basetype = NULL; ++ int vptr_fieldno; ++ + if (dont_print_statmem == 0) + { + statmem_obstack_initial_size = +@@ -225,6 +227,7 @@ + } + } + ++ vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype); + for (i = n_baseclasses; i < len; i++) + { + /* If requested, skip printing of static fields. */ +@@ -358,7 +361,7 @@ + v, stream, recurse + 1, + options); + } +- else if (i == TYPE_VPTR_FIELDNO (type)) ++ else if (i == vptr_fieldno && type == vptr_basetype) + { + int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8; + struct type *i_type = TYPE_FIELD_TYPE (type, i); +### src/gdb/testsuite/ChangeLog 2012/09/26 19:50:12 1.3396 +### src/gdb/testsuite/ChangeLog 2012/09/27 16:04:22 1.3397 +## -1,3 +1,10 @@ ++2012-09-27 Tom Tromey ++ ++ * gdb.cp/derivation.exp: Add regression test. ++ * gdb.cp/derivation.cc (class V_base, class V_inter, class ++ V_derived): New. ++ (vderived): New global. ++ + 2012-09-26 Tom Tromey + + * gdb.dwarf2/dw2-common-block.S: New file. +--- src/gdb/testsuite/gdb.cp/derivation.cc 2011/12/13 17:22:08 1.2 ++++ src/gdb/testsuite/gdb.cp/derivation.cc 2012/09/27 16:04:23 1.3 +@@ -118,8 +118,37 @@ + + }; + ++class V_base ++{ ++public: ++ virtual void m(); ++ int base; ++}; + ++void ++V_base::m() ++{ ++} ++ ++class V_inter : public virtual V_base ++{ ++public: ++ virtual void f(); ++ int inter; ++}; ++ ++void ++V_inter::f() ++{ ++} ++ ++class V_derived : public V_inter ++{ ++public: ++ double x; ++}; + ++V_derived vderived; + + int A::afoo() { + return 1; +--- src/gdb/testsuite/gdb.cp/derivation.exp 2012/07/10 15:18:18 1.19 ++++ src/gdb/testsuite/gdb.cp/derivation.exp 2012/09/27 16:04:23 1.20 +@@ -176,3 +176,11 @@ + + gdb_test "print g_instance.bfoo()" "\\$\[0-9\]+ = 2" "print value of g_instance.bfoo()" + gdb_test "print g_instance.cfoo()" "\\$\[0-9\]+ = 3" "print value of g_instance.cfoo()" ++ ++# This is a regression test for a bug that caused a crash when trying ++# to print the vtbl pointer. We don't care about the output so much ++# here (it is tested elsewhere), just that gdb doesn't crash. We test ++# "ptype" first because, before the gdb fix, that was the only code ++# path calling get_vptr_fieldno. ++gdb_test "ptype vderived" "type = .*" ++gdb_test "print vderived" " = {.* inter = 0.*x = 0}" diff --git a/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch new file mode 100644 index 0000000..f9574ee --- /dev/null +++ b/gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch @@ -0,0 +1,75 @@ +Index: gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c +=================================================================== +--- /dev/null ++++ gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.c +@@ -0,0 +1,26 @@ ++/* Copyright (C) 2012 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 ++#include ++ ++int ++main (int argc, char *argv[]) ++{ ++ printf ("Hello, World.\n"); ++ abort (); ++} +Index: gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp +=================================================================== +--- /dev/null ++++ gdb-7.0.1/gdb/testsuite/gdb.base/set-solib-absolute-prefix.exp +@@ -0,0 +1,39 @@ ++# 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 . ++ ++set testfile "set-solib-absolute-prefix" ++set srcfile ${testfile}.c ++ ++# It is necessary to verify if the binary is 32-bit, so that the system ++# call `__kernel_vsyscall' originates from vDSO. ++ ++if { ![is_ilp32_target] } { ++ return -1 ++} ++ ++if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { ++ return -1 ++} ++ ++if { ![runto_main] } { ++ return -1 ++} ++ ++gdb_test "continue" "Program received signal SIGABRT, Aborted.*" \ ++ "continue until abort" ++gdb_test "set solib-absolute-prefix /BOGUS_DIRECT" \ ++ ".*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-rhbz795424-bitpos-06of25.patch b/gdb-rhbz795424-bitpos-06of25.patch new file mode 100644 index 0000000..769f404 --- /dev/null +++ b/gdb-rhbz795424-bitpos-06of25.patch @@ -0,0 +1,23 @@ +http://sourceware.org/ml/gdb-cvs/2012-07/msg00173.html + +### src/gdb/ChangeLog 2012/07/20 17:54:05 1.14507 +### src/gdb/ChangeLog 2012/07/22 16:52:39 1.14508 +## -1,3 +1,7 @@ ++2012-07-22 Siddhesh Poyarekar ++ ++ * sh-tdep.c (sh_treat_as_flt_p): Remove unused variable LEN. ++ + 2012-07-20 Jeff Kenton + + * tilegx-linux-tdep.c (tilegx_linux_sigframe_init): Fix +--- src/gdb/sh-tdep.c 2012/06/08 14:24:57 1.245 ++++ src/gdb/sh-tdep.c 2012/07/22 16:52:41 1.246 +@@ -1032,8 +1032,6 @@ + static int + sh_treat_as_flt_p (struct type *type) + { +- int len = TYPE_LENGTH (type); +- + /* Ordinary float types are obviously treated as float. */ + if (TYPE_CODE (type) == TYPE_CODE_FLT) + return 1; diff --git a/gdb-rhbz795424-bitpos-07of25.patch b/gdb-rhbz795424-bitpos-07of25.patch new file mode 100644 index 0000000..215144a --- /dev/null +++ b/gdb-rhbz795424-bitpos-07of25.patch @@ -0,0 +1,64 @@ +http://sourceware.org/ml/gdb-cvs/2012-07/msg00182.html + +### src/gdb/ChangeLog 2012/07/23 15:25:11 1.14514 +### src/gdb/ChangeLog 2012/07/23 18:08:27 1.14515 +## -1,3 +1,9 @@ ++2012-07-23 Siddhesh Poyarekar ++ ++ * p-valprint.c (pascal_object_print_value): Replace potentially ++ unsafe alloca with xmalloc/xfree. ++ * valops.c (search_struct_method): Likewise. ++ + 2012-07-23 Tom Tromey + + * solib-svr4.c (enable_break): Update. +--- src/gdb/p-valprint.c 2012/05/18 21:02:49 1.100 ++++ src/gdb/p-valprint.c 2012/07/23 18:08:29 1.101 +@@ -797,8 +797,11 @@ + + if (boffset < 0 || boffset >= TYPE_LENGTH (type)) + { +- /* FIXME (alloc): not safe is baseclass is really really big. */ +- gdb_byte *buf = alloca (TYPE_LENGTH (baseclass)); ++ gdb_byte *buf; ++ struct cleanup *back_to; ++ ++ buf = xmalloc (TYPE_LENGTH (baseclass)); ++ back_to = make_cleanup (xfree, buf); + + base_valaddr = buf; + if (target_read_memory (address + boffset, buf, +@@ -807,6 +810,7 @@ + address = address + boffset; + thisoffset = 0; + boffset = 0; ++ do_cleanups (back_to); + } + else + base_valaddr = valaddr; +--- src/gdb/valops.c 2012/06/24 07:28:10 1.297 ++++ src/gdb/valops.c 2012/07/23 18:08:29 1.298 +@@ -2281,8 +2281,13 @@ + + if (offset < 0 || offset >= TYPE_LENGTH (type)) + { +- gdb_byte *tmp = alloca (TYPE_LENGTH (baseclass)); +- CORE_ADDR address = value_address (*arg1p); ++ gdb_byte *tmp; ++ struct cleanup *back_to; ++ CORE_ADDR address; ++ ++ tmp = xmalloc (TYPE_LENGTH (baseclass)); ++ back_to = make_cleanup (xfree, tmp); ++ address = value_address (*arg1p); + + if (target_read_memory (address + offset, + tmp, TYPE_LENGTH (baseclass)) != 0) +@@ -2293,6 +2298,7 @@ + address + offset); + base_valaddr = value_contents_for_printing (base_val); + this_offset = 0; ++ do_cleanups (back_to); + } + else + { diff --git a/gdb-rhbz795424-bitpos-08of25.patch b/gdb-rhbz795424-bitpos-08of25.patch new file mode 100644 index 0000000..446476e --- /dev/null +++ b/gdb-rhbz795424-bitpos-08of25.patch @@ -0,0 +1,139 @@ +http://sourceware.org/ml/gdb-cvs/2012-07/msg00213.html + +### src/gdb/ChangeLog 2012/07/25 20:14:17 1.14531 +### src/gdb/ChangeLog 2012/07/26 02:03:14 1.14532 +## -1,3 +1,17 @@ ++2012-07-26 Siddhesh Poyarekar ++ ++ * dwarf2loc.c (dwarf2_evaluate_loc_desc_full): Expand parameter ++ SIZE to size_t. ++ (dwarf2_evaluate_loc_desc): Likewise. ++ (dwarf2_loc_desc_needs_frame): Likewise. ++ (locexpr_describe_location_1): Likewise. ++ * dwarf2loc.h (struct dwarf2_locexpr_baton): Make SIZE as ++ size_t. ++ (struct dwarf2_loclist_baton): Likewise. ++ * dwarf2read.c (struct dwarf_block): Likewise. ++ (dump_die_shallow): Use pulongest to print dwarf_block.size. ++ (decode_locdesc): Expand SIZE and I to size_t. ++ + 2012-07-25 Jan Kratochvil + + * contrib/cc-with-tweaks.sh: Put into comment path gdb/contrib/. +--- src/gdb/dwarf2loc.c 2012/07/13 20:15:50 1.152 ++++ src/gdb/dwarf2loc.c 2012/07/26 02:03:16 1.153 +@@ -54,8 +54,8 @@ + static struct value *dwarf2_evaluate_loc_desc_full (struct type *type, + struct frame_info *frame, + const gdb_byte *data, +- unsigned short size, +- struct dwarf2_per_cu_data *per_cu, ++ size_t size, ++ struct dwarf2_per_cu_data *per_cu, + LONGEST byte_offset); + + /* Until these have formal names, we define these here. +@@ -2111,7 +2111,7 @@ + + static struct value * + dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +- const gdb_byte *data, unsigned short size, ++ const gdb_byte *data, size_t size, + struct dwarf2_per_cu_data *per_cu, + LONGEST byte_offset) + { +@@ -2312,7 +2312,7 @@ + + struct value * + dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, +- const gdb_byte *data, unsigned short size, ++ const gdb_byte *data, size_t size, + struct dwarf2_per_cu_data *per_cu) + { + return dwarf2_evaluate_loc_desc_full (type, frame, data, size, per_cu, 0); +@@ -2433,7 +2433,7 @@ + requires a frame to evaluate. */ + + static int +-dwarf2_loc_desc_needs_frame (const gdb_byte *data, unsigned short size, ++dwarf2_loc_desc_needs_frame (const gdb_byte *data, size_t size, + struct dwarf2_per_cu_data *per_cu) + { + struct needs_frame_baton baton; +@@ -3827,7 +3827,7 @@ + static void + locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, + struct ui_file *stream, +- const gdb_byte *data, int size, ++ const gdb_byte *data, size_t size, + struct objfile *objfile, unsigned int addr_size, + int offset_size, struct dwarf2_per_cu_data *per_cu) + { +--- src/gdb/dwarf2loc.h 2012/05/22 18:45:22 1.33 ++++ src/gdb/dwarf2loc.h 2012/07/26 02:03:16 1.34 +@@ -77,7 +77,7 @@ + struct value *dwarf2_evaluate_loc_desc (struct type *type, + struct frame_info *frame, + const gdb_byte *data, +- unsigned short size, ++ size_t size, + struct dwarf2_per_cu_data *per_cu); + + CORE_ADDR dwarf2_read_addr_index (struct dwarf2_per_cu_data *per_cu, +@@ -97,7 +97,7 @@ + + /* Length of the location expression. For optimized out expressions it is + zero. */ +- unsigned long size; ++ size_t size; + + /* The compilation unit containing the symbol whose location + we're computing. */ +@@ -114,7 +114,7 @@ + const gdb_byte *data; + + /* Length of the location list. */ +- unsigned long size; ++ size_t size; + + /* The compilation unit containing the symbol whose location + we're computing. */ +--- src/gdb/dwarf2read.c 2012/07/20 17:38:04 1.697 ++++ src/gdb/dwarf2read.c 2012/07/26 02:03:16 1.698 +@@ -990,7 +990,7 @@ + /* Blocks are a bunch of untyped bytes. */ + struct dwarf_block + { +- unsigned int size; ++ size_t size; + + /* Valid only if SIZE is not zero. */ + gdb_byte *data; +@@ -16197,12 +16197,12 @@ + case DW_FORM_block4: + case DW_FORM_block: + case DW_FORM_block1: +- fprintf_unfiltered (f, "block: size %d", +- DW_BLOCK (&die->attrs[i])->size); ++ fprintf_unfiltered (f, "block: size %s", ++ pulongest (DW_BLOCK (&die->attrs[i])->size)); + break; + case DW_FORM_exprloc: +- fprintf_unfiltered (f, "expression: size %u", +- DW_BLOCK (&die->attrs[i])->size); ++ fprintf_unfiltered (f, "expression: size %s", ++ pulongest (DW_BLOCK (&die->attrs[i])->size)); + break; + case DW_FORM_ref_addr: + fprintf_unfiltered (f, "ref address: "); +@@ -16746,8 +16746,8 @@ + decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu) + { + struct objfile *objfile = cu->objfile; +- int i; +- int size = blk->size; ++ size_t i; ++ size_t size = blk->size; + gdb_byte *data = blk->data; + CORE_ADDR stack[64]; + int stacki; diff --git a/gdb-rhbz795424-bitpos-09of25.patch b/gdb-rhbz795424-bitpos-09of25.patch new file mode 100644 index 0000000..20ae3af --- /dev/null +++ b/gdb-rhbz795424-bitpos-09of25.patch @@ -0,0 +1,34 @@ +http://sourceware.org/ml/gdb-cvs/2012-08/msg00085.html + +### src/gdb/ChangeLog 2012/08/10 05:03:07 1.14574 +### src/gdb/ChangeLog 2012/08/10 18:55:16 1.14575 +## -1,3 +1,9 @@ ++2012-08-10 Siddhesh Poyarekar ++ ++ * python/py-type.c (convert_field): Use gdb_py_long_from_longest ++ for TYPE_FIELD_BITPOS. ++ (typy_get_sizeof): Likewise for TYPE_LENGTH. ++ + 2012-08-10 Mike Frysinger + + PR cli/10436: +--- src/gdb/python/py-type.c 2012/05/18 21:02:52 1.39 ++++ src/gdb/python/py-type.c 2012/08/10 18:55:18 1.40 +@@ -176,7 +176,7 @@ + } + else + { +- arg = PyLong_FromLong (TYPE_FIELD_BITPOS (type, field)); ++ arg = gdb_py_long_from_longest (TYPE_FIELD_BITPOS (type, field)); + attrstring = "bitpos"; + } + +@@ -683,7 +683,7 @@ + } + /* Ignore exceptions. */ + +- return PyLong_FromLong (TYPE_LENGTH (type)); ++ return gdb_py_long_from_longest (TYPE_LENGTH (type)); + } + + static struct type * diff --git a/gdb-rhbz795424-bitpos-10of25.patch b/gdb-rhbz795424-bitpos-10of25.patch new file mode 100644 index 0000000..af7fa5c --- /dev/null +++ b/gdb-rhbz795424-bitpos-10of25.patch @@ -0,0 +1,119 @@ +http://sourceware.org/ml/gdb-cvs/2012-08/msg00187.html + +### src/gdb/ChangeLog 2012/08/24 03:17:12 1.14628 +### src/gdb/ChangeLog 2012/08/24 03:57:22 1.14629 +## -1,3 +1,11 @@ ++2012-08-24 Siddhesh Poyarekar ++ ++ * h8300-tdep.c (h8300_push_dummy_call): Replace unsafe alloca ++ with xmalloc/cleanup. ++ * mt-tdep.c (mt_push_dummy_call): Likewise. ++ * tilegx-tdep.c (tilegx_push_dummy_call): Likewise. ++ * xstormy16-tdep.c (xstormy16_push_dummy_call): Likewise. ++ + 2012-08-24 Yao Qi + + * jv-exp.y (push_expression_name): Add "." at the end of error +--- src/gdb/h8300-tdep.c 2012/05/18 21:02:47 1.133 ++++ src/gdb/h8300-tdep.c 2012/08/24 03:57:22 1.134 +@@ -666,13 +666,15 @@ + + for (argument = 0; argument < nargs; argument++) + { ++ struct cleanup *back_to; + struct type *type = value_type (args[argument]); + int len = TYPE_LENGTH (type); + char *contents = (char *) value_contents (args[argument]); + + /* Pad the argument appropriately. */ + int padded_len = align_up (len, wordsize); +- gdb_byte *padded = alloca (padded_len); ++ gdb_byte *padded = xmalloc (padded_len); ++ back_to = make_cleanup (xfree, padded); + + memset (padded, 0, padded_len); + memcpy (len < wordsize ? padded + padded_len - len : padded, +@@ -720,6 +722,8 @@ + subsequent arguments go on the stack. */ + reg = E_ARGLAST_REGNUM + 1; + } ++ ++ do_cleanups (back_to); + } + + /* Store return address. */ +--- src/gdb/mt-tdep.c 2012/05/16 14:35:06 1.40 ++++ src/gdb/mt-tdep.c 2012/08/24 03:57:22 1.41 +@@ -845,16 +845,20 @@ + for (j = nargs - 1; j >= i; j--) + { + gdb_byte *val; ++ struct cleanup *back_to; ++ const gdb_byte *contents = value_contents (args[j]); + + /* Right-justify the value in an aligned-length buffer. */ + typelen = TYPE_LENGTH (value_type (args[j])); + slacklen = (wordsize - (typelen % wordsize)) % wordsize; +- val = alloca (typelen + slacklen); +- memcpy (val, value_contents (args[j]), typelen); ++ val = xmalloc (typelen + slacklen); ++ back_to = make_cleanup (xfree, val); ++ memcpy (val, contents, typelen); + memset (val + typelen, 0, slacklen); + /* Now write this data to the stack. */ + stack_dest -= typelen + slacklen; + write_memory (stack_dest, val, typelen + slacklen); ++ do_cleanups (back_to); + } + + /* Finally, if a param needs to be split between registers and stack, +--- src/gdb/tilegx-tdep.c 2012/05/30 19:31:44 1.1 ++++ src/gdb/tilegx-tdep.c 2012/08/24 03:57:22 1.2 +@@ -343,16 +343,20 @@ + for (j = nargs - 1; j >= i; j--) + { + gdb_byte *val; ++ struct cleanup *back_to; ++ const gdb_byte *contents = value_contents (args[j]); + + typelen = TYPE_LENGTH (value_enclosing_type (args[j])); + slacklen = ((typelen + 3) & (~3)) - typelen; +- val = alloca (typelen + slacklen); +- memcpy (val, value_contents (args[j]), typelen); ++ val = xmalloc (typelen + slacklen); ++ back_to = make_cleanup (xfree, val); ++ memcpy (val, contents, typelen); + memset (val + typelen, 0, slacklen); + + /* Now write data to the stack. The stack grows downwards. */ + stack_dest -= typelen + slacklen; + write_memory (stack_dest, val, typelen + slacklen); ++ do_cleanups (back_to); + } + + /* Add 2 words for linkage space to the stack. */ +--- src/gdb/xstormy16-tdep.c 2012/05/16 14:35:08 1.118 ++++ src/gdb/xstormy16-tdep.c 2012/08/24 03:57:22 1.119 +@@ -279,16 +279,20 @@ + for (j = nargs - 1; j >= i; j--) + { + char *val; ++ struct cleanup *back_to; ++ const gdb_byte *bytes = value_contents (args[j]); + + typelen = TYPE_LENGTH (value_enclosing_type (args[j])); + slacklen = typelen & 1; +- val = alloca (typelen + slacklen); +- memcpy (val, value_contents (args[j]), typelen); ++ val = xmalloc (typelen + slacklen); ++ back_to = make_cleanup (xfree, val); ++ memcpy (val, bytes, typelen); + memset (val + typelen, 0, slacklen); + + /* Now write this data to the stack. The stack grows upwards. */ + write_memory (stack_dest, val, typelen + slacklen); + stack_dest += typelen + slacklen; ++ do_cleanups (back_to); + } + + store_unsigned_integer (buf, xstormy16_pc_size, byte_order, bp_addr); diff --git a/gdb-rhbz795424-bitpos-11of25.patch b/gdb-rhbz795424-bitpos-11of25.patch new file mode 100644 index 0000000..9aa3a3e --- /dev/null +++ b/gdb-rhbz795424-bitpos-11of25.patch @@ -0,0 +1,34 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00065.html + +### src/gdb/ChangeLog 2012/09/14 00:54:57 1.14656 +### src/gdb/ChangeLog 2012/09/14 07:00:37 1.14657 +## -1,3 +1,8 @@ ++2012-09-14 Siddhesh Poyarekar ++ ++ * printcmd.c (ui_printf): Eliminate single-use variable ++ PARAM_LEN. ++ + 2012-09-14 Yao Qi + Pedro Alves + +--- src/gdb/printcmd.c 2012/09/11 21:26:16 1.211 ++++ src/gdb/printcmd.c 2012/09/14 07:00:42 1.212 +@@ -2267,7 +2267,6 @@ + + /* Parameter data. */ + struct type *param_type = value_type (val_args[i]); +- unsigned int param_len = TYPE_LENGTH (param_type); + struct gdbarch *gdbarch = get_type_arch (param_type); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + +@@ -2329,8 +2328,8 @@ + + /* Conversion between different DFP types. */ + if (TYPE_CODE (param_type) == TYPE_CODE_DECFLOAT) +- decimal_convert (param_ptr, param_len, byte_order, +- dec, dfp_len, byte_order); ++ decimal_convert (param_ptr, TYPE_LENGTH (param_type), ++ byte_order, dec, dfp_len, byte_order); + else + /* If this is a non-trivial conversion, just output 0. + A correct converted value can be displayed by explicitly diff --git a/gdb-rhbz795424-bitpos-12of25.patch b/gdb-rhbz795424-bitpos-12of25.patch new file mode 100644 index 0000000..4b0158b --- /dev/null +++ b/gdb-rhbz795424-bitpos-12of25.patch @@ -0,0 +1,66 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00068.html + +### src/gdb/ChangeLog 2012/09/14 12:10:21 1.14659 +### src/gdb/ChangeLog 2012/09/14 12:46:55 1.14660 +## -1,3 +1,8 @@ ++2012-09-14 Siddhesh Poyarekar ++ ++ * valarith.c (value_concat): Replace unsafe ALLOCA with ++ XMALLOC/XFREE. ++ + 2012-09-14 Pedro Alves + + * gdb.1 (SEE ALSO): Expand pointer to GDB's Texinfo manual. +Index: gdb-7.5.0.20120926/gdb/valarith.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/valarith.c 2012-11-07 22:00:41.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/valarith.c 2012-11-07 22:02:18.661767281 +0100 +@@ -716,9 +716,12 @@ value_concat (struct value *arg1, struct + if (TYPE_CODE (type2) == TYPE_CODE_STRING + || TYPE_CODE (type2) == TYPE_CODE_CHAR) + { ++ struct cleanup *back_to; ++ + count = longest_to_int (value_as_long (inval1)); + inval2len = TYPE_LENGTH (type2); +- ptr = (char *) alloca (count * inval2len); ++ ptr = (char *) xmalloc (count * inval2len); ++ back_to = make_cleanup (xfree, ptr); + if (TYPE_CODE (type2) == TYPE_CODE_CHAR) + { + char_type = type2; +@@ -741,6 +744,7 @@ value_concat (struct value *arg1, struct + } + } + outval = value_string (ptr, count * inval2len, char_type); ++ do_cleanups (back_to); + } + else if (TYPE_CODE (type2) == TYPE_CODE_BITSTRING + || TYPE_CODE (type2) == TYPE_CODE_BOOL) +@@ -755,6 +759,8 @@ value_concat (struct value *arg1, struct + else if (TYPE_CODE (type1) == TYPE_CODE_STRING + || TYPE_CODE (type1) == TYPE_CODE_CHAR) + { ++ struct cleanup *back_to; ++ + /* We have two character strings to concatenate. */ + if (TYPE_CODE (type2) != TYPE_CODE_STRING + && TYPE_CODE (type2) != TYPE_CODE_CHAR) +@@ -763,7 +769,8 @@ value_concat (struct value *arg1, struct + } + inval1len = TYPE_LENGTH (type1); + inval2len = TYPE_LENGTH (type2); +- ptr = (char *) alloca (inval1len + inval2len); ++ ptr = (char *) xmalloc (inval1len + inval2len); ++ back_to = make_cleanup (xfree, ptr); + if (TYPE_CODE (type1) == TYPE_CODE_CHAR) + { + char_type = type1; +@@ -786,6 +793,7 @@ value_concat (struct value *arg1, struct + memcpy (ptr + inval1len, value_contents (inval2), inval2len); + } + outval = value_string (ptr, inval1len + inval2len, char_type); ++ do_cleanups (back_to); + } + else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING + || TYPE_CODE (type1) == TYPE_CODE_BOOL) diff --git a/gdb-rhbz795424-bitpos-13of25.patch b/gdb-rhbz795424-bitpos-13of25.patch new file mode 100644 index 0000000..df3f384 --- /dev/null +++ b/gdb-rhbz795424-bitpos-13of25.patch @@ -0,0 +1,28 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00082.html + +### src/gdb/ChangeLog 2012/09/17 07:15:47 1.14664 +### src/gdb/ChangeLog 2012/09/17 07:26:54 1.14665 +## -1,3 +1,8 @@ ++2012-09-17 Siddhesh Poyarekar ++ ++ * infrun.c (restore_infcall_suspend_state): Eliminate single-use ++ variable LEN. ++ + 2012-09-17 Jan Kratochvil + + PR 14119 +--- src/gdb/infrun.c 2012/09/17 07:09:34 1.558 ++++ src/gdb/infrun.c 2012/09/17 07:26:55 1.559 +@@ -6777,11 +6777,10 @@ + if (inf_state->siginfo_gdbarch == gdbarch) + { + struct type *type = gdbarch_get_siginfo_type (gdbarch); +- size_t len = TYPE_LENGTH (type); + + /* Errors ignored. */ + target_write (¤t_target, TARGET_OBJECT_SIGNAL_INFO, NULL, +- inf_state->siginfo_data, 0, len); ++ inf_state->siginfo_data, 0, TYPE_LENGTH (type)); + } + + /* The inferior can be gone if the user types "print exit(0)" diff --git a/gdb-rhbz795424-bitpos-14of25.patch b/gdb-rhbz795424-bitpos-14of25.patch new file mode 100644 index 0000000..611c7d1 --- /dev/null +++ b/gdb-rhbz795424-bitpos-14of25.patch @@ -0,0 +1,209 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00084.html + +### src/gdb/ChangeLog 2012/09/17 08:42:07 1.14666 +### src/gdb/ChangeLog 2012/09/17 08:52:17 1.14667 +## -1,3 +1,23 @@ ++2012-09-17 Siddhesh Poyarekar ++ ++ * m2-valprint.c (m2_print_array_contents): Eliminate variable ++ ELTLEN and use TYPE_LENGTH directly. ++ (m2_val_print): Likewise. ++ * m68k-tdep.c (m68k_svr4_extract_return_value): Eliminate ++ variable LEN and use TYPE_LENGTH directly. ++ (m68k_svr4_store_return_value): Likewise. ++ * mips-tdep.c (mips_o32_push_dummy_call): Eliminate variable ++ ARGLEN and use TYPE_LENGTH directly. ++ (mips_o64_push_dummy_call): Likewise. ++ * s390-tdep (s390_function_arg_pass_by_reference): Eliminate ++ variable LENGTH and use TYPE_LENGTH directly. ++ (s390_function_arg_float): Likewise. ++ (s390_function_arg_integer): Likewise. ++ (s390_push_dummy_call): Likewise. ++ (s390_return_value_convention): Likewise. ++ * spu-tdep.c (spu_push_dummy_call): Eliminate LEN and use ++ TYPE_LENGTH directly. ++ + 2012-09-17 Yao Qi + + * cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): New. +--- src/gdb/m2-valprint.c 2012/08/16 07:36:20 1.45 ++++ src/gdb/m2-valprint.c 2012/09/17 08:52:18 1.46 +@@ -269,16 +269,14 @@ + const struct value_print_options *options, + int len) + { +- int eltlen; + CHECK_TYPEDEF (type); + + if (TYPE_LENGTH (type) > 0) + { +- eltlen = TYPE_LENGTH (type); + if (options->prettyprint_arrays) + print_spaces_filtered (2 + 2 * recurse, stream); + /* For an array of chars, print with string syntax. */ +- if (eltlen == 1 && ++ if (TYPE_LENGTH (type) == 1 && + ((TYPE_CODE (type) == TYPE_CODE_INT) + || ((current_language->la_language == language_m2) + && (TYPE_CODE (type) == TYPE_CODE_CHAR))) +@@ -320,7 +318,6 @@ + unsigned int i = 0; /* Number of characters printed. */ + unsigned len; + struct type *elttype; +- unsigned eltlen; + CORE_ADDR addr; + + CHECK_TYPEDEF (type); +@@ -330,12 +327,11 @@ + if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0) + { + elttype = check_typedef (TYPE_TARGET_TYPE (type)); +- eltlen = TYPE_LENGTH (elttype); +- len = TYPE_LENGTH (type) / eltlen; ++ len = TYPE_LENGTH (type) / TYPE_LENGTH (elttype); + if (options->prettyprint_arrays) + print_spaces_filtered (2 + 2 * recurse, stream); + /* For an array of chars, print with string syntax. */ +- if (eltlen == 1 && ++ if (TYPE_LENGTH (elttype) == 1 && + ((TYPE_CODE (elttype) == TYPE_CODE_INT) + || ((current_language->la_language == language_m2) + && (TYPE_CODE (elttype) == TYPE_CODE_CHAR))) +--- src/gdb/m68k-tdep.c 2012/07/24 16:37:24 1.159 ++++ src/gdb/m68k-tdep.c 2012/09/17 08:52:18 1.160 +@@ -315,7 +315,6 @@ + m68k_svr4_extract_return_value (struct type *type, struct regcache *regcache, + gdb_byte *valbuf) + { +- int len = TYPE_LENGTH (type); + gdb_byte buf[M68K_MAX_REGISTER_SIZE]; + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); +@@ -326,7 +325,7 @@ + regcache_raw_read (regcache, M68K_FP0_REGNUM, buf); + convert_typed_floating (buf, fpreg_type, valbuf, type); + } +- else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4) ++ else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) + regcache_raw_read (regcache, M68K_A0_REGNUM, valbuf); + else + m68k_extract_return_value (type, regcache, valbuf); +@@ -357,7 +356,6 @@ + m68k_svr4_store_return_value (struct type *type, struct regcache *regcache, + const gdb_byte *valbuf) + { +- int len = TYPE_LENGTH (type); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + +@@ -368,7 +366,7 @@ + convert_typed_floating (valbuf, type, buf, fpreg_type); + regcache_raw_write (regcache, M68K_FP0_REGNUM, buf); + } +- else if (TYPE_CODE (type) == TYPE_CODE_PTR && len == 4) ++ else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4) + { + regcache_raw_write (regcache, M68K_A0_REGNUM, valbuf); + regcache_raw_write (regcache, M68K_D0_REGNUM, valbuf); +--- src/gdb/mips-tdep.c 2012/08/19 22:22:49 1.561 ++++ src/gdb/mips-tdep.c 2012/09/17 08:52:18 1.562 +@@ -5174,13 +5174,12 @@ + for (argnum = 0; argnum < nargs; argnum++) + { + struct type *arg_type = check_typedef (value_type (args[argnum])); +- int arglen = TYPE_LENGTH (arg_type); + + /* Align to double-word if necessary. */ + if (mips_type_needs_double_align (arg_type)) + len = align_up (len, MIPS32_REGSIZE * 2); + /* Allocate space on the stack. */ +- len += align_up (arglen, MIPS32_REGSIZE); ++ len += align_up (TYPE_LENGTH (arg_type), MIPS32_REGSIZE); + } + sp -= align_up (len, 16); + +@@ -5703,10 +5702,9 @@ + for (argnum = 0; argnum < nargs; argnum++) + { + struct type *arg_type = check_typedef (value_type (args[argnum])); +- int arglen = TYPE_LENGTH (arg_type); + + /* Allocate space on the stack. */ +- len += align_up (arglen, MIPS64_REGSIZE); ++ len += align_up (TYPE_LENGTH (arg_type), MIPS64_REGSIZE); + } + sp -= align_up (len, 16); + +--- src/gdb/s390-tdep.c 2012/05/18 21:02:50 1.206 ++++ src/gdb/s390-tdep.c 2012/09/17 08:52:18 1.207 +@@ -2489,8 +2489,7 @@ + static int + s390_function_arg_pass_by_reference (struct type *type) + { +- unsigned length = TYPE_LENGTH (type); +- if (length > 8) ++ if (TYPE_LENGTH (type) > 8) + return 1; + + return (is_struct_like (type) && !is_power_of_two (TYPE_LENGTH (type))) +@@ -2503,8 +2502,7 @@ + static int + s390_function_arg_float (struct type *type) + { +- unsigned length = TYPE_LENGTH (type); +- if (length > 8) ++ if (TYPE_LENGTH (type) > 8) + return 0; + + return is_float_like (type); +@@ -2515,13 +2513,12 @@ + static int + s390_function_arg_integer (struct type *type) + { +- unsigned length = TYPE_LENGTH (type); +- if (length > 8) ++ if (TYPE_LENGTH (type) > 8) + return 0; + + return is_integer_like (type) + || is_pointer_like (type) +- || (is_struct_like (type) && is_power_of_two (length)); ++ || (is_struct_like (type) && is_power_of_two (TYPE_LENGTH (type))); + } + + /* Return ARG, a `SIMPLE_ARG', sign-extended or zero-extended to a full +@@ -2616,11 +2613,10 @@ + { + struct value *arg = args[i]; + struct type *type = check_typedef (value_type (arg)); +- unsigned length = TYPE_LENGTH (type); + + if (s390_function_arg_pass_by_reference (type)) + { +- sp -= length; ++ sp -= TYPE_LENGTH (type); + sp = align_down (sp, alignment_of (type)); + copy_addr[i] = sp; + } +@@ -2799,8 +2795,7 @@ + static enum return_value_convention + s390_return_value_convention (struct gdbarch *gdbarch, struct type *type) + { +- int length = TYPE_LENGTH (type); +- if (length > 8) ++ if (TYPE_LENGTH (type) > 8) + return RETURN_VALUE_STRUCT_CONVENTION; + + switch (TYPE_CODE (type)) +--- src/gdb/spu-tdep.c 2012/05/18 21:02:50 1.81 ++++ src/gdb/spu-tdep.c 2012/09/17 08:52:18 1.82 +@@ -1373,8 +1373,7 @@ + struct value *arg = args[i]; + struct type *type = check_typedef (value_type (arg)); + const gdb_byte *contents = value_contents (arg); +- int len = TYPE_LENGTH (type); +- int n_regs = align_up (len, 16) / 16; ++ int 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. */ diff --git a/gdb-rhbz795424-bitpos-15of25.patch b/gdb-rhbz795424-bitpos-15of25.patch new file mode 100644 index 0000000..a965878 --- /dev/null +++ b/gdb-rhbz795424-bitpos-15of25.patch @@ -0,0 +1,36 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00132.html + +### src/gdb/ChangeLog 2012/09/22 13:04:54 1.14691 +### src/gdb/ChangeLog 2012/09/24 10:25:07 1.14692 +## -1,3 +1,8 @@ ++2012-09-24 Siddhesh Poyarekar ++ ++ * m2-typeprint.c (m2_enum): Expand LASTVAL to LONGEST. ++ * p-valprint.c (pascal_type_print_base): Likewise. ++ + 2012-09-22 Yao Qi + + * remote.c (remote_get_trace_status): Remove setting default +--- src/gdb/m2-typeprint.c 2012/04/18 06:46:46 1.30 ++++ src/gdb/m2-typeprint.c 2012/09/24 10:25:09 1.31 +@@ -587,7 +587,8 @@ + void + m2_enum (struct type *type, struct ui_file *stream, int show, int level) + { +- int lastval, i, len; ++ LONGEST lastval; ++ int i, len; + + if (show < 0) + { +--- src/gdb/p-typeprint.c 2012/08/16 07:36:20 1.47 ++++ src/gdb/p-typeprint.c 2012/09/24 10:25:09 1.48 +@@ -440,7 +440,7 @@ + { + int i; + int len; +- int lastval; ++ LONGEST lastval; + enum + { + s_none, s_public, s_private, s_protected diff --git a/gdb-rhbz795424-bitpos-16of25.patch b/gdb-rhbz795424-bitpos-16of25.patch new file mode 100644 index 0000000..54d8621 --- /dev/null +++ b/gdb-rhbz795424-bitpos-16of25.patch @@ -0,0 +1,27 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00138.html + +### src/gdb/ChangeLog 2012/09/24 10:25:07 1.14692 +### src/gdb/ChangeLog 2012/09/25 12:20:35 1.14693 +## -1,3 +1,8 @@ ++2012-09-25 Siddhesh Poyarekar ++ ++ * c-typeprint.c (c_type_print_varspec_suffix): Remove cast and ++ use plongest to print the array size. ++ + 2012-09-24 Siddhesh Poyarekar + + * m2-typeprint.c (m2_enum): Expand LASTVAL to LONGEST. +Index: gdb-7.5.0.20120926/gdb/c-typeprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/c-typeprint.c 2012-11-07 22:00:40.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/c-typeprint.c 2012-11-07 22:03:39.269650157 +0100 +@@ -631,7 +631,8 @@ c_type_print_varspec_suffix (struct type + fprintf_filtered (stream, "variable"); + } + else if (get_array_bounds (type, &low_bound, &high_bound)) +- fprintf_filtered (stream, "%d", (int) (high_bound - low_bound + 1)); ++ fprintf_filtered (stream, "%s", ++ plongest (high_bound - low_bound + 1)); + fprintf_filtered (stream, "]"); + + c_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, diff --git a/gdb-rhbz795424-bitpos-17of25.patch b/gdb-rhbz795424-bitpos-17of25.patch new file mode 100644 index 0000000..a29d6ce --- /dev/null +++ b/gdb-rhbz795424-bitpos-17of25.patch @@ -0,0 +1,729 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00142.html + +### src/gdb/ChangeLog 2012/09/25 12:38:55 1.14696 +### src/gdb/ChangeLog 2012/09/25 12:48:52 1.14697 +## -1,3 +1,36 @@ ++2012-09-25 Siddhesh Poyarekar ++ ++ * ada-valprint.c (ada_val_print_1): Eliminate single-use ++ variable LEN. ++ * alpha-tdep.c (alpha_extract_return_value): Use TYPE_LENGTH ++ directly. ++ (alpha_store_return_value): Likewise. ++ * amd64-tdep.c (amd64_classify_aggregate): Likewise. ++ (amd64_push_arguments): Likewise. ++ * ax-gdb.c (gen_trace_static_fields): Likewise. ++ (gen_traced_pop): Likewise. ++ * bfin-tdep.c (bfin_push_dummy_call): Likewise. ++ * breakpoint.c (update_watchpoint): Likewise. ++ * findcmd.c (parse_find_args): Use local variable for type ++ instead of length. ++ * findvar.c (default_read_var_value): Use TYPE_LENGTH directly. ++ * h8300-tdep.c (h8300h_extract_return_value): Likewise. ++ (h8300_store_return_value): Likewise. ++ * i386-darwin-tdep.c (i386_darwin_push_dummy_call): Likewise. ++ Use i386_darwin_arg_type_alignment directly. ++ * infcall.c (call_function_by_hand): Use TYPE_LENGTH directly. ++ * lm32-tdep.c (lm32_push_dummy_call): Likewise. ++ * m68hc11-tdep.c (m68hc11_push_dummy_call): Likewise. ++ (m68hc11_extract_return_value): Likewise. ++ * mep-tdep.c (mep_push_dummy_call): Likewise. ++ * printcmd.c (float_type_from_length): Likewise. ++ * s390-tdep.c (s390_value_from_register): Likewise. ++ * stack.c (read_frame_arg): Likewise. ++ * tracepoint.c (encode_actions_1): Likewise. ++ * valops.c (value_fetch_lazy): Use local variable for type ++ instead of length. Use TYPE_LENGTH directly. ++ * value.c (value_contents_equal): Use TYPE_LENGTH directly. ++ + 2012-09-25 Joel Brobecker + + * symtab.c (skip_prologue_sal): Fix typo in comment. +Index: gdb-7.5.0.20120926/gdb/ada-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ada-valprint.c 2012-04-18 08:46:46.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ada-valprint.c 2012-11-07 22:03:57.600623522 +0100 +@@ -730,9 +730,8 @@ ada_val_print_1 (struct type *type, cons + if (ada_is_fixed_point_type (type)) + { + LONGEST v = unpack_long (type, valaddr + offset_aligned); +- int len = TYPE_LENGTH (type); + +- fprintf_filtered (stream, len < 4 ? "%.11g" : "%.17g", ++ fprintf_filtered (stream, TYPE_LENGTH (type) < 4 ? "%.11g" : "%.17g", + (double) ada_fixed_to_float (type, v)); + return; + } +Index: gdb-7.5.0.20120926/gdb/alpha-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/alpha-tdep.c 2012-05-16 16:35:02.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/alpha-tdep.c 2012-11-07 22:03:57.602623520 +0100 +@@ -475,14 +475,13 @@ alpha_extract_return_value (struct type + { + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); +- int length = TYPE_LENGTH (valtype); + gdb_byte raw_buffer[ALPHA_REGISTER_SIZE]; + ULONGEST l; + + switch (TYPE_CODE (valtype)) + { + case TYPE_CODE_FLT: +- switch (length) ++ switch (TYPE_LENGTH (valtype)) + { + case 4: + regcache_cooked_read (regcache, ALPHA_FP0_REGNUM, raw_buffer); +@@ -505,7 +504,7 @@ alpha_extract_return_value (struct type + break; + + case TYPE_CODE_COMPLEX: +- switch (length) ++ switch (TYPE_LENGTH (valtype)) + { + case 8: + /* ??? This isn't correct wrt the ABI, but it's what GCC does. */ +@@ -531,7 +530,7 @@ alpha_extract_return_value (struct type + default: + /* Assume everything else degenerates to an integer. */ + regcache_cooked_read_unsigned (regcache, ALPHA_V0_REGNUM, &l); +- store_unsigned_integer (valbuf, length, byte_order, l); ++ store_unsigned_integer (valbuf, TYPE_LENGTH (valtype), byte_order, l); + break; + } + } +@@ -544,14 +543,13 @@ alpha_store_return_value (struct type *v + const gdb_byte *valbuf) + { + struct gdbarch *gdbarch = get_regcache_arch (regcache); +- int length = TYPE_LENGTH (valtype); + gdb_byte raw_buffer[ALPHA_REGISTER_SIZE]; + ULONGEST l; + + switch (TYPE_CODE (valtype)) + { + case TYPE_CODE_FLT: +- switch (length) ++ switch (TYPE_LENGTH (valtype)) + { + case 4: + alpha_lds (gdbarch, raw_buffer, valbuf); +@@ -575,7 +573,7 @@ alpha_store_return_value (struct type *v + break; + + case TYPE_CODE_COMPLEX: +- switch (length) ++ switch (TYPE_LENGTH (valtype)) + { + case 8: + /* ??? This isn't correct wrt the ABI, but it's what GCC does. */ +@@ -603,7 +601,7 @@ alpha_store_return_value (struct type *v + /* Assume everything else degenerates to an integer. */ + /* 32-bit values must be sign-extended to 64 bits + even if the base data type is unsigned. */ +- if (length == 4) ++ if (TYPE_LENGTH (valtype) == 4) + valtype = builtin_type (gdbarch)->builtin_int32; + l = unpack_long (valtype, valbuf); + regcache_cooked_write_unsigned (regcache, ALPHA_V0_REGNUM, l); +Index: gdb-7.5.0.20120926/gdb/amd64-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/amd64-tdep.c 2012-11-07 22:00:42.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/amd64-tdep.c 2012-11-07 22:03:57.623623489 +0100 +@@ -446,12 +446,10 @@ amd64_non_pod_p (struct type *type) + static void + amd64_classify_aggregate (struct type *type, enum amd64_reg_class class[2]) + { +- int len = TYPE_LENGTH (type); +- + /* 1. If the size of an object is larger than two eightbytes, or in + C++, is a non-POD structure or union type, or contains + unaligned fields, it has class memory. */ +- if (len > 16 || amd64_non_pod_p (type)) ++ if (TYPE_LENGTH (type) > 16 || amd64_non_pod_p (type)) + { + class[0] = class[1] = AMD64_MEMORY; + return; +@@ -471,7 +469,7 @@ amd64_classify_aggregate (struct type *t + + /* All fields in an array have the same type. */ + amd64_classify (subtype, class); +- if (len > 8 && class[1] == AMD64_NO_CLASS) ++ if (TYPE_LENGTH (type) > 8 && class[1] == AMD64_NO_CLASS) + class[1] = class[0]; + } + else +@@ -839,10 +837,9 @@ amd64_push_arguments (struct regcache *r + { + struct type *type = value_type (stack_args[i]); + const gdb_byte *valbuf = value_contents (stack_args[i]); +- int len = TYPE_LENGTH (type); + CORE_ADDR arg_addr = sp + element * 8; + +- write_memory (arg_addr, valbuf, len); ++ write_memory (arg_addr, valbuf, TYPE_LENGTH (type)); + if (arg_addr_regno[i] >= 0) + { + /* We also need to store the address of that argument in +@@ -853,7 +850,7 @@ amd64_push_arguments (struct regcache *r + store_unsigned_integer (buf, 8, byte_order, arg_addr); + regcache_cooked_write (regcache, arg_addr_regno[i], buf); + } +- element += ((len + 7) / 8); ++ element += ((TYPE_LENGTH (type) + 7) / 8); + } + + /* The psABI says that "For calls that may call functions that use +Index: gdb-7.5.0.20120926/gdb/ax-gdb.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ax-gdb.c 2012-07-05 03:03:01.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ax-gdb.c 2012-11-07 22:03:57.626623484 +0100 +@@ -367,9 +367,9 @@ gen_trace_static_fields (struct gdbarch + { + case axs_lvalue_memory: + { +- int length = TYPE_LENGTH (check_typedef (value.type)); +- +- ax_const_l (ax, length); ++ /* Initialize the TYPE_LENGTH if it is a typedef. */ ++ check_typedef (value.type); ++ ax_const_l (ax, TYPE_LENGTH (value.type)); + ax_simple (ax, aop_trace); + } + break; +@@ -425,17 +425,18 @@ gen_traced_pop (struct gdbarch *gdbarch, + + case axs_lvalue_memory: + { +- int length = TYPE_LENGTH (check_typedef (value->type)); +- + if (string_trace) + ax_simple (ax, aop_dup); + ++ /* Initialize the TYPE_LENGTH if it is a typedef. */ ++ check_typedef (value->type); ++ + /* There's no point in trying to use a trace_quick bytecode + here, since "trace_quick SIZE pop" is three bytes, whereas + "const8 SIZE trace" is also three bytes, does the same + thing, and the simplest code which generates that will also + work correctly for objects with large sizes. */ +- ax_const_l (ax, length); ++ ax_const_l (ax, TYPE_LENGTH (value->type)); + ax_simple (ax, aop_trace); + + if (string_trace) +Index: gdb-7.5.0.20120926/gdb/bfin-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/bfin-tdep.c 2012-05-16 16:35:03.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/bfin-tdep.c 2012-11-07 22:03:57.643623460 +0100 +@@ -513,9 +513,8 @@ bfin_push_dummy_call (struct gdbarch *gd + for (i = nargs - 1; i >= 0; i--) + { + struct type *value_type = value_enclosing_type (args[i]); +- int len = TYPE_LENGTH (value_type); + +- total_len += (len + 3) & ~3; ++ total_len += (TYPE_LENGTH (value_type) + 3) & ~3; + } + + /* At least twelve bytes of stack space must be allocated for the function's +@@ -531,8 +530,7 @@ bfin_push_dummy_call (struct gdbarch *gd + { + struct type *value_type = value_enclosing_type (args[i]); + struct type *arg_type = check_typedef (value_type); +- int len = TYPE_LENGTH (value_type); +- int container_len = (len + 3) & ~3; ++ int container_len = (TYPE_LENGTH (value_type) + 3) & ~3; + + sp -= container_len; + write_memory (sp, value_contents_writeable (args[i]), container_len); +Index: gdb-7.5.0.20120926/gdb/breakpoint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/breakpoint.c 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/breakpoint.c 2012-11-07 22:03:57.660623434 +0100 +@@ -1844,11 +1844,10 @@ update_watchpoint (struct watchpoint *b, + && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) + { + CORE_ADDR addr; +- int len, type; ++ int type; + struct bp_location *loc, **tmp; + + addr = value_address (v); +- len = TYPE_LENGTH (value_type (v)); + type = hw_write; + if (b->base.type == bp_read_watchpoint) + type = hw_read; +@@ -1863,7 +1862,7 @@ update_watchpoint (struct watchpoint *b, + + loc->pspace = frame_pspace; + loc->address = addr; +- loc->length = len; ++ loc->length = TYPE_LENGTH (value_type (v)); + loc->watchpoint_type = type; + } + } +Index: gdb-7.5.0.20120926/gdb/findcmd.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/findcmd.c 2012-07-06 17:51:39.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/findcmd.c 2012-11-07 22:03:57.676623411 +0100 +@@ -169,19 +169,19 @@ parse_find_args (char *args, ULONGEST *m + while (*s != '\0') + { + LONGEST x; +- int val_bytes; ++ struct type *t; + ULONGEST pattern_buf_size_need; + + while (isspace (*s)) + ++s; + + v = parse_to_comma_and_eval (&s); +- val_bytes = TYPE_LENGTH (value_type (v)); ++ t = value_type (v); + + /* Keep it simple and assume size == 'g' when watching for when we + need to grow the pattern buf. */ + pattern_buf_size_need = (pattern_buf_end - pattern_buf +- + max (val_bytes, sizeof (int64_t))); ++ + max (TYPE_LENGTH (t), sizeof (int64_t))); + if (pattern_buf_size_need > pattern_buf_size) + { + size_t current_offset = pattern_buf_end - pattern_buf; +@@ -215,8 +215,8 @@ parse_find_args (char *args, ULONGEST *m + } + else + { +- memcpy (pattern_buf_end, value_contents (v), val_bytes); +- pattern_buf_end += val_bytes; ++ memcpy (pattern_buf_end, value_contents (v), TYPE_LENGTH (t)); ++ pattern_buf_end += TYPE_LENGTH (t); + } + + if (*s == ',') +Index: gdb-7.5.0.20120926/gdb/h8300-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/h8300-tdep.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/h8300-tdep.c 2012-11-07 22:03:57.679623409 +0100 +@@ -785,16 +785,15 @@ h8300h_extract_return_value (struct type + { + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); +- int len = TYPE_LENGTH (type); + ULONGEST c; + +- switch (len) ++ switch (TYPE_LENGTH (type)) + { + case 1: + case 2: + case 4: + regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); +- store_unsigned_integer (valbuf, len, byte_order, c); ++ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c); + break; + case 8: /* long long is now 8 bytes. */ + if (TYPE_CODE (type) == TYPE_CODE_INT) +@@ -852,18 +851,17 @@ h8300_store_return_value (struct type *t + { + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); +- int len = TYPE_LENGTH (type); + ULONGEST val; + +- switch (len) ++ switch (TYPE_LENGTH (type)) + { + case 1: + case 2: /* short... */ +- val = extract_unsigned_integer (valbuf, len, byte_order); ++ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order); + regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val); + break; + case 4: /* long, float */ +- val = extract_unsigned_integer (valbuf, len, byte_order); ++ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order); + regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, + (val >> 16) & 0xffff); + regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, val & 0xffff); +@@ -882,19 +880,18 @@ h8300h_store_return_value (struct type * + { + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); +- int len = TYPE_LENGTH (type); + ULONGEST val; + +- switch (len) ++ switch (TYPE_LENGTH (type)) + { + case 1: + case 2: + case 4: /* long, float */ +- val = extract_unsigned_integer (valbuf, len, byte_order); ++ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order); + regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, val); + break; + case 8: +- val = extract_unsigned_integer (valbuf, len, byte_order); ++ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order); + regcache_cooked_write_unsigned (regcache, E_RET0_REGNUM, + (val >> 32) & 0xffffffff); + regcache_cooked_write_unsigned (regcache, E_RET1_REGNUM, +Index: gdb-7.5.0.20120926/gdb/i386-darwin-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/i386-darwin-tdep.c 2012-04-02 15:15:48.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/i386-darwin-tdep.c 2012-11-07 22:03:57.680623407 +0100 +@@ -196,13 +196,12 @@ i386_darwin_push_dummy_call (struct gdba + } + else + { +- int len = TYPE_LENGTH (arg_type); +- int align = i386_darwin_arg_type_alignment (arg_type); +- +- args_space = align_up (args_space, align); ++ args_space = align_up (args_space, ++ i386_darwin_arg_type_alignment (arg_type)); + if (write_pass) + write_memory (sp + args_space, +- value_contents_all (args[i]), len); ++ value_contents_all (args[i]), ++ TYPE_LENGTH (arg_type)); + + /* The System V ABI says that: + +@@ -211,7 +210,7 @@ i386_darwin_push_dummy_call (struct gdba + depending on the size of the argument." + + This makes sure the stack stays word-aligned. */ +- args_space += align_up (len, 4); ++ args_space += align_up (TYPE_LENGTH (arg_type), 4); + } + } + +Index: gdb-7.5.0.20120926/gdb/infcall.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/infcall.c 2012-07-31 09:34:39.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/infcall.c 2012-11-07 22:03:57.694623385 +0100 +@@ -709,13 +709,11 @@ call_function_by_hand (struct value *fun + + if (struct_return || hidden_first_param_p) + { +- int len = TYPE_LENGTH (values_type); +- + if (gdbarch_inner_than (gdbarch, 1, 2)) + { + /* Stack grows downward. Align STRUCT_ADDR and SP after + making space for the return value. */ +- sp -= len; ++ sp -= TYPE_LENGTH (values_type); + if (gdbarch_frame_align_p (gdbarch)) + sp = gdbarch_frame_align (gdbarch, sp); + struct_addr = sp; +@@ -727,7 +725,7 @@ call_function_by_hand (struct value *fun + if (gdbarch_frame_align_p (gdbarch)) + sp = gdbarch_frame_align (gdbarch, sp); + struct_addr = sp; +- sp += len; ++ sp += TYPE_LENGTH (values_type); + if (gdbarch_frame_align_p (gdbarch)) + sp = gdbarch_frame_align (gdbarch, sp); + } +Index: gdb-7.5.0.20120926/gdb/lm32-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/lm32-tdep.c 2012-05-18 23:02:48.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/lm32-tdep.c 2012-11-07 22:03:57.695623384 +0100 +@@ -261,7 +261,6 @@ lm32_push_dummy_call (struct gdbarch *gd + struct value *arg = args[i]; + struct type *arg_type = check_typedef (value_type (arg)); + gdb_byte *contents; +- int len; + ULONGEST val; + + /* Promote small integer types to int. */ +@@ -283,8 +282,8 @@ lm32_push_dummy_call (struct gdbarch *gd + /* FIXME: Handle structures. */ + + contents = (gdb_byte *) value_contents (arg); +- len = TYPE_LENGTH (arg_type); +- val = extract_unsigned_integer (contents, len, byte_order); ++ val = extract_unsigned_integer (contents, TYPE_LENGTH (arg_type), ++ byte_order); + + /* First num_arg_regs parameters are passed by registers, + and the rest are passed on the stack. */ +@@ -292,7 +291,7 @@ lm32_push_dummy_call (struct gdbarch *gd + regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val); + else + { +- write_memory (sp, (void *) &val, len); ++ write_memory (sp, (void *) &val, TYPE_LENGTH (arg_type)); + sp -= 4; + } + } +Index: gdb-7.5.0.20120926/gdb/m68hc11-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m68hc11-tdep.c 2012-05-16 16:35:06.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/m68hc11-tdep.c 2012-11-07 22:03:57.724623347 +0100 +@@ -1174,7 +1174,6 @@ m68hc11_push_dummy_call (struct gdbarch + int first_stack_argnum; + struct type *type; + char *val; +- int len; + char buf[2]; + + first_stack_argnum = 0; +@@ -1185,19 +1184,18 @@ m68hc11_push_dummy_call (struct gdbarch + else if (nargs > 0) + { + type = value_type (args[0]); +- len = TYPE_LENGTH (type); + + /* First argument is passed in D and X registers. */ +- if (len <= 4) ++ if (TYPE_LENGTH (type) <= 4) + { + ULONGEST v; + + v = extract_unsigned_integer (value_contents (args[0]), +- len, byte_order); ++ TYPE_LENGTH (type), byte_order); + first_stack_argnum = 1; + + regcache_cooked_write_unsigned (regcache, HARD_D_REGNUM, v); +- if (len > 2) ++ if (TYPE_LENGTH (type) > 2) + { + v >>= 16; + regcache_cooked_write_unsigned (regcache, HARD_X_REGNUM, v); +@@ -1208,9 +1206,8 @@ m68hc11_push_dummy_call (struct gdbarch + for (argnum = nargs - 1; argnum >= first_stack_argnum; argnum--) + { + type = value_type (args[argnum]); +- len = TYPE_LENGTH (type); + +- if (len & 1) ++ if (TYPE_LENGTH (type) & 1) + { + static char zero = 0; + +@@ -1218,8 +1215,8 @@ m68hc11_push_dummy_call (struct gdbarch + write_memory (sp, &zero, 1); + } + val = (char*) value_contents (args[argnum]); +- sp -= len; +- write_memory (sp, val, len); ++ sp -= TYPE_LENGTH (type); ++ write_memory (sp, val, TYPE_LENGTH (type)); + } + + /* Store return address. */ +@@ -1291,11 +1288,10 @@ static void + m68hc11_extract_return_value (struct type *type, struct regcache *regcache, + void *valbuf) + { +- int len = TYPE_LENGTH (type); + char buf[M68HC11_REG_SIZE]; + + regcache_raw_read (regcache, HARD_D_REGNUM, buf); +- switch (len) ++ switch (TYPE_LENGTH (type)) + { + case 1: + memcpy (valbuf, buf + 1, 1); +Index: gdb-7.5.0.20120926/gdb/mep-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/mep-tdep.c 2012-05-16 16:35:06.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/mep-tdep.c 2012-11-07 22:03:57.727623334 +0100 +@@ -2337,11 +2337,10 @@ mep_push_dummy_call (struct gdbarch *gdb + + for (i = 0; i < argc; i++) + { +- unsigned arg_size = TYPE_LENGTH (value_type (argv[i])); + ULONGEST value; + + /* Arguments that fit in a GPR get expanded to fill the GPR. */ +- if (arg_size <= MEP_GPR_SIZE) ++ if (TYPE_LENGTH (value_type (argv[i])) <= MEP_GPR_SIZE) + value = extract_unsigned_integer (value_contents (argv[i]), + TYPE_LENGTH (value_type (argv[i])), + byte_order); +Index: gdb-7.5.0.20120926/gdb/printcmd.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/printcmd.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/printcmd.c 2012-11-07 22:03:57.730623334 +0100 +@@ -347,13 +347,12 @@ float_type_from_length (struct type *typ + { + struct gdbarch *gdbarch = get_type_arch (type); + const struct builtin_type *builtin = builtin_type (gdbarch); +- unsigned int len = TYPE_LENGTH (type); + +- if (len == TYPE_LENGTH (builtin->builtin_float)) ++ if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_float)) + type = builtin->builtin_float; +- else if (len == TYPE_LENGTH (builtin->builtin_double)) ++ else if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_double)) + type = builtin->builtin_double; +- else if (len == TYPE_LENGTH (builtin->builtin_long_double)) ++ else if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_long_double)) + type = builtin->builtin_long_double; + + return type; +Index: gdb-7.5.0.20120926/gdb/s390-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/s390-tdep.c 2012-11-07 22:02:30.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/s390-tdep.c 2012-11-07 22:03:57.733623329 +0100 +@@ -376,9 +376,11 @@ s390_value_from_register (struct type *t + struct frame_info *frame) + { + struct value *value = default_value_from_register (type, regnum, frame); +- int len = TYPE_LENGTH (check_typedef (type)); + +- if (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM && len < 8) ++ check_typedef (type); ++ ++ if (regnum >= S390_F0_REGNUM && regnum <= S390_F15_REGNUM ++ && TYPE_LENGTH (type) < 8) + set_value_offset (value, 0); + + return value; +Index: gdb-7.5.0.20120926/gdb/stack.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/stack.c 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/stack.c 2012-11-07 22:03:57.737623322 +0100 +@@ -354,14 +354,15 @@ read_frame_arg (struct symbol *sym, stru + + if (val && entryval && !ui_out_is_mi_like_p (current_uiout)) + { +- unsigned len = TYPE_LENGTH (value_type (val)); ++ struct type *type = value_type (val); + + if (!value_optimized_out (val) && value_lazy (val)) + value_fetch_lazy (val); + if (!value_optimized_out (val) && value_lazy (entryval)) + value_fetch_lazy (entryval); + if (!value_optimized_out (val) +- && value_available_contents_eq (val, 0, entryval, 0, len)) ++ && value_available_contents_eq (val, 0, entryval, 0, ++ TYPE_LENGTH (type))) + { + /* Initialize it just to avoid a GCC false warning. */ + struct value *val_deref = NULL, *entryval_deref; +@@ -373,12 +374,12 @@ read_frame_arg (struct symbol *sym, stru + + TRY_CATCH (except, RETURN_MASK_ERROR) + { +- unsigned len_deref; ++ struct type *type_deref; + + val_deref = coerce_ref (val); + if (value_lazy (val_deref)) + value_fetch_lazy (val_deref); +- len_deref = TYPE_LENGTH (value_type (val_deref)); ++ type_deref = value_type (val_deref); + + entryval_deref = coerce_ref (entryval); + if (value_lazy (entryval_deref)) +@@ -389,7 +390,7 @@ read_frame_arg (struct symbol *sym, stru + if (val != val_deref + && value_available_contents_eq (val_deref, 0, + entryval_deref, 0, +- len_deref)) ++ TYPE_LENGTH (type_deref))) + val_equal = 1; + } + +Index: gdb-7.5.0.20120926/gdb/tracepoint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/tracepoint.c 2012-06-30 00:46:46.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/tracepoint.c 2012-11-07 22:03:57.741623318 +0100 +@@ -1450,7 +1450,7 @@ encode_actions_1 (struct command_line *a + } + else + { +- unsigned long addr, len; ++ unsigned long addr; + struct cleanup *old_chain = NULL; + struct cleanup *old_chain1 = NULL; + +@@ -1480,8 +1480,10 @@ encode_actions_1 (struct command_line *a + /* Safe because we know it's a simple expression. */ + tempval = evaluate_expression (exp); + addr = value_address (tempval); +- len = TYPE_LENGTH (check_typedef (exp->elts[1].type)); +- add_memrange (collect, memrange_absolute, addr, len); ++ /* Initialize the TYPE_LENGTH if it is a typedef. */ ++ check_typedef (exp->elts[1].type); ++ add_memrange (collect, memrange_absolute, addr, ++ TYPE_LENGTH (exp->elts[1].type)); + break; + + case OP_VAR_VALUE: +Index: gdb-7.5.0.20120926/gdb/valops.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/valops.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/valops.c 2012-11-07 22:06:35.899393539 +0100 +@@ -1055,7 +1055,6 @@ value_fetch_lazy (struct value *val) + struct value *parent = value_parent (val); + LONGEST offset = value_offset (val); + LONGEST num; +- int length = TYPE_LENGTH (type); + + if (!value_bits_valid (val, + TARGET_CHAR_BIT * offset + value_bitpos (val), +@@ -1069,9 +1068,9 @@ value_fetch_lazy (struct value *val) + value_bitsize (val), parent, &num)) + mark_value_bytes_unavailable (val, + value_embedded_offset (val), +- length); ++ TYPE_LENGTH (type)); + else +- store_signed_integer (value_contents_raw (val), length, ++ store_signed_integer (value_contents_raw (val), TYPE_LENGTH (type), + byte_order, num); + } + else if (VALUE_LVAL (val) == lval_memory) +@@ -1080,16 +1079,16 @@ value_fetch_lazy (struct value *val) + + if (object_address_get_data (value_type (val), &addr)) + { +- struct type *type = value_enclosing_type (val); +- int length = TYPE_LENGTH (check_typedef (type)); ++ struct type *type = check_typedef (value_enclosing_type (val)); + +- if (length) ++ if (TYPE_LENGTH (type)) + { + /* Delay it after object_address_get_data above. */ + allocate_value_contents (val); + addr += value_offset (val); + read_value_memory (val, 0, value_stack (val), +- addr, value_contents_all_raw (val), length); ++ addr, value_contents_all_raw (val), ++ TYPE_LENGTH (type)); + } + } + /* Just to be sure it has been called. */ +Index: gdb-7.5.0.20120926/gdb/value.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/value.c 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/value.c 2012-11-07 22:03:57.751623303 +0100 +@@ -1034,15 +1034,14 @@ value_contents_equal (struct value *val1 + { + struct type *type1; + struct type *type2; +- int len; + + type1 = check_typedef (value_type (val1)); + type2 = check_typedef (value_type (val2)); +- len = TYPE_LENGTH (type1); +- if (len != TYPE_LENGTH (type2)) ++ if (TYPE_LENGTH (type1) != TYPE_LENGTH (type2)) + return 0; + +- return (memcmp (value_contents (val1), value_contents (val2), len) == 0); ++ return (memcmp (value_contents (val1), value_contents (val2), ++ TYPE_LENGTH (type1)) == 0); + } + + int diff --git a/gdb-rhbz795424-bitpos-18of25.patch b/gdb-rhbz795424-bitpos-18of25.patch new file mode 100644 index 0000000..66c4d3d --- /dev/null +++ b/gdb-rhbz795424-bitpos-18of25.patch @@ -0,0 +1,45 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00145.html + +### src/gdb/ChangeLog 2012/09/25 12:48:52 1.14697 +### src/gdb/ChangeLog 2012/09/26 02:06:51 1.14698 +## -1,3 +1,8 @@ ++2012-09-26 Siddhesh Poyarekar ++ ++ * breakpoint.c (invalidate_bp_value_on_memory_change): Expand ++ parameter LEN to ssize_t. ++ + 2012-09-25 Siddhesh Poyarekar + + * ada-valprint.c (ada_val_print_1): Eliminate single-use +--- src/gdb/breakpoint.c 2012/09/25 12:48:52 1.705 ++++ src/gdb/breakpoint.c 2012/09/26 02:06:54 1.706 +@@ -14718,7 +14718,7 @@ + GDB itself. */ + + static void +-invalidate_bp_value_on_memory_change (CORE_ADDR addr, int len, ++invalidate_bp_value_on_memory_change (CORE_ADDR addr, ssize_t len, + const bfd_byte *data) + { + struct breakpoint *bp; +### src/gdb/doc/ChangeLog 2012/09/21 01:46:42 1.1370 +### src/gdb/doc/ChangeLog 2012/09/26 02:06:55 1.1371 +## -1,3 +1,7 @@ ++2012-09-26 Siddhesh Poyarekar ++ ++ * observer.texi (memory_changed): Expand parameter LEN to ssize_t. ++ + 2012-09-21 Yao Qi + Pedro Alves + +--- src/gdb/doc/observer.texi 2012/09/21 01:46:43 1.40 ++++ src/gdb/doc/observer.texi 2012/09/26 02:06:55 1.41 +@@ -230,7 +230,7 @@ + This method is called immediately before freeing @var{inf}. + @end deftypefun + +-@deftypefun void memory_changed (CORE_ADDR @var{addr}, int @var{len}, const bfd_byte *@var{data}) ++@deftypefun void memory_changed (CORE_ADDR @var{addr}, ssize_t @var{len}, const bfd_byte *@var{data}) + Bytes from @var{data} to @var{data} + @var{len} have been written + to the current inferior at @var{addr}. + @end deftypefun diff --git a/gdb-rhbz795424-bitpos-19of25.patch b/gdb-rhbz795424-bitpos-19of25.patch new file mode 100644 index 0000000..63564a3 --- /dev/null +++ b/gdb-rhbz795424-bitpos-19of25.patch @@ -0,0 +1,260 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00147.html + +### src/gdb/ChangeLog 2012/09/26 02:06:51 1.14698 +### src/gdb/ChangeLog 2012/09/26 07:52:44 1.14699 +## -1,5 +1,19 @@ + 2012-09-26 Siddhesh Poyarekar + ++ * amd64-tdep.c (amd64_return_value): Use TYPE_LENGTH directly. ++ * bfin-tdep.c (bfin_extract_return_value): Likewise. ++ (bfin_store_return_value): Likewise. ++ * cris-tdep.c (cris_store_return_value): Likewise. ++ (cris_extract_return_value): Likewise. ++ * h8300-tdep.c (h8300_extract_return_value): Likewise. ++ * hppa-tdep.c (hppa64_return_value): Likewise. ++ * lm32-tdep.c (lm32_store_return_value): Likewise. ++ * microblaze-tdep.c (microblaze_store_return_value): Likewise. ++ * spu-tdep.c (spu_value_from_register): Likewise. ++ * vax-tdep.c (vax_return_value): Likewise. ++ ++2012-09-26 Siddhesh Poyarekar ++ + * breakpoint.c (invalidate_bp_value_on_memory_change): Expand + parameter LEN to ssize_t. + +--- src/gdb/amd64-tdep.c 2012/09/25 12:48:52 1.110 ++++ src/gdb/amd64-tdep.c 2012/09/26 07:52:47 1.111 +@@ -637,7 +637,7 @@ + } + + gdb_assert (class[1] != AMD64_MEMORY); +- gdb_assert (len <= 16); ++ gdb_assert (TYPE_LENGTH (type) <= 16); + + for (i = 0; len > 0; i++, len -= 8) + { +--- src/gdb/bfin-tdep.c 2012/09/25 12:48:52 1.11 ++++ src/gdb/bfin-tdep.c 2012/09/26 07:52:47 1.12 +@@ -615,7 +615,7 @@ + ULONGEST tmp; + int regno = BFIN_R0_REGNUM; + +- gdb_assert (len <= 8); ++ gdb_assert (TYPE_LENGTH (type) <= 8); + + while (len > 0) + { +@@ -643,7 +643,7 @@ + int len = TYPE_LENGTH (type); + int regno = BFIN_R0_REGNUM; + +- gdb_assert (len <= 8); ++ gdb_assert (TYPE_LENGTH (type) <= 8); + + while (len > 0) + { +--- src/gdb/cris-tdep.c 2012/05/18 21:02:47 1.185 ++++ src/gdb/cris-tdep.c 2012/09/26 07:52:47 1.186 +@@ -1662,20 +1662,20 @@ + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + ULONGEST val; +- int len = TYPE_LENGTH (type); + +- if (len <= 4) ++ if (TYPE_LENGTH (type) <= 4) + { + /* Put the return value in R10. */ +- val = extract_unsigned_integer (valbuf, len, byte_order); ++ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order); + regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val); + } +- else if (len <= 8) ++ else if (TYPE_LENGTH (type) <= 8) + { + /* Put the return value in R10 and R11. */ + val = extract_unsigned_integer (valbuf, 4, byte_order); + regcache_cooked_write_unsigned (regcache, ARG1_REGNUM, val); +- val = extract_unsigned_integer ((char *)valbuf + 4, len - 4, byte_order); ++ val = extract_unsigned_integer ((char *)valbuf + 4, ++ TYPE_LENGTH (type) - 4, byte_order); + regcache_cooked_write_unsigned (regcache, ARG2_REGNUM, val); + } + else +@@ -1833,21 +1833,21 @@ + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + ULONGEST val; +- int len = TYPE_LENGTH (type); + +- if (len <= 4) ++ if (TYPE_LENGTH (type) <= 4) + { + /* Get the return value from R10. */ + regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val); +- store_unsigned_integer (valbuf, len, byte_order, val); ++ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, val); + } +- else if (len <= 8) ++ else if (TYPE_LENGTH (type) <= 8) + { + /* Get the return value from R10 and R11. */ + regcache_cooked_read_unsigned (regcache, ARG1_REGNUM, &val); + store_unsigned_integer (valbuf, 4, byte_order, val); + regcache_cooked_read_unsigned (regcache, ARG2_REGNUM, &val); +- store_unsigned_integer ((char *)valbuf + 4, len - 4, byte_order, val); ++ store_unsigned_integer ((char *)valbuf + 4, TYPE_LENGTH (type) - 4, ++ byte_order, val); + } + else + error (_("cris_extract_return_value: type length too large")); +--- src/gdb/h8300-tdep.c 2012/09/25 12:48:53 1.136 ++++ src/gdb/h8300-tdep.c 2012/09/26 07:52:48 1.137 +@@ -751,12 +751,12 @@ + int len = TYPE_LENGTH (type); + ULONGEST c, addr; + +- switch (len) ++ switch (TYPE_LENGTH (type)) + { + case 1: + case 2: + regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); +- store_unsigned_integer (valbuf, len, byte_order, c); ++ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c); + break; + case 4: /* Needs two registers on plain H8/300 */ + regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c); +@@ -768,8 +768,9 @@ + if (TYPE_CODE (type) == TYPE_CODE_INT) + { + regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr); +- c = read_memory_unsigned_integer ((CORE_ADDR) addr, len, byte_order); +- store_unsigned_integer (valbuf, len, byte_order, c); ++ c = read_memory_unsigned_integer ((CORE_ADDR) addr, ++ TYPE_LENGTH (type), byte_order); ++ store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c); + } + else + { +--- src/gdb/hppa-tdep.c 2012/05/18 21:02:48 1.281 ++++ src/gdb/hppa-tdep.c 2012/09/26 07:52:48 1.282 +@@ -1160,7 +1160,7 @@ + int len = TYPE_LENGTH (type); + int regnum, offset; + +- if (len > 16) ++ if (TYPE_LENGTH (type) > 16) + { + /* All return values larget than 128 bits must be aggregate + return values. */ +--- src/gdb/lm32-tdep.c 2012/09/25 12:48:53 1.13 ++++ src/gdb/lm32-tdep.c 2012/09/26 07:52:48 1.14 +@@ -349,18 +349,18 @@ + struct gdbarch *gdbarch = get_regcache_arch (regcache); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + ULONGEST val; +- int len = TYPE_LENGTH (type); + +- if (len <= 4) ++ if (TYPE_LENGTH (type) <= 4) + { +- val = extract_unsigned_integer (valbuf, len, byte_order); ++ val = extract_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order); + regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val); + } +- else if (len <= 8) ++ else if (TYPE_LENGTH (type) <= 8) + { + val = extract_unsigned_integer (valbuf, 4, byte_order); + regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val); +- val = extract_unsigned_integer (valbuf + 4, len - 4, byte_order); ++ val = extract_unsigned_integer (valbuf + 4, TYPE_LENGTH (type) - 4, ++ byte_order); + regcache_cooked_write_unsigned (regcache, SIM_LM32_R2_REGNUM, val); + } + else +--- src/gdb/microblaze-tdep.c 2012/08/02 09:36:39 1.13 ++++ src/gdb/microblaze-tdep.c 2012/09/26 07:52:48 1.14 +@@ -590,22 +590,21 @@ + microblaze_store_return_value (struct type *type, struct regcache *regcache, + const gdb_byte *valbuf) + { +- int len = TYPE_LENGTH (type); + gdb_byte buf[8]; + + memset (buf, 0, sizeof(buf)); + + /* Integral and pointer return values. */ + +- if (len > 4) ++ if (TYPE_LENGTH (type) > 4) + { +- gdb_assert (len == 8); ++ gdb_assert (TYPE_LENGTH (type) == 8); + memcpy (buf, valbuf, 8); + regcache_cooked_write (regcache, MICROBLAZE_RETVAL_REGNUM+1, buf + 4); + } + else + /* ??? Do we need to do any sign-extension here? */ +- memcpy (buf + 4 - len, valbuf, len); ++ memcpy (buf + 4 - TYPE_LENGTH (type), valbuf, TYPE_LENGTH (type)); + + regcache_cooked_write (regcache, MICROBLAZE_RETVAL_REGNUM, buf); + } +--- src/gdb/spu-tdep.c 2012/09/17 08:52:18 1.82 ++++ src/gdb/spu-tdep.c 2012/09/26 07:52:48 1.83 +@@ -316,11 +316,10 @@ + struct frame_info *frame) + { + struct value *value = default_value_from_register (type, regnum, frame); +- int len = TYPE_LENGTH (type); + +- if (regnum < SPU_NUM_GPRS && len < 16) ++ if (regnum < SPU_NUM_GPRS && TYPE_LENGTH (type) < 16) + { +- int preferred_slot = len < 4 ? 4 - len : 0; ++ int preferred_slot = TYPE_LENGTH (type) < 4 ? 4 - TYPE_LENGTH (type) : 0; + set_value_offset (value, preferred_slot); + } + +--- src/gdb/vax-tdep.c 2012/05/16 14:35:08 1.112 ++++ src/gdb/vax-tdep.c 2012/09/26 07:52:48 1.113 +@@ -208,7 +208,6 @@ + struct type *type, struct regcache *regcache, + gdb_byte *readbuf, const gdb_byte *writebuf) + { +- int len = TYPE_LENGTH (type); + gdb_byte buf[8]; + + if (TYPE_CODE (type) == TYPE_CODE_STRUCT +@@ -224,7 +223,7 @@ + ULONGEST addr; + + regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr); +- read_memory (addr, readbuf, len); ++ read_memory (addr, readbuf, TYPE_LENGTH (type)); + } + + return RETURN_VALUE_ABI_RETURNS_ADDRESS; +@@ -234,16 +233,16 @@ + { + /* Read the contents of R0 and (if necessary) R1. */ + regcache_cooked_read (regcache, VAX_R0_REGNUM, buf); +- if (len > 4) ++ if (TYPE_LENGTH (type) > 4) + regcache_cooked_read (regcache, VAX_R1_REGNUM, buf + 4); +- memcpy (readbuf, buf, len); ++ memcpy (readbuf, buf, TYPE_LENGTH (type)); + } + if (writebuf) + { + /* Read the contents to R0 and (if necessary) R1. */ +- memcpy (buf, writebuf, len); ++ memcpy (buf, writebuf, TYPE_LENGTH (type)); + regcache_cooked_write (regcache, VAX_R0_REGNUM, buf); +- if (len > 4) ++ if (TYPE_LENGTH (type) > 4) + regcache_cooked_write (regcache, VAX_R1_REGNUM, buf + 4); + } + diff --git a/gdb-rhbz795424-bitpos-20of25.patch b/gdb-rhbz795424-bitpos-20of25.patch new file mode 100644 index 0000000..80a0621 --- /dev/null +++ b/gdb-rhbz795424-bitpos-20of25.patch @@ -0,0 +1,4532 @@ +http://sourceware.org/ml/gdb-patches/2012-09/msg00631.html +Subject: [PATCH 1/4] Expand bitpos and type.length to LONGEST and ULONGEST + + +--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 + +Index: gdb-7.5.0.20120926/gdb/ada-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ada-lang.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/ada-lang.c 2012-11-07 22:09:29.668141036 +0100 +@@ -80,7 +80,7 @@ static struct type *desc_bounds_type (st + + 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 *); + +@@ -88,13 +88,13 @@ static struct type *desc_data_target_typ + + 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); + +@@ -174,7 +174,7 @@ static struct type *static_unwrap_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 *); + +@@ -189,7 +189,8 @@ static int ada_is_unconstrained_packed_a + static struct value *value_subscript_packed (struct value *, int, + struct value **); + +-static void move_bits (gdb_byte *, int, const gdb_byte *, int, int, int); ++static void move_bits (gdb_byte *, int, const gdb_byte *, LONGEST, LONGEST, ++ int); + + static struct value *coerce_unspec_val_to_type (struct value *, + struct type *); +@@ -217,14 +218,14 @@ static struct value *value_val_atr (stru + static struct symbol *standard_lookup (const char *, const struct block *, + domain_enum); + +-static struct value *ada_search_struct_field (char *, struct value *, int, ++static struct value *ada_search_struct_field (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 struct value *ada_to_fixed_value_create (struct type *, CORE_ADDR, + struct value *); +@@ -240,7 +241,7 @@ static void ada_language_arch_info (stru + + static void check_size (const struct type *); + +-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 *, +@@ -586,7 +587,7 @@ coerce_unspec_val_to_type (struct value + } + + 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; +@@ -595,7 +596,7 @@ cond_offset_host (const gdb_byte *valadd + } + + static CORE_ADDR +-cond_offset_target (CORE_ADDR address, long offset) ++cond_offset_target (CORE_ADDR address, LONGEST offset) + { + if (address == 0) + return 0; +@@ -1601,7 +1602,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); +@@ -1667,7 +1668,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); +@@ -1702,7 +1703,7 @@ desc_one_bound (struct value *bounds, in + 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); +@@ -1892,7 +1893,7 @@ ada_type_of_array (struct value *arr, in + 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; +@@ -2044,7 +2045,7 @@ decode_packed_array_bitsize (struct type + in bits. */ + + 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; +@@ -2096,7 +2097,7 @@ decode_constrained_packed_array_type (st + 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)); +@@ -2167,7 +2168,8 @@ decode_constrained_packed_array (struct + 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; +@@ -2268,15 +2270,16 @@ has_negatives (struct type *type) + + 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; +- int src, /* Index into the source area */ +- targ, /* Index into the target area */ +- srcBitsLeft, /* Number of source bits left to move */ +- nsrc, ntarg, /* Number of source and target bytes */ +- unusedLS, /* Number of bits in next significant ++ int src; /* Index into the source area */ ++ LONGEST targ; /* Index into the target area */ ++ int srcBitsLeft, /* Number of source bits left to move */ ++ nsrc; /* Number of source bytes */ ++ LONGEST ntarg; /* Number of target bytes */ ++ int unusedLS, /* Number of bits in next significant + byte of source that are unused */ + accumSize; /* Number of meaningful bits in accum */ + unsigned char *bytes; /* First byte containing data to unpack */ +@@ -2309,7 +2312,7 @@ ada_value_primitive_packed_val (struct v + + 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)); +@@ -2426,7 +2429,7 @@ ada_value_primitive_packed_val (struct v + not overlap. */ + static void + move_bits (gdb_byte *target, int targ_offset, const gdb_byte *source, +- int src_offset, int n, int bits_big_endian_p) ++ LONGEST src_offset, LONGEST n, int bits_big_endian_p) + { + unsigned int accum, mask; + int accum_bits, chunk_size; +@@ -2516,7 +2519,7 @@ ada_value_assign (struct value *toval, s + { + int len = (value_bitpos (toval) + + bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; +- int from_size; ++ LONGEST from_size; + char *buffer = (char *) alloca (len); + struct value *val; + CORE_ADDR to_addr = value_address (toval); +@@ -2561,7 +2564,7 @@ value_assign_to_component (struct value + (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); + +@@ -4081,7 +4084,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)); + +@@ -4155,7 +4158,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 = alloca (len); + CORE_ADDR addr; + +@@ -6024,7 +6027,7 @@ value_tag_from_contents_and_address (str + 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, +@@ -6407,7 +6410,7 @@ ada_in_variant (LONGEST val, struct type + 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; +@@ -6419,7 +6422,7 @@ ada_value_primitive_field (struct value + + 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), +@@ -6446,9 +6449,9 @@ ada_value_primitive_field (struct value + 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; +@@ -6466,8 +6469,8 @@ find_struct_field (const char *name, str + + 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) +@@ -6537,7 +6540,7 @@ num_visible_fields (struct type *type) + Searches recursively through wrapper fields (e.g., '_parent'). */ + + static struct value * +-ada_search_struct_field (char *name, struct value *arg, int offset, ++ada_search_struct_field (char *name, struct value *arg, LONGEST offset, + struct type *type) + { + int i; +@@ -6570,7 +6573,7 @@ ada_search_struct_field (char *name, str + 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) + { +@@ -6588,8 +6591,8 @@ ada_search_struct_field (char *name, str + 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 +@@ -6598,7 +6601,7 @@ static struct value *ada_index_struct_fi + * 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); +@@ -6610,7 +6613,7 @@ ada_index_struct_field (int index, struc + * *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; +@@ -6700,7 +6703,8 @@ ada_value_struct_elt (struct value *arg, + 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; + +@@ -7006,8 +7010,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); + } +@@ -7386,10 +7390,9 @@ ada_template_to_fixed_record_type_1 (str + 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 +@@ -7460,7 +7463,7 @@ ada_template_to_fixed_record_type_1 (str + 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); +@@ -7579,11 +7582,11 @@ ada_template_to_fixed_record_type_1 (str + 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 + { +@@ -7920,7 +7923,8 @@ to_fixed_array_type (struct type *type0, + 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); +Index: gdb-7.5.0.20120926/gdb/ada-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ada-lang.h 2012-03-29 20:23:00.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ada-lang.h 2012-11-07 22:09:29.669141035 +0100 +@@ -168,7 +168,7 @@ extern void ada_print_type (struct type + extern void ada_print_typedef (struct type *type, struct symbol *new_symbol, + struct ui_file *stream); + +-extern void ada_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, ++extern void ada_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *); +@@ -183,7 +183,7 @@ extern void ada_emit_char (int, struct t + 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, +@@ -257,7 +257,7 @@ extern int ada_is_constrained_packed_arr + + 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 *); +Index: gdb-7.5.0.20120926/gdb/ada-typeprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ada-typeprint.c 2012-04-18 08:46:46.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ada-typeprint.c 2012-11-07 22:09:29.705140982 +0100 +@@ -815,8 +815,8 @@ ada_print_type (struct type *type0, cons + 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 "); +@@ -837,7 +837,8 @@ ada_print_type (struct type *type0, cons + } + 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) +Index: gdb-7.5.0.20120926/gdb/ada-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ada-valprint.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/ada-valprint.c 2012-11-07 22:09:29.731140943 +0100 +@@ -42,16 +42,16 @@ static void print_record (struct type *, + const struct value_print_options *); + + static int print_field_values (struct type *, const gdb_byte *, +- int, ++ LONGEST, + struct ui_file *, int, + const struct value *, + const struct value_print_options *, +- int, struct type *, int); ++ int, struct type *, LONGEST); + + static void adjust_type_signedness (struct type *); + +-static void ada_val_print_1 (struct type *, const gdb_byte *, int, CORE_ADDR, +- struct ui_file *, int, ++static void ada_val_print_1 (struct type *, const gdb_byte *, LONGEST, ++ CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *); + +@@ -144,7 +144,7 @@ val_print_packed_array_elements (struct + unsigned int things_printed = 0; + unsigned len; + struct type *elttype, *index_type; +- unsigned eltlen; ++ ULONGEST eltlen; + unsigned long bitsize = TYPE_FIELD_BITSIZE (type, 0); + struct value *mark = value_mark (); + LONGEST low = 0; +@@ -293,7 +293,7 @@ ada_emit_char (int c, struct type *type, + 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) +@@ -465,11 +465,11 @@ ada_print_scalar (struct type *type, LON + + 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; +@@ -484,9 +484,9 @@ printstr (struct ui_file *stream, struct + { + /* 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; + +@@ -520,7 +520,8 @@ printstr (struct ui_file *stream, struct + 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 + + 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) + { +@@ -570,7 +571,7 @@ ada_printstr (struct ui_file *stream, st + + void + ada_val_print (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) +@@ -602,8 +603,8 @@ ada_val_print_array (struct type *type, + { + 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 found + that TYPE is a string-like type. Similarly, the size of ELTTYPE +@@ -621,7 +622,7 @@ ada_val_print_array (struct type *type, + 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; +@@ -654,7 +655,7 @@ ada_val_print_array (struct type *type, + + static void + ada_val_print_1 (struct type *type, const gdb_byte *valaddr, +- int offset, CORE_ADDR address, ++ LONGEST offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) +@@ -923,12 +924,12 @@ ada_val_print_1 (struct type *type, cons + + 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, + const 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) + { + struct type *var_type = TYPE_FIELD_TYPE (type, field_num); + int which = ada_which_variant_applies (var_type, outer_type, +@@ -1035,11 +1036,11 @@ print_record (struct type *type, const g + + 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, + const 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) + { + int i, len; + +@@ -1120,7 +1121,7 @@ print_field_values (struct type *type, c + } + else + { +- 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; + +Index: gdb-7.5.0.20120926/gdb/annotate.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/annotate.c 2012-01-04 09:16:56.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/annotate.c 2012-11-07 22:09:29.732140942 +0100 +@@ -522,21 +522,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 +Index: gdb-7.5.0.20120926/gdb/annotate.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/annotate.h 2012-01-04 09:16:56.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/annotate.h 2012-11-07 22:09:29.733140941 +0100 +@@ -94,8 +94,8 @@ extern void annotate_frame_source_end (v + 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); +Index: gdb-7.5.0.20120926/gdb/arm-linux-nat.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/arm-linux-nat.c 2012-08-01 14:57:06.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/arm-linux-nat.c 2012-11-07 22:09:29.734140940 +0100 +@@ -1073,7 +1073,7 @@ arm_linux_remove_hw_breakpoint (struct g + /* Are we able to use a hardware watchpoint for the LEN bytes starting at + ADDR? */ + static int +-arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++arm_linux_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; +Index: gdb-7.5.0.20120926/gdb/ax-gdb.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ax-gdb.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/ax-gdb.c 2012-11-07 22:09:29.736140938 +0100 +@@ -84,12 +84,12 @@ static void gen_traced_pop (struct gdbar + 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 gdbarch *, struct agent_expr *); + static void gen_frame_locals_address (struct gdbarch *, 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 gdbarch *, struct agent_expr *ax, + struct axs_value *value, struct symbol *var); +@@ -137,15 +137,16 @@ static void gen_deref (struct agent_expr + static void gen_address_of (struct agent_expr *, struct axs_value *); + static void gen_bitfield_ref (struct expression *exp, 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 expression *exp, + 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 expression *exp, + struct agent_expr *ax, + struct axs_value *value, +- char *field, int offset, ++ char *field, LONGEST offset, + struct type *type); + static void gen_struct_ref (struct expression *exp, struct agent_expr *ax, + struct axs_value *value, +@@ -570,7 +571,7 @@ gen_fetch (struct agent_expr *ax, struct + 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) + { +@@ -624,7 +625,7 @@ gen_frame_locals_address (struct gdbarch + 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 +@@ -1280,7 +1281,7 @@ gen_address_of (struct agent_expr *ax, s + static void + gen_bitfield_ref (struct expression *exp, struct agent_expr *ax, + struct axs_value *value, struct type *type, +- int start, int end) ++ LONGEST start, LONGEST end) + { + /* Note that ops[i] fetches 8 << i bits. */ + static enum agent_op ops[] +@@ -1315,13 +1316,13 @@ gen_bitfield_ref (struct expression *exp + + /* 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; +@@ -1440,7 +1441,7 @@ gen_bitfield_ref (struct expression *exp + static void + gen_primitive_field (struct expression *exp, + 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)) +@@ -1465,7 +1466,7 @@ gen_primitive_field (struct expression * + static int + gen_struct_ref_recursive (struct expression *exp, struct agent_expr *ax, + struct axs_value *value, +- char *field, int offset, struct type *type) ++ char *field, LONGEST offset, struct type *type) + { + int i, rslt; + int nbases = TYPE_N_BASECLASSES (type); +Index: gdb-7.5.0.20120926/gdb/ax-general.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ax-general.c 2012-07-02 17:29:33.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ax-general.c 2012-11-07 22:09:29.743140927 +0100 +@@ -192,7 +192,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) +Index: gdb-7.5.0.20120926/gdb/ax.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ax.h 2012-07-02 17:29:33.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ax.h 2012-11-07 22:09:29.744140925 +0100 +@@ -190,7 +190,7 @@ extern void ax_ext (struct agent_expr *E + 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, +Index: gdb-7.5.0.20120926/gdb/breakpoint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/breakpoint.c 2012-11-07 22:09:24.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/breakpoint.c 2012-11-07 22:09:29.748140920 +0100 +@@ -6565,7 +6565,7 @@ breakpoint_address_match (struct address + + static int + breakpoint_address_match_range (struct address_space *aspace1, CORE_ADDR addr1, +- int len1, struct address_space *aspace2, ++ LONGEST len1, struct address_space *aspace2, + CORE_ADDR addr2) + { + return ((gdbarch_has_global_breakpoints (target_gdbarch) +@@ -11043,7 +11043,7 @@ can_use_hardware_watchpoint (struct valu + && TYPE_CODE (vtype) != TYPE_CODE_ARRAY)) + { + CORE_ADDR vaddr = value_address (v); +- int len; ++ LONGEST len; + int num_regs; + + len = (target_exact_watchpoints +Index: gdb-7.5.0.20120926/gdb/breakpoint.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/breakpoint.h 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/breakpoint.h 2012-11-07 22:09:29.778140875 +0100 +@@ -250,7 +250,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 +@@ -419,7 +419,7 @@ struct bp_location + /* For hardware watchpoints, the size of the memory region being + watched. For hardware ranged breakpoints, the size of the + breakpoint range. */ +- int length; ++ LONGEST length; + + /* Type of hardware watchpoint. */ + enum target_hw_bp_type watchpoint_type; +Index: gdb-7.5.0.20120926/gdb/c-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/c-lang.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/c-lang.c 2012-11-07 22:09:29.786140864 +0100 +@@ -189,7 +189,7 @@ c_printchar (int c, struct type *type, s + + 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) + { +@@ -678,7 +678,7 @@ evaluate_subexp_c (struct type *expect_t + } + else + { +- int i; ++ LONGEST i; + + /* Write the terminating character. */ + for (i = 0; i < TYPE_LENGTH (type); ++i) +@@ -687,7 +687,7 @@ evaluate_subexp_c (struct type *expect_t + 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) +Index: gdb-7.5.0.20120926/gdb/c-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/c-lang.h 2012-03-01 20:26:12.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/c-lang.h 2012-11-07 22:09:29.787140863 +0100 +@@ -72,7 +72,7 @@ extern void c_print_typedef (struct type + struct ui_file *); + + extern void c_val_print (struct type *, const gdb_byte *, +- int, CORE_ADDR, ++ LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *); +@@ -92,7 +92,7 @@ extern void c_printchar (int, struct typ + 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); +@@ -118,14 +118,14 @@ extern void cp_print_class_member (const + struct ui_file *, char *); + + extern void cp_print_value_fields (struct type *, struct type *, +- const gdb_byte *, int, CORE_ADDR, ++ const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *, + struct type **, int); + + extern void cp_print_value_fields_rtti (struct type *, +- const gdb_byte *, int, CORE_ADDR, ++ const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *, +Index: gdb-7.5.0.20120926/gdb/c-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/c-valprint.c 2012-05-18 23:02:47.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/c-valprint.c 2012-11-07 22:09:29.789140861 +0100 +@@ -133,7 +133,7 @@ static const struct generic_val_print_de + + void + c_val_print (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 *original_value, + const struct value_print_options *options) +@@ -144,7 +144,7 @@ c_val_print (struct type *type, const gd + unsigned len; + struct type *elttype, *unresolved_elttype; + struct type *unresolved_type = type; +- unsigned eltlen; ++ ULONGEST eltlen; + CORE_ADDR addr; + + CHECK_TYPEDEF (type); +@@ -364,9 +364,9 @@ c_val_print (struct type *type, const gd + /* Print vtable entry - we only get here if NOT using + -fvtable_thunks. (Otherwise, look under + TYPE_CODE_PTR.) */ +- int offset = (embedded_offset +- + TYPE_FIELD_BITPOS (type, +- VTBL_FNADDR_OFFSET) / 8); ++ LONGEST offset = (embedded_offset ++ + TYPE_FIELD_BITPOS (type, ++ VTBL_FNADDR_OFFSET) / 8); + struct type *field_type = TYPE_FIELD_TYPE (type, + VTBL_FNADDR_OFFSET); + CORE_ADDR addr +@@ -445,7 +445,8 @@ c_value_print (struct value *val, struct + const struct value_print_options *options) + { + struct type *type, *real_type, *val_type; +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + struct value_print_options opts = *options; + + opts.deref_ref = 1; +Index: gdb-7.5.0.20120926/gdb/cp-abi.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/cp-abi.c 2012-03-15 16:43:11.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/cp-abi.c 2012-11-07 22:09:29.790140859 +0100 +@@ -68,13 +68,13 @@ 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, +- int embedded_offset, CORE_ADDR address, ++ LONGEST embedded_offset, CORE_ADDR address, + const struct value *val) + { + volatile struct gdb_exception ex; +- int res = 0; ++ LONGEST res = 0; + + gdb_assert (current_cp_abi.baseclass_offset != NULL); + +@@ -98,7 +98,7 @@ baseclass_offset (struct type *type, int + 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; +@@ -108,7 +108,7 @@ value_virtual_fn_field (struct value **a + + struct type * + value_rtti_type (struct value *v, int *full, +- int *top, int *using_enc) ++ LONGEST *top, int *using_enc) + { + struct type *ret = NULL; + volatile struct gdb_exception e; +Index: gdb-7.5.0.20120926/gdb/cp-abi.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/cp-abi.h 2012-03-15 16:43:11.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/cp-abi.h 2012-11-07 22:09:29.792140855 +0100 +@@ -108,7 +108,7 @@ extern struct value *value_virtual_fn_fi + 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 +@@ -135,7 +135,7 @@ extern struct value *value_virtual_fn_fi + FULL, TOP, and USING_ENC can each be zero, in which case we don't + provide the corresponding piece of information. */ + extern struct type *value_rtti_type (struct value *value, +- int *full, int *top, ++ int *full, LONGEST *top, + int *using_enc); + + /* Compute the offset of the baseclass which is the INDEXth baseclass +@@ -144,11 +144,11 @@ extern struct type *value_rtti_type (str + 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, +- int 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 +@@ -204,12 +204,13 @@ 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, +- int *top, int *using_enc); +- int (*baseclass_offset) (struct type *type, int index, +- const bfd_byte *valaddr, int embedded_offset, +- CORE_ADDR address, const struct value *val); ++ LONGEST *top, int *using_enc); ++ 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); +Index: gdb-7.5.0.20120926/gdb/cp-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/cp-valprint.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/cp-valprint.c 2012-11-07 22:12:14.392901699 +0100 +@@ -82,7 +82,7 @@ static void cp_print_static_field (struc + const struct value_print_options *); + + static void cp_print_value (struct type *, struct type *, +- const gdb_byte *, int, ++ const gdb_byte *, LONGEST, + CORE_ADDR, struct ui_file *, + int, const struct value *, + const struct value_print_options *, +@@ -156,7 +156,7 @@ cp_is_vtbl_member (struct type *type) + + void + cp_print_value_fields (struct type *type, struct type *real_type, +- const gdb_byte *valaddr, int offset, ++ const gdb_byte *valaddr, LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, const struct value *val, + const struct value_print_options *options, +@@ -363,7 +363,7 @@ cp_print_value_fields (struct type *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)) +@@ -446,7 +446,7 @@ cp_print_value_fields (struct type *type + + void + cp_print_value_fields_rtti (struct type *type, +- const gdb_byte *valaddr, int offset, ++ const gdb_byte *valaddr, LONGEST offset, + CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *val, +@@ -462,7 +462,8 @@ cp_print_value_fields_rtti (struct type + TARGET_CHAR_BIT * TYPE_LENGTH (type))) + { + struct value *value; +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + + /* Ugh, we have to convert back to a value here. */ + value = value_from_contents_and_address (type, valaddr + offset, +@@ -486,7 +487,7 @@ cp_print_value_fields_rtti (struct type + + static void + cp_print_value (struct type *type, struct type *real_type, +- const gdb_byte *valaddr, int offset, ++ const gdb_byte *valaddr, LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, const struct value *val, + const struct value_print_options *options, +@@ -496,7 +497,7 @@ cp_print_value (struct type *type, struc + = (struct type **) obstack_next_free (&dont_print_vb_obstack); + struct obstack tmp_obstack = dont_print_vb_obstack; + int i, n_baseclasses = TYPE_N_BASECLASSES (type); +- int thisoffset; ++ LONGEST thisoffset; + struct type *thistype; + + if (dont_print_vb == 0) +@@ -510,7 +511,7 @@ cp_print_value (struct type *type, struc + + for (i = 0; i < n_baseclasses; i++) + { +- int boffset = 0; ++ LONGEST boffset = 0; + int skip; + struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); + const char *basename = TYPE_NAME (baseclass); +Index: gdb-7.5.0.20120926/gdb/d-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/d-lang.h 2012-03-01 20:26:12.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/d-lang.h 2012-11-07 22:09:29.795140852 +0100 +@@ -25,7 +25,7 @@ + extern char *d_demangle (const char *mangled, int options); + + extern void d_val_print (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); +Index: gdb-7.5.0.20120926/gdb/d-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/d-valprint.c 2012-03-01 20:26:12.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/d-valprint.c 2012-11-07 22:09:29.795140852 +0100 +@@ -29,7 +29,7 @@ + + static int + dynamic_array_type (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) +@@ -71,9 +71,9 @@ dynamic_array_type (struct type *type, c + + /* Implements the la_val_print routine for language D. */ + void +-d_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, int recurse, +- const struct value *val, ++d_val_print (struct type *type, const gdb_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ struct ui_file *stream, int recurse, const struct value *val, + const struct value_print_options *options) + { + int ret; +Index: gdb-7.5.0.20120926/gdb/doublest.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/doublest.c 2012-01-04 09:17:00.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/doublest.c 2012-11-07 22:09:29.797140848 +0100 +@@ -770,7 +770,7 @@ floatformat_from_doublest (const struct + but not passed on by GDB. This should be fixed. */ + + static const struct floatformat * +-floatformat_from_length (struct gdbarch *gdbarch, int len) ++floatformat_from_length (struct gdbarch *gdbarch, LONGEST len) + { + const struct floatformat *format; + +@@ -798,8 +798,8 @@ floatformat_from_length (struct gdbarch + else + format = NULL; + if (format == NULL) +- error (_("Unrecognized %d-bit floating-point type."), +- len * TARGET_CHAR_BIT); ++ error (_("Unrecognized %s-bit floating-point type."), ++ plongest (len * TARGET_CHAR_BIT)); + return format; + } + +Index: gdb-7.5.0.20120926/gdb/dwarf2loc.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/dwarf2loc.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/dwarf2loc.c 2012-11-07 22:09:29.800140844 +0100 +@@ -1672,19 +1672,19 @@ insert_bits (unsigned int datum, + BITS_BIG_ENDIAN is taken directly from gdbarch. */ + + static void +-copy_bitwise (gdb_byte *dest, unsigned int dest_offset_bits, +- const gdb_byte *source, unsigned int source_offset_bits, +- unsigned int bit_count, ++copy_bitwise (gdb_byte *dest, ULONGEST dest_offset_bits, ++ const gdb_byte *source, ULONGEST source_offset, ++ ULONGEST bit_count, + int bits_big_endian) + { +- unsigned int dest_avail; ++ unsigned int dest_avail, source_offset_bits; + int datum; + + /* Reduce everything to byte-size pieces. */ + dest += dest_offset_bits / 8; + dest_offset_bits %= 8; +- source += source_offset_bits / 8; +- source_offset_bits %= 8; ++ source += source_offset / 8; ++ source_offset_bits = source_offset % 8; + + dest_avail = 8 - dest_offset_bits % 8; + +@@ -1722,13 +1722,13 @@ static void + read_pieced_value (struct value *v) + { + int i; +- long offset = 0; ++ LONGEST offset = 0; + ULONGEST bits_to_skip; + gdb_byte *contents; + struct piece_closure *c + = (struct piece_closure *) value_computed_closure (v); + struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (v)); +- size_t type_len; ++ ULONGEST type_len; + size_t buffer_size = 0; + char *buffer = NULL; + struct cleanup *cleanup; +@@ -1755,8 +1755,8 @@ read_pieced_value (struct value *v) + for (i = 0; i < c->n_pieces && offset < type_len; i++) + { + struct dwarf_expr_piece *p = &c->pieces[i]; +- size_t this_size, this_size_bits; +- long dest_offset_bits, source_offset_bits, source_offset; ++ ULONGEST this_size, this_size_bits; ++ LONGEST dest_offset_bits, source_offset_bits, source_offset; + const gdb_byte *intermediate_buffer; + + /* Compute size, source, and destination offsets for copying, in +@@ -1905,13 +1905,13 @@ static void + write_pieced_value (struct value *to, struct value *from) + { + int i; +- long offset = 0; ++ LONGEST offset = 0; + ULONGEST bits_to_skip; + const gdb_byte *contents; + struct piece_closure *c + = (struct piece_closure *) value_computed_closure (to); + struct frame_info *frame = frame_find_by_id (VALUE_FRAME_ID (to)); +- size_t type_len; ++ ULONGEST type_len; + size_t buffer_size = 0; + char *buffer = NULL; + struct cleanup *cleanup; +@@ -1939,8 +1939,8 @@ write_pieced_value (struct value *to, st + for (i = 0; i < c->n_pieces && offset < type_len; i++) + { + struct dwarf_expr_piece *p = &c->pieces[i]; +- size_t this_size_bits, this_size; +- long dest_offset_bits, source_offset_bits, dest_offset, source_offset; ++ ULONGEST this_size_bits, this_size; ++ LONGEST dest_offset_bits, source_offset_bits, dest_offset, source_offset; + int need_bitwise; + const gdb_byte *source_buffer; + +@@ -2069,8 +2069,8 @@ write_pieced_value (struct value *to, st + implicit pointer. */ + + static int +-check_pieced_value_bits (const struct value *value, int bit_offset, +- int bit_length, ++check_pieced_value_bits (const struct value *value, LONGEST bit_offset, ++ LONGEST bit_length, + enum dwarf_value_location check_for) + { + struct piece_closure *c +@@ -2086,7 +2086,7 @@ check_pieced_value_bits (const struct va + for (i = 0; i < c->n_pieces && 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) + { +@@ -2124,8 +2124,8 @@ check_pieced_value_bits (const struct va + } + + static int +-check_pieced_value_validity (const struct value *value, int bit_offset, +- int bit_length) ++check_pieced_value_validity (const struct value *value, LONGEST bit_offset, ++ LONGEST bit_length) + { + return check_pieced_value_bits (value, bit_offset, bit_length, + DWARF_VALUE_MEMORY); +@@ -2143,8 +2143,8 @@ check_pieced_value_invalid (const struct + a synthetic pointer. */ + + static int +-check_pieced_synthetic_pointer (const struct value *value, int bit_offset, +- int bit_length) ++check_pieced_synthetic_pointer (const struct value *value, LONGEST bit_offset, ++ LONGEST bit_length) + { + return check_pieced_value_bits (value, bit_offset, bit_length, + DWARF_VALUE_IMPLICIT_POINTER); +@@ -2169,9 +2169,10 @@ indirect_pieced_value (struct value *val + struct type *type; + struct frame_info *frame; + struct dwarf2_locexpr_baton baton; +- int i, bit_offset, bit_length; ++ int i; ++ LONGEST bit_length; + struct dwarf_expr_piece *piece = NULL; +- LONGEST byte_offset; ++ LONGEST byte_offset, bit_offset; + + type = check_typedef (value_type (value)); + if (TYPE_CODE (type) != TYPE_CODE_PTR) +@@ -2185,7 +2186,7 @@ indirect_pieced_value (struct value *val + for (i = 0; i < c->n_pieces && 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) + { +@@ -2400,7 +2401,7 @@ dwarf2_evaluate_loc_desc_full (struct ty + struct value *value = dwarf_expr_fetch (ctx, 0); + gdb_byte *contents; + const gdb_byte *val_bytes; +- size_t n = TYPE_LENGTH (value_type (value)); ++ ULONGEST n = TYPE_LENGTH (value_type (value)); + + if (byte_offset + TYPE_LENGTH (type) > n) + invalid_synthetic_pointer (); +Index: gdb-7.5.0.20120926/gdb/dwarf2read.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/dwarf2read.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/dwarf2read.c 2012-11-07 22:09:29.809140832 +0100 +@@ -1128,12 +1128,12 @@ dwarf2_complex_location_expr_complaint ( + } + + 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 (&symfile_complaints, +- _("const value length mismatch for '%s', got %d, expected %d"), +- arg1, arg2, arg3); ++ _("const value length mismatch for '%s', got %s, expected %s"), ++ arg1, plongest (arg2), plongest (arg3)); + } + + static void +@@ -9831,8 +9831,8 @@ dwarf2_add_field (struct field_info *fip + 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) +Index: gdb-7.5.0.20120926/gdb/eval.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/eval.c 2012-11-07 22:00:41.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/eval.c 2012-11-07 22:13:52.096837314 +0100 +@@ -320,7 +320,8 @@ evaluate_struct_tuple (struct value *str + int pc = *pos; + struct value *val = NULL; + int nlabels = 0; +- int bitpos, bitsize; ++ int bitsize; ++ LONGEST bitpos; + bfd_byte *addr; + + /* Skip past the labels, and count them. */ +@@ -463,7 +464,7 @@ init_array_element (struct value *array, + 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) + { +@@ -816,11 +817,11 @@ binop_promote (const struct language_def + /* 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 +@@ -1004,7 +1005,7 @@ evaluate_subexp_standard (struct type *e + int lower; + int code; + int ix; +- long mem_offset; ++ LONGEST mem_offset; + struct type **arg_types; + int save_pos1; + struct symbol *function = NULL; +@@ -1194,7 +1195,7 @@ evaluate_subexp_standard (struct type *e + 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) +@@ -2194,7 +2195,8 @@ evaluate_subexp_standard (struct type *e + { + struct type *type = value_type (arg1); + struct type *real_type; +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + struct value_print_options opts; + + get_user_print_options (&opts); +Index: gdb-7.5.0.20120926/gdb/f-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/f-lang.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/f-lang.c 2012-11-07 22:09:29.847140776 +0100 +@@ -124,7 +124,7 @@ f_printchar (int c, struct type *type, s + + 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); +Index: gdb-7.5.0.20120926/gdb/f-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/f-lang.h 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/f-lang.h 2012-11-07 22:12:39.504865208 +0100 +@@ -32,7 +32,7 @@ extern const char *f_object_address_data + (struct type *type, struct ui_file *stream); + extern void f_object_address_data_valid_or_error (struct type *type); + +-extern void f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, ++extern void f_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *); +Index: gdb-7.5.0.20120926/gdb/f-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/f-valprint.c 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/f-valprint.c 2012-11-07 22:09:29.849140772 +0100 +@@ -43,7 +43,7 @@ static void f77_create_arrayprint_offset + struct ui_file *); + 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. */ +@@ -126,7 +126,7 @@ static void + f77_create_arrayprint_offset_tbl (struct type *type, struct ui_file *stream) + { + struct type *tmp_type; +- int eltlen; ++ LONGEST eltlen; + int ndimen = 1; + int upper, lower; + +@@ -171,13 +171,13 @@ f77_create_arrayprint_offset_tbl (struct + 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, + int *elts) + { +- int i; ++ LONGEST i; + + if (nss != ndimensions) + { +@@ -220,7 +220,7 @@ f77_print_array_1 (int nss, int ndimensi + + 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, +@@ -263,8 +263,9 @@ static const struct generic_val_print_de + function; they are identical. */ + + void +-f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, int recurse, ++f_val_print (struct type *type, const gdb_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) + { +@@ -389,7 +390,7 @@ f_val_print (struct type *type, const gd + fprintf_filtered (stream, "( "); + for (index = 0; index < TYPE_NFIELDS (type); index++) + { +- int offset = TYPE_FIELD_BITPOS (type, index) / 8; ++ LONGEST offset = TYPE_FIELD_BITPOS (type, index) / 8; + + val_print (TYPE_FIELD_TYPE (type, index), valaddr, + embedded_offset + offset, +Index: gdb-7.5.0.20120926/gdb/findvar.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/findvar.c 2012-11-07 22:00:41.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/findvar.c 2012-11-07 22:10:21.855065210 +0100 +@@ -645,7 +645,7 @@ default_value_from_register (struct type + struct frame_info *frame) + { + struct gdbarch *gdbarch = get_frame_arch (frame); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + struct value *value = allocate_value (type); + + VALUE_LVAL (value) = lval_register; +@@ -675,10 +675,10 @@ void + read_frame_register_value (struct value *value, struct frame_info *frame) + { + struct gdbarch *gdbarch = get_frame_arch (frame); +- int offset = 0; +- int reg_offset = value_offset (value); ++ LONGEST offset = 0; ++ LONGEST reg_offset = value_offset (value); + int regnum = VALUE_REGNUM (value); +- int len = TYPE_LENGTH (check_typedef (value_type (value))); ++ LONGEST len = TYPE_LENGTH (check_typedef (value_type (value))); + + gdb_assert (VALUE_LVAL (value) == lval_register); + +@@ -693,7 +693,7 @@ read_frame_register_value (struct value + while (len > 0) + { + struct value *regval = get_frame_register_value (frame, regnum); +- int reg_len = TYPE_LENGTH (value_type (regval)) - reg_offset; ++ LONGEST reg_len = TYPE_LENGTH (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. */ +Index: gdb-7.5.0.20120926/gdb/frame.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/frame.c 2012-09-17 09:17:27.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/frame.c 2012-11-07 22:09:29.853140768 +0100 +@@ -1117,7 +1117,7 @@ frame_register_read (struct frame_info * + + 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); +@@ -1146,7 +1146,7 @@ get_frame_register_bytes (struct frame_i + } + 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) +Index: gdb-7.5.0.20120926/gdb/frame.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/frame.h 2012-03-01 23:47:46.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/frame.h 2012-11-07 22:09:29.854140766 +0100 +@@ -530,7 +530,7 @@ extern void put_frame_register (struct f + 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); + +Index: gdb-7.5.0.20120926/gdb/gdbtypes.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/gdbtypes.c 2012-11-07 22:09:57.924099982 +0100 +@@ -2089,7 +2089,7 @@ allocate_gnat_aux_type (struct type *typ + where init_type is called with a NULL value for NAME). */ + + struct type * +-init_type (enum type_code code, int length, int flags, ++init_type (enum type_code code, LONGEST length, int flags, + char *name, struct objfile *objfile) + { + struct type *type; +@@ -2321,8 +2321,8 @@ is_public_ancestor (struct type *base, s + + 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; +@@ -2333,7 +2333,7 @@ is_unique_ancestor_worker (struct type * + 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)); + +@@ -2374,7 +2374,7 @@ is_unique_ancestor_worker (struct type * + 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), +@@ -3275,7 +3275,7 @@ recursive_dump_type (struct type *type, + 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 "); +@@ -3395,8 +3395,8 @@ recursive_dump_type (struct type *type, + idx, plongest (TYPE_FIELD_ENUMVAL (type, idx))); + else + printfi_filtered (spaces + 2, +- "[%d] bitpos %d bitsize %d type ", +- idx, TYPE_FIELD_BITPOS (type, idx), ++ "[%d] bitpos %s bitsize %d type ", ++ idx, plongest (TYPE_FIELD_BITPOS (type, idx)), + TYPE_FIELD_BITSIZE (type, idx)); + gdb_print_host_address (TYPE_FIELD_TYPE (type, idx), gdb_stdout); + printf_filtered (" name '%s' (", +@@ -4105,7 +4105,7 @@ free_all_types (void) + CODE, LENGTH, and NAME fields. */ + struct type * + arch_type (struct gdbarch *gdbarch, +- enum type_code code, int length, char *name) ++ enum type_code code, LONGEST length, char *name) + { + struct type *type; + +Index: gdb-7.5.0.20120926/gdb/gdbtypes.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.h 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/gdbtypes.h 2012-11-07 22:09:29.861140755 +0100 +@@ -602,7 +602,7 @@ struct main_type + gdbarch_bits_big_endian=0 targets, it is the bit offset to + the LSB. */ + +- int bitpos; ++ LONGEST bitpos; + + /* Enum value. */ + LONGEST enumval; +@@ -794,7 +794,7 @@ struct type + HOST_CHAR_BIT. However, this would still fail to address + machines based on a ternary or decimal representation. */ + +- unsigned length; ++ ULONGEST length; + + /* Core type, shared by a group of qualified types. */ + struct main_type *main_type; +@@ -1546,11 +1546,12 @@ extern struct type *alloc_type_copy (con + extern struct gdbarch *get_type_arch (const struct type *); + + /* Helper function to construct objfile-owned types. */ +-extern struct type *init_type (enum type_code, int, int, char *, ++extern struct type *init_type (enum type_code, LONGEST, int, char *, + struct objfile *); + + /* Helper functions to construct architecture-owned types. */ +-extern struct type *arch_type (struct gdbarch *, enum type_code, int, char *); ++extern struct type *arch_type (struct gdbarch *, enum type_code, LONGEST, ++ char *); + extern struct type *arch_integer_type (struct gdbarch *, int, int, char *); + extern struct type *arch_character_type (struct gdbarch *, int, int, char *); + extern struct type *arch_boolean_type (struct gdbarch *, int, int, char *); +Index: gdb-7.5.0.20120926/gdb/gnu-v2-abi.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/gnu-v2-abi.c 2012-02-07 05:48:21.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/gnu-v2-abi.c 2012-11-07 22:09:29.870140742 +0100 +@@ -86,7 +86,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)); +@@ -187,7 +187,8 @@ gnuv2_virtual_fn_field (struct value **a + + + static struct type * +-gnuv2_value_rtti_type (struct value *v, int *full, int *top, int *using_enc) ++gnuv2_value_rtti_type (struct value *v, int *full, LONGEST *top, ++ int *using_enc) + { + struct type *known_type; + struct type *rtti_type; +@@ -342,9 +343,9 @@ vb_match (struct type *type, int index, + 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, int embedded_offset, ++ const bfd_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, const struct value *val) + { + struct type *basetype = TYPE_BASECLASS (type, index); +@@ -362,8 +363,8 @@ gnuv2_baseclass_offset (struct type *typ + if (vb_match (type, i, basetype)) + { + struct type *field_type; +- int field_offset; +- int field_length; ++ LONGEST field_offset; ++ LONGEST field_length; + CORE_ADDR addr; + + field_type = check_typedef (TYPE_FIELD_TYPE (type, i)); +@@ -387,7 +388,7 @@ gnuv2_baseclass_offset (struct type *typ + /* 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); + +Index: gdb-7.5.0.20120926/gdb/gnu-v3-abi.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/gnu-v3-abi.c 2012-05-21 21:47:53.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/gnu-v3-abi.c 2012-11-07 22:09:29.872140740 +0100 +@@ -105,7 +105,7 @@ build_gdb_vtable_type (struct gdbarch *a + { + struct type *t; + struct field *field_list, *field; +- int offset; ++ LONGEST offset; + + struct type *void_ptr_type + = builtin_type (arch)->builtin_data_ptr; +@@ -181,7 +181,7 @@ vtable_ptrdiff_type (struct gdbarch *gdb + /* 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 = gdbarch_data (gdbarch, vtable_type_gdbarch_data); +@@ -272,7 +272,7 @@ gnuv3_get_vtable (struct gdbarch *gdbarc + + static struct type * + gnuv3_rtti_type (struct value *value, +- int *full_p, int *top_p, int *using_enc_p) ++ int *full_p, LONGEST *top_p, int *using_enc_p) + { + struct gdbarch *gdbarch; + struct type *values_type = check_typedef (value_type (value)); +@@ -384,7 +384,7 @@ gnuv3_get_virtual_fn (struct gdbarch *gd + 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; +@@ -414,16 +414,16 @@ gnuv3_virtual_fn_field (struct value **v + + -1 is returned on error. */ + +-static int ++static LONGEST + gnuv3_baseclass_offset (struct type *type, int index, +- const bfd_byte *valaddr, int embedded_offset, ++ const bfd_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, const struct value *val) + { + struct gdbarch *gdbarch; + 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); +@@ -447,7 +447,7 @@ gnuv3_baseclass_offset (struct type *typ + 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); +@@ -491,7 +491,7 @@ gnuv3_find_method_in (struct type *domai + 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)) +Index: gdb-7.5.0.20120926/gdb/go-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/go-lang.h 2012-04-25 16:07:20.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/go-lang.h 2012-11-07 22:09:29.874140737 +0100 +@@ -80,7 +80,7 @@ extern void go_print_type (struct type * + /* Defined in go-valprint.c. */ + + extern void go_val_print (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); +Index: gdb-7.5.0.20120926/gdb/go-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/go-valprint.c 2012-05-18 17:29:12.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/go-valprint.c 2012-11-07 22:09:29.874140737 +0100 +@@ -37,7 +37,7 @@ + + static void + print_go_string (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) +@@ -86,9 +86,9 @@ print_go_string (struct type *type, cons + /* Implements the la_val_print routine for language Go. */ + + void +-go_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, int recurse, +- const struct value *val, ++go_val_print (struct type *type, const gdb_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ struct ui_file *stream, int recurse, const struct value *val, + const struct value_print_options *options) + { + CHECK_TYPEDEF (type); +Index: gdb-7.5.0.20120926/gdb/i386-nat.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/i386-nat.c 2012-01-24 14:49:56.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/i386-nat.c 2012-11-07 22:09:29.876140733 +0100 +@@ -293,7 +293,7 @@ static int i386_remove_aligned_watchpoin + valid value, bombs through internal_error. */ + static int i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state, + i386_wp_op_t what, +- CORE_ADDR addr, int len, ++ CORE_ADDR addr, LONGEST len, + enum target_hw_bp_type type); + + /* Implementation. */ +@@ -505,8 +505,8 @@ i386_remove_aligned_watchpoint (struct i + + static int + i386_handle_nonaligned_watchpoint (struct i386_debug_reg_state *state, +- i386_wp_op_t what, CORE_ADDR addr, int len, +- enum target_hw_bp_type type) ++ i386_wp_op_t what, CORE_ADDR addr, ++ LONGEST len, enum target_hw_bp_type type) + { + int retval = 0; + int max_wp_len = TARGET_HAS_DR_LEN_8 ? 8 : 4; +@@ -663,7 +663,7 @@ i386_remove_watchpoint (CORE_ADDR addr, + address ADDR and whose length is LEN bytes. */ + + static int +-i386_region_ok_for_watchpoint (CORE_ADDR addr, int len) ++i386_region_ok_for_watchpoint (CORE_ADDR addr, LONGEST len) + { + struct i386_debug_reg_state *state = i386_debug_reg_state (); + int nregs; +Index: gdb-7.5.0.20120926/gdb/inf-ttrace.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/inf-ttrace.c 2012-06-14 20:21:31.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/inf-ttrace.c 2012-11-07 22:09:29.877140732 +0100 +@@ -364,7 +364,7 @@ inf_ttrace_can_use_hw_breakpoint (int ty + } + + static int +-inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++inf_ttrace_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + return 1; + } +Index: gdb-7.5.0.20120926/gdb/jv-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/jv-lang.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/jv-lang.c 2012-11-07 22:09:29.894140708 +0100 +@@ -440,7 +440,7 @@ java_link_class_type (struct gdbarch *gd + for (i = TYPE_N_BASECLASSES (type); i < nfields; i++) + { + int accflags; +- int boffset; ++ LONGEST boffset; + + if (fields == NULL) + { +@@ -890,7 +890,7 @@ java_printchar (int c, struct type *type + static void + java_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 = java_get_encoding (type); +Index: gdb-7.5.0.20120926/gdb/jv-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/jv-lang.h 2012-03-01 20:26:13.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/jv-lang.h 2012-11-07 22:09:29.902140696 +0100 +@@ -42,8 +42,8 @@ struct builtin_java_type + + extern const struct builtin_java_type *builtin_java_type (struct gdbarch *); + +-extern void java_val_print (struct type *, const gdb_byte *, int, CORE_ADDR, +- struct ui_file *, int, ++extern void java_val_print (struct type *, const gdb_byte *, LONGEST, ++ CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *); + +Index: gdb-7.5.0.20120926/gdb/jv-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/jv-valprint.c 2012-05-18 17:29:12.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/jv-valprint.c 2012-11-07 22:09:29.903140694 +0100 +@@ -266,7 +266,7 @@ java_value_print (struct value *val, str + + static void + java_print_value_fields (struct type *type, const gdb_byte *valaddr, +- int offset, ++ LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const struct value *val, +@@ -484,7 +484,7 @@ java_print_value_fields (struct type *ty + + void + java_val_print (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) +Index: gdb-7.5.0.20120926/gdb/language.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/language.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/language.c 2012-11-07 22:09:29.905140691 +0100 +@@ -724,7 +724,7 @@ unk_lang_printchar (int c, struct type * + + 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) + { +@@ -742,7 +742,7 @@ unk_lang_print_type (struct type *type, + + static void + unk_lang_val_print (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) +Index: gdb-7.5.0.20120926/gdb/language.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/language.h 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/language.h 2012-11-07 22:09:29.906140690 +0100 +@@ -175,7 +175,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 *); + +@@ -217,7 +217,7 @@ struct language_defn + + void (*la_val_print) (struct type *type, + const gdb_byte *contents, +- 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); +Index: gdb-7.5.0.20120926/gdb/m2-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m2-lang.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/m2-lang.c 2012-11-07 22:09:29.908140688 +0100 +@@ -104,10 +104,10 @@ m2_printchar (int c, struct type *type, + + 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; +@@ -122,9 +122,9 @@ m2_printstr (struct ui_file *stream, str + { + /* 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; + +@@ -153,7 +153,7 @@ m2_printstr (struct ui_file *stream, str + 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; +Index: gdb-7.5.0.20120926/gdb/m2-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m2-lang.h 2012-03-01 20:26:13.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/m2-lang.h 2012-11-07 22:09:29.909140686 +0100 +@@ -32,7 +32,7 @@ extern void m2_print_typedef (struct typ + 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 *, const gdb_byte *, int, CORE_ADDR, ++extern void m2_val_print (struct type *, const gdb_byte *, LONGEST, CORE_ADDR, + struct ui_file *, int, + const struct value *, + const struct value_print_options *); +Index: gdb-7.5.0.20120926/gdb/m2-typeprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m2-typeprint.c 2012-11-07 22:02:30.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/m2-typeprint.c 2012-11-07 22:09:29.910140684 +0100 +@@ -228,9 +228,12 @@ static void m2_array (struct type *type, + 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); +Index: gdb-7.5.0.20120926/gdb/m2-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m2-valprint.c 2012-11-07 22:02:30.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/m2-valprint.c 2012-11-07 22:09:29.911140682 +0100 +@@ -36,7 +36,7 @@ static int print_unpacked_pointer (struc + 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, + const struct value *val, + const struct value_print_options *options, +@@ -68,7 +68,7 @@ get_long_set_bounds (struct type *type, + + 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; +@@ -159,7 +159,7 @@ m2_print_long_set (struct type *type, co + + 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) + { +@@ -263,7 +263,7 @@ print_variable_at_address (struct 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, + const struct value *val, + const struct value_print_options *options, +@@ -309,14 +309,15 @@ static const struct generic_val_print_de + function; they are identical. */ + + void +-m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +- CORE_ADDR address, struct ui_file *stream, int recurse, ++m2_val_print (struct type *type, const gdb_byte *valaddr, ++ LONGEST embedded_offset, CORE_ADDR address, ++ struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options) + { + struct gdbarch *gdbarch = get_type_arch (type); +- unsigned int i = 0; /* Number of characters printed. */ +- unsigned len; ++ ULONGEST i = 0; /* Number of characters printed. */ ++ ULONGEST len; + struct type *elttype; + CORE_ADDR addr; + +@@ -341,7 +342,7 @@ m2_val_print (struct type *type, const g + 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; +Index: gdb-7.5.0.20120926/gdb/memrange.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/memrange.c 2012-01-04 09:17:06.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/memrange.c 2012-11-07 22:09:29.916140676 +0100 +@@ -21,8 +21,8 @@ + #include "memrange.h" + + 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; + +Index: gdb-7.5.0.20120926/gdb/memrange.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/memrange.h 2012-01-04 09:17:06.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/memrange.h 2012-11-07 22:09:29.917140674 +0100 +@@ -30,7 +30,7 @@ struct mem_range + CORE_ADDR start; + + /* Length of the range. */ +- int length; ++ LONGEST length; + }; + + typedef struct mem_range mem_range_s; +@@ -40,8 +40,8 @@ DEF_VEC_O(mem_range_s); + /* 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); + + /* Sort ranges by start address, then coalesce contiguous or + overlapping ranges. */ +Index: gdb-7.5.0.20120926/gdb/mips-linux-nat.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/mips-linux-nat.c 2012-05-22 20:12:13.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/mips-linux-nat.c 2012-11-07 22:09:29.918140672 +0100 +@@ -938,7 +938,7 @@ try_one_watch (struct pt_watch_regs *reg + the specified region can be covered by the watch registers. */ + + static int +-mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++mips_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + struct pt_watch_regs dummy_regs; + int i; +Index: gdb-7.5.0.20120926/gdb/objc-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/objc-lang.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/objc-lang.c 2012-11-07 22:09:29.920140670 +0100 +@@ -347,11 +347,11 @@ objc_printchar (int c, struct type *type + + static void + objc_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) + { +- unsigned int i; ++ ULONGEST i; + unsigned int things_printed = 0; + int in_quotes = 0; + int need_comma = 0; +@@ -372,9 +372,9 @@ objc_printstr (struct ui_file *stream, s + { + /* 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; + +@@ -403,7 +403,7 @@ objc_printstr (struct ui_file *stream, s + in_quotes = 0; + } + objc_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; +Index: gdb-7.5.0.20120926/gdb/opencl-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/opencl-lang.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/opencl-lang.c 2012-11-07 22:09:29.921140669 +0100 +@@ -80,11 +80,11 @@ builtin_opencl_type (struct gdbarch *gdb + + 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); + +@@ -174,9 +174,9 @@ lval_func_read (struct value *v) + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); + struct type *type = check_typedef (value_type (v)); + struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val))); +- int offset = value_offset (v); +- int elsize = TYPE_LENGTH (eltype); +- int n, i, j = 0; ++ LONGEST offset = value_offset (v); ++ LONGEST elsize = TYPE_LENGTH (eltype); ++ LONGEST n, i, j = 0; + LONGEST lowb = 0; + LONGEST highb = 0; + +@@ -203,9 +203,9 @@ lval_func_write (struct value *v, struct + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); + struct type *type = check_typedef (value_type (v)); + struct type *eltype = TYPE_TARGET_TYPE (check_typedef (value_type (c->val))); +- int offset = value_offset (v); +- int elsize = TYPE_LENGTH (eltype); +- int n, i, j = 0; ++ LONGEST offset = value_offset (v); ++ LONGEST elsize = TYPE_LENGTH (eltype); ++ LONGEST n, i, j = 0; + LONGEST lowb = 0; + LONGEST highb = 0; + +@@ -243,17 +243,18 @@ lval_func_write (struct value *v, struct + /* Return nonzero if all bits in V within OFFSET and LENGTH are valid. */ + + static int +-lval_func_check_validity (const struct value *v, int offset, int length) ++lval_func_check_validity (const struct value *v, LONGEST offset, ++ LONGEST length) + { + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); ++ struct type *t = check_typedef (value_type (c->val)); + /* Size of the target type in bits. */ +- int 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 elsize = TYPE_LENGTH (TYPE_TARGET_TYPE (t)) * 8; ++ LONGEST startrest = offset % elsize; ++ LONGEST start = offset / elsize; ++ LONGEST endrest = (offset + length) % elsize; ++ LONGEST end = (offset + length) / elsize; ++ LONGEST i; + + if (endrest) + end++; +@@ -263,8 +264,8 @@ lval_func_check_validity (const struct 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_valid (c->val, c->indices[i] * elsize + comp_offset, + comp_length)) +@@ -281,8 +282,8 @@ lval_func_check_any_valid (const struct + { + struct lval_closure *c = (struct lval_closure *) value_computed_closure (v); + /* Size of the target type in bits. */ +- int elsize = +- TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; ++ LONGEST elsize = ++ TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; + int i; + + for (i = 0; i < c->n; i++) +@@ -297,17 +298,17 @@ lval_func_check_any_valid (const struct + + static int + lval_func_check_synthetic_pointer (const struct value *v, +- int 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 = +- 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 elsize = ++ TYPE_LENGTH (TYPE_TARGET_TYPE (check_typedef (value_type (c->val)))) * 8; ++ LONGEST startrest = offset % elsize; ++ LONGEST start = offset / elsize; ++ LONGEST endrest = (offset + length) % elsize; ++ LONGEST end = (offset + length) / elsize; ++ LONGEST i; + + if (endrest) + end++; +@@ -317,8 +318,8 @@ lval_func_check_synthetic_pointer (const + + 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, +Index: gdb-7.5.0.20120926/gdb/p-lang.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/p-lang.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/p-lang.c 2012-11-07 22:09:29.922140667 +0100 +@@ -96,8 +96,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) + { +@@ -217,12 +217,12 @@ pascal_printchar (int c, struct type *ty + + 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; +@@ -250,9 +250,9 @@ pascal_printstr (struct ui_file *stream, + { + /* 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; +@@ -287,7 +287,7 @@ pascal_printstr (struct ui_file *stream, + 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; +Index: gdb-7.5.0.20120926/gdb/p-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/p-lang.h 2012-03-01 20:26:13.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/p-lang.h 2012-11-07 22:09:29.923140665 +0100 +@@ -35,7 +35,7 @@ extern void pascal_print_type (struct ty + extern void pascal_print_typedef (struct type *, struct symbol *, + struct ui_file *); + +-extern void pascal_val_print (struct type *, const gdb_byte *, int, ++extern void pascal_val_print (struct type *, const gdb_byte *, LONGEST, + CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *); +@@ -49,13 +49,13 @@ extern void pascal_type_print_method_arg + /* 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[]); +@@ -69,7 +69,7 @@ extern void + pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int); + + extern void pascal_object_print_value_fields (struct type *, const gdb_byte *, +- int, ++ LONGEST, + CORE_ADDR, struct ui_file *, + int, + const struct value *, +Index: gdb-7.5.0.20120926/gdb/p-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/p-valprint.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/p-valprint.c 2012-11-07 22:09:29.930140655 +0100 +@@ -59,7 +59,7 @@ static const struct generic_val_print_de + + void + pascal_val_print (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 *original_value, + const struct value_print_options *options) +@@ -70,8 +70,8 @@ pascal_val_print (struct type *type, con + unsigned len; + LONGEST low_bound, high_bound; + 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; +@@ -504,7 +504,7 @@ static void pascal_object_print_static_f + const struct value_print_options *); + + static void pascal_object_print_value (struct type *, const gdb_byte *, +- int, ++ LONGEST, + CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *, +@@ -563,7 +563,7 @@ pascal_object_is_vtbl_member (struct typ + + void + pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, +- int offset, ++ LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const struct value *val, +@@ -758,7 +758,7 @@ pascal_object_print_value_fields (struct + + static void + pascal_object_print_value (struct type *type, const gdb_byte *valaddr, +- int offset, ++ LONGEST offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const struct value *val, +@@ -781,11 +781,11 @@ pascal_object_print_value (struct type * + + for (i = 0; i < n_baseclasses; i++) + { +- int boffset = 0; ++ LONGEST boffset = 0; + struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); + const char *basename = type_name_no_tag (baseclass); + const gdb_byte *base_valaddr = NULL; +- int thisoffset; ++ LONGEST thisoffset; + volatile struct gdb_exception ex; + int skip = 0; + +Index: gdb-7.5.0.20120926/gdb/ppc-linux-nat.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ppc-linux-nat.c 2012-07-06 18:49:43.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ppc-linux-nat.c 2012-11-07 22:09:29.933140651 +0100 +@@ -1493,7 +1493,7 @@ ppc_linux_can_use_hw_breakpoint (int typ + } + + static int +-ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++ppc_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + /* Handle sub-8-byte quantities. */ + if (len <= 0) +Index: gdb-7.5.0.20120926/gdb/printcmd.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/printcmd.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/printcmd.c 2012-11-07 22:09:29.940140641 +0100 +@@ -291,7 +291,7 @@ print_formatted (struct value *val, int + 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; +@@ -369,7 +369,7 @@ print_scalar_formatted (const void *vala + { + struct gdbarch *gdbarch = get_type_arch (type); + LONGEST val_long = 0; +- 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. */ +Index: gdb-7.5.0.20120926/gdb/procfs.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/procfs.c 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/procfs.c 2012-11-07 22:09:29.945140633 +0100 +@@ -4966,7 +4966,7 @@ procfs_remove_watchpoint (CORE_ADDR addr + } + + static int +-procfs_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++procfs_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 +Index: gdb-7.5.0.20120926/gdb/python/py-prettyprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/python/py-prettyprint.c 2012-01-04 09:17:25.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/python/py-prettyprint.c 2012-11-07 22:09:29.969140598 +0100 +@@ -676,7 +676,7 @@ print_children (PyObject *printer, const + + int + apply_val_pretty_printer (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, +@@ -824,7 +824,7 @@ gdbpy_default_visualizer (PyObject *self + + int + apply_val_pretty_printer (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, +Index: gdb-7.5.0.20120926/gdb/python/python.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/python/python.h 2012-11-07 22:00:41.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/python/python.h 2012-11-07 22:10:46.010030115 +0100 +@@ -37,7 +37,7 @@ void source_python_script (FILE *file, c + void run_python_script (int argc, char **argv); + + int apply_val_pretty_printer (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, +Index: gdb-7.5.0.20120926/gdb/regcache.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/regcache.c 2012-01-04 09:17:09.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/regcache.c 2012-11-07 22:09:29.988140571 +0100 +@@ -902,7 +902,7 @@ typedef void (regcache_write_ftype) (str + + static enum register_status + regcache_xfer_part (struct regcache *regcache, int regnum, +- int offset, int len, void *in, const void *out, ++ LONGEST offset, LONGEST len, void *in, const void *out, + enum register_status (*read) (struct regcache *regcache, + int regnum, + gdb_byte *buf), +@@ -946,7 +946,7 @@ regcache_xfer_part (struct regcache *reg + + enum register_status + regcache_raw_read_part (struct regcache *regcache, int regnum, +- int offset, int len, gdb_byte *buf) ++ int offset, LONGEST len, gdb_byte *buf) + { + struct regcache_descr *descr = regcache->descr; + +@@ -957,7 +957,7 @@ regcache_raw_read_part (struct regcache + + void + regcache_raw_write_part (struct regcache *regcache, int regnum, +- int offset, int len, const gdb_byte *buf) ++ int offset, LONGEST len, const gdb_byte *buf) + { + struct regcache_descr *descr = regcache->descr; + +@@ -968,7 +968,7 @@ regcache_raw_write_part (struct regcache + + enum register_status + regcache_cooked_read_part (struct regcache *regcache, int regnum, +- int offset, int len, gdb_byte *buf) ++ LONGEST offset, LONGEST len, gdb_byte *buf) + { + struct regcache_descr *descr = regcache->descr; + +@@ -979,7 +979,7 @@ regcache_cooked_read_part (struct regcac + + void + regcache_cooked_write_part (struct regcache *regcache, int regnum, +- int offset, int len, const gdb_byte *buf) ++ LONGEST offset, LONGEST len, const gdb_byte *buf) + { + struct regcache_descr *descr = regcache->descr; + +Index: gdb-7.5.0.20120926/gdb/regcache.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/regcache.h 2012-01-04 09:17:10.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/regcache.h 2012-11-07 22:09:29.990140568 +0100 +@@ -90,9 +90,9 @@ extern void regcache_raw_write_unsigned + + extern enum register_status + regcache_raw_read_part (struct regcache *regcache, int regnum, +- int offset, int len, gdb_byte *buf); ++ int offset, LONGEST len, gdb_byte *buf); + void regcache_raw_write_part (struct regcache *regcache, int regnum, +- int offset, int len, const gdb_byte *buf); ++ int offset, LONGEST len, const gdb_byte *buf); + + void regcache_invalidate (struct regcache *regcache, int regnum); + +@@ -129,10 +129,11 @@ extern void regcache_cooked_write_unsign + write style operations. */ + + enum register_status regcache_cooked_read_part (struct regcache *regcache, +- int regnum, int offset, +- int len, gdb_byte *buf); ++ int regnum, LONGEST offset, ++ LONGEST len, gdb_byte *buf); + void regcache_cooked_write_part (struct regcache *regcache, int regnum, +- int offset, int len, const gdb_byte *buf); ++ LONGEST offset, LONGEST len, ++ const gdb_byte *buf); + + /* Special routines to read/write the PC. */ + +Index: gdb-7.5.0.20120926/gdb/remote.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/remote.c 2012-11-07 22:00:42.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/remote.c 2012-11-07 22:09:29.994140562 +0100 +@@ -8119,7 +8119,7 @@ int remote_hw_watchpoint_length_limit = + int remote_hw_breakpoint_limit = -1; + + static int +-remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + if (remote_hw_watchpoint_length_limit == 0) + return 0; +Index: gdb-7.5.0.20120926/gdb/s390-nat.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/s390-nat.c 2012-03-05 20:05:09.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/s390-nat.c 2012-11-07 22:09:30.016140531 +0100 +@@ -572,7 +572,7 @@ s390_can_use_hw_breakpoint (int type, in + } + + static int +-s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, int cnt) ++s390_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST cnt) + { + return 1; + } +Index: gdb-7.5.0.20120926/gdb/spu-multiarch.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/spu-multiarch.c 2012-05-18 23:02:50.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/spu-multiarch.c 2012-11-07 22:09:30.021140523 +0100 +@@ -118,7 +118,7 @@ spu_thread_architecture (struct target_o + + /* Override the to_region_ok_for_hw_watchpoint routine. */ + static int +-spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++spu_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + struct target_ops *ops_beneath = find_target_beneath (&spu_ops); + while (ops_beneath && !ops_beneath->to_region_ok_for_hw_watchpoint) +Index: gdb-7.5.0.20120926/gdb/stack.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/stack.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/stack.c 2012-11-07 22:09:30.024140518 +0100 +@@ -173,7 +173,7 @@ print_stack_frame (struct frame_info *fr + 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); +@@ -497,7 +497,7 @@ print_frame_args (struct symbol *func, s + /* 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; + struct cleanup *old_chain; +@@ -537,8 +537,8 @@ print_frame_args (struct symbol *func, s + 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. */ +@@ -673,7 +673,7 @@ print_frame_args (struct symbol *func, s + 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)); +Index: gdb-7.5.0.20120926/gdb/symmisc.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/symmisc.c 2012-11-07 22:00:42.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/symmisc.c 2012-11-07 22:09:30.026140516 +0100 +@@ -517,11 +517,11 @@ print_symbol (void *args) + + 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]); +Index: gdb-7.5.0.20120926/gdb/target.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/target.c 2012-07-02 17:29:35.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/target.c 2012-11-07 22:09:30.029140511 +0100 +@@ -51,7 +51,7 @@ static void default_terminal_info (char + static int default_watchpoint_addr_within_range (struct target_ops *, + CORE_ADDR, CORE_ADDR, int); + +-static int default_region_ok_for_hw_watchpoint (CORE_ADDR, int); ++static int default_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); + + static void tcomplain (void) ATTRIBUTE_NORETURN; + +@@ -127,7 +127,7 @@ static int debug_to_stopped_data_address + static int debug_to_watchpoint_addr_within_range (struct target_ops *, + CORE_ADDR, CORE_ADDR, int); + +-static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, int); ++static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); + + static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int, + struct expression *); +@@ -3546,7 +3546,7 @@ target_fileio_read_stralloc (const char + + + static int +-default_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++default_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + return (len <= gdbarch_ptr_bit (target_gdbarch) / TARGET_CHAR_BIT); + } +@@ -4197,7 +4197,7 @@ debug_to_can_use_hw_breakpoint (int type + } + + static int +-debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len) ++debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + { + CORE_ADDR retval; + +Index: gdb-7.5.0.20120926/gdb/target.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/target.h 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/target.h 2012-11-07 22:09:30.055140474 +0100 +@@ -478,7 +478,7 @@ struct target_ops + + /* Documentation of this routine is provided with the corresponding + target_* macro. */ +- int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, int); ++ int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, LONGEST); + + int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int, + struct expression *); +Index: gdb-7.5.0.20120926/gdb/tracepoint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/tracepoint.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/tracepoint.c 2012-11-07 22:09:30.065140459 +0100 +@@ -934,13 +934,13 @@ add_register (struct collection_list *co + static void + add_memrange (struct collection_list *memranges, + int type, bfd_signed_vma base, +- unsigned long len) ++ ULONGEST len) + { + if (info_verbose) + { + printf_filtered ("(%d,", type); + printf_vma (base); +- printf_filtered (",%ld)\n", len); ++ printf_filtered (",%s)\n", pulongest (len)); + } + + /* type: memrange_absolute == memory, other n == basereg */ +@@ -969,7 +969,7 @@ collect_symbol (struct collection_list * + long frame_regno, long frame_offset, + CORE_ADDR scope) + { +- unsigned long len; ++ ULONGEST len; + unsigned int reg; + bfd_signed_vma offset; + int treat_as_expr = 0; +@@ -993,8 +993,8 @@ collect_symbol (struct collection_list * + char tmp[40]; + + sprintf_vma (tmp, offset); +- 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), + tmp /* address */); + } + /* A struct may be a C++ class with static fields, go to general +@@ -1026,8 +1026,8 @@ collect_symbol (struct collection_list * + offset = frame_offset + SYMBOL_VALUE (sym); + if (info_verbose) + { +- printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset ", +- SYMBOL_PRINT_NAME (sym), len); ++ printf_filtered ("LOC_LOCAL %s: Collect %s bytes at offset ", ++ SYMBOL_PRINT_NAME (sym), pulongest (len)); + printf_vma (offset); + printf_filtered (" from frame ptr reg %d\n", reg); + } +@@ -1038,8 +1038,8 @@ collect_symbol (struct collection_list * + offset = 0; + if (info_verbose) + { +- printf_filtered ("LOC_REGPARM_ADDR %s: Collect %ld bytes at offset ", +- SYMBOL_PRINT_NAME (sym), len); ++ printf_filtered ("LOC_REGPARM_ADDR %s: Collect %s bytes at offset ", ++ SYMBOL_PRINT_NAME (sym), pulongest (len)); + printf_vma (offset); + printf_filtered (" from reg %d\n", reg); + } +@@ -1050,8 +1050,8 @@ collect_symbol (struct collection_list * + offset = frame_offset + SYMBOL_VALUE (sym); + if (info_verbose) + { +- printf_filtered ("LOC_LOCAL %s: Collect %ld bytes at offset ", +- SYMBOL_PRINT_NAME (sym), len); ++ printf_filtered ("LOC_LOCAL %s: Collect %s bytes at offset ", ++ SYMBOL_PRINT_NAME (sym), pulongest (len)); + printf_vma (offset); + printf_filtered (" from frame ptr reg %d\n", reg); + } +@@ -2617,7 +2617,8 @@ scope_info (char *args, int from_tty) + const char *symname; + char *save_args = args; + struct block_iterator iter; +- int j, count = 0; ++ int count = 0; ++ LONGEST j; + struct gdbarch *gdbarch; + int regno; + +@@ -2747,8 +2748,11 @@ scope_info (char *args, int from_tty) + break; + } + 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; +Index: gdb-7.5.0.20120926/gdb/typeprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/typeprint.c 2012-11-07 22:00:41.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/typeprint.c 2012-11-07 22:09:30.066140457 +0100 +@@ -123,7 +123,7 @@ whatis_exp (char *exp, int show) + struct type *real_type = NULL; + struct type *type; + int full = 0; +- int top = -1; ++ LONGEST top = -1; + int using_enc = 0; + struct value_print_options opts; + +Index: gdb-7.5.0.20120926/gdb/valarith.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/valarith.c 2012-11-07 22:02:18.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/valarith.c 2012-11-07 22:13:31.145867519 +0100 +@@ -192,15 +192,15 @@ value_subscript (struct value *array, LO + 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)); +- unsigned int elt_size = TYPE_LENGTH (elt_type); +- unsigned int elt_stride ++ ULONGEST elt_size = TYPE_LENGTH (elt_type); ++ ULONGEST elt_stride + = (TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type)) == 0 + ? elt_size : TYPE_BYTE_STRIDE (TYPE_INDEX_TYPE (array_type))); +- unsigned int elt_offs = elt_stride * longest_to_int (index - lowerbound); ++ ULONGEST elt_offs = elt_stride * longest_to_int (index - lowerbound); + struct value *v; + + if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) +@@ -678,7 +678,7 @@ value_concat (struct value *arg1, struct + struct value *inval1; + struct value *inval2; + struct value *outval = NULL; +- int inval1len, inval2len; ++ ssize_t inval1len, inval2len; + int count, idx; + char *ptr; + char inchar; +@@ -1489,7 +1489,7 @@ value_binop (struct value *arg1, struct + int + value_logical_not (struct value *arg1) + { +- int len; ++ LONGEST len; + const gdb_byte *p; + struct type *type1; + +@@ -1520,11 +1520,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++) + { +Index: gdb-7.5.0.20120926/gdb/valops.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/valops.c 2012-11-07 22:06:35.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/valops.c 2012-11-07 22:09:30.074140445 +0100 +@@ -54,11 +54,11 @@ static int typecmp (int staticp, int var + struct field t1[], struct value *t2[]); + + static struct value *search_struct_field (const char *, struct value *, +- int, struct type *, int); ++ LONGEST, struct type *, int); + + static struct value *search_struct_method (const char *, struct value **, + struct value **, +- int, int *, struct type *); ++ LONGEST, int *, struct type *); + + static int find_oload_champ_namespace (struct value **, int, + const char *, const char *, +@@ -86,7 +86,7 @@ oload_classification classify_oload_matc + int, int); + + static struct value *value_struct_elt_for_reference (struct type *, +- int, struct type *, ++ LONGEST, struct type *, + char *, + struct type *, + int, enum noside); +@@ -103,8 +103,8 @@ static CORE_ADDR allocate_space_in_infer + static struct value *cast_into_complex (struct type *, struct value *); + + static struct fn_field *find_method_list (struct value **, const char *, +- int, struct type *, int *, +- struct type **, int *); ++ LONGEST, struct type *, int *, ++ struct type **, LONGEST *); + + void _initialize_valops (void); + +@@ -189,7 +189,7 @@ find_function_in_inferior (const char *n + 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); +@@ -262,7 +262,8 @@ value_cast_structs (struct type *type, s + if (TYPE_NAME (t2) != NULL) + { + /* Try downcasting using the run-time type of the value. */ +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + struct type *real_type; + + real_type = value_rtti_type (v2, &full, &top, &using_enc); +@@ -401,12 +402,12 @@ value_cast (struct type *type, struct va + 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) +@@ -656,7 +657,7 @@ value_reinterpret_cast (struct type *typ + static int + dynamic_cast_check_1 (struct type *desired_type, + const gdb_byte *valaddr, +- int embedded_offset, ++ LONGEST embedded_offset, + CORE_ADDR address, + struct value *val, + struct type *search_type, +@@ -668,8 +669,8 @@ dynamic_cast_check_1 (struct type *desir + + for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i) + { +- int offset = baseclass_offset (search_type, i, valaddr, embedded_offset, +- address, val); ++ LONGEST offset = baseclass_offset (search_type, i, valaddr, ++ embedded_offset, address, val); + + if (class_types_same_p (desired_type, TYPE_BASECLASS (search_type, i))) + { +@@ -703,7 +704,7 @@ dynamic_cast_check_1 (struct type *desir + static int + dynamic_cast_check_2 (struct type *desired_type, + const gdb_byte *valaddr, +- int embedded_offset, ++ LONGEST embedded_offset, + CORE_ADDR address, + struct value *val, + struct type *search_type, +@@ -713,7 +714,7 @@ dynamic_cast_check_2 (struct type *desir + + for (i = 0; i < TYPE_N_BASECLASSES (search_type) && result_count < 2; ++i) + { +- int offset; ++ LONGEST offset; + + if (! BASETYPE_VIA_PUBLIC (search_type, i)) + continue; +@@ -744,7 +745,8 @@ dynamic_cast_check_2 (struct type *desir + struct value * + value_dynamic_cast (struct type *type, struct value *arg) + { +- int full, top, using_enc; ++ int full, using_enc; ++ LONGEST top; + struct type *resolved_type = check_typedef (type); + struct type *arg_type = check_typedef (value_type (arg)); + struct type *class_type, *rtti_type; +@@ -1197,7 +1199,7 @@ value_fetch_lazy (struct value *val) + } + + void +-read_value_memory (struct value *val, int embedded_offset, ++read_value_memory (struct value *val, LONGEST embedded_offset, + int stack, CORE_ADDR memaddr, + gdb_byte *buffer, size_t length) + { +@@ -1332,7 +1334,7 @@ value_assign (struct value *toval, struc + { + const gdb_byte *dest_buffer; + CORE_ADDR changed_addr; +- int changed_len; ++ LONGEST changed_len; + gdb_byte buffer[sizeof (LONGEST)]; + + if (value_bitsize (toval)) +@@ -1411,7 +1413,7 @@ value_assign (struct value *toval, struc + if (value_bitsize (toval)) + { + struct value *parent = value_parent (toval); +- int offset = value_offset (parent) + value_offset (toval); ++ LONGEST offset = value_offset (parent) + value_offset (toval); + int changed_len; + gdb_byte buffer[sizeof (LONGEST)]; + int optim, unavail; +@@ -1892,7 +1894,7 @@ value_array (int lowbound, int highbound + { + int nelem; + int idx; +- unsigned int typelength; ++ ULONGEST typelength; + struct value *val; + struct type *arraytype; + +@@ -2080,7 +2082,7 @@ typecmp (int staticp, int varargs, int n + + static void + update_search_result (struct value **result_ptr, struct value *v, +- int *last_boffset, int boffset, ++ LONGEST *last_boffset, LONGEST boffset, + const char *name, struct type *type) + { + if (v != NULL) +@@ -2104,10 +2106,10 @@ update_search_result (struct value **res + lookup is ambiguous. */ + + static void +-do_search_struct_field (const char *name, struct value *arg1, int offset, ++do_search_struct_field (const char *name, struct value *arg1, LONGEST offset, + struct type *type, int looking_for_baseclass, + struct value **result_ptr, +- int *last_boffset, ++ LONGEST *last_boffset, + struct type *outermost_type) + { + int i; +@@ -2162,7 +2164,7 @@ do_search_struct_field (const char *name + . */ + + struct value *v = NULL; +- int new_offset = offset; ++ LONGEST new_offset = offset; + + /* This is pretty gross. In G++, the offset in an + anonymous union is relative to the beginning of the +@@ -2201,7 +2203,7 @@ do_search_struct_field (const char *name + && (strcmp_iw (name, + TYPE_BASECLASS_NAME (type, + i)) == 0)); +- int boffset = value_embedded_offset (arg1) + offset; ++ LONGEST boffset = value_embedded_offset (arg1) + offset; + + if (BASETYPE_VIA_VIRTUAL (type, i)) + { +@@ -2276,11 +2278,11 @@ do_search_struct_field (const char *name + fields, look for a baseclass named NAME. */ + + static struct value * +-search_struct_field (const char *name, struct value *arg1, int offset, ++search_struct_field (const char *name, struct value *arg1, LONGEST offset, + struct type *type, int looking_for_baseclass) + { + struct value *result = NULL; +- int boffset = 0; ++ LONGEST boffset = 0; + + do_search_struct_field (name, arg1, offset, type, looking_for_baseclass, + &result, &boffset, type); +@@ -2297,7 +2299,7 @@ search_struct_field (const char *name, s + + static struct value * + search_struct_method (const char *name, struct value **arg1p, +- struct value **args, int offset, ++ struct value **args, LONGEST offset, + int *static_memfuncp, struct type *type) + { + int i; +@@ -2361,9 +2363,9 @@ search_struct_method (const char *name, + + for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) + { +- int base_offset; ++ LONGEST base_offset; + int skip = 0; +- int this_offset; ++ LONGEST this_offset; + + if (BASETYPE_VIA_VIRTUAL (type, i)) + { +@@ -2545,8 +2547,8 @@ value_struct_elt (struct value **argp, s + + static struct fn_field * + find_method_list (struct value **argp, const char *method, +- int offset, struct type *type, int *num_fns, +- struct type **basetype, int *boffset) ++ LONGEST offset, struct type *type, int *num_fns, ++ struct type **basetype, LONGEST *boffset) + { + int i; + struct fn_field *f; +@@ -2579,7 +2581,7 @@ find_method_list (struct value **argp, c + /* Not found in object, check in base subobjects. */ + for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) + { +- int base_offset; ++ LONGEST base_offset; + + if (BASETYPE_VIA_VIRTUAL (type, i)) + { +@@ -2615,7 +2617,7 @@ find_method_list (struct value **argp, c + static struct fn_field * + value_find_oload_method_list (struct value **argp, const char *method, + int offset, int *num_fns, +- struct type **basetype, int *boffset) ++ struct type **basetype, LONGEST *boffset) + { + struct type *t; + +@@ -2707,7 +2709,7 @@ find_overload_match (struct value **args + /* Number of overloaded instances being considered. */ + int num_fns = 0; + struct type *basetype = NULL; +- int boffset; ++ LONGEST boffset; + + struct cleanup *all_cleanups = make_cleanup (null_cleanup, NULL); + +@@ -3413,7 +3415,7 @@ compare_parameters (struct type *t1, str + 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, char *name, + struct type *intype, + int want_address, +@@ -3450,7 +3452,7 @@ value_struct_elt_for_reference (struct t + 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_AVOID_SIDE_EFFECTS) + return allocate_value (TYPE_FIELD_TYPE (t, i)); + else +@@ -3593,7 +3595,7 @@ value_struct_elt_for_reference (struct t + 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; +@@ -3683,7 +3685,7 @@ value_maybe_namespace_elt (const struct + + struct type * + value_rtti_indirect_type (struct value *v, int *full, +- int *top, int *using_enc) ++ LONGEST *top, int *using_enc) + { + struct value *target; + struct type *type, *real_type, *target_type; +@@ -3733,12 +3735,12 @@ value_rtti_indirect_type (struct value * + 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; + int full = 0; +- int top = -1; ++ LONGEST top = -1; + int using_enc = 0; + struct value *new_val; + +Index: gdb-7.5.0.20120926/gdb/valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/valprint.c 2012-11-07 22:00:41.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/valprint.c 2012-11-07 22:11:49.313938133 +0100 +@@ -264,7 +264,7 @@ scalar_type_p (struct type *type) + int + valprint_check_validity (struct ui_file *stream, + struct type *type, +- int embedded_offset, ++ LONGEST embedded_offset, + const struct value *val) + { + CHECK_TYPEDEF (type); +@@ -328,7 +328,7 @@ val_print_invalid_address (struct ui_fil + + void + generic_val_print (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 *original_value, + const struct value_print_options *options, +@@ -691,7 +691,7 @@ generic_val_print (struct type *type, co + RECURSE. */ + + void +-val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, ++val_print (struct type *type, const gdb_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, struct ui_file *stream, int recurse, + const struct value *val, + const struct value_print_options *options, +@@ -903,7 +903,7 @@ val_print_type_code_flags (struct type * + + void + val_print_scalar_formatted (struct type *type, +- const gdb_byte *valaddr, int embedded_offset, ++ const gdb_byte *valaddr, LONGEST embedded_offset, + const struct value *val, + const struct value_print_options *options, + int size, +@@ -1444,7 +1444,7 @@ print_decimal_chars (struct ui_file *str + + 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) + { + const gdb_byte *p; + +@@ -1561,23 +1561,23 @@ maybe_print_array_index (struct type *in + + void + val_print_array_elements (struct type *type, +- const gdb_byte *valaddr, int embedded_offset, ++ const gdb_byte *valaddr, LONGEST embedded_offset, + CORE_ADDR address, struct ui_file *stream, + int recurse, + const 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 *saved_type = type; + struct type *elttype, *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; + struct cleanup *back_to; + CORE_ADDR saved_address = address; +@@ -1672,7 +1672,7 @@ val_print_array_elements (struct type *t + 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; +@@ -2085,7 +2085,7 @@ generic_emit_char (int c, struct type *t + + 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) +Index: gdb-7.5.0.20120926/gdb/valprint.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/valprint.h 2012-05-18 17:31:40.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/valprint.h 2012-11-07 22:09:30.093140418 +0100 +@@ -117,11 +117,11 @@ extern void maybe_print_array_index (str + struct ui_file *stream, + const struct value_print_options *); + +-extern void val_print_array_elements (struct type *, const gdb_byte *, int, ++extern void val_print_array_elements (struct type *, const gdb_byte *, LONGEST, + CORE_ADDR, struct ui_file *, int, + const struct value *, + const struct value_print_options *, +- unsigned int); ++ ULONGEST); + + extern void val_print_type_code_int (struct type *, const gdb_byte *, + struct ui_file *); +@@ -131,7 +131,7 @@ extern void val_print_type_code_flags (s + struct ui_file *stream); + + extern void val_print_scalar_formatted (struct type *, +- const gdb_byte *, int, ++ const gdb_byte *, LONGEST, + const struct value *, + const struct value_print_options *, + int, +@@ -147,7 +147,7 @@ extern void print_decimal_chars (struct + unsigned int, enum bfd_endian); + + extern void print_hex_chars (struct ui_file *, const gdb_byte *, +- unsigned int, enum bfd_endian); ++ ULONGEST, enum bfd_endian); + + extern void print_char_chars (struct ui_file *, struct type *, + const gdb_byte *, unsigned int, enum bfd_endian); +@@ -191,7 +191,7 @@ struct generic_val_print_decorations + + + extern void generic_val_print (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 *original_value, + const struct value_print_options *options, +@@ -201,7 +201,7 @@ extern void generic_emit_char (int c, st + 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); +Index: gdb-7.5.0.20120926/gdb/value.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/value.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/value.c 2012-11-07 22:09:30.096140414 +0100 +@@ -68,10 +68,10 @@ struct internal_function + struct range + { + /* Lowest offset in the range. */ +- int offset; ++ LONGEST offset; + + /* Length of the range. */ +- int length; ++ LONGEST length; + }; + + typedef struct range range_s; +@@ -82,8 +82,8 @@ DEF_VEC_O(range_s); + [offset2, offset2+len2) overlap. */ + + static int +-ranges_overlap (int offset1, int len1, +- int offset2, int len2) ++ranges_overlap (LONGEST offset1, LONGEST len1, ++ LONGEST offset2, LONGEST len2) + { + ULONGEST h, l; + +@@ -107,7 +107,7 @@ range_lessthan (const range_s *r1, const + OFFSET+LENGTH). */ + + static int +-ranges_contain (VEC(range_s) *ranges, int offset, int length) ++ranges_contain (VEC(range_s) *ranges, LONGEST offset, LONGEST length) + { + range_s what; + int i; +@@ -240,7 +240,7 @@ struct value + lval == lval_register, this is a further offset from + location.address within the registers structure. Note also the + member embedded_offset below. */ +- int offset; ++ LONGEST offset; + + /* Only used for bitfields; number of bits contained in them. */ + int bitsize; +@@ -310,8 +310,8 @@ struct value + `type', and `embedded_offset' is zero, so everything works + normally. */ + struct type *enclosing_type; +- int embedded_offset; +- int pointed_to_offset; ++ LONGEST embedded_offset; ++ LONGEST pointed_to_offset; + + /* Values are stored in a chain, so that they can be deleted easily + over calls to the inferior. Values assigned to internal +@@ -333,7 +333,8 @@ struct value + }; + + int +-value_bytes_available (const struct value *value, int offset, int length) ++value_bytes_available (const struct value *value, LONGEST offset, ++ LONGEST length) + { + gdb_assert (!value->lazy); + +@@ -354,7 +355,8 @@ value_entirely_available (struct value * + } + + void +-mark_value_bytes_unavailable (struct value *value, int offset, int length) ++mark_value_bytes_unavailable (struct value *value, LONGEST offset, ++ LONGEST length) + { + range_s newr; + int i; +@@ -525,7 +527,7 @@ mark_value_bytes_unavailable (struct val + + static int + find_first_range_overlap (VEC(range_s) *ranges, int pos, +- int offset, int length) ++ LONGEST offset, LONGEST length) + { + range_s *r; + int i; +@@ -538,9 +540,9 @@ find_first_range_overlap (VEC(range_s) * + } + + int +-value_available_contents_eq (const struct value *val1, int offset1, +- const struct value *val2, int offset2, +- int length) ++value_available_contents_eq (const struct value *val1, LONGEST offset1, ++ const struct value *val2, LONGEST offset2, ++ LONGEST length) + { + int idx1 = 0, idx2 = 0; + +@@ -768,13 +770,13 @@ deprecated_set_value_type (struct value + value->type = type; + } + +-int ++LONGEST + value_offset (const struct value *value) + { + return value->offset; + } + void +-set_value_offset (struct value *value, int offset) ++set_value_offset (struct value *value, LONGEST offset) + { + value->offset = offset; + } +@@ -924,8 +926,9 @@ value_contents_all (struct value *value) + DST_OFFSET+LENGTH) range are wholly available. */ + + void +-value_contents_copy_raw (struct value *dst, int dst_offset, +- struct value *src, int src_offset, int length) ++value_contents_copy_raw (struct value *dst, ssize_t dst_offset, ++ struct value *src, ssize_t src_offset, ++ ssize_t length) + { + range_s *r; + int i; +@@ -973,8 +976,8 @@ value_contents_copy_raw (struct value *d + DST_OFFSET+LENGTH) range are wholly available. */ + + void +-value_contents_copy (struct value *dst, int dst_offset, +- struct value *src, int src_offset, int length) ++value_contents_copy (struct value *dst, ssize_t dst_offset, ++ struct value *src, ssize_t src_offset, ssize_t length) + { + require_not_optimized_out (src); + +@@ -1068,7 +1071,7 @@ value_entirely_optimized_out (const stru + } + + int +-value_bits_valid (const struct value *value, int offset, int length) ++value_bits_valid (const struct value *value, LONGEST offset, LONGEST length) + { + if (!value->optimized_out) + return 1; +@@ -1081,7 +1084,7 @@ value_bits_valid (const struct value *va + + int + value_bits_synthetic_pointer (const struct value *value, +- int offset, int length) ++ LONGEST offset, LONGEST length) + { + if (value->lval != lval_computed + || !value->location.computed.funcs->check_synthetic_pointer) +@@ -1091,26 +1094,26 @@ value_bits_synthetic_pointer (const stru + length); + } + +-int ++LONGEST + value_embedded_offset (struct value *value) + { + return value->embedded_offset; + } + + void +-set_value_embedded_offset (struct value *value, int val) ++set_value_embedded_offset (struct value *value, LONGEST val) + { + value->embedded_offset = val; + } + +-int ++LONGEST + value_pointed_to_offset (struct value *value) + { + return value->pointed_to_offset; + } + + void +-set_value_pointed_to_offset (struct value *value, int val) ++set_value_pointed_to_offset (struct value *value, LONGEST val) + { + value->pointed_to_offset = val; + } +@@ -1970,7 +1973,7 @@ get_internalvar_function (struct interna + } + + void +-set_internalvar_component (struct internalvar *var, int offset, int bitpos, ++set_internalvar_component (struct internalvar *var, LONGEST offset, int bitpos, + int bitsize, struct value *newval) + { + gdb_byte *addr; +@@ -2671,7 +2674,7 @@ set_value_enclosing_type (struct value * + FIELDNO says which field. */ + + struct value * +-value_primitive_field (struct value *arg1, int offset, ++value_primitive_field (struct value *arg1, LONGEST offset, + int fieldno, struct type *arg_type) + { + struct value *v; +@@ -2701,7 +2704,7 @@ value_primitive_field (struct value *arg + bit. Assume that the address, offset, and embedded offset + are sufficiently aligned. */ + +- int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno); ++ LONGEST bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno); + int container_bitsize = TYPE_LENGTH (type) * 8; + + v = allocate_value_lazy (type); +@@ -2724,7 +2727,7 @@ value_primitive_field (struct value *arg + /* This field is actually a base subobject, so preserve the + entire object's contents for later references to virtual + bases, etc. */ +- int boffset; ++ LONGEST boffset; + + /* Lazy register values with offsets are not supported. */ + if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1)) +@@ -2801,7 +2804,7 @@ value_field (struct value *arg1, int fie + struct value * + value_fn_field (struct value **arg1p, struct fn_field *f, + int j, struct type *type, +- int offset) ++ LONGEST offset) + { + struct value *v; + struct type *ftype = TYPE_FN_FIELD_TYPE (f, j); +@@ -2861,8 +2864,8 @@ value_fn_field (struct value **arg1p, st + + static int + unpack_value_bits_as_long_1 (struct type *field_type, const gdb_byte *valaddr, +- int embedded_offset, int bitpos, int bitsize, +- const struct value *original_value, ++ LONGEST embedded_offset, LONGEST bitpos, ++ int bitsize, const struct value *original_value, + LONGEST *result) + { + enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (field_type)); +@@ -2870,7 +2873,7 @@ unpack_value_bits_as_long_1 (struct type + ULONGEST valmask; + int lsbcount; + int bytes_read; +- int read_offset; ++ LONGEST read_offset; + + /* Read the minimum number of bytes required; there may not be + enough bytes to read an entire ULONGEST. */ +@@ -2940,7 +2943,7 @@ unpack_value_bits_as_long_1 (struct type + + int + unpack_value_bits_as_long (struct type *field_type, const gdb_byte *valaddr, +- int embedded_offset, int bitpos, int bitsize, ++ LONGEST embedded_offset, int bitpos, int bitsize, + const struct value *original_value, + LONGEST *result) + { +@@ -2958,10 +2961,10 @@ unpack_value_bits_as_long (struct type * + + static int + unpack_value_field_as_long_1 (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, int fieldno, ++ LONGEST embedded_offset, int fieldno, + const struct value *val, LONGEST *result) + { +- int bitpos = TYPE_FIELD_BITPOS (type, fieldno); ++ LONGEST bitpos = TYPE_FIELD_BITPOS (type, fieldno); + int bitsize = TYPE_FIELD_BITSIZE (type, fieldno); + struct type *field_type = TYPE_FIELD_TYPE (type, fieldno); + +@@ -2977,7 +2980,7 @@ unpack_value_field_as_long_1 (struct typ + + int + unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, int fieldno, ++ LONGEST embedded_offset, int fieldno, + const struct value *val, LONGEST *result) + { + gdb_assert (val != NULL); +@@ -3009,7 +3012,7 @@ unpack_field_as_long (struct type *type, + struct value * + value_field_bitfield (struct type *type, int fieldno, + const gdb_byte *valaddr, +- int embedded_offset, const struct value *val) ++ LONGEST embedded_offset, const struct value *val) + { + LONGEST l; + +@@ -3036,12 +3039,12 @@ value_field_bitfield (struct type *type, + + void + modify_field (struct type *type, gdb_byte *addr, +- LONGEST fieldval, int bitpos, int bitsize) ++ LONGEST fieldval, LONGEST bitpos, int bitsize) + { + enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); + ULONGEST oword; + ULONGEST mask = (ULONGEST) -1 >> (8 * sizeof (ULONGEST) - bitsize); +- int bytesize; ++ LONGEST bytesize; + + /* Normalize BITPOS. */ + addr += bitpos / 8; +Index: gdb-7.5.0.20120926/gdb/value.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/value.h 2012-11-07 22:00:41.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/value.h 2012-11-07 22:09:30.104140403 +0100 +@@ -82,8 +82,8 @@ extern void set_value_parent (struct val + within the registers structure. Note also the member + embedded_offset below. */ + +-extern int value_offset (const struct value *); +-extern void set_value_offset (struct value *, int offset); ++extern LONGEST value_offset (const struct value *); ++extern void set_value_offset (struct value *, LONGEST offset); + + /* The comment from "struct value" reads: ``Is it modifiable? Only + relevant if lval != not_lval.''. Shouldn't the value instead be +@@ -154,10 +154,10 @@ extern struct type *value_actual_type (s + int resolve_simple_types, + int *real_type_found); + +-extern int value_pointed_to_offset (struct value *value); +-extern void set_value_pointed_to_offset (struct value *value, int val); +-extern int value_embedded_offset (struct value *value); +-extern void set_value_embedded_offset (struct value *value, int val); ++extern LONGEST value_pointed_to_offset (struct value *value); ++extern void set_value_pointed_to_offset (struct value *value, LONGEST val); ++extern LONGEST value_embedded_offset (struct value *value); ++extern void set_value_embedded_offset (struct value *value, LONGEST val); + + /* For lval_computed values, this structure holds functions used to + retrieve and set the value (or portions of the value). +@@ -185,7 +185,8 @@ struct lval_funcs + /* Check the validity of some bits in VALUE. This should return 1 + if all the bits starting at OFFSET and extending for LENGTH bits + are valid, or 0 if any bit is invalid. */ +- int (*check_validity) (const struct value *value, int offset, int length); ++ int (*check_validity) (const struct value *value, LONGEST offset, ++ LONGEST length); + + /* Return 1 if any bit in VALUE is valid, 0 if they are all invalid. */ + int (*check_any_valid) (const struct value *value); +@@ -203,7 +204,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, +- int 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 +@@ -240,7 +241,7 @@ extern struct value *allocate_computed_v + Otherwise, return 1. */ + + extern int valprint_check_validity (struct ui_file *stream, struct type *type, +- int embedded_offset, ++ LONGEST embedded_offset, + const struct value *val); + + extern struct value *allocate_optimized_out_value (struct type *type); +@@ -411,13 +412,13 @@ extern struct value *coerce_array (struc + bits in the given range are valid, zero if any bit is invalid. */ + + extern int value_bits_valid (const struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Given a value, determine whether the bits starting at OFFSET and + extending for LENGTH bits are a synthetic pointer. */ + + extern int value_bits_synthetic_pointer (const struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Given a value, determine whether the contents bytes starting at + OFFSET and extending for LENGTH bytes are available. This returns +@@ -425,7 +426,7 @@ extern int value_bits_synthetic_pointer + byte is unavailable. */ + + extern int value_bytes_available (const struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Like value_bytes_available, but return false if any byte in the + whole object is unavailable. */ +@@ -435,7 +436,7 @@ extern int value_entirely_available (str + LENGTH bytes as unavailable. */ + + extern void mark_value_bytes_unavailable (struct value *value, +- int offset, int length); ++ LONGEST offset, LONGEST length); + + /* Compare LENGTH bytes of VAL1's contents starting at OFFSET1 with + LENGTH bytes of VAL2's contents starting at OFFSET2. +@@ -445,7 +446,7 @@ extern void mark_value_bytes_unavailable + example, to compare a complete object value with itself, including + its enclosing type chunk, you'd do: + +- int len = TYPE_LENGTH (check_typedef (value_enclosing_type (val))); ++ ULONGEST len = TYPE_LENGTH (check_typedef (value_enclosing_type (val))); + value_available_contents (val, 0, val, 0, len); + + Returns true iff the set of available contents match. Unavailable +@@ -467,9 +468,10 @@ extern void mark_value_bytes_unavailable + value_available_contents_eq(val, 3, val, 4, 4) => 0 + */ + +-extern int value_available_contents_eq (const struct value *val1, int offset1, +- const struct value *val2, int offset2, +- int length); ++extern int value_available_contents_eq (const struct value *val1, ++ LONGEST offset1, ++ const struct value *val2, ++ LONGEST offset2, LONGEST length); + + /* Read LENGTH bytes of memory starting at MEMADDR into BUFFER, which + is (or will be copied to) VAL's contents buffer offset by +@@ -478,7 +480,7 @@ extern int value_available_contents_eq ( + memory is likewise unavailable. STACK indicates whether the memory + is known to be stack memory. */ + +-extern void read_value_memory (struct value *val, int embedded_offset, ++extern void read_value_memory (struct value *val, LONGEST embedded_offset, + int stack, CORE_ADDR memaddr, + gdb_byte *buffer, size_t length); + +@@ -506,7 +508,7 @@ extern CORE_ADDR unpack_pointer (struct + + extern int unpack_value_bits_as_long (struct type *field_type, + const gdb_byte *valaddr, +- int embedded_offset, int bitpos, ++ LONGEST embedded_offset, int bitpos, + int bitsize, + const struct value *original_value, + LONGEST *result); +@@ -515,12 +517,12 @@ extern LONGEST unpack_field_as_long (str + const gdb_byte *valaddr, + int fieldno); + extern int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr, +- int embedded_offset, int fieldno, ++ LONGEST embedded_offset, int fieldno, + const struct value *val, LONGEST *result); + + extern struct value *value_field_bitfield (struct type *type, int fieldno, + const gdb_byte *valaddr, +- int embedded_offset, ++ LONGEST embedded_offset, + const struct value *val); + + extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num); +@@ -578,12 +580,12 @@ extern struct value *default_read_var_va + extern struct value *allocate_value (struct type *type); + extern struct value *allocate_value_lazy (struct type *type); + extern void allocate_value_contents (struct value *value); +-extern void value_contents_copy (struct value *dst, int dst_offset, +- struct value *src, int src_offset, +- int length); +-extern void value_contents_copy_raw (struct value *dst, int dst_offset, +- struct value *src, int src_offset, +- int length); ++extern void value_contents_copy (struct value *dst, ssize_t dst_offset, ++ struct value *src, ssize_t src_offset, ++ ssize_t length); ++extern void value_contents_copy_raw (struct value *dst, ssize_t dst_offset, ++ struct value *src, ssize_t src_offset, ++ ssize_t length); + + extern struct value *allocate_repeat_value (struct type *type, int count); + +@@ -657,16 +659,16 @@ extern int find_overload_match (struct v + + extern struct value *value_field (struct value *arg1, int fieldno); + +-extern struct value *value_primitive_field (struct value *arg1, int offset, ++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 *, int *, ++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); + +@@ -756,7 +758,7 @@ extern void set_internalvar_string (stru + extern void clear_internalvar (struct internalvar *var); + + extern void set_internalvar_component (struct internalvar *var, +- int offset, ++ LONGEST offset, + int bitpos, int bitsize, + struct value *newvalue); + +@@ -838,7 +840,7 @@ extern struct value *value_x_unop (struc + enum noside noside); + + extern struct value *value_fn_field (struct value **arg1p, struct fn_field *f, +- int j, struct type *type, int offset); ++ int j, struct type *type, LONGEST offset); + + extern int binop_types_user_defined_p (enum exp_opcode op, + struct type *type1, +@@ -866,7 +868,8 @@ extern void release_value_or_incref (str + extern int record_latest_value (struct value *val); + + extern void modify_field (struct type *type, gdb_byte *addr, +- LONGEST fieldval, int bitpos, int bitsize); ++ LONGEST fieldval, LONGEST bitpos, ++ int bitsize); + + extern void type_print (struct type *type, const char *varstring, + struct ui_file *stream, int show); +@@ -896,7 +899,7 @@ extern void value_print_array_elements ( + extern struct value *value_release_to_mark (struct value *mark); + + extern void val_print (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, +@@ -947,10 +950,11 @@ extern struct value *value_literal_compl + 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-rhbz795424-bitpos-21of25.patch b/gdb-rhbz795424-bitpos-21of25.patch new file mode 100644 index 0000000..8ca2edc --- /dev/null +++ b/gdb-rhbz795424-bitpos-21of25.patch @@ -0,0 +1,224 @@ +http://sourceware.org/ml/gdb-patches/2012-09/msg00632.html +Subject: [PATCH 2/4] Add a check to ensure that a type may fit into host memory + + +--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 + +Index: gdb-7.5.0.20120926/gdb/alpha-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/alpha-tdep.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/alpha-tdep.c 2012-11-07 22:46:00.042902382 +0100 +@@ -414,6 +414,13 @@ alpha_push_dummy_call (struct gdbarch *g + 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. */ +Index: gdb-7.5.0.20120926/gdb/cp-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/cp-valprint.c 2012-11-07 22:12:14.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/cp-valprint.c 2012-11-07 22:46:00.043902381 +0100 +@@ -561,6 +561,8 @@ cp_print_value (struct type *type, struc + gdb_byte *buf; + struct cleanup *back_to; + ++ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); ++ + buf = xmalloc (TYPE_LENGTH (baseclass)); + back_to = make_cleanup (xfree, buf); + +Index: gdb-7.5.0.20120926/gdb/dwarf2loc.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/dwarf2loc.c 2012-11-07 22:09:29.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/dwarf2loc.c 2012-11-07 22:46:00.070902342 +0100 +@@ -1784,6 +1784,8 @@ read_pieced_value (struct value *v) + + this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8; + source_offset = source_offset_bits / 8; ++ ulongest_fits_host_or_error (this_size); ++ + if (buffer_size < this_size) + { + buffer_size = this_size; +@@ -1975,6 +1977,7 @@ write_pieced_value (struct value *to, st + } + else + { ++ ulongest_fits_host_or_error (this_size); + if (buffer_size < this_size) + { + buffer_size = this_size; +Index: gdb-7.5.0.20120926/gdb/findcmd.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/findcmd.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/findcmd.c 2012-11-07 22:46:00.153902249 +0100 +@@ -187,6 +187,7 @@ parse_find_args (char *args, ULONGEST *m + size_t current_offset = pattern_buf_end - pattern_buf; + + pattern_buf_size = pattern_buf_size_need * 2; ++ ulongest_fits_host_or_error (pattern_buf_size); + pattern_buf = xrealloc (pattern_buf, pattern_buf_size); + pattern_buf_end = pattern_buf + current_offset; + } +Index: gdb-7.5.0.20120926/gdb/p-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/p-valprint.c 2012-11-07 22:09:29.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/p-valprint.c 2012-11-07 22:46:00.163902208 +0100 +@@ -827,6 +827,7 @@ pascal_object_print_value (struct type * + gdb_byte *buf; + struct cleanup *back_to; + ++ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); + buf = xmalloc (TYPE_LENGTH (baseclass)); + back_to = make_cleanup (xfree, buf); + +Index: gdb-7.5.0.20120926/gdb/utils.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/utils.c 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/utils.c 2012-11-07 22:46:00.166902202 +0100 +@@ -3135,6 +3135,18 @@ host_address_to_string (const void *addr + return str; + } + ++/* 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)); ++} ++ + char * + gdb_realpath (const char *filename) + { +Index: gdb-7.5.0.20120926/gdb/valops.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/valops.c 2012-11-07 22:09:30.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/valops.c 2012-11-07 22:46:00.181902181 +0100 +@@ -2383,6 +2383,7 @@ search_struct_method (const char *name, + struct cleanup *back_to; + CORE_ADDR address; + ++ ulongest_fits_host_or_error (TYPE_LENGTH (baseclass)); + tmp = xmalloc (TYPE_LENGTH (baseclass)); + back_to = make_cleanup (xfree, tmp); + address = value_address (*arg1p); +Index: gdb-7.5.0.20120926/gdb/value.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/value.c 2012-11-07 22:09:30.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/value.c 2012-11-07 22:46:00.184902176 +0100 +@@ -663,6 +663,7 @@ allocate_value_lazy (struct type *type) + description correctly. */ + check_typedef (type); + ++ ulongest_fits_host_or_error (TYPE_LENGTH (type)); + val = (struct value *) xzalloc (sizeof (struct value)); + val->contents = NULL; + val->next = all_values; +@@ -694,6 +695,8 @@ allocate_value_lazy (struct type *type) + void + allocate_value_contents (struct value *val) + { ++ ulongest_fits_host_or_error (TYPE_LENGTH (val->enclosing_type)); ++ + if (!val->contents) + val->contents = (gdb_byte *) xzalloc (TYPE_LENGTH (val->enclosing_type)); + } +@@ -2662,8 +2665,12 @@ void + set_value_enclosing_type (struct value *val, struct type *new_encl_type) + { + if (TYPE_LENGTH (new_encl_type) > TYPE_LENGTH (value_enclosing_type (val))) +- val->contents = +- (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type)); ++ { ++ ulongest_fits_host_or_error (TYPE_LENGTH (new_encl_type)); ++ ++ val->contents = ++ (gdb_byte *) xrealloc (val->contents, TYPE_LENGTH (new_encl_type)); ++ } + + val->enclosing_type = new_encl_type; + } +Index: gdb-7.5.0.20120926/gdb/vax-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/vax-tdep.c 2012-11-07 22:09:24.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/vax-tdep.c 2012-11-07 22:46:56.810819878 +0100 +@@ -223,6 +223,7 @@ vax_return_value (struct gdbarch *gdbarc + ULONGEST addr; + + regcache_raw_read_unsigned (regcache, VAX_R0_REGNUM, &addr); ++ ulongest_fits_host_or_error (TYPE_LENGTH (type)); + read_memory (addr, readbuf, TYPE_LENGTH (type)); + } + +Index: gdb-7.5.0.20120926/gdb/defs.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/defs.h 2012-11-07 22:00:43.111906109 +0100 ++++ gdb-7.5.0.20120926/gdb/defs.h 2012-11-07 22:47:46.001001239 +0100 +@@ -1170,4 +1170,6 @@ enum block_enum + FIRST_LOCAL_BLOCK = 2 + }; + ++extern void ulongest_fits_host_or_error (ULONGEST num); ++ + #endif /* #ifndef DEFS_H */ diff --git a/gdb-rhbz795424-bitpos-22of25.patch b/gdb-rhbz795424-bitpos-22of25.patch new file mode 100644 index 0000000..7e6ae2a --- /dev/null +++ b/gdb-rhbz795424-bitpos-22of25.patch @@ -0,0 +1,701 @@ +http://sourceware.org/ml/gdb-patches/2012-09/msg00629.html +Subject: [PATCH 3/4] Expand watchpoint lengths to LONGEST + + +--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-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/arm-linux-nat.c b/gdb/arm-linux-nat.c +index 231b008..6deb23d 100644 +--- a/gdb/arm-linux-nat.c ++++ b/gdb/arm-linux-nat.c +@@ -1105,7 +1105,7 @@ arm_linux_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + + /* Insert a Hardware breakpoint. */ + static int +-arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, ++arm_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -1123,7 +1123,7 @@ arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, + + /* Remove a hardware breakpoint. */ + static int +-arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, ++arm_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -1180,7 +1180,7 @@ arm_linux_stopped_by_watchpoint (void) + static int + arm_linux_watchpoint_addr_within_range (struct target_ops *target, + CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + return start <= addr && start + length - 1 >= addr; + } +diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c +index 76c51a8..9e293fe 100644 +--- a/gdb/i386-nat.c ++++ b/gdb/i386-nat.c +@@ -592,7 +592,7 @@ i386_update_inferior_debug_regs (struct i386_debug_reg_state *new_state) + of the type TYPE. Return 0 on success, -1 on failure. */ + + static int +-i386_insert_watchpoint (CORE_ADDR addr, int len, int type, ++i386_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct i386_debug_reg_state *state = i386_debug_reg_state (); +@@ -629,7 +629,7 @@ i386_insert_watchpoint (CORE_ADDR addr, int len, int type, + address ADDR, whose length is LEN bytes, and for accesses of the + type TYPE. Return 0 on success, -1 on failure. */ + static int +-i386_remove_watchpoint (CORE_ADDR addr, int len, int type, ++i386_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct i386_debug_reg_state *state = i386_debug_reg_state (); +diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c +index 9b5fbf3..6061eae 100644 +--- a/gdb/ia64-linux-nat.c ++++ b/gdb/ia64-linux-nat.c +@@ -542,7 +542,7 @@ is_power_of_2 (int val) + } + + static int +-ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, ++ia64_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -596,7 +596,7 @@ ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, + } + + static int +-ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, ++ia64_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int idx; +diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c +index d60eddb..c33db45 100644 +--- a/gdb/inf-ttrace.c ++++ b/gdb/inf-ttrace.c +@@ -313,14 +313,14 @@ inf_ttrace_disable_page_protections (pid_t pid) + type TYPE. */ + + static int +-inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type, ++inf_ttrace_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + const int pagesize = inf_ttrace_page_dict.pagesize; + pid_t pid = ptid_get_pid (inferior_ptid); + CORE_ADDR page_addr; +- int num_pages; +- int page; ++ LONGEST num_pages; ++ LONGEST page; + + gdb_assert (type == hw_write); + +@@ -337,14 +337,14 @@ inf_ttrace_insert_watchpoint (CORE_ADDR addr, int len, int type, + type TYPE. */ + + static int +-inf_ttrace_remove_watchpoint (CORE_ADDR addr, int len, int type, ++inf_ttrace_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + const int pagesize = inf_ttrace_page_dict.pagesize; + pid_t pid = ptid_get_pid (inferior_ptid); + CORE_ADDR page_addr; +- int num_pages; +- int page; ++ LONGEST num_pages; ++ LONGEST page; + + gdb_assert (type == hw_write); + +diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c +index 5566d0c..7467d11 100644 +--- a/gdb/mips-linux-nat.c ++++ b/gdb/mips-linux-nat.c +@@ -1017,7 +1017,7 @@ populate_regs_from_watches (struct pt_watch_regs *regs) + watch. Return zero on success. */ + + static int +-mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, ++mips_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct pt_watch_regs regs; +@@ -1067,7 +1067,7 @@ mips_linux_insert_watchpoint (CORE_ADDR addr, int len, int type, + Return zero on success. */ + + static int +-mips_linux_remove_watchpoint (CORE_ADDR addr, int len, int type, ++mips_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int retval; +diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c +index b58f318..25fecf3 100644 +--- a/gdb/nto-procfs.c ++++ b/gdb/nto-procfs.c +@@ -69,10 +69,10 @@ static ptid_t do_attach (ptid_t ptid); + + static int procfs_can_use_hw_breakpoint (int, int, int); + +-static int procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, ++static int procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond); + +-static int procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, ++static int procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond); + + static int procfs_stopped_by_watchpoint (void); +@@ -1493,14 +1493,14 @@ procfs_can_use_hw_breakpoint (int type, int cnt, int othertype) + } + + static int +-procfs_remove_hw_watchpoint (CORE_ADDR addr, int len, int type, ++procfs_remove_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + return procfs_hw_watchpoint (addr, -1, type); + } + + static int +-procfs_insert_hw_watchpoint (CORE_ADDR addr, int len, int type, ++procfs_insert_hw_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + return procfs_hw_watchpoint (addr, len, type); +diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c +index 67e1cac..abfb2fc 100644 +--- a/gdb/ppc-linux-nat.c ++++ b/gdb/ppc-linux-nat.c +@@ -1839,11 +1839,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 +@@ -1930,7 +1930,7 @@ num_memory_accesses (struct value *v) + 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, *left_chain, *right_chain; +@@ -1997,7 +1997,7 @@ check_condition (CORE_ADDR watch_addr, struct expression *cond, + the condition expression, thus only triggering the watchpoint when it is + true. */ + static int +-ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, ++ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + CORE_ADDR data_value; +@@ -2014,7 +2014,7 @@ ppc_linux_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, + + static void + create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr, +- int len, int rw, struct expression *cond, ++ LONGEST len, int rw, struct expression *cond, + int insert) + { + if (len == 1 +@@ -2059,7 +2059,7 @@ create_watchpoint_request (struct ppc_hw_breakpoint *p, CORE_ADDR addr, + } + + static int +-ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, ++ppc_linux_insert_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -2127,7 +2127,7 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw, + } + + static int +-ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw, ++ppc_linux_remove_watchpoint (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + struct lwp_info *lp; +@@ -2267,7 +2267,7 @@ ppc_linux_stopped_by_watchpoint (void) + static int + ppc_linux_watchpoint_addr_within_range (struct target_ops *target, + CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + int mask; + +diff --git a/gdb/procfs.c b/gdb/procfs.c +index 4a9336f..26accd8 100644 +--- a/gdb/procfs.c ++++ b/gdb/procfs.c +@@ -2470,7 +2470,7 @@ procfs_address_to_host_pointer (CORE_ADDR addr) + #endif + + 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) + { + #if !defined (PCWATCH) && !defined (PIOCSWATCH) + /* If neither or these is defined, we can't support watchpoints. +@@ -4816,7 +4816,7 @@ procfs_pid_to_str (struct target_ops *ops, ptid_t ptid) + /* 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) + { + #ifndef UNIXWARE +@@ -4938,7 +4938,7 @@ procfs_stopped_data_address (struct target_ops *targ, CORE_ADDR *addr) + } + + static int +-procfs_insert_watchpoint (CORE_ADDR addr, int len, int type, ++procfs_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + if (!target_have_steppable_watchpoint +@@ -4960,7 +4960,7 @@ procfs_insert_watchpoint (CORE_ADDR addr, int len, int type, + } + + static int +-procfs_remove_watchpoint (CORE_ADDR addr, int len, int type, ++procfs_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + return procfs_set_watchpoint (inferior_ptid, addr, 0, 0, 0); +diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c +index 748aeba..b385c3f 100644 +--- a/gdb/remote-m32r-sdi.c ++++ b/gdb/remote-m32r-sdi.c +@@ -1417,14 +1417,14 @@ m32r_can_use_hw_watchpoint (int type, int cnt, int othertype) + watchpoint. */ + + static int +-m32r_insert_watchpoint (CORE_ADDR addr, int len, int type, ++m32r_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int i; + + if (remote_debug) +- fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%d,%d)\n", +- paddress (target_gdbarch, addr), len, type); ++ fprintf_unfiltered (gdb_stdlog, "m32r_insert_watchpoint(%s,%s,%d)\n", ++ paddress (target_gdbarch, addr), plongest (len), type); + + for (i = 0; i < MAX_ACCESS_BREAKS; i++) + { +@@ -1442,14 +1442,14 @@ m32r_insert_watchpoint (CORE_ADDR addr, int len, int type, + } + + static int +-m32r_remove_watchpoint (CORE_ADDR addr, int len, int type, ++m32r_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int i; + + if (remote_debug) +- fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%d,%d)\n", +- paddress (target_gdbarch, addr), len, type); ++ fprintf_unfiltered (gdb_stdlog, "m32r_remove_watchpoint(%s,%s,%d)\n", ++ paddress (target_gdbarch, addr), plongest (len), type); + + for (i = 0; i < MAX_ACCESS_BREAKS; i++) + { +diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c +index eee2460..9a9265a 100644 +--- a/gdb/remote-mips.c ++++ b/gdb/remote-mips.c +@@ -2419,7 +2419,7 @@ calculate_mask (CORE_ADDR addr, int len) + watchpoint. */ + + static int +-mips_insert_watchpoint (CORE_ADDR addr, int len, int type, ++mips_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + if (mips_set_breakpoint (addr, len, type)) +@@ -2431,7 +2431,7 @@ mips_insert_watchpoint (CORE_ADDR addr, int len, int type, + /* Remove a watchpoint. */ + + static int +-mips_remove_watchpoint (CORE_ADDR addr, int len, int type, ++mips_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + if (mips_clear_breakpoint (addr, len, type)) +diff --git a/gdb/remote.c b/gdb/remote.c +index 8c27390..bcec331 100644 +--- a/gdb/remote.c ++++ b/gdb/remote.c +@@ -8035,7 +8035,7 @@ watchpoint_to_Z_packet (int type) + } + + static int +-remote_insert_watchpoint (CORE_ADDR addr, int len, int type, ++remote_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct remote_state *rs = get_remote_state (); +@@ -8050,7 +8050,7 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type, + p = strchr (rs->buf, '\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, &rs->buf_size, 0); +@@ -8070,7 +8070,7 @@ remote_insert_watchpoint (CORE_ADDR addr, int len, int type, + + static int + remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + CORE_ADDR diff = remote_address_masked (addr - start); + +@@ -8079,7 +8079,7 @@ remote_watchpoint_addr_within_range (struct target_ops *target, CORE_ADDR addr, + + + static int +-remote_remove_watchpoint (CORE_ADDR addr, int len, int type, ++remote_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct remote_state *rs = get_remote_state (); +@@ -8094,7 +8094,7 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type, + p = strchr (rs->buf, '\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, &rs->buf_size, 0); + +diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c +index 4974bad..3f41519 100644 +--- a/gdb/s390-nat.c ++++ b/gdb/s390-nat.c +@@ -517,7 +517,7 @@ s390_fix_watch_points (struct lwp_info *lp) + } + + static int +-s390_insert_watchpoint (CORE_ADDR addr, int len, int type, ++s390_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct lwp_info *lp; +@@ -538,7 +538,7 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type, + } + + static int +-s390_remove_watchpoint (CORE_ADDR addr, int len, int type, ++s390_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + struct lwp_info *lp; +diff --git a/gdb/target.c b/gdb/target.c +index f7207c0..a69fb06 100644 +--- a/gdb/target.c ++++ b/gdb/target.c +@@ -49,7 +49,8 @@ static void target_info (char *, int); + static void default_terminal_info (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 (CORE_ADDR, LONGEST); + +@@ -114,10 +115,10 @@ static int debug_to_insert_hw_breakpoint (struct gdbarch *, + static int debug_to_remove_hw_breakpoint (struct gdbarch *, + struct bp_target_info *); + +-static int debug_to_insert_watchpoint (CORE_ADDR, int, int, ++static int debug_to_insert_watchpoint (CORE_ADDR, LONGEST, int, + struct expression *); + +-static int debug_to_remove_watchpoint (CORE_ADDR, int, int, ++static int debug_to_remove_watchpoint (CORE_ADDR, LONGEST, int, + struct expression *); + + static int debug_to_stopped_by_watchpoint (void); +@@ -125,11 +126,12 @@ static int debug_to_stopped_by_watchpoint (void); + static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *); + + static int debug_to_watchpoint_addr_within_range (struct target_ops *, +- CORE_ADDR, CORE_ADDR, int); ++ CORE_ADDR, CORE_ADDR, ++ LONGEST); + + static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, LONGEST); + +-static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, int, int, ++static int debug_to_can_accel_watchpoint_condition (CORE_ADDR, LONGEST, int, + struct expression *); + + static void debug_to_terminal_init (void); +@@ -751,10 +753,10 @@ update_current_target (void) + (int (*) (struct gdbarch *, struct bp_target_info *)) + return_minus_one); + de_fault (to_insert_watchpoint, +- (int (*) (CORE_ADDR, int, int, struct expression *)) ++ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) + return_minus_one); + de_fault (to_remove_watchpoint, +- (int (*) (CORE_ADDR, int, int, struct expression *)) ++ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) + return_minus_one); + de_fault (to_stopped_by_watchpoint, + (int (*) (void)) +@@ -767,7 +769,7 @@ update_current_target (void) + de_fault (to_region_ok_for_hw_watchpoint, + default_region_ok_for_hw_watchpoint); + de_fault (to_can_accel_watchpoint_condition, +- (int (*) (CORE_ADDR, int, int, struct expression *)) ++ (int (*) (CORE_ADDR, LONGEST, int, struct expression *)) + return_zero); + de_fault (to_terminal_init, + (void (*) (void)) +@@ -3558,7 +3560,7 @@ default_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + 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; + } +@@ -4263,7 +4265,7 @@ debug_to_region_ok_for_hw_watchpoint (CORE_ADDR addr, LONGEST len) + } + + static int +-debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, ++debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, LONGEST len, int rw, + struct expression *cond) + { + int retval; +@@ -4273,8 +4275,8 @@ debug_to_can_accel_watchpoint_condition (CORE_ADDR addr, int len, int rw, + + fprintf_unfiltered (gdb_stdlog, + "target_can_accel_watchpoint_condition " +- "(%s, %d, %d, %s) = %ld\n", +- core_addr_to_string (addr), len, rw, ++ "(%s, %s, %d, %s) = %ld\n", ++ core_addr_to_string (addr), plongest (len), rw, + host_address_to_string (cond), (unsigned long) retval); + return retval; + } +@@ -4309,7 +4311,7 @@ debug_to_stopped_data_address (struct target_ops *target, CORE_ADDR *addr) + static int + debug_to_watchpoint_addr_within_range (struct target_ops *target, + CORE_ADDR addr, +- CORE_ADDR start, int length) ++ CORE_ADDR start, LONGEST length) + { + int retval; + +@@ -4317,9 +4319,9 @@ debug_to_watchpoint_addr_within_range (struct target_ops *target, + start, length); + + fprintf_filtered (gdb_stdlog, +- "target_watchpoint_addr_within_range (%s, %s, %d) = %d\n", ++ "target_watchpoint_addr_within_range (%s, %s, %s) = %d\n", + core_addr_to_string (addr), core_addr_to_string (start), +- length, retval); ++ plongest (length), retval); + return retval; + } + +@@ -4354,7 +4356,7 @@ debug_to_remove_hw_breakpoint (struct gdbarch *gdbarch, + } + + static int +-debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type, ++debug_to_insert_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int retval; +@@ -4362,14 +4364,14 @@ debug_to_insert_watchpoint (CORE_ADDR addr, int len, int type, + retval = debug_target.to_insert_watchpoint (addr, len, type, cond); + + fprintf_unfiltered (gdb_stdlog, +- "target_insert_watchpoint (%s, %d, %d, %s) = %ld\n", +- core_addr_to_string (addr), len, type, ++ "target_insert_watchpoint (%s, %s, %d, %s) = %ld\n", ++ core_addr_to_string (addr), plongest (len), type, + host_address_to_string (cond), (unsigned long) retval); + return retval; + } + + static int +-debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type, ++debug_to_remove_watchpoint (CORE_ADDR addr, LONGEST len, int type, + struct expression *cond) + { + int retval; +@@ -4377,8 +4379,8 @@ debug_to_remove_watchpoint (CORE_ADDR addr, int len, int type, + retval = debug_target.to_remove_watchpoint (addr, len, type, cond); + + fprintf_unfiltered (gdb_stdlog, +- "target_remove_watchpoint (%s, %d, %d, %s) = %ld\n", +- core_addr_to_string (addr), len, type, ++ "target_remove_watchpoint (%s, %s, %d, %s) = %ld\n", ++ core_addr_to_string (addr), plongest (len), type, + host_address_to_string (cond), (unsigned long) retval); + return retval; + } +diff --git a/gdb/target.h b/gdb/target.h +index 69228e1..4b52d53 100644 +--- a/gdb/target.h ++++ b/gdb/target.h +@@ -466,8 +466,8 @@ struct target_ops + + /* Documentation of what the two routines below are expected to do is + provided with the corresponding target_* macros. */ +- int (*to_remove_watchpoint) (CORE_ADDR, int, int, struct expression *); +- int (*to_insert_watchpoint) (CORE_ADDR, int, int, struct expression *); ++ int (*to_remove_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *); ++ int (*to_insert_watchpoint) (CORE_ADDR, LONGEST, int, struct expression *); + + int (*to_insert_mask_watchpoint) (struct target_ops *, + CORE_ADDR, CORE_ADDR, int); +@@ -478,13 +478,13 @@ struct target_ops + int to_have_continuable_watchpoint; + int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *); + int (*to_watchpoint_addr_within_range) (struct target_ops *, +- CORE_ADDR, CORE_ADDR, int); ++ CORE_ADDR, CORE_ADDR, LONGEST); + + /* Documentation of this routine is provided with the corresponding + target_* macro. */ + int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, LONGEST); + +- int (*to_can_accel_watchpoint_condition) (CORE_ADDR, int, int, ++ int (*to_can_accel_watchpoint_condition) (CORE_ADDR, LONGEST, int, + struct expression *); + int (*to_masked_watch_num_registers) (struct target_ops *, + CORE_ADDR, CORE_ADDR); + +--MP_/6HRlH6vpyqtSy4CYyMrX6b2-- + diff --git a/gdb-rhbz795424-bitpos-23of25.patch b/gdb-rhbz795424-bitpos-23of25.patch new file mode 100644 index 0000000..e3f599a --- /dev/null +++ b/gdb-rhbz795424-bitpos-23of25.patch @@ -0,0 +1,1324 @@ +http://sourceware.org/ml/gdb-patches/2012-09/msg00630.html +Subject: [PATCH 4/4] Bitpos expansion - tdep changes + + +--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-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 + +Index: gdb-7.5.0.20120926/gdb/alpha-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/alpha-tdep.c 2012-11-07 22:46:00.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/alpha-tdep.c 2012-11-07 22:47:57.371984929 +0100 +@@ -299,18 +299,18 @@ alpha_push_dummy_call (struct gdbarch *g + { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int i; +- int accumulate_size = struct_return ? 8 : 0; ++ ssize_t accumulate_size = struct_return ? 8 : 0; + struct alpha_arg + { + const gdb_byte *contents; +- int len; +- int offset; ++ ssize_t len; ++ ssize_t offset; + }; + struct alpha_arg *alpha_args + = (struct alpha_arg *) alloca (nargs * sizeof (struct alpha_arg)); + 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 *g + 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 *g + } + 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; +Index: gdb-7.5.0.20120926/gdb/amd64-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/amd64-tdep.c 2012-11-07 22:09:24.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/amd64-tdep.c 2012-11-07 22:47:57.374984923 +0100 +@@ -599,7 +599,7 @@ amd64_return_value (struct gdbarch *gdba + { + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + enum amd64_reg_class class[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; +@@ -728,8 +728,8 @@ amd64_push_arguments (struct regcache *r + that register number (or a negative value otherwise). */ + int *arg_addr_regno = alloca (nargs * sizeof (int)); + 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; +@@ -743,7 +743,7 @@ amd64_push_arguments (struct regcache *r + 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 class[2]; + int needed_integer_regs = 0; + int needed_sse_regs = 0; +Index: gdb-7.5.0.20120926/gdb/amd64-windows-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/amd64-windows-tdep.c 2012-06-05 15:50:57.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/amd64-windows-tdep.c 2012-11-07 22:47:57.413984867 +0100 +@@ -78,7 +78,7 @@ amd64_windows_return_value (struct gdbar + 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 +Index: gdb-7.5.0.20120926/gdb/arm-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/arm-tdep.c 2012-06-25 14:32:45.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/arm-tdep.c 2012-11-07 22:47:57.422984855 +0100 +@@ -3377,7 +3377,7 @@ arm_vfp_cprc_reg_char (enum arm_vfp_cprc + array). Vectors and complex 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) + { +@@ -3408,7 +3408,7 @@ arm_vfp_cprc_sub_candidate (struct type + + case TYPE_CODE_ARRAY: + { +- int count; ++ LONGEST count; + unsigned unitlen; + count = arm_vfp_cprc_sub_candidate (TYPE_TARGET_TYPE (t), base_type); + if (count == -1) +@@ -3428,13 +3428,15 @@ arm_vfp_cprc_sub_candidate (struct type + + 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 = 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 += sub_count; +@@ -3454,13 +3456,15 @@ arm_vfp_cprc_sub_candidate (struct type + + 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); +@@ -3496,7 +3500,7 @@ arm_vfp_call_candidate (struct type *t, + 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; +@@ -3577,7 +3581,7 @@ arm_push_dummy_call (struct gdbarch *gdb + + for (argnum = 0; argnum < nargs; argnum++) + { +- int len; ++ LONGEST len; + struct type *arg_type; + struct type *target_type; + enum type_code typecode; +Index: gdb-7.5.0.20120926/gdb/avr-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/avr-tdep.c 2012-05-18 23:02:47.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/avr-tdep.c 2012-11-07 22:47:57.444984823 +0100 +@@ -1170,13 +1170,14 @@ avr_dummy_id (struct gdbarch *gdbarch, s + + struct stack_item + { +- int len; ++ ssize_t len; + struct stack_item *prev; + void *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 = xmalloc (sizeof (struct stack_item)); +@@ -1265,12 +1266,12 @@ avr_push_dummy_call (struct gdbarch *gdb + + 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. */ + last_regnum = regnum - (len + (len & 1)); +Index: gdb-7.5.0.20120926/gdb/bfin-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/bfin-tdep.c 2012-11-07 22:09:24.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/bfin-tdep.c 2012-11-07 22:47:57.450984814 +0100 +@@ -506,7 +506,7 @@ bfin_push_dummy_call (struct gdbarch *gd + char buf[4]; + int i; + long reg_r0, reg_r1, reg_r2; +- int total_len = 0; ++ ssize_t total_len = 0; + enum bfin_abi abi = bfin_abi (gdbarch); + CORE_ADDR func_addr = find_function_addr (function, NULL); + +@@ -530,7 +530,7 @@ bfin_push_dummy_call (struct gdbarch *gd + { + struct type *value_type = value_enclosing_type (args[i]); + struct type *arg_type = check_typedef (value_type); +- int container_len = (TYPE_LENGTH (value_type) + 3) & ~3; ++ ssize_t container_len = (TYPE_LENGTH (value_type) + 3) & ~3; + + sp -= container_len; + write_memory (sp, value_contents_writeable (args[i]), container_len); +Index: gdb-7.5.0.20120926/gdb/cris-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/cris-tdep.c 2012-11-07 22:09:24.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/cris-tdep.c 2012-11-07 22:47:57.453984810 +0100 +@@ -670,13 +670,13 @@ static CORE_ADDR cris_unwind_sp (struct + + struct stack_item + { +- int len; ++ ssize_t len; + struct stack_item *prev; + void *data; + }; + + static struct stack_item * +-push_stack_item (struct stack_item *prev, void *contents, int len) ++push_stack_item (struct stack_item *prev, void *contents, ssize_t len) + { + struct stack_item *si; + si = xmalloc (sizeof (struct stack_item)); +@@ -849,13 +849,13 @@ cris_push_dummy_call (struct gdbarch *gd + + for (argnum = 0; argnum < nargs; argnum++) + { +- int len; ++ ssize_t len; + char *val; +- int reg_demand; +- int i; ++ ssize_t reg_demand; ++ ssize_t i; + +- len = TYPE_LENGTH (value_type (args[argnum])); + val = (char *) 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); +Index: gdb-7.5.0.20120926/gdb/h8300-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/h8300-tdep.c 2012-11-07 22:09:24.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/h8300-tdep.c 2012-11-07 22:47:57.456984806 +0100 +@@ -641,7 +641,7 @@ h8300_push_dummy_call (struct gdbarch *g + int struct_return, 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; +@@ -668,11 +668,11 @@ h8300_push_dummy_call (struct gdbarch *g + { + struct cleanup *back_to; + struct type *type = value_type (args[argument]); +- int len = TYPE_LENGTH (type); + char *contents = (char *) value_contents (args[argument]); ++ ssize_t len = TYPE_LENGTH (type); + + /* Pad the argument appropriately. */ +- int padded_len = align_up (len, wordsize); ++ ssize_t padded_len = align_up (len, wordsize); + gdb_byte *padded = xmalloc (padded_len); + back_to = make_cleanup (xfree, padded); + +@@ -701,7 +701,7 @@ h8300_push_dummy_call (struct gdbarch *g + /* 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) + { +Index: gdb-7.5.0.20120926/gdb/hppa-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/hppa-tdep.c 2012-11-07 22:09:24.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/hppa-tdep.c 2012-11-07 22:48:31.378936083 +0100 +@@ -962,7 +962,7 @@ hppa64_push_dummy_call (struct gdbarch * + { + 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; +@@ -1157,7 +1157,7 @@ hppa64_return_value (struct gdbarch *gdb + 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 (TYPE_LENGTH (type) > 16) +Index: gdb-7.5.0.20120926/gdb/i386-darwin-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/i386-darwin-tdep.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/i386-darwin-tdep.c 2012-11-07 22:47:57.470984786 +0100 +@@ -166,7 +166,7 @@ i386_darwin_push_dummy_call (struct gdba + + for (write_pass = 0; write_pass < 2; write_pass++) + { +- int args_space = 0; ++ LONGEST args_space = 0; + int num_m128 = 0; + + if (struct_return) +Index: gdb-7.5.0.20120926/gdb/i386-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/i386-tdep.c 2012-11-07 22:00:42.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/i386-tdep.c 2012-11-07 22:47:57.474984780 +0100 +@@ -2358,7 +2358,7 @@ i386_push_dummy_call (struct gdbarch *gd + gdb_byte buf[4]; + int i; + int write_pass; +- int args_space = 0; ++ LONGEST args_space = 0; + + /* Determine the total space required for arguments and struct + return address in a first pass (allowing for 16-byte-aligned +@@ -2366,7 +2366,7 @@ i386_push_dummy_call (struct gdbarch *gd + + for (write_pass = 0; write_pass < 2; write_pass++) + { +- int args_space_used = 0; ++ LONGEST args_space_used = 0; + + if (struct_return) + { +@@ -2383,7 +2383,7 @@ i386_push_dummy_call (struct gdbarch *gd + + 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) + { +@@ -2590,7 +2590,7 @@ i386_reg_struct_return_p (struct gdbarch + { + 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 +@@ -3042,7 +3042,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 +@@ -3075,7 +3075,7 @@ i386_register_to_value (struct frame_inf + 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, +@@ -3111,7 +3111,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)) + { +Index: gdb-7.5.0.20120926/gdb/ia64-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ia64-tdep.c 2012-11-07 22:00:42.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/ia64-tdep.c 2012-11-07 22:47:57.491984756 +0100 +@@ -3974,8 +3974,10 @@ ia64_push_dummy_call (struct gdbarch *gd + int argno; + struct value *arg; + struct type *type; +- int len, argoffset; +- int nslots, rseslots, memslots, slotnum, nfuncargs; ++ LONGEST argoffset; ++ LONGEST len; ++ int rseslots, slotnum, nfuncargs; ++ LONGEST nslots, memslots; + int floatreg; + ULONGEST bsp; + CORE_ADDR funcdescaddr, pc, global_pointer; +Index: gdb-7.5.0.20120926/gdb/iq2000-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/iq2000-tdep.c 2012-05-16 16:35:06.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/iq2000-tdep.c 2012-11-07 22:47:57.509984729 +0100 +@@ -655,8 +655,9 @@ iq2000_push_dummy_call (struct gdbarch * + 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; + +Index: gdb-7.5.0.20120926/gdb/m32r-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m32r-tdep.c 2012-05-18 23:02:49.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/m32r-tdep.c 2012-11-07 22:47:57.516984719 +0100 +@@ -696,7 +696,7 @@ m32r_push_dummy_call (struct gdbarch *gd + CORE_ADDR regval; + gdb_byte *val; + gdb_byte valbuf[MAX_REGISTER_SIZE]; +- int len; ++ LONGEST len; + + /* First force sp to a 4-byte alignment. */ + sp = sp & ~3; +Index: gdb-7.5.0.20120926/gdb/m68k-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m68k-tdep.c 2012-11-07 22:02:30.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/m68k-tdep.c 2012-11-07 22:49:45.881829032 +0100 +@@ -384,7 +384,7 @@ m68k_reg_struct_return_p (struct gdbarch + { + 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); + +@@ -513,9 +513,9 @@ m68k_push_dummy_call (struct gdbarch *gd + 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. */ +Index: gdb-7.5.0.20120926/gdb/m88k-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/m88k-tdep.c 2012-05-16 16:35:06.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/m88k-tdep.c 2012-11-07 22:47:57.520984714 +0100 +@@ -260,13 +260,13 @@ m88k_store_arguments (struct regcache *r + { + struct gdbarch *gdbarch = get_regcache_arch (regcache); + int num_register_words = 0; +- int num_stack_words = 0; ++ LONGEST num_stack_words = 0; + int i; + + for (i = 0; i < nargs; i++) + { + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + if (m88k_integral_or_pointer_p (type) && len < 4) + { +@@ -308,8 +308,8 @@ m88k_store_arguments (struct regcache *r + { + const bfd_byte *valbuf = value_contents (args[i]); + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); +- int stack_word = num_stack_words; ++ LONGEST len = TYPE_LENGTH (type); ++ LONGEST stack_word = num_stack_words; + + if (m88k_in_register_p (type)) + { +Index: gdb-7.5.0.20120926/gdb/mep-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/mep-tdep.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/mep-tdep.c 2012-11-07 22:47:57.522984712 +0100 +@@ -2279,7 +2279,7 @@ push_large_arguments (CORE_ADDR sp, int + + 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) + { +Index: gdb-7.5.0.20120926/gdb/mips-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/mips-tdep.c 2012-11-07 22:02:30.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/mips-tdep.c 2012-11-07 22:47:57.534984694 +0100 +@@ -396,7 +396,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; + +@@ -419,8 +419,8 @@ mips_xfer_register (struct gdbarch *gdba + } + 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; +@@ -4295,13 +4295,13 @@ mips_eabi_push_dummy_call (struct gdbarc + gdb_byte valbuf[MAX_REGISTER_SIZE]; + 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); + + /* Function pointer arguments to mips16 code need to be made into + mips16 pointers. */ +@@ -4586,7 +4586,7 @@ mips_eabi_return_value (struct gdbarch * + + static int + mips_n32n64_fp_arg_chunk_p (struct gdbarch *gdbarch, struct type *arg_type, +- int offset) ++ LONGEST offset) + { + int i; + +@@ -4601,7 +4601,7 @@ mips_n32n64_fp_arg_chunk_p (struct gdbar + + for (i = 0; i < TYPE_NFIELDS (arg_type); i++) + { +- int pos; ++ LONGEST pos; + struct type *field_type; + + /* We're only looking at normal fields. */ +@@ -4643,7 +4643,7 @@ mips_n32n64_push_dummy_call (struct gdba + int argreg; + int float_argreg; + int argnum; +- int len = 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); +@@ -4994,11 +4994,11 @@ mips_n32n64_return_value (struct gdbarch + : 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 +@@ -5040,8 +5040,8 @@ mips_n32n64_return_value (struct gdbarch + 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, +@@ -5099,7 +5099,7 @@ mips_o32_push_dummy_call (struct gdbarch + int argreg; + int float_argreg; + int argnum; +- int len = 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); +@@ -5163,13 +5163,13 @@ mips_o32_push_dummy_call (struct gdbarch + 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); + +@@ -5627,8 +5627,8 @@ mips_o64_push_dummy_call (struct gdbarch + int argreg; + int float_argreg; + int argnum; +- int len = 0; +- int stack_offset = 0; ++ LONGEST len = 0; ++ LONGEST stack_offset = 0; + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + CORE_ADDR func_addr = find_function_addr (function, NULL); + +@@ -5689,13 +5689,13 @@ mips_o64_push_dummy_call (struct gdbarch + gdb_byte valbuf[MAX_REGISTER_SIZE]; + 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); + +Index: gdb-7.5.0.20120926/gdb/mn10300-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/mn10300-tdep.c 2012-05-18 23:02:49.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/mn10300-tdep.c 2012-11-07 22:47:57.542984682 +0100 +@@ -1228,7 +1228,7 @@ mn10300_push_dummy_call (struct 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; + char *val, valbuf[MAX_REGISTER_SIZE]; +Index: gdb-7.5.0.20120926/gdb/mt-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/mt-tdep.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/mt-tdep.c 2012-11-07 22:47:57.544984680 +0100 +@@ -783,9 +783,9 @@ mt_push_dummy_call (struct gdbarch *gdba + gdb_byte buf[MT_MAX_STRUCT_SIZE]; + int argreg = MT_1ST_ARGREG; + int split_param_len = 0; +- int stack_dest = sp; ++ LONGEST stack_dest = sp; + int slacklen; +- int typelen; ++ LONGEST typelen; + int i, j; + + /* First handle however many args we can fit into MT_1ST_ARGREG thru +Index: gdb-7.5.0.20120926/gdb/ppc-sysv-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/ppc-sysv-tdep.c 2012-05-18 23:02:49.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/ppc-sysv-tdep.c 2012-11-07 22:47:57.551984669 +0100 +@@ -69,7 +69,7 @@ ppc_sysv_abi_push_dummy_call (struct gdb + 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 gdb + /* 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 gdb + { + 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 +@@ -1557,14 +1557,14 @@ ppc64_sysv_abi_push_dummy_call (struct g + } + else + { +- int byte; ++ ssize_t byte; + for (byte = 0; byte < TYPE_LENGTH (type); + byte += tdep->wordsize) + { + if (write_pass && greg <= 10) + { + gdb_byte regval[MAX_REGISTER_SIZE]; +- int len = TYPE_LENGTH (type) - byte; ++ ssize_t len = TYPE_LENGTH (type) - byte; + if (len > tdep->wordsize) + len = tdep->wordsize; + memset (regval, 0, sizeof regval); +@@ -1592,7 +1592,7 @@ ppc64_sysv_abi_push_dummy_call (struct g + register. Work around this by always writing the + value to memory. Fortunately, doing this + simplifies the code. */ +- int len = TYPE_LENGTH (type); ++ ssize_t len = TYPE_LENGTH (type); + if (len < tdep->wordsize) + write_memory (gparam + tdep->wordsize - len, val, len); + else +Index: gdb-7.5.0.20120926/gdb/rl78-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/rl78-tdep.c 2012-05-18 23:02:50.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/rl78-tdep.c 2012-11-07 22:47:57.557984660 +0100 +@@ -1019,8 +1019,8 @@ rl78_push_dummy_call (struct gdbarch *gd + 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), +Index: gdb-7.5.0.20120926/gdb/rs6000-aix-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/rs6000-aix-tdep.c 2012-05-18 23:02:50.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/rs6000-aix-tdep.c 2012-11-07 22:47:57.560984657 +0100 +@@ -197,9 +197,9 @@ rs6000_push_dummy_call (struct gdbarch * + 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; +@@ -327,7 +327,7 @@ ran_out_of_registers_for_arguments: + + if ((argno < nargs) || argbytes) + { +- int space = 0, jj; ++ LONGEST space = 0, jj; + + if (argbytes) + { +Index: gdb-7.5.0.20120926/gdb/s390-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/s390-tdep.c 2012-11-07 22:03:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/s390-tdep.c 2012-11-07 22:47:57.569984644 +0100 +@@ -2481,7 +2481,7 @@ is_float_like (struct type *type) + + + static int +-is_power_of_two (unsigned int n) ++is_power_of_two (ULONGEST n) + { + return ((n & (n - 1)) == 0); + } +@@ -2667,7 +2667,7 @@ s390_push_dummy_call (struct gdbarch *gd + { + struct value *arg = args[i]; + struct type *type = check_typedef (value_type (arg)); +- unsigned length = TYPE_LENGTH (type); ++ ULONGEST length = TYPE_LENGTH (type); + + if (s390_function_arg_pass_by_reference (type)) + { +Index: gdb-7.5.0.20120926/gdb/score-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/score-tdep.c 2012-05-18 23:02:50.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/score-tdep.c 2012-11-07 22:47:57.571984640 +0100 +@@ -515,7 +515,7 @@ score_push_dummy_call (struct gdbarch *g + 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; + +Index: gdb-7.5.0.20120926/gdb/sh-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/sh-tdep.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/sh-tdep.c 2012-11-07 22:47:57.579984628 +0100 +@@ -805,7 +805,7 @@ sh_skip_prologue (struct gdbarch *gdbarc + 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. */ +@@ -907,7 +907,7 @@ sh_frame_align (struct gdbarch *ignore, + + /* Helper function to justify value in register according to endianess. */ + static char * +-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 char valbuf[4]; + +@@ -1067,7 +1067,8 @@ sh_push_dummy_call_fpu (struct gdbarch * + struct type *type; + CORE_ADDR regval; + char *val; +- int len, reg_size = 0; ++ LONGEST len; ++ ssize_t reg_size = 0; + int pass_on_stack = 0; + int treat_as_flt; + int last_reg_arg = INT_MAX; +@@ -1208,7 +1209,8 @@ sh_push_dummy_call_nofpu (struct gdbarch + struct type *type; + CORE_ADDR regval; + char *val; +- int len, reg_size = 0; ++ LONGEST len; ++ ssize_t reg_size = 0; + int pass_on_stack = 0; + int last_reg_arg = INT_MAX; + +Index: gdb-7.5.0.20120926/gdb/sh64-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/sh64-tdep.c 2012-06-06 20:03:53.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/sh64-tdep.c 2012-11-07 22:47:57.582984625 +0100 +@@ -1058,7 +1058,7 @@ sh64_push_dummy_call (struct gdbarch *gd + CORE_ADDR struct_addr) + { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); +- int stack_offset, stack_alloc; ++ LONGEST stack_offset, stack_alloc; + int int_argreg; + int float_argreg; + int double_argreg; +@@ -1069,7 +1069,7 @@ sh64_push_dummy_call (struct gdbarch *gd + CORE_ADDR regval; + char *val; + char valbuf[8]; +- int len; ++ LONGEST len; + int argreg_size; + int fp_args[12]; + +Index: gdb-7.5.0.20120926/gdb/sparc-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/sparc-tdep.c 2012-11-07 22:00:43.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/sparc-tdep.c 2012-11-07 22:47:57.593984609 +0100 +@@ -470,7 +470,7 @@ sparc32_store_arguments (struct regcache + for (i = 0; i < nargs; i++) + { + struct type *type = value_type (args[i]); +- int len = TYPE_LENGTH (type); ++ LONGEST len = TYPE_LENGTH (type); + + if (sparc_structure_or_union_p (type) + || (sparc_floating_p (type) && len == 16) +Index: gdb-7.5.0.20120926/gdb/sparc64-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/sparc64-tdep.c 2012-05-16 16:35:07.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/sparc64-tdep.c 2012-11-07 22:47:57.595984605 +0100 +@@ -639,7 +639,8 @@ sparc64_16_byte_align_p (struct type *ty + + 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) + { + int len = TYPE_LENGTH (type); + +@@ -681,7 +682,7 @@ sparc64_store_floating_fields (struct re + 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); +@@ -713,7 +714,7 @@ sparc64_store_floating_fields (struct re + + static void + sparc64_extract_floating_fields (struct regcache *regcache, struct type *type, +- gdb_byte *valbuf, int bitpos) ++ gdb_byte *valbuf, LONGEST bitpos) + { + if (sparc64_floating_p (type)) + { +@@ -750,7 +751,7 @@ sparc64_extract_floating_fields (struct + 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); + } +@@ -783,7 +784,7 @@ sparc64_store_arguments (struct regcache + 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)) +@@ -883,7 +884,7 @@ sparc64_store_arguments (struct regcache + { + 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]; + +Index: gdb-7.5.0.20120926/gdb/spu-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/spu-tdep.c 2012-11-07 22:09:24.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/spu-tdep.c 2012-11-07 22:47:57.598984602 +0100 +@@ -1372,7 +1372,7 @@ spu_push_dummy_call (struct gdbarch *gdb + 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. */ +@@ -1404,7 +1404,7 @@ spu_push_dummy_call (struct gdbarch *gdb + { + 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)) +Index: gdb-7.5.0.20120926/gdb/tic6x-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/tic6x-tdep.c 2012-06-08 16:24:57.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/tic6x-tdep.c 2012-11-07 22:50:31.792763178 +0100 +@@ -918,7 +918,7 @@ tic6x_push_dummy_call (struct gdbarch *g + int argnum; + int len = 0; + int stack_offset = 4; +- int references_offset = 4; ++ LONGEST references_offset = 4; + CORE_ADDR func_addr = find_function_addr (function, NULL); + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + struct type *func_type = value_type (function); +@@ -952,7 +952,7 @@ tic6x_push_dummy_call (struct gdbarch *g + /* 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; +@@ -971,7 +971,7 @@ tic6x_push_dummy_call (struct gdbarch *g + 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); +@@ -1131,7 +1131,8 @@ tic6x_push_dummy_call (struct gdbarch *g + } + 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); +Index: gdb-7.5.0.20120926/gdb/tilegx-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/tilegx-tdep.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/tilegx-tdep.c 2012-11-07 22:47:57.610984584 +0100 +@@ -291,7 +291,7 @@ tilegx_push_dummy_call (struct gdbarch * + CORE_ADDR stack_dest = sp; + int argreg = TILEGX_R0_REGNUM; + int i, j; +- int typelen, slacklen, alignlen; ++ LONGEST typelen, slacklen, alignlen; + static const gdb_byte two_zero_words[8] = { 0 }; + + /* If struct_return is 1, then the struct return address will +Index: gdb-7.5.0.20120926/gdb/v850-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/v850-tdep.c 2012-05-18 23:02:50.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/v850-tdep.c 2012-11-07 22:47:57.617984575 +0100 +@@ -809,7 +809,7 @@ v850_push_dummy_call (struct gdbarch *gd + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int argreg; + int argnum; +- int len = 0; ++ LONGEST len = 0; + int stack_offset; + + /* The offset onto the stack at which we will start copying parameters +@@ -834,7 +834,7 @@ v850_push_dummy_call (struct gdbarch *gd + 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]; + +Index: gdb-7.5.0.20120926/gdb/vax-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/vax-tdep.c 2012-11-07 22:46:56.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/vax-tdep.c 2012-11-07 22:47:57.618984573 +0100 +@@ -116,7 +116,7 @@ vax_store_arguments (struct regcache *re + struct gdbarch *gdbarch = get_regcache_arch (regcache); + 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 +@@ -125,7 +125,7 @@ vax_store_arguments (struct regcache *re + /* 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; +Index: gdb-7.5.0.20120926/gdb/xstormy16-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/xstormy16-tdep.c 2012-11-07 22:00:44.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/xstormy16-tdep.c 2012-11-07 22:47:57.626984562 +0100 +@@ -235,8 +235,9 @@ xstormy16_push_dummy_call (struct gdbarc + 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; + char buf[xstormy16_pc_size]; + +Index: gdb-7.5.0.20120926/gdb/xtensa-tdep.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/xtensa-tdep.c 2012-05-18 23:02:51.000000000 +0200 ++++ gdb-7.5.0.20120926/gdb/xtensa-tdep.c 2012-11-07 22:47:57.629984557 +0100 +@@ -1653,8 +1653,7 @@ xtensa_store_return_value (struct 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); + +@@ -1728,18 +1727,18 @@ xtensa_push_dummy_call (struct gdbarch * + { + enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + int i; +- int size, onstack_size; ++ 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; + }; +@@ -1763,9 +1762,10 @@ xtensa_push_dummy_call (struct 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: +@@ -1835,8 +1835,8 @@ xtensa_push_dummy_call (struct 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); +@@ -1881,7 +1881,7 @@ xtensa_push_dummy_call (struct 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 +@@ -1897,7 +1897,7 @@ xtensa_push_dummy_call (struct 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-24of25.patch b/gdb-rhbz795424-bitpos-24of25.patch new file mode 100644 index 0000000..05c656d --- /dev/null +++ b/gdb-rhbz795424-bitpos-24of25.patch @@ -0,0 +1,113 @@ +http://sourceware.org/ml/gdb-cvs/2012-09/msg00160.html + +### src/gdb/ChangeLog 2012/09/26 23:53:53 1.14709 +### src/gdb/ChangeLog 2012/09/27 08:57:14 1.14710 +## -1,3 +1,16 @@ ++2012-09-27 Siddhesh Poyarekar ++ ++ * gdbtypes.c (lookup_array_range_type): Expand parameters ++ LOW_BOUND and HIGH_BOUND to LONGEST. ++ (lookup_string_range_type): Likewise. ++ * gdbtypes.h (lookup_array_range_type): Likewise. ++ (lookup_string_range_type): Likewise. ++ * valops.c (value_cstring): Expand parameter LEN to ssize_t. ++ Expand HIGHBOUND to ssize_t. ++ (value_string): Likewise. ++ * value.h (value_cstring): Expand parameter LEN to ssize_t. ++ (value_string): Likewise. ++ + 2012-09-27 Yao Qi + + PR breakpoints/13898 +Index: gdb-7.5.0.20120926/gdb/gdbtypes.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.c 2012-11-07 22:09:57.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/gdbtypes.c 2012-11-07 22:50:47.048741164 +0100 +@@ -1022,7 +1022,7 @@ create_array_type (struct type *result_t + + struct type * + lookup_array_range_type (struct type *element_type, +- int low_bound, int high_bound) ++ LONGEST low_bound, LONGEST high_bound) + { + struct gdbarch *gdbarch = get_type_arch (element_type); + struct type *index_type = builtin_type (gdbarch)->builtin_int; +@@ -1058,7 +1058,7 @@ create_string_type (struct type *result_ + + struct type * + lookup_string_range_type (struct type *string_char_type, +- int low_bound, int high_bound) ++ LONGEST low_bound, LONGEST high_bound) + { + struct type *result_type; + +Index: gdb-7.5.0.20120926/gdb/gdbtypes.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/gdbtypes.h 2012-11-07 22:09:29.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/gdbtypes.h 2012-11-07 22:51:46.440655817 +0100 +@@ -1640,7 +1640,7 @@ extern struct type *create_range_type (s + + extern struct type *create_array_type (struct type *, struct type *, + struct type *); +-extern struct type *lookup_array_range_type (struct type *, int, int); ++extern struct type *lookup_array_range_type (struct type *, LONGEST, LONGEST); + + extern CORE_ADDR type_range_any_field_internal (struct type *range_type, + int fieldno); +@@ -1656,7 +1656,7 @@ extern void finalize_type (struct type * + + extern struct type *create_string_type (struct type *, struct type *, + struct type *); +-extern struct type *lookup_string_range_type (struct type *, int, int); ++extern struct type *lookup_string_range_type (struct type *, LONGEST, LONGEST); + + extern struct type *create_set_type (struct type *, struct type *); + +Index: gdb-7.5.0.20120926/gdb/valops.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/valops.c 2012-11-07 22:46:00.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/valops.c 2012-11-07 22:50:47.091741104 +0100 +@@ -1937,11 +1937,11 @@ value_array (int lowbound, int highbound + } + + struct value * +-value_cstring (char *ptr, int len, struct type *char_type) ++value_cstring (char *ptr, ssize_t len, struct type *char_type) + { + struct value *val; + int lowbound = current_language->string_lower_bound; +- int highbound = len / TYPE_LENGTH (char_type); ++ ssize_t highbound = len / TYPE_LENGTH (char_type); + struct type *stringtype + = lookup_array_range_type (char_type, lowbound, highbound + lowbound - 1); + +@@ -1960,11 +1960,11 @@ value_cstring (char *ptr, int len, struc + string may contain embedded null bytes. */ + + struct value * +-value_string (char *ptr, int len, struct type *char_type) ++value_string (char *ptr, ssize_t len, struct type *char_type) + { + struct value *val; + int lowbound = current_language->string_lower_bound; +- int highbound = len / TYPE_LENGTH (char_type); ++ ssize_t highbound = len / TYPE_LENGTH (char_type); + struct type *stringtype + = lookup_string_range_type (char_type, lowbound, highbound + lowbound - 1); + +Index: gdb-7.5.0.20120926/gdb/value.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/value.h 2012-11-07 22:09:30.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/value.h 2012-11-07 22:51:11.744705614 +0100 +@@ -593,9 +593,9 @@ extern struct value *value_mark (void); + + extern void value_free_to_mark (struct value *mark); + +-extern struct value *value_cstring (char *ptr, int len, ++extern struct value *value_cstring (char *ptr, ssize_t len, + struct type *char_type); +-extern struct value *value_string (char *ptr, int len, ++extern struct value *value_string (char *ptr, ssize_t len, + struct type *char_type); + extern struct value *value_bitstring (char *ptr, int len, + struct type *index_type); diff --git a/gdb-rhbz795424-bitpos-25of25-test.patch b/gdb-rhbz795424-bitpos-25of25-test.patch new file mode 100644 index 0000000..8130a77 --- /dev/null +++ b/gdb-rhbz795424-bitpos-25of25-test.patch @@ -0,0 +1,627 @@ +http://sourceware.org/ml/gdb-patches/2012-10/msg00231.html +Subject: Re: [PATCH] Expand fortran array bounds sizes to LONGEST + +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. + +--- /dev/null 2012-09-26 15:32:16.098506310 +0200 ++++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.exp 2012-10-15 20:53:26.427072583 +0200 +@@ -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\).*} +--- /dev/null 2012-09-26 15:32:16.098506310 +0200 ++++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.f 2012-10-15 19:35:12.500254261 +0200 +@@ -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 ++ +--- /dev/null 2012-09-26 15:32:16.098506310 +0200 ++++ gdb-7.2/gdb/testsuite/gdb.fortran/array-bounds.S 2012-10-15 20:52:36.851118215 +0200 +@@ -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-rhbz795424-bitpos-25of25.patch b/gdb-rhbz795424-bitpos-25of25.patch new file mode 100644 index 0000000..75d6cbf --- /dev/null +++ b/gdb-rhbz795424-bitpos-25of25.patch @@ -0,0 +1,156 @@ +http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html +Subject: [PATCH] Expand fortran array bounds sizes to LONGEST + + +--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 + +Index: gdb-7.5.0.20120926/gdb/f-lang.h +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/f-lang.h 2012-11-07 22:12:39.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/f-lang.h 2012-11-07 22:52:02.688632498 +0100 +@@ -66,9 +66,9 @@ enum f90_range_type + extern char *real_main_name; /* Name of main function. */ + extern int real_main_c_value; /* C_value field of main function. */ + +-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 *); + +Index: gdb-7.5.0.20120926/gdb/f-typeprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/f-typeprint.c 2012-11-07 22:00:41.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/f-typeprint.c 2012-11-07 22:52:02.689632497 +0100 +@@ -182,7 +182,7 @@ f_type_print_varspec_suffix (struct type + int show, int passed_a_ptr, int demangled_args, + int arrayprint_recurse_level) + { +- 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. */ +@@ -212,7 +212,7 @@ f_type_print_varspec_suffix (struct type + + 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 '*'. */ +@@ -222,7 +222,7 @@ f_type_print_varspec_suffix (struct type + else + { + upper_bound = f77_get_upperbound (type); +- fprintf_filtered (stream, "%d", upper_bound); ++ fprintf_filtered (stream, "%s", plongest (upper_bound)); + } + + if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY) +@@ -291,7 +291,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; +@@ -373,7 +373,7 @@ f_type_print_base (struct type *type, st + else + { + upper_bound = f77_get_upperbound (type); +- fprintf_filtered (stream, "character*%d", upper_bound); ++ fprintf_filtered (stream, "character*%s", plongest (upper_bound)); + } + break; + +Index: gdb-7.5.0.20120926/gdb/f-valprint.c +=================================================================== +--- gdb-7.5.0.20120926.orig/gdb/f-valprint.c 2012-11-07 22:09:29.000000000 +0100 ++++ gdb-7.5.0.20120926/gdb/f-valprint.c 2012-11-07 22:52:21.888604907 +0100 +@@ -57,7 +57,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN + + #define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0]) + +-int ++LONGEST + f77_get_lowerbound (struct type *type) + { + f_object_address_data_valid_or_error (type); +@@ -68,7 +68,7 @@ f77_get_lowerbound (struct type *type) + return TYPE_ARRAY_LOWER_BOUND_VALUE (type); + } + +-int ++LONGEST + f77_get_upperbound (struct type *type) + { + f_object_address_data_valid_or_error (type); +@@ -92,8 +92,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 +@@ -128,7 +128,7 @@ f77_create_arrayprint_offset_tbl (struct + struct type *tmp_type; + LONGEST eltlen; + int ndimen = 1; +- int upper, lower; ++ LONGEST upper, lower; + + tmp_type = type; + diff --git a/gdb-rhbz795424-bitpos-lazyvalue.patch b/gdb-rhbz795424-bitpos-lazyvalue.patch new file mode 100644 index 0000000..32fa243 --- /dev/null +++ b/gdb-rhbz795424-bitpos-lazyvalue.patch @@ -0,0 +1,425 @@ +--- gdb-7.5.0.20120926-m64/gdb/value.c-orig 2012-11-09 17:08:52.137406118 +0100 ++++ gdb-7.5.0.20120926-m64/gdb/value.c 2012-11-09 17:32:38.324199230 +0100 +@@ -663,7 +663,6 @@ allocate_value_lazy (struct type *type) + description correctly. */ + check_typedef (type); + +- ulongest_fits_host_or_error (TYPE_LENGTH (type)); + val = (struct value *) xzalloc (sizeof (struct value)); + val->contents = NULL; + val->next = all_values; +--- /dev/null 2012-10-18 11:08:13.202328239 +0200 ++++ gdb-7.5.0.20120926-m64-test/gdb/testsuite/gdb.base/longest-types.exp 2012-11-09 18:13:56.286587994 +0100 +@@ -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}-64bit.bz2.uu ++set file64bit ${objdir}/${subdir}/${testfile}-64bit ++ ++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}-64bit $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" +--- /dev/null 2012-10-18 11:08:13.202328239 +0200 ++++ ./gdb/testsuite/gdb.base/longest-types.c 2012-11-09 17:08:51.374406344 +0100 +@@ -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; ++} +--- /dev/null 2012-10-18 11:08:13.202328239 +0200 ++++ ./gdb/testsuite/gdb.base/longest-types-64bit.S 2012-11-09 17:51:37.597846130 +0100 +@@ -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 +--- /dev/null 2012-10-18 11:08:13.202328239 +0200 ++++ gdb-7.5.0.20120926-m64-test/gdb/testsuite/gdb.base/longest-types-64bit.bz2.uu 2012-11-09 18:04:52.995692771 +0100 +@@ -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-rhel5.9-testcase-xlf-var-inside-mod.patch b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch new file mode 100644 index 0000000..12f9ac6 --- /dev/null +++ b/gdb-rhel5.9-testcase-xlf-var-inside-mod.patch @@ -0,0 +1,723 @@ +Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.S +=================================================================== +--- /dev/null ++++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.S +@@ -0,0 +1,638 @@ ++/* Copyright (C) 2012 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 . */ ++ ++/* This file has been generated from the file named `xlf-variable.f', which ++ should be present in this directory. The command used to generate this ++ file was: ++ ++ xlf -qnoopt -g9 -S xlf-variable.f -o xlf-variable.S ++ ++ After issuing this command, you must hand-edit this file and remove the ++ mentions for `_xlfExit', since it is only present in XLF-specific ++ libraries. You must also make sure to remove the file named `mod1.mod' ++ which will be created in the compilation directory. ++ ++ In order to generated this file, the following XLF package was used: ++ ++ xlf.14.1.0.0.linux.eval.tar.gz ++ ++ These instructions may be different for different versions of the XLF ++ compiler. */ ++ ++.set r0,0; .set SP,1; .set RTOC,2; .set r3,3; .set r4,4 ++.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 ++.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 ++.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 ++.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 ++.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 ++.set r30,30; .set r31,31 ++.set fp0,0; .set fp1,1; .set fp2,2; .set fp3,3; .set fp4,4 ++.set fp5,5; .set fp6,6; .set fp7,7; .set fp8,8; .set fp9,9 ++.set fp10,10; .set fp11,11; .set fp12,12; .set fp13,13; .set fp14,14 ++.set fp15,15; .set fp16,16; .set fp17,17; .set fp18,18; .set fp19,19 ++.set fp20,20; .set fp21,21; .set fp22,22; .set fp23,23; .set fp24,24 ++.set fp25,25; .set fp26,26; .set fp27,27; .set fp28,28; .set fp29,29 ++.set fp30,30; .set fp31,31 ++.set v0,0; .set v1,1; .set v2,2; .set v3,3; .set v4,4 ++.set v5,5; .set v6,6; .set v7,7; .set v8,8; .set v9,9 ++.set v10,10; .set v11,11; .set v12,12; .set v13,13; .set v14,14 ++.set v15,15; .set v16,16; .set v17,17; .set v18,18; .set v19,19 ++.set v20,20; .set v21,21; .set v22,22; .set v23,23; .set v24,24 ++.set v25,25; .set v26,26; .set v27,27; .set v28,28; .set v29,29 ++.set v30,30; .set v31,31 ++.set q0,0; .set q1,1; .set q2,2; .set q3,3; .set q4,4 ++.set q5,5; .set q6,6; .set q7,7; .set q8,8; .set q9,9 ++.set q10,10; .set q11,11; .set q12,12; .set q13,13; .set q14,14 ++.set q15,15; .set q16,16; .set q17,17; .set q18,18; .set q19,19 ++.set q20,20; .set q21,21; .set q22,22; .set q23,23; .set q24,24 ++.set q25,25; .set q26,26; .set q27,27; .set q28,28; .set q29,29 ++.set q30,30; .set q31,31 ++.set MQ,0; .set XER,1; .set FROM_RTCU,4; .set FROM_RTCL,5; .set FROM_DEC,6 ++.set LR,8; .set CTR,9; .set TID,17; .set DSISR,18; .set DAR,19; .set TO_RTCU,20 ++.set TO_RTCL,21; .set TO_DEC,22; .set SDR_0,24; .set SDR_1,25; .set SRR_0,26 ++.set SRR_1,27 ++.set BO_dCTR_NZERO_AND_NOT,0; .set BO_dCTR_NZERO_AND_NOT_1,1 ++.set BO_dCTR_ZERO_AND_NOT,2; .set BO_dCTR_ZERO_AND_NOT_1,3 ++.set BO_IF_NOT,4; .set BO_IF_NOT_1,5; .set BO_IF_NOT_2,6 ++.set BO_IF_NOT_3,7; .set BO_dCTR_NZERO_AND,8; .set BO_dCTR_NZERO_AND_1,9 ++.set BO_dCTR_ZERO_AND,10; .set BO_dCTR_ZERO_AND_1,11; .set BO_IF,12 ++.set BO_IF_1,13; .set BO_IF_2,14; .set BO_IF_3,15; .set BO_dCTR_NZERO,16 ++.set BO_dCTR_NZERO_1,17; .set BO_dCTR_ZERO,18; .set BO_dCTR_ZERO_1,19 ++.set BO_ALWAYS,20; .set BO_ALWAYS_1,21; .set BO_ALWAYS_2,22 ++.set BO_ALWAYS_3,23; .set BO_dCTR_NZERO_8,24; .set BO_dCTR_NZERO_9,25 ++.set BO_dCTR_ZERO_8,26; .set BO_dCTR_ZERO_9,27; .set BO_ALWAYS_8,28 ++.set BO_ALWAYS_9,29; .set BO_ALWAYS_10,30; .set BO_ALWAYS_11,31 ++.set CR0_LT,0; .set CR0_GT,1; .set CR0_EQ,2; .set CR0_SO,3 ++.set CR1_FX,4; .set CR1_FEX,5; .set CR1_VX,6; .set CR1_OX,7 ++.set CR2_LT,8; .set CR2_GT,9; .set CR2_EQ,10; .set CR2_SO,11 ++.set CR3_LT,12; .set CR3_GT,13; .set CR3_EQ,14; .set CR3_SO,15 ++.set CR4_LT,16; .set CR4_GT,17; .set CR4_EQ,18; .set CR4_SO,19 ++.set CR5_LT,20; .set CR5_GT,21; .set CR5_EQ,22; .set CR5_SO,23 ++.set CR6_LT,24; .set CR6_GT,25; .set CR6_EQ,26; .set CR6_SO,27 ++.set CR7_LT,28; .set CR7_GT,29; .set CR7_EQ,30; .set CR7_SO,31 ++.set TO_LT,16; .set TO_GT,8; .set TO_EQ,4; .set TO_LLT,2; .set TO_LGT,1 ++ ++ .file "xlf-variable.f" ++ .globl __mod1_NMOD_____mod1 ++ .type __mod1_NMOD_____mod1,@function ++ .size __mod1_NMOD_____mod1,32 ++ .globl main ++ .type main,@function ++ .size main,68 ++ .globl __mod1_NMOD_sub1 ++ .type __mod1_NMOD_sub1,@function ++ .size __mod1_NMOD_sub1,136 ++ .globl _main ++ .type _main,@function ++ .size _main,68 ++ ++ .section ".text" ++ .align 7 ++.LC.text: ++__mod1_NMOD_____mod1: ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ or r31,SP,SP ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r31,-4(r11) ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text32: ++ ++__mod1_NMOD_sub1: ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ stw r30,24(SP) ++ or r31,SP,SP ++ addis r30,r0,.const_dr@ha ++ addi r30,r30,.const_dr@l ++ addis r3,r0,__N_mod1@ha ++ addi r3,r3,__N_mod1@l ++ addi r0,r0,1 ++ stb r0,4(r3) ++ addi r4,r0,14 ++ stb r4,5(r3) ++ stb r0,7(r3) ++ addis r5,r0,__N__mod1@ha ++ addi r5,r5,__N__mod1@l ++ stw r5,0(r3) ++ lbz r5,6(r3) ++ rlwinm r5,r5,0,25,25 ++ ori r5,r5,0x0040 ++ stb r5,6(r3) ++ lwz r5,0(r3) ++ lfs fp0,0(r30) ++ stfs fp0,0(r5) ++ stb r0,4(r3) ++ stb r4,5(r3) ++ addi r4,r0,0 ++ stb r4,6(r3) ++ stb r0,7(r3) ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r30,-8(r11) ++ lwz r31,-4(r11) ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text168: ++ .long 0 ++ .skip 0x54 ++.LC.text256: ++ ++main: ++_main: ++ mfspr r0,LR ++ stwu SP,-32(SP) ++ stw r31,28(SP) ++ stw r0,36(SP) ++ or r31,SP,SP ++ bl __mod1_NMOD_sub1 ++ addi r3,r0,0 ++.LC.text288: ++ ++ tw TO_EQ,r14,r14 ++ addi r3,r0,0 ++ b $+0x4 ++ addi r11,r31,32 ++ lwz r31,-4(r11) ++ lwz r0,4(r11) ++ mtspr LR,r0 ++ or SP,r11,r11 ++ bclr BO_ALWAYS,CR0_LT ++.LC.text324: ++ ++ ++ .section ".rodata","a" ++ .align 2 ++.LC.rodata: ++ .type .const_dr,@object ++ .size .const_dr,4 ++.const_dr: ++ .long 0x40400000 ++ ++ .section ".eh_frame","wa" ++ .align 2 ++.LC.eh_frame: ++ .long 0x0000000c ++ .long 0x00000000 ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x0000001c ++ .long 0x00000014 ++ .long .LC.text ++ .long 0x00000020 ++ .long 0x410e2041 ++ .long 0x9f01410d ++ .long 0x1f410a42 ++ .long 0xdf420b00 ++ .long 0x00000020 ++ .long 0x00000034 ++ .long .LC.text32 ++ .long 0x00000088 ++ .long 0x410e2041 ++ .long 0x9f01419e ++ .long 0x02410d1f ++ .long 0x590a42de ++ .long 0x41df420b ++ .long 0x0000000c ++ .long 0x00000000 ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x00000020 ++ .long 0x00000014 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x420e2041 ++ .long 0x9f014111 ++ .long 0x417f410d ++ .long 0x1f460a42 ++ .long 0xdf440b00 ++ ++ .section ".data","wa" ++ .align 4 ++.LC.data: ++ .globl __N_mod1 ++ .type __N_mod1,@object ++ .size __N_mod1,8 ++__N_mod1: ++ .long 0x00000000 ++ .long 0x01000001 ++ ++ .section ".except.1","wa" ++ .align 1 ++.LC.except.1: ++ .long .LC.text288 ++ .byte 0x01 ++ .byte 0x09 ++ ++ .ident "Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000.Fri Jun 15 16:35:45 2012 .IBM XL Fortran for Linux, V14.1 (5765-J05, 5725-C75) Version 14.01.0000.0000." ++ ++ .section ".debug_aranges" ++ .align 0 ++.LC.debug_aranges: ++ .long 0x0000001c ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x04000000 ++ .byte 0x00 ++ .byte 0x00 ++ .long .LC.text ++ .long 0x000000a8 ++ .long 0x00000000 ++ .long 0x00000000 ++ .long 0x0000001c ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x04000000 ++ .byte 0x00 ++ .byte 0x00 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x00000000 ++ .long 0x00000000 ++ ++ .section ".debug_pubnames" ++ .align 0 ++.LC.debug_pubnames: ++ .long 0x0000002f ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x00000111 ++ .long 0x000000dc ++ .long 0x79000000 ++ .long 0x00ec7a00 ++ .long 0x000000fc ++ .long 0x5f5f6d6f ++ .long 0x64315f4e ++ .long 0x4d4f445f ++ .long 0x73756231 ++ .long 0x00000000 ++ .long 0x00000000 ++ .byte 0x18 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x00000127 ++ .long 0x0000010f ++ .long 0x5f6d6169 ++ .long 0x6e000000 ++ .byte 0x00 ++ .byte 0x00 ++ ++ .section ".debug_info" ++ .align 0 ++.LC.debug_info: ++ .long 0x0000010d ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_abbrev ++ .long 0x0401786c ++ .long 0x662d7661 ++ .long 0x72696162 ++ .long 0x6c652e66 ++ .byte 0x00 ++ .long .LC.debug_line ++ .long .LC.text ++ .long .LC.text168 ++ .long 0x082f726f ++ .long 0x6f742f73 ++ .long 0x65726769 ++ .long 0x6f646a2f ++ .long 0x6764622d ++ .long 0x372e302e ++ .long 0x312d3432 ++ .long 0x2e656c35 ++ .long 0x2f676462 ++ .long 0x2d372e30 ++ .long 0x2e312f67 ++ .long 0x64622f74 ++ .long 0x65737473 ++ .long 0x75697465 ++ .long 0x2f676462 ++ .long 0x2e666f72 ++ .long 0x7472616e ++ .long 0x0049424d ++ .long 0x20584c20 ++ .long 0x466f7274 ++ .long 0x72616e20 ++ .long 0x666f7220 ++ .long 0x4c696e75 ++ .long 0x782c2056 ++ .long 0x31342e31 ++ .long 0x20283537 ++ .long 0x36352d4a ++ .long 0x30352c20 ++ .long 0x35373235 ++ .long 0x2d433735 ++ .long 0x29205665 ++ .long 0x7273696f ++ .long 0x6e203134 ++ .long 0x2e30312e ++ .long 0x30303030 ++ .long 0x2e303030 ++ .long 0x30000249 ++ .long 0x4e544547 ++ .long 0x45520004 ++ .long 0x05030005 ++ .long 0x02524541 ++ .long 0x4c000404 ++ .long 0x04050000 ++ .long 0x0000c706 ++ .long 0x6d6f6431 ++ .long 0x00070503 ++ .long __N_mod1 ++ .long 0x79000100 ++ .long 0x01000000 ++ .long 0xd0070503 ++ .long __N__mod1 ++ .long 0x7a000100 ++ .long 0x01000000 ++ .long 0xc7087375 ++ .byte 0x62 ++ .byte 0x31 ++ .byte 0x00 ++ .long .LC.text32 ++ .long .LC.text168 ++ .long 0x01180101 ++ .byte 0x6f ++ .byte 0x00 ++ .byte 0x00 ++.LC.debug_info273: ++ .long 0x00000123 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_abbrev97 ++ .long 0x0401786c ++ .long 0x662d7661 ++ .long 0x72696162 ++ .long 0x6c652e66 ++ .byte 0x00 ++ .long .LC.debug_line98 ++ .long .LC.text256 ++ .long .LC.text324 ++ .long 0x082f726f ++ .long 0x6f742f73 ++ .long 0x65726769 ++ .long 0x6f646a2f ++ .long 0x6764622d ++ .long 0x372e302e ++ .long 0x312d3432 ++ .long 0x2e656c35 ++ .long 0x2f676462 ++ .long 0x2d372e30 ++ .long 0x2e312f67 ++ .long 0x64622f74 ++ .long 0x65737473 ++ .long 0x75697465 ++ .long 0x2f676462 ++ .long 0x2e666f72 ++ .long 0x7472616e ++ .long 0x0049424d ++ .long 0x20584c20 ++ .long 0x466f7274 ++ .long 0x72616e20 ++ .long 0x666f7220 ++ .long 0x4c696e75 ++ .long 0x782c2056 ++ .long 0x31342e31 ++ .long 0x20283537 ++ .long 0x36352d4a ++ .long 0x30352c20 ++ .long 0x35373235 ++ .long 0x2d433735 ++ .long 0x29205665 ++ .long 0x7273696f ++ .long 0x6e203134 ++ .long 0x2e30312e ++ .long 0x30303030 ++ .long 0x2e303030 ++ .long 0x30000249 ++ .long 0x4e544547 ++ .long 0x45520004 ++ .long 0x05030005 ++ .long 0x02524541 ++ .long 0x4c000404 ++ .long 0x04000000 ++ .long 0xb9050000 ++ .long 0x0000c706 ++ .long 0x000000f4 ++ .long 0x26264e26 ++ .long 0x6d6f6431 ++ .long 0x00080779 ++ .long 0x00022300 ++ .long 0x000000d4 ++ .long 0x00060000 ++ .long 0x010f2626 ++ .long 0x4e26266d ++ .long 0x6f643100 ++ .long 0x04077a00 ++ .long 0x02230000 ++ .long 0x0000c700 ++ .long 0x085f6d61 ++ .byte 0x69 ++ .byte 0x6e ++ .byte 0x00 ++ .long .LC.text256 ++ .long .LC.text324 ++ .long 0x0201016f ++ .long 0x000000b9 ++ .byte 0x00 ++ ++ .section ".debug_abbrev" ++ .align 0 ++.LC.debug_abbrev: ++ .long 0x01110103 ++ .long 0x08100611 ++ .long 0x01120113 ++ .long 0x0b1b0825 ++ .long 0x08000002 ++ .long 0x24000308 ++ .long 0x0b0b3e0b ++ .long 0x00000324 ++ .long 0x000b0b3e ++ .long 0x0b000004 ++ .long 0x15000000 ++ .long 0x050f0033 ++ .long 0x0b491300 ++ .long 0x00061e01 ++ .long 0x03080000 ++ .long 0x07340002 ++ .long 0x0a03083a ++ .long 0x0b3b0b3f ++ .long 0x0c491300 ++ .long 0x00082e00 ++ .long 0x03081101 ++ .long 0x12013a0b ++ .long 0x3b0b3f0c ++ .long 0x400a0000 ++ .byte 0x00 ++.LC.debug_abbrev97: ++ .long 0x01110103 ++ .long 0x08100611 ++ .long 0x01120113 ++ .long 0x0b1b0825 ++ .long 0x08000002 ++ .long 0x24000308 ++ .long 0x0b0b3e0b ++ .long 0x00000324 ++ .long 0x000b0b3e ++ .long 0x0b000004 ++ .long 0x15004913 ++ .long 0x0000050f ++ .long 0x00330b49 ++ .long 0x13000006 ++ .long 0x13010113 ++ .long 0x03080b0b ++ .long 0x0000070d ++ .long 0x00030838 ++ .long 0x0a491300 ++ .long 0x00082e00 ++ .long 0x03081101 ++ .long 0x1201360b ++ .long 0x3f0c400a ++ .long 0x49130000 ++ .byte 0x00 ++ ++ .section ".debug_line" ++ .align 0 ++.LC.debug_line: ++ .long 0x0000005e ++ .long 0x00020000 ++ .long 0x00220101 ++ .long 0x9cdc0a00 ++ .long 0x01010101 ++ .long 0x00000001 ++ .long 0x00786c66 ++ .long 0x2d766172 ++ .long 0x6961626c ++ .long 0x652e6600 ++ .long 0x00000000 ++ .long 0x04010005 ++ .byte 0x02 ++ .long .LC.text ++ .long 0x03130109 ++ .long 0x000c0309 ++ .long 0x01090014 ++ .long 0x037b0109 ++ .long 0x00180301 ++ .long 0x01090038 ++ .long 0x03010109 ++ .long 0x000c0301 ++ .long 0x01090014 ++ .long 0x03010109 ++ .long 0x00180001 ++ .byte 0x01 ++.LC.debug_line98: ++ .long 0x00000046 ++ .long 0x00020000 ++ .long 0x00220101 ++ .long 0x9cdc0a00 ++ .long 0x01010101 ++ .long 0x00000001 ++ .long 0x00786c66 ++ .long 0x2d766172 ++ .long 0x6961626c ++ .long 0x652e6600 ++ .long 0x00000000 ++ .long 0x04010005 ++ .byte 0x02 ++ .long .LC.text256 ++ .long 0x031f0109 ++ .long 0x00140300 ++ .long 0x01090004 ++ .long 0x03010109 ++ .long 0x002c0001 ++ .byte 0x01 ++ ++ .section ".debug_frame" ++ .align 0 ++.LC.debug_frame: ++ .long 0x0000000c ++ .long 0xffffffff ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x0000001c ++ .long .LC.debug_frame ++ .long .LC.text ++ .long 0x00000020 ++ .long 0x410e2041 ++ .long 0x9f01410d ++ .long 0x1f410a42 ++ .long 0xdf420b00 ++ .long 0x00000020 ++ .long .LC.debug_frame ++ .long .LC.text32 ++ .long 0x00000088 ++ .long 0x410e2041 ++ .long 0x9f01419e ++ .long 0x02410d1f ++ .long 0x590a42de ++ .long 0x41df420b ++.LC.debug_frame84: ++ .long 0x0000000c ++ .long 0xffffffff ++ .long 0x0100047c ++ .long 0x410c0100 ++ .long 0x00000020 ++ .long .LC.debug_frame84 ++ .long .LC.text256 ++ .long 0x00000044 ++ .long 0x420e2041 ++ .long 0x9f014111 ++ .long 0x417f410d ++ .long 0x1f460a42 ++ .long 0xdf440b00 ++ ++ .section ".debug_pubtypes" ++ .align 0 ++.LC.debug_pubtypes: ++ .long 0x00000023 ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info ++ .long 0x00000111 ++ .long 0x000000b9 ++ .long 0x494e5445 ++ .long 0x47455200 ++ .long 0x000000c7 ++ .long 0x5245414c ++ .long 0x00000000 ++ .long 0x00000000 ++ .byte 0x3e ++ .byte 0x00 ++ .byte 0x02 ++ .long .LC.debug_info273 ++ .long 0x00000127 ++ .long 0x000000b9 ++ .long 0x494e5445 ++ .long 0x47455200 ++ .long 0x000000c7 ++ .long 0x5245414c ++ .long 0x00000000 ++ .long 0xda26264e ++ .long 0x266d6f64 ++ .long 0x31000000 ++ .long 0x00f42626 ++ .long 0x4e26266d ++ .long 0x6f643100 ++ .long 0x00000000 ++ ++ .comm __N__mod1,4,16 +Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.exp +=================================================================== +--- /dev/null ++++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.exp +@@ -0,0 +1,37 @@ ++# 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 test can only be run on PPC64 machines. ++ ++if { ![istarget powerpc64-*] || ![is_ilp32_target] } { ++ return -1 ++} ++ ++set testfile "xlf-variable" ++set srcfile ${testfile}.S ++ ++if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { ++ return -1 ++} ++ ++if { ![runto_main] } { ++ return -1 ++} ++ ++gdb_test "step" ".*y => z.*" "y => z" ++gdb_test "step" ".*y = 3\.0.*" "y = 3.0" ++gdb_test "step" ".*nullify \\(y\\).*" "nullify (y)" ++gdb_test "print z" "= 3" "z = 3" ++gdb_test "ptype z" "= REAL" "z is REAL" +Index: gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.f +=================================================================== +--- /dev/null ++++ gdb-7.4.50.20120603/gdb/testsuite/gdb.fortran/xlf-variable.f +@@ -0,0 +1,33 @@ ++c Copyright 2012 Free Software Foundation, Inc. ++c ++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 . ++ ++c This file is the Fortran source file for xlf-variable.f. ++c It was used to generate the assembly output called xlf-variable.S, ++c which was generated using IBM's XLF compiler. ++ ++ module mod1 ++ real, pointer :: y ++ real, target :: z ++ contains ++ subroutine sub1 ++ y => z ++ y = 3.0 ++ nullify (y) ++ end subroutine ++ end module ++ ++ use mod1 ++ call sub1 ++ end diff --git a/gdb-upstream.patch b/gdb-upstream.patch deleted file mode 100644 index 105c4d3..0000000 --- a/gdb-upstream.patch +++ /dev/null @@ -1,293 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-06/msg00065.html -Subject: [commit 1/2] testsuite: code_elim.exp: unique names - -Hi, - -this is just removal of non-unique test names and one small simplification. - -Checked in. - - -Thanks, -Jan - - -http://sourceware.org/ml/gdb-cvs/2012-06/msg00011.html - -### src/gdb/testsuite/ChangeLog 2012/05/28 20:37:29 1.3209 -### src/gdb/testsuite/ChangeLog 2012/06/03 17:06:04 1.3210 -## -1,3 +1,16 @@ -+2012-06-03 Jan Kratochvil -+ -+ * gdb.base/code_elim.exp (add-symbol-file ${testfile1} 0x100000): -+ Simplify it to ... -+ (symbol-file ${testfile1}): ... here. -+ (test eliminated var my_global_symbol) -+ (test eliminated var my_static_symbol) -+ (test eliminated var my_global_func, get address of main): Wrap them to -+ 'single psymtabs' and 'single symtabs' -+ (get address of my_global_symbol, get address of my_static_symbol) -+ (get address of my_global_func, get address of main): Wrap them to -+ 'order1' and 'order2'. -+ - 2012-05-28 Jan Kratochvil - - * gdb.server/solib-list-lib.c: New file. ---- src/gdb/testsuite/gdb.base/code_elim.exp 2012/01/16 16:21:44 1.4 -+++ src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:06:04 1.5 -@@ -95,16 +95,16 @@ - gdb_exit - gdb_start - --gdb_test "add-symbol-file ${binfile1} 0x100000" \ -+gdb_test "symbol-file ${binfile1}" \ - "Reading symbols from .*${testfile1}\\.\\.\\.done\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)" \ -- "add-symbol-file ${testfile1} 0x100000" \ -- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \ -- "y" -+ "symbol-file ${testfile1}" - --test_eliminated_var my_global_symbol --test_eliminated_var my_static_symbol --test_eliminated_var my_global_func --not_null_var_address main -+with_test_prefix "single psymtabs" { -+ test_eliminated_var my_global_symbol -+ test_eliminated_var my_static_symbol -+ test_eliminated_var my_global_func -+ not_null_var_address main -+} - - # Same thing for symtabs - -@@ -115,10 +115,12 @@ - gdb_start - set GDBFLAGS $saved_gdbflags - --test_eliminated_var my_global_symbol --test_eliminated_var my_static_symbol --test_eliminated_var my_global_func --not_null_var_address main -+with_test_prefix "single symtabs" { -+ test_eliminated_var my_global_symbol -+ test_eliminated_var my_static_symbol -+ test_eliminated_var my_global_func -+ not_null_var_address main -+} - - # binfile2 contains the symbols that have been eliminated in binfile1. Check - # the eliminated symbols does not hide these valid ones. -@@ -138,10 +140,12 @@ - "add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \ - "y" - --not_null_var_address my_global_symbol --not_null_var_address my_static_symbol --not_null_var_address my_global_func --not_null_var_address main -+with_test_prefix "order1" { -+ not_null_var_address my_global_symbol -+ not_null_var_address my_static_symbol -+ not_null_var_address my_global_func -+ not_null_var_address main -+} - - # Same thing, but loading binfile2 before binfile1. - -@@ -160,9 +164,9 @@ - "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \ - "y" - --not_null_var_address my_global_symbol --not_null_var_address my_static_symbol --not_null_var_address my_global_func --not_null_var_address main -- -- -+with_test_prefix "order2" { -+ not_null_var_address my_global_symbol -+ not_null_var_address my_static_symbol -+ not_null_var_address my_global_func -+ not_null_var_address main -+} - - - -http://sourceware.org/ml/gdb-patches/2012-06/msg00066.html -Subject: [commit 2/2] testsuite: code_elim.exp: Fix false FAIL - -Hi, - -with Fedora 18 x86_64 (Rawhide) there is a false FAIl since: -2167931cf70f91206efb8b01e848a55d82a347ce is the first bad commit -Author: Tom Tromey -Date: Fri May 18 15:31:39 2012 +0000 -http://sourceware.org/bugzilla/show_bug.cgi?id=13907 - - print &my_global_symbol --$1 = (int *) 0x804a004 --(gdb) PASS: gdb.base/code_elim.exp: get address of my_global_symbol -+$1 = (int *) 0x804a004 -+(gdb) FAIL: gdb.base/code_elim.exp: get address of my_global_symbol - -Nothing really changed, just GDB now prints and the testcase -expects either none or suffix. - -This is because the two symbol files (their sections .data/.bss) have -overlapped so GDB chooses randomly which symbol to display. And since -Fedora 18 GCC puts there that "completed.5732" symbol. - -This may be because add-symbol-file FILE ADDR relocates to ADDR on the .text -section and leaves other sections at their original place, which is IMO a bit -unexpected; it is a FAQ people expect more ADDR to be relocation displacement -(and not relative to .text and not limited to .text). But this is really -outside of the scope of this testcase false FAIL. - -Checked in. - - -Thanks, -Jan - - -http://sourceware.org/ml/gdb-cvs/2012-06/msg00012.html - -### src/gdb/testsuite/ChangeLog 2012/06/03 17:06:04 1.3210 -### src/gdb/testsuite/ChangeLog 2012/06/03 17:10:28 1.3211 -## -11,6 +11,16 @@ - (get address of my_global_func, get address of main): Wrap them to - 'order1' and 'order2'. - -+ * gdb.base/code_elim.exp -+ (add-symbol-file ${testfile1} 0x100000) -+ (add-symbol-file ${testfile2} 0x200000): Wrap them to 'order1' and -+ 'order2'. -+ (order1: add-symbol-file ${testfile1} 0x100000) -+ (order1: add-symbol-file ${testfile2} 0x200000) -+ (order2: add-symbol-file ${testfile2} 0x200000) -+ (order2: add-symbol-file ${testfile1} 0x100000): Add -s .data and -s -+ .bss as appropriate. -+ - 2012-05-28 Jan Kratochvil - - * gdb.server/solib-list-lib.c: New file. ---- src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:06:04 1.5 -+++ src/gdb/testsuite/gdb.base/code_elim.exp 2012/06/03 17:10:28 1.6 -@@ -128,19 +128,19 @@ - gdb_exit - gdb_start - --gdb_test "add-symbol-file ${binfile1} 0x100000" \ -- "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \ -- "add-symbol-file ${testfile1} 0x100000" \ -- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \ -- "y" -- --gdb_test "add-symbol-file ${binfile2} 0x200000" \ -- "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \ -- "add-symbol-file ${testfile2} 0x200000" \ -- "add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \ -- "y" -- - with_test_prefix "order1" { -+ gdb_test "add-symbol-file ${binfile1} 0x100000 -s .bss 0x120000" \ -+ "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \ -+ "add-symbol-file ${testfile1} 0x100000" \ -+ "add symbol table from file \".*${testfile1}\" at.*\\(y or n\\) " \ -+ "y" -+ -+ gdb_test "add-symbol-file ${binfile2} 0x200000 -s .data 0x210000 -s .bss 0x220000" \ -+ "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \ -+ "add-symbol-file ${testfile2} 0x200000" \ -+ "add symbol table from file \".*${testfile2}\" at.*\\(y or n\\) " \ -+ "y" -+ - not_null_var_address my_global_symbol - not_null_var_address my_static_symbol - not_null_var_address my_global_func -@@ -152,19 +152,19 @@ - gdb_exit - gdb_start - --gdb_test "add-symbol-file ${binfile2} 0x200000" \ -- "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \ -- "add-symbol-file ${testfile2} 0x200000" \ -- "add symbol table from file \".*${testfile2}\" at\[ \t\r\n\]+\.text_addr = 0x200000\[\r\n\]+\\(y or n\\) " \ -- "y" -- --gdb_test "add-symbol-file ${binfile1} 0x100000" \ -- "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \ -- "add-symbol-file ${testfile1} 0x100000" \ -- "add symbol table from file \".*${testfile1}\" at\[ \t\r\n\]+\.text_addr = 0x100000\[\r\n\]+\\(y or n\\) " \ -- "y" -- - with_test_prefix "order2" { -+ gdb_test "add-symbol-file ${binfile2} 0x200000 -s .data 0x210000 -s .bss 0x220000" \ -+ "Reading symbols from .*${testfile2}\\.\\.\\.done\\." \ -+ "add-symbol-file ${testfile2} 0x200000" \ -+ "add symbol table from file \".*${testfile2}\" at.*\\(y or n\\) " \ -+ "y" -+ -+ gdb_test "add-symbol-file ${binfile1} 0x100000 -s .bss 0x120000" \ -+ "Reading symbols from .*${testfile1}\\.\\.\\.done\\." \ -+ "add-symbol-file ${testfile1} 0x100000" \ -+ "add symbol table from file \".*${testfile1}\" at.*\\(y or n\\) " \ -+ "y" -+ - not_null_var_address my_global_symbol - not_null_var_address my_static_symbol - not_null_var_address my_global_func - - - -http://sourceware.org/ml/gdb-cvs/2012-06/msg00047.html - -### src/gdb/ChangeLog 2012/06/06 06:04:42 1.14330 -### src/gdb/ChangeLog 2012/06/06 16:57:34 1.14331 -## -1,3 +1,8 @@ -+2012-06-06 Jan Kratochvil -+ -+ * configure.ac: Move development=true below AC_INIT. -+ * configure: Regenerate. -+ - 2012-06-05 Stan Shebs - - * mi/mi-interp.c (mi_interpreter_init): Set raw_stdout from ---- src/gdb/configure 2012/06/01 18:20:18 1.366 -+++ src/gdb/configure 2012/06/06 16:57:36 1.367 -@@ -2683,6 +2683,11 @@ - - - -+# Provide more thorough testing by -lmcheck. -+# Set it to 'true' for development snapshots, 'false' for releases or -+# pre-releases. -+development=true -+ - ac_ext=c - ac_cpp='$CPP $CPPFLAGS' - ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ---- src/gdb/configure.ac 2012/06/01 18:20:18 1.177 -+++ src/gdb/configure.ac 2012/06/06 16:57:38 1.178 -@@ -18,16 +18,16 @@ - - dnl Process this file with autoconf to produce a configure script. - --dnl Provide more thorough testing by -lmcheck. --dnl Set it to 'true' for development snapshots, 'false' for releases or --dnl pre-releases. --development=true -- - AC_PREREQ(2.59)dnl - AC_INIT(main.c) - AC_CONFIG_HEADER(config.h:config.in) - AM_MAINTAINER_MODE - -+# Provide more thorough testing by -lmcheck. -+# Set it to 'true' for development snapshots, 'false' for releases or -+# pre-releases. -+development=true -+ - AC_PROG_CC - AC_USE_SYSTEM_EXTENSIONS - ACX_LARGEFILE diff --git a/gdb-x86-onstack-1of2.patch b/gdb-x86-onstack-1of2.patch deleted file mode 100644 index 9e5d428..0000000 --- a/gdb-x86-onstack-1of2.patch +++ /dev/null @@ -1,119 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-03/msg00357.html -Subject: [patch 1/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5 - -Hi, - -posted as a new thread. - -As described in - cancel: [patch] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #4 [Re: [revert] Regression on PowerPC] - http://sourceware.org/ml/gdb-patches/2012-03/msg00322.html -just ON_STACK had some regressions. - -The expectations in that mail were wrong (at least that cleanup/fix is not -required for gdb.cp/gdb2495.exp). - -The problem is that the inferior call return pad breakpoint instruction is -never removed even after inferior call finishes. It is even still visible in -"maintenance info breakpoints". This does not matter much for AT_ENTRY_POINT -but for ON_STACK it just corrupts stack. - -No regressions on -{x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for -gdbsever non-extended mode. - - -Thanks, -Jan - - -gdb/ -2012-03-09 Jan Kratochvil - - Remove momentary breakpoints for completed inferior calls. - * dummy-frame.c: Include gdbthread.h. - (pop_dummy_frame_bpt): New function. - (pop_dummy_frame): Initialie DUMMY earlier. Call pop_dummy_frame_bpt. - -gdb/testsuite/ -2012-03-09 Jan Kratochvil - - Remove momentary breakpoints for completed inferior calls. - * gdb.base/call-signal-resume.exp (maintenance print dummy-frames) - (maintenance info breakpoints): New tests. - -Index: gdb-7.4.50.20120602/gdb/dummy-frame.c -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/dummy-frame.c 2012-01-04 09:17:00.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/dummy-frame.c 2012-06-02 20:42:40.907720327 +0200 -@@ -29,6 +29,7 @@ - #include "gdbcmd.h" - #include "gdb_string.h" - #include "observer.h" -+#include "gdbthread.h" - - /* Dummy frame. This saves the processor state just prior to setting - up the inferior function call. Older targets save the registers -@@ -108,19 +109,36 @@ remove_dummy_frame (struct dummy_frame * - xfree (dummy); - } - -+/* Delete any breakpoint B which is a momentary breakpoint for return from -+ inferior call matching DUMMY_VOIDP. */ -+ -+static int -+pop_dummy_frame_bpt (struct breakpoint *b, void *dummy_voidp) -+{ -+ struct dummy_frame *dummy = dummy_voidp; -+ -+ if (b->disposition == disp_del && frame_id_eq (b->frame_id, dummy->id) -+ && b->thread == pid_to_thread_id (inferior_ptid)) -+ delete_breakpoint (b); -+ -+ /* Continue the traversal. */ -+ return 0; -+} -+ - /* Pop *DUMMY_PTR, restoring program state to that before the - frame was created. */ - - static void - pop_dummy_frame (struct dummy_frame **dummy_ptr) - { -- struct dummy_frame *dummy; -+ struct dummy_frame *dummy = *dummy_ptr; -+ -+ restore_infcall_suspend_state (dummy->caller_state); - -- restore_infcall_suspend_state ((*dummy_ptr)->caller_state); -+ iterate_over_breakpoints (pop_dummy_frame_bpt, dummy); - - /* restore_infcall_control_state frees inf_state, - all that remains is to pop *dummy_ptr. */ -- dummy = *dummy_ptr; - *dummy_ptr = dummy->next; - xfree (dummy); - -Index: gdb-7.4.50.20120602/gdb/testsuite/gdb.base/call-signal-resume.exp -=================================================================== ---- gdb-7.4.50.20120602.orig/gdb/testsuite/gdb.base/call-signal-resume.exp 2012-01-23 18:11:50.000000000 +0100 -+++ gdb-7.4.50.20120602/gdb/testsuite/gdb.base/call-signal-resume.exp 2012-06-02 20:43:10.523709052 +0200 -@@ -101,6 +101,18 @@ gdb_test "frame $frame_number" ".*" - gdb_test_no_output "set confirm off" - gdb_test "return" "" - -+# Verify there are no remains of the dummy frame. -+gdb_test_no_output "maintenance print dummy-frames" -+set test "maintenance info breakpoints" -+gdb_test_multiple $test $test { -+ -re "call dummy.*\r\n$gdb_prompt $" { -+ fail $test -+ } -+ -re "\r\n$gdb_prompt $" { -+ pass $test -+ } -+} -+ - # Resume execution, the program should continue without any signal. - - gdb_test "break stop_two" "Breakpoint \[0-9\]* at .*" diff --git a/gdb-x86-onstack-2of2.patch b/gdb-x86-onstack-2of2.patch deleted file mode 100644 index 8b5fa37..0000000 --- a/gdb-x86-onstack-2of2.patch +++ /dev/null @@ -1,166 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2012-03/msg00358.html -Subject: [patch 2/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5 - -Hi, - -here is the ON_STACK code again, with fixed alignment for i386 SSE. - -It is generalized for all OSes on i386/amd64. I can move it to -{i386,amd64)-linux-tdep.c but I find this code much more lightweight than -i386_push_dummy_call which is already present in i386-tdep. - -No regressions on -{x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for -gdbsever non-extended mode. - -For x86_64-fedora17-linux-gnu it fixes: --FAIL: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler. --FAIL: gdb.cp/gdb2495.exp: bt after returning from a popped frame -+PASS: gdb.cp/gdb2495.exp: Call a function that raises an exception without a handler. -+PASS: gdb.cp/gdb2495.exp: bt after returning from a popped frame - - -Thanks, -Jan - - -gdb/ -2012-03-09 Jan Kratochvil - - * amd64-dicos-tdep.c (amd64_dicos_push_dummy_code): Remove. - (amd64_dicos_init_abi): Remove its installment. - * dicos-tdep.c (dicos_init_abi): Remove the - set_gdbarch_call_dummy_location call. Update the comment here. - * i386-dicos-tdep.c (i386_dicos_push_dummy_code): Remove. - (i386_dicos_init_abi): Remove its installment. - * i386-tdep.c (i386_push_dummy_code): New function. - (i386_gdbarch_init): Call set_gdbarch_call_dummy_location, install - i386_push_dummy_code. - ---- a/gdb/amd64-dicos-tdep.c -+++ b/gdb/amd64-dicos-tdep.c -@@ -23,24 +23,6 @@ - #include "amd64-tdep.h" - #include "dicos-tdep.h" - --static CORE_ADDR --amd64_dicos_push_dummy_code (struct gdbarch *gdbarch, -- CORE_ADDR sp, CORE_ADDR funaddr, -- struct value **args, int nargs, -- struct type *value_type, -- CORE_ADDR *real_pc, CORE_ADDR *bp_addr, -- struct regcache *regcache) --{ -- int bplen; -- CORE_ADDR bppc = sp; -- -- gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen); -- *bp_addr = sp - bplen; -- *real_pc = funaddr; -- -- return *bp_addr; --} -- - static void - amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - { -@@ -49,8 +31,6 @@ amd64_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - amd64_init_abi (info, gdbarch); - - dicos_init_abi (gdbarch); -- -- set_gdbarch_push_dummy_code (gdbarch, amd64_dicos_push_dummy_code); - } - - static enum gdb_osabi ---- a/gdb/dicos-tdep.c -+++ b/gdb/dicos-tdep.c -@@ -43,8 +43,8 @@ dicos_init_abi (struct gdbarch *gdbarch) - - /* There's no (standard definition of) entry point or a guaranteed - text location with a symbol where to place the call dummy, so we -- put it on the stack. */ -- set_gdbarch_call_dummy_location (gdbarch, ON_STACK); -+ need it on the stack. Rely on i386_gdbarch_init used also for -+ amd64 to set up ON_STACK inferior calls. */ - - /* DICOS rewinds the PC itself. */ - set_gdbarch_decr_pc_after_break (gdbarch, 0); ---- a/gdb/i386-dicos-tdep.c -+++ b/gdb/i386-dicos-tdep.c -@@ -22,32 +22,12 @@ - #include "gdb_string.h" - #include "dicos-tdep.h" - --static CORE_ADDR --i386_dicos_push_dummy_code (struct gdbarch *gdbarch, -- CORE_ADDR sp, CORE_ADDR funaddr, -- struct value **args, int nargs, -- struct type *value_type, -- CORE_ADDR *real_pc, CORE_ADDR *bp_addr, -- struct regcache *regcache) --{ -- int bplen; -- CORE_ADDR bppc = sp; -- -- gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen); -- *bp_addr = sp - bplen; -- *real_pc = funaddr; -- -- return *bp_addr; --} -- - static void - i386_dicos_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - { - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - dicos_init_abi (gdbarch); -- -- set_gdbarch_push_dummy_code (gdbarch, i386_dicos_push_dummy_code); - } - - static enum gdb_osabi ---- a/gdb/i386-tdep.c -+++ b/gdb/i386-tdep.c -@@ -2326,6 +2326,30 @@ i386_16_byte_align_p (struct type *type) - return 0; - } - -+/* Implementation for set_gdbarch_push_dummy_code. */ -+ -+static CORE_ADDR -+i386_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, CORE_ADDR funaddr, -+ struct value **args, int nargs, struct type *value_type, -+ CORE_ADDR *real_pc, CORE_ADDR *bp_addr, -+ struct regcache *regcache) -+{ -+ int bplen; -+ CORE_ADDR bppc = sp; -+ -+ gdbarch_breakpoint_from_pc (gdbarch, &bppc, &bplen); -+ sp -= bplen; -+ -+ /* amd64_push_dummy_call does alignment on its own but i386_push_dummy_call -+ does not. ABI requires stack alignment for executables using SSE. */ -+ if (gdbarch_frame_align_p (gdbarch)) -+ sp = gdbarch_frame_align (gdbarch, sp); -+ -+ *bp_addr = sp; -+ *real_pc = funaddr; -+ return sp; -+} -+ - static CORE_ADDR - i386_push_dummy_call (struct gdbarch *gdbarch, struct value *function, - struct regcache *regcache, CORE_ADDR bp_addr, int nargs, -@@ -7372,6 +7396,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - set_gdbarch_get_longjmp_target (gdbarch, i386_get_longjmp_target); - - /* Call dummy code. */ -+ set_gdbarch_call_dummy_location (gdbarch, ON_STACK); -+ set_gdbarch_push_dummy_code (gdbarch, i386_push_dummy_code); - set_gdbarch_push_dummy_call (gdbarch, i386_push_dummy_call); - set_gdbarch_frame_align (gdbarch, i386_frame_align); - - diff --git a/gdb.changes b/gdb.changes index e0d09ce..5459c0f 100644 --- a/gdb.changes +++ b/gdb.changes @@ -1,3 +1,38 @@ +------------------------------------------------------------------- +Mon Dec 3 14:29:15 UTC 2012 - matz@suse.com + +- Merge from gdb-7.5.1-30.fc18.src.rpm. + + 7.5.1 gives: + * An "Attempt to dereference a generic pointer" errors (-var-create). + * Backtrace problems on x32 (PR backtrace/14646). + * next/step/finish problems on x32 (PR gdb/14647). + * A "malformed linespec error: unexpected keyword, [...]" error + (PR breakpoints/14643). + * GDB crash while stepping through powerpc (32bits) code. + * A failed assertion in linux_ptrace_test_ret_to_nx. + * A "!frame_id_inlined_p (frame_id)" failed assertion. + * A "No more reverse-execution history." error during reverse + "next" execution (PR 14548). + * Incomplete command descriptions in "apropos" output. + * PR gdb/14494 (a GDB crash difficult to characterize). + + 7.5 gives: + * Go language support. + * New targets (x32 ABI, microMIPS, Renesas RL78, HP OpenVMS ia64). + * More Python scripting improvements. + * SDT (Static Defined Tracing) probes support with SystemTap probes. + * GDBserver improvements (stdio connections, target-side evaluation + of breakpoint conditions, remote protocol improvements). + * Other miscellaneous improvements (ability to stop when a shared + library is loaded/unloaded, dynamic printf, etc). + * Reverse debugging on ARM. + +------------------------------------------------------------------- +Tue Jun 19 13:58:08 UTC 2012 - rguenther@suse.com + +- Do not provide a custom (safe) auto-load dir. + ------------------------------------------------------------------- Tue Jun 12 13:00:14 UTC 2012 - rguenther@suse.com diff --git a/gdb.spec b/gdb.spec index 78d36d4..ee50537 100644 --- a/gdb.spec +++ b/gdb.spec @@ -16,11 +16,10 @@ Summary: A GNU source-level debugger for C, C++, Fortran and other languages Name: gdb -# Set version to contents of gdb/version.in. -# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3 -# and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch). -%global snap 20120603 -Version: 7.4.50.%{snap} +%global snap 20120817 +# See timestamp of source gnulib installed into gdb/gnulib/ . +%global snapgnulib 20120623 +Version: 7.5.1 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. @@ -30,12 +29,14 @@ License: GPL-3.0+ and GPL-3.0-with-GCC-exception and LGPL-2.1+ and LGPL-3.0+ Group: Development/Tools/Debuggers BuildRoot: %{_tmppath}/%{name}-%{version}-build # Do not provide URL for snapshots as the file lasts there only for 2 days. -# ftp://sourceware.org/pub/gdb/snapshots/current/gdb-%{version}.tar.bz2 -# ftp://sourceware.org/pub/gdb/snapshots/branch/gdb-%{version}.tar.bz2 # ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.bz2 Source: gdb-%{version}.tar.bz2 URL: http://gnu.org/software/gdb/ +%if "%{scl}" == "devtoolset-1.1" +Obsoletes: devtoolset-1.0-%{pkg_name} +%endif + # For our convenience %global gdb_src %{name}-%{version} %global gdb_build build-%{_target_platform} @@ -227,7 +228,7 @@ Patch231: gdb-6.3-bz202689-exec-from-pthread-test.patch # Backported fixups post the source tarball. #Xdrop: Just backports. -Patch232: gdb-upstream.patch +#Patch232: gdb-upstream.patch # Testcase for PPC Power6/DFP instructions disassembly (BZ 230000). #=fedoratest+ppc @@ -365,6 +366,7 @@ Patch360: gdb-6.8-bz457187-largefile-test.patch Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch # Fix GNU/Linux core open: Can't read pathname for load map: Input/output error. +# Fix regression of undisplayed missing shared libraries caused by a fix for. #=push+work: It should be in glibc: libc-alpha: <20091004161706.GA27450@.*> Patch382: gdb-core-open-vdso-warning.patch @@ -431,12 +433,6 @@ Patch496: gdb-bz568248-oom-is-error.patch #=push: There is different patch on gdb-patches, waiting now for resolution in kernel. Patch504: gdb-bz623749-gcore-relro.patch -# Fix lost siginfo_t in linux-nat (BZ 592031). -#=push -Patch510: gdb-bz592031-siginfo-lost-4of5.patch -#=push -Patch511: gdb-bz592031-siginfo-lost-5of5.patch - # Verify GDB Python built-in function gdb.solib_address exists (BZ # 634108). #=fedoratest Patch526: gdb-bz634108-solib_address.patch @@ -469,8 +465,15 @@ Patch579: gdb-7.2.50-sparc-add-workaround-to-broken-debug-files.patch # Fix dlopen of libpthread.so, patched glibc required (Gary Benson, BZ 669432). #=push -Patch618: gdb-dlopen-stap-probe.patch +Patch618: gdb-dlopen-stap-probe-1of7.patch +Patch717: gdb-dlopen-stap-probe-2of7.patch +Patch718: gdb-dlopen-stap-probe-3of7.patch +Patch719: gdb-dlopen-stap-probe-4of7.patch +Patch720: gdb-dlopen-stap-probe-5of7.patch +Patch721: gdb-dlopen-stap-probe-6of7.patch +Patch722: gdb-dlopen-stap-probe-7of7.patch Patch619: gdb-dlopen-stap-probe-test.patch +Patch723: gdb-dlopen-stap-probe-test2.patch # Work around PR libc/13097 "linux-vdso.so.1" warning message. #=push @@ -494,31 +497,60 @@ Patch653: gdb-attach-fail-reasons-5of5.patch #=fedora Patch657: gdb-attach-fail-reasons-5of5configure.patch -# Fix inferior calls, particularly uncaught thrown exceptions (BZ 799531). -#=push+work -Patch654: gdb-x86-onstack-1of2.patch -Patch658: gdb-x86-onstack-2of2.patch - # Workaround crashes from stale frame_info pointer (BZ 804256). -#=push+work +#=fedora Patch661: gdb-stale-frame_info.patch # Workaround PR libc/14166 for inferior calls of strstr. #=push+work: But push it to glibc. Patch690: gdb-glibc-strstr-workaround.patch -# Fix dejagnu-1.5-4.fc17 compatibility for Go (for BZ 635651). +# Include testcase for `Unable to see a variable inside a module (XLF)' (BZ 823789). #=fedoratest -Patch692: gdb-dejagnu-go.patch +#+ppc +Patch698: gdb-rhel5.9-testcase-xlf-var-inside-mod.patch -# Revert recent breakage of UNIX objfiles order for symbols lookup. -Patch693: gdb-objfile-order.patch +# Testcase for `Setting solib-absolute-prefix breaks vDSO' (BZ 818343). +#=fedoratest +Patch703: gdb-rhbz-818343-set-solib-absolute-prefix-testcase.patch -# Disable -lmcheck in the development builds. -Patch694: gdb-disable-mcheck.patch +# Implement MiniDebugInfo F-18 Feature consumer (Alexander Larsson, BZ 834068). +#=fedora +Patch716: gdb-minidebuginfo.patch -# Fix assertion on some files as glibc-2.15.90-8.fc18 (Doug Evans). -Patch695: gdb-index-assert.patch +# Fix crash printing classes (BZ 849357, Tom Tromey). +Patch726: gdb-print-class.patch + +# Permit passing pointers as address number even for C++ methods (Keith Seitz). +Patch728: gdb-check-type.patch + +# entry values: Fix resolving in inlined frames. +Patch729: gdb-entryval-inlined.patch + +# Fix `GDB cannot access struct member whose offset is larger than 256MB' +# (RH BZ 795424). +Patch797: gdb-rhbz795424-bitpos-06of25.patch +Patch798: gdb-rhbz795424-bitpos-07of25.patch +Patch799: gdb-rhbz795424-bitpos-08of25.patch +Patch800: gdb-rhbz795424-bitpos-09of25.patch +Patch801: gdb-rhbz795424-bitpos-10of25.patch +Patch802: gdb-rhbz795424-bitpos-11of25.patch +Patch803: gdb-rhbz795424-bitpos-12of25.patch +Patch804: gdb-rhbz795424-bitpos-13of25.patch +Patch805: gdb-rhbz795424-bitpos-14of25.patch +Patch806: gdb-rhbz795424-bitpos-15of25.patch +Patch807: gdb-rhbz795424-bitpos-16of25.patch +Patch808: gdb-rhbz795424-bitpos-17of25.patch +Patch809: gdb-rhbz795424-bitpos-18of25.patch +Patch810: gdb-rhbz795424-bitpos-19of25.patch +Patch811: gdb-rhbz795424-bitpos-20of25.patch +Patch812: gdb-rhbz795424-bitpos-21of25.patch +Patch813: gdb-rhbz795424-bitpos-22of25.patch +Patch814: gdb-rhbz795424-bitpos-23of25.patch +Patch815: gdb-rhbz795424-bitpos-24of25.patch +Patch816: gdb-rhbz795424-bitpos-25of25.patch +Patch817: gdb-rhbz795424-bitpos-25of25-test.patch +Patch818: gdb-rhbz795424-bitpos-lazyvalue.patch # Upstream patch to fix gcc -Werror Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch @@ -575,6 +607,9 @@ BuildRequires: glibc-devel-32bit %if 0%{suse_version} > 1120 BuildRequires: gcc-c++-32bit %endif +%if 0%{!?rhel:1} || 0%{?rhel} > 6 +BuildRequires: xz +%endif %endif # 0%{?_with_testsuite:1} @@ -609,6 +644,10 @@ License: GFDL-1.3 Group: Documentation/Other PreReq: %{install_info_prereq} +%if "%{scl}" == "devtoolset-1.1" +Obsoletes: devtoolset-1.0-%{pkg_name}-doc +%endif + %description doc GDB, the GNU debugger, allows you to debug programs written in C, C++, Java, and other languages, by executing them in a controlled fashion @@ -627,14 +666,18 @@ tar xjf %{SOURCE5} # Files have `# ' statements breaking VPATH / find-debuginfo.sh . rm -f gdb/ada-exp.c gdb/ada-lex.c gdb/c-exp.c gdb/cp-name-parser.c gdb/f-exp.c -rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c +rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c gdb/go-exp.c + +# *.info* is needlessly split in the distro tar; also it would not get used as +# we build in %{gdb_build}, just to be sure. +find -name "*.info*"|xargs rm -f # Apply patches defined above. # Match the Fedora's version info. %patch2 -p1 -%patch232 -p1 +#patch232 -p1 %patch349 -p1 %patch1 -p1 %patch3 -p1 @@ -723,28 +766,55 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c %patch491 -p1 %patch496 -p1 %patch504 -p1 -%patch510 -p1 -%patch511 -p1 %patch526 -p1 %patch542 -p1 %patch547 -p1 %patch548 -p1 %patch579 -p1 %patch618 -p1 +%patch717 -p1 +%patch718 -p1 +%patch719 -p1 +%patch720 -p1 +%patch721 -p1 +%patch722 -p1 +%patch723 -p1 %patch619 -p1 %patch627 -p1 %patch634 -p1 %patch643 -p1 %patch653 -p1 %patch657 -p1 -%patch654 -p1 -%patch658 -p1 %patch661 -p1 %patch690 -p1 -%patch692 -p1 -%patch693 -p1 -%patch694 -p1 -%patch695 -p1 +%patch698 -p1 +%patch703 -p1 +%patch716 -p1 +%patch726 -p1 +%patch728 -p1 +%patch729 -p1 +%patch797 -p1 +%patch798 -p1 +%patch799 -p1 +%patch800 -p1 +%patch801 -p1 +%patch802 -p1 +%patch803 -p1 +%patch804 -p1 +%patch805 -p1 +%patch806 -p1 +%patch807 -p1 +%patch808 -p1 +%patch809 -p1 +%patch810 -p1 +%patch811 -p1 +%patch812 -p1 +%patch813 -p1 +%patch814 -p1 +%patch815 -p1 +%patch816 -p1 +%patch817 -p1 +%patch818 -p1 %patch1002 -p1 %patch1003 -p1 @@ -767,6 +837,7 @@ rm -f gdb/doc/*.info-* %build +rm -rf %{buildroot} # Identify the build directory with the version of gdb as well as the # architecture, to allow for mutliple versions to be installed and @@ -801,8 +872,12 @@ fi --enable-gdb-build-warnings=,-Wno-unused \ %ifnarch %{ix86} alpha ia64 ppc s390 s390x x86_64 ppc64 sparc sparcv9 sparc64 --disable-werror \ +%else +%if %{suse_version} < 1110 + --disable-werror \ %else --enable-werror \ +%endif %endif --with-separate-debug-dir=/usr/lib/debug \ --disable-sim \ @@ -840,9 +915,6 @@ $(: ppc64 host build crashes on ppc variant of libexpat.so ) \ %else --disable-inprocess-agent \ %endif -$(: %{_bindir}/mono-gdb.py is workaround for mono BZ 815501. ) \ - --with-auto-load-dir='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}' \ - --with-auto-load-safe-path='$debugdir:$datadir/auto-load%{?scl::%{_root_datadir}/gdb/auto-load}:%{_root_bindir}/mono-gdb.py' \ %ifarch sparc sparcv9 sparc-%{_vendor}-%{_target_os}%{?_gnu} %else @@ -887,10 +959,10 @@ else fi # Prepare gdb/config.h first. -make %{?_smp_mflags} CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$FPROFILE_CFLAGS" maybe-configure-gdb +make %{?_smp_mflags} CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" maybe-configure-gdb perl -i.relocatable -pe 's/^(D\[".*_RELOCATABLE"\]=" )1(")$/${1}0$2/' gdb/config.status -make %{?_smp_mflags} CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$FPROFILE_CFLAGS" +make %{?_smp_mflags} CFLAGS="$CFLAGS $FPROFILE_CFLAGS" LDFLAGS="$LDFLAGS $FPROFILE_CFLAGS" ! grep '_RELOCATABLE.*1' gdb/config.h @@ -1208,6 +1280,103 @@ fi %changelog +* Sun Dec 2 2012 Jan Kratochvil - 7.5.1-30.fc18 +- Temporarily disable PDF in gdb-doc before texinfo RH BZ 876710 gets fixed. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-29.fc18 +- Provide Source URL when it is a release. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-28.fc18 +- Fix (unsplit) split info doc. + +* Thu Nov 29 2012 Jan Kratochvil - 7.5.1-27.fc18 +- Rebase to FSF GDB 7.5.1 (7.5 stable branch). + +* Fri Nov 9 2012 Jan Kratochvil - 7.5.0.20120926-26.fc18 +- Fix `GDB cannot access struct member whose offset is larger than 256MB' + (RH BZ 871066). + +* Fri Oct 5 2012 Jan Kratochvil - 7.5.0.20120926-25.fc18 +- entry values: Fix resolving in inlined frames. + +* Thu Sep 27 2012 Jan Kratochvil - 7.5.0.20120926-24.fc18 +- Permit passing pointers as address number even for C++ methods (Keith Seitz). + +* Thu Sep 27 2012 Jan Kratochvil - 7.5.0.20120926-23.fc18 +- Fix crash printing classes (BZ 849357, Tom Tromey). + +* Wed Sep 26 2012 Jan Kratochvil - 7.5.0.20120926-22.fc18 +- Fix .spec 'bundled' Provides for the stable branch rebase. + +* Wed Sep 26 2012 Jan Kratochvil - 7.5.0.20120926-21.fc18 +- [ppc32] Fix stepping over symbol-less code crash regression (BZ 860696). +- Rebase to FSF GDB 7.5.0.20120926 (7.5 stable branch). + - Remove the .spec Source keyword URL as not valid now. + +* Fri Sep 14 2012 Jan Kratochvil - 7.5-20.fc18 +- [RHEL-6] Disable no longer valid workaround of man pages .gz suffix. + +* Sat Aug 18 2012 Jan Kratochvil - 7.5-19.fc18 +- Rebase to FSF GDB 7.5. +- Update dlopen to support two variants of glibc (Gary Benson, BZ 669432). + +* Fri Aug 17 2012 Jan Kratochvil - 7.4.91.20120801-18.fc18 +- Drop Source URL for snapshots. +- Separate %%{snapgnulib} from %%{snap}. +- Fix %%{libstdcxxpython} to be %%{name}-prefixed. +- Fix debug info for go-exp.y and go-exp.c. +- Include RHEL-5 compatible %%{buildroot} cleanup. +- Use %%__global_ldflags. + +* Wed Aug 1 2012 Jan Kratochvil - 7.4.91.20120801-17.fc18 +- Rebase to FSF GDB 7.4.91.20120801. +- [dwz] Rebase it from FSF GDB HEAD. + +* Thu Jul 19 2012 Fedora Release Engineering - 7.4.50.20120714-16.fc18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jul 16 2012 Jan Kratochvil - 7.4.50.20120714-15.fc18 +- [devtoolset] Include Obsoletes of devtoolset-1.0-* by devtoolset-1.1-*. + +* Sun Jul 15 2012 Jan Kratochvil - 7.4.50.20120714-14.fc18 +- Rebase to FSF GDB 7.4.50.20120714. + - Fix entryval feature crash on some .debug files optimized by dwz (BZ 839596). +- Fix another stale frame_info * (PR 11914, like PR 13866). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-13.fc18 +- [RHEL] Disable MiniDebugInfo F-18 feature on RHEL <= 6 (BZ 834068). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-12.fc18 +- Fix .spec metadata for the MiniDebugInfo F-18 feature (BZ 834068). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-11.fc18 +- [archer-tromey-dwz-multifile-rebase] Fix DWARF files reading (Tom Tromey). + +* Fri Jul 6 2012 Jan Kratochvil - 7.4.50.20120703-10.fc18 +- Fix build-id-core-loads internal error (BZ 837870). + +* Thu Jul 5 2012 Jan Kratochvil - 7.4.50.20120703-9.fc18 +- Implement MiniDebugInfo F-18 Feature consumer (Alexander Larsson, BZ 834068). + +* Tue Jul 3 2012 Jan Kratochvil - 7.4.50.20120703-8.fc18 +- Rebase to FSF GDB 7.4.50.20120703. +- [archer-tromey-dwz-multifile-rebase] Merge new branch (Tom Tromey). +- [arm] <--with testsuite>: Disable fpc BuildRequires as it is not yet built. +- Revert function returning pointer fix (PR 9514) regressing Fedora errno patch. + +* Thu Jun 21 2012 Sergio Durigan Junior - 7.4.50.20120603-7.fc18 +- Include testcase for BZ 818343. + +* Tue Jun 19 2012 Jan Kratochvil - 7.4.50.20120603-6.fc18 +- Fix regression of undisplayed missing shared libraries caused by a fix for: + GNU/Linux core open: Can't read pathname for load map: Input/output error. + +* Sun Jun 17 2012 Sergio Durigan Junior - 7.4.50.20120603-5.fc18 +- Include testcase for BZ 823789. + +* Thu Jun 14 2012 Jan Kratochvil - 7.4.50.20120603-4.fc18 +- Support DW_OP_GNU_parameter_ref for -O2 -g inferiors (BZ 827375). + * Wed Jun 6 2012 Jan Kratochvil - 7.4.50.20120603-3.fc18 - Disable -lmcheck in the development builds. - Fix assertion on some files as glibc-2.15.90-8.fc18 (Doug Evans).