From 7760c38a746313f48a5f657fdccffe67c9eb6176 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 23 2015 07:05:26 +0000 Subject: import devtoolset-3-gdb-7.8.2-38.el7 --- diff --git a/.devtoolset-3-gdb.metadata b/.devtoolset-3-gdb.metadata index bd7507e..13eb45b 100644 --- a/.devtoolset-3-gdb.metadata +++ b/.devtoolset-3-gdb.metadata @@ -1,2 +1,2 @@ -4810d78a77064fefc05e701fc0a2193562a23afe SOURCES/gdb-7.8.tar.gz +85a9cc2a4dfb748bc8eb74113af278524126a9bd SOURCES/gdb-7.8.2.tar.xz 0b14aa05bd956d4ea4d01a0fc6a3cc950a5278bc SOURCES/gdb-libstdc++-v3-python-r155978.tar.bz2 diff --git a/.gitignore b/.gitignore index 57a3698..7eaec4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/gdb-7.8.tar.gz +SOURCES/gdb-7.8.2.tar.xz SOURCES/gdb-libstdc++-v3-python-r155978.tar.bz2 diff --git a/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch b/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch index 1c8f99b..7cb307a 100644 --- a/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch +++ b/SOURCES/gdb-6.5-bz185337-resolve-tls-without-debuginfo-v2.patch @@ -22,6 +22,8 @@ for the most common under-ggdb3 compiled programs. Original patch hooked into target_translate_tls_address. But its inferior call invalidates `struct frame *' in the callers - RH BZ 690908. +https://bugzilla.redhat.com/show_bug.cgi?id=1166549 + 2007-11-03 Jan Kratochvil @@ -32,23 +34,25 @@ glibc-debuginfo-2.7-2.x86_64: /usr/lib/debug/lib64/libc.so.6.debug: <81a2> DW_AT_name : (indirect string, offset: 0x280e): __errno_location <81a8> DW_AT_MIPS_linkage_name: (indirect string, offset: 0x2808): *__GI___errno_location -Index: gdb-7.6.50.20130731-cvs/gdb/printcmd.c +Index: gdb-7.8.1/gdb/printcmd.c =================================================================== ---- gdb-7.6.50.20130731-cvs.orig/gdb/printcmd.c 2013-08-02 16:21:13.665758324 +0200 -+++ gdb-7.6.50.20130731-cvs/gdb/printcmd.c 2013-08-02 16:22:24.367853322 +0200 -@@ -982,6 +982,8 @@ print_command_1 (const char *exp, int vo +--- gdb-7.8.1.orig/gdb/printcmd.c 2014-11-21 19:05:44.699959209 +0100 ++++ gdb-7.8.1/gdb/printcmd.c 2014-11-21 19:05:44.868959291 +0100 +@@ -980,6 +980,10 @@ print_command_1 (const char *exp, int vo if (exp && *exp) { -+ if (strcmp (exp, "errno") == 0) -+ exp = "*((int *(*) (void)) __errno_location) ()"; ++ /* '*((int *(*) (void)) __errno_location) ()' is incompatible with ++ function descriptors. */ ++ if (target_has_execution && strcmp (exp, "errno") == 0) ++ exp = "*(*(int *(*)(void)) __errno_location) ()"; expr = parse_expression (exp); make_cleanup (free_current_contents, &expr); val = evaluate_expression (expr); -Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.c +Index: gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2013-08-02 16:21:13.665758324 +0200 ++++ gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno.c 2014-11-21 19:05:44.869959291 +0100 @@ -0,0 +1,28 @@ +/* This testcase is part of GDB, the GNU debugger. + @@ -78,10 +82,10 @@ Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.c + + return 0; /* breakpoint */ +} -Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2013-08-02 16:21:13.665758324 +0200 ++++ gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno.exp 2014-11-21 19:05:44.869959291 +0100 @@ -0,0 +1,60 @@ +# Copyright 2007 Free Software Foundation, Inc. + @@ -143,3 +147,112 @@ Index: gdb-7.6.50.20130731-cvs/gdb/testsuite/gdb.dwarf2/dw2-errno.exp + +# TODO: Test the error on resolving ERRNO with only libc loaded. +# Just how to find the current libc filename? +Index: gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno2.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno2.c 2014-11-21 19:05:44.869959291 +0100 +@@ -0,0 +1,28 @@ ++/* This testcase is part of GDB, the GNU debugger. ++ ++ Copyright 2005, 2007 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 . ++ ++ Please email any bugs, comments, and/or additions to this file to: ++ bug-gdb@prep.ai.mit.edu */ ++ ++#include ++ ++int main() ++{ ++ errno = 42; ++ ++ return 0; /* breakpoint */ ++} +Index: gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.dwarf2/dw2-errno2.exp 2014-11-21 19:13:01.553171326 +0100 +@@ -0,0 +1,71 @@ ++# Copyright 2007 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 dw2-errno2 ++set srcfile ${testfile}.c ++set binfile ${objdir}/${subdir}/${testfile} ++ ++proc prep { message {do_xfail 0} } { with_test_prefix $message { ++ global srcdir subdir binfile variant ++ gdb_exit ++ gdb_start ++ gdb_reinitialize_dir $srcdir/$subdir ++ gdb_load ${binfile}${variant} ++ ++ runto_main ++ ++ gdb_breakpoint [gdb_get_line_number "breakpoint"] ++ gdb_continue_to_breakpoint "breakpoint" ++ ++ gdb_test "gcore ${binfile}${variant}.core" "\r\nSaved corefile .*" "gcore $variant" ++ ++ gdb_test "print errno" ".* = 42" ++ ++ gdb_test "kill" ".*" "kill" {Kill the program being debugged\? \(y or n\) } "y" ++ gdb_test "core-file ${binfile}${variant}.core" "\r\nCore was generated by .*" "core-file" ++ if $do_xfail { ++ setup_xfail "*-*-*" ++ } ++ gdb_test "print errno" ".* = 42" "print errno for core" ++}} ++ ++set variant g2thrN ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++prep "macros=N threads=N" 1 ++ ++set variant g3thrN ++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } { ++ untested "Couldn't compile test program" ++ return -1 ++} ++prep "macros=Y threads=N" 1 ++ ++set variant g2thrY ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g2"] != "" } { ++ return -1 ++} ++prep "macros=N threads=Y" ++ ++set variant g3thrY ++if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}${variant}" executable "additional_flags=-g3"] != "" } { ++ return -1 ++} ++prep "macros=Y threads=Y" 1 ++ ++# TODO: Test the error on resolving ERRNO with only libc loaded. ++# Just how to find the current libc filename? diff --git a/SOURCES/gdb-archer.patch b/SOURCES/gdb-archer.patch index 48f0b8c..d6c8e38 100644 --- a/SOURCES/gdb-archer.patch +++ b/SOURCES/gdb-archer.patch @@ -35,21 +35,21 @@ Index: gdb-7.8/gdb/data-directory/Makefile.in =================================================================== --- gdb-7.8.orig/gdb/data-directory/Makefile.in 2014-07-29 19:29:02.665979655 +0200 +++ gdb-7.8/gdb/data-directory/Makefile.in 2014-07-29 19:29:33.053022486 +0200 -@@ -66,6 +66,8 @@ PYTHON_FILE_LIST = \ +@@ -65,6 +65,8 @@ PYTHON_FILE_LIST = \ + gdb/prompt.py \ gdb/xmethod.py \ - gdb/command/bound_registers.py \ gdb/command/__init__.py \ + gdb/command/ignore_errors.py \ + gdb/command/pahole.py \ gdb/command/xmethods.py \ gdb/command/frame_filters.py \ gdb/command/type_printers.py \ -@@ -73,7 +75,10 @@ PYTHON_FILE_LIST = \ - gdb/command/prompt.py \ - gdb/command/explore.py \ +@@ -74,7 +76,10 @@ PYTHON_FILE_LIST = \ gdb/function/__init__.py \ -- gdb/function/strfns.py -+ gdb/function/strfns.py \ + gdb/function/strfns.py \ + gdb/printer/__init__.py \ +- gdb/printer/bound_registers.py ++ gdb/printer/bound_registers.py \ + gdb/function/caller_is.py \ + gdb/function/in_scope.py \ + gdb/types.py diff --git a/SOURCES/gdb-async-stopped-on-pid-arg-1of2.patch b/SOURCES/gdb-async-stopped-on-pid-arg-1of2.patch deleted file mode 100644 index 5c312e3..0000000 --- a/SOURCES/gdb-async-stopped-on-pid-arg-1of2.patch +++ /dev/null @@ -1,350 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-09/msg00102.html -Subject: Re: Regression: GDB stopped on run with attached process (PR 17347) [Re: [pushed+7.8] Re: [PATCH] Fix "attach" command vs user input race - -On 09/03/2014 08:58 AM, Jan Kratochvil wrote: - -> https://sourceware.org/bugzilla/show_bug.cgi?id=17347 - -Thanks Jan. - -Here's a fix, test included. Comments? - -Thanks, -Pedro Alves - --------------------------- -[PATCH] gdb/17347 - Regression: GDB stopped on run with attached process - -Doing: - - gdb --pid=PID -ex run - -Results in GDB getting a SIGTTIN, and thus ending stopped. That's -usually indicative of a missing target_terminal_ours call. - -E.g., from the PR: - - $ sleep 1h & p=$!; sleep 0.1; gdb -batch sleep $p -ex run - [1] 28263 - [1] Killed sleep 1h - - [2]+ Stopped gdb -batch sleep $p -ex run - -The workaround is doing: - - gdb -ex "attach $PID" -ex "run" - -instead of - - gdb [-p] $PID -ex "run" - -With the former, gdb waits for the attach command to complete before -moving on to the "run" command, because the interpreter is in sync -mode at this point, within execute_command. But for the latter, -attach_command is called directly from captured_main, and thus misses -that waiting. IOW, "run" is running before the attach continuation -has run, before the program stops and attach completes. The broken -terminal settings are just one symptom of that. Any command that -queries or requires input results in the same. - -The fix is to wait in catch_command_errors (which is specific to -main.c nowadays), just like we wait in execute_command. - -gdb/ChangeLog: -2014-09-03 Pedro Alves - - PR gdb/17347 - * main.c: Include "infrun.h". - (catch_command_errors, catch_command_errors_const): Wait for the - foreground command to complete. - * top.c (maybe_wait_sync_command_done): New function, factored out - from ... - (maybe_wait_sync_command_done): ... here. - * top.h (maybe_wait_sync_command_done): New declaration. - -gdb/testsuite/ChangeLog: -2014-09-03 Pedro Alves - - PR gdb/17347 - * gdb.base/attach.exp (spawn_test_prog): New, factored out from - ... - (do_attach_tests, do_call_attach_tests, do_command_attach_tests): - ... here. - (gdb_spawn_with_cmdline_opts): New procedure. - (test_command_line_attach_run): New procedure. - (top level): Call it. ---- - gdb/main.c | 9 +++ - gdb/testsuite/gdb.base/attach.exp | 118 ++++++++++++++++++++++++++------------ - gdb/top.c | 26 +++++---- - gdb/top.h | 8 +++ - 4 files changed, 114 insertions(+), 47 deletions(-) - -Index: gdb-7.8/gdb/main.c -=================================================================== ---- gdb-7.8.orig/gdb/main.c 2014-09-07 19:12:45.066981588 +0200 -+++ gdb-7.8/gdb/main.c 2014-09-07 19:14:22.613095201 +0200 -@@ -47,6 +47,7 @@ - #include "filenames.h" - #include "filestuff.h" - #include "event-top.h" -+#include "infrun.h" - - /* The selected interpreter. This will be used as a set command - variable, so it should always be malloc'ed - since -@@ -350,7 +351,11 @@ catch_command_errors (catch_command_erro - - TRY_CATCH (e, mask) - { -+ int was_sync = sync_execution; -+ - command (arg, from_tty); -+ -+ maybe_wait_sync_command_done (was_sync); - } - return handle_command_errors (e); - } -@@ -369,7 +374,11 @@ catch_command_errors_const (catch_comman - - TRY_CATCH (e, mask) - { -+ int was_sync = sync_execution; -+ - command (arg, from_tty); -+ -+ maybe_wait_sync_command_done (was_sync); - } - return handle_command_errors (e); - } -Index: gdb-7.8/gdb/testsuite/gdb.base/attach.exp -=================================================================== ---- gdb-7.8.orig/gdb/testsuite/gdb.base/attach.exp 2014-09-07 19:12:45.067981589 +0200 -+++ gdb-7.8/gdb/testsuite/gdb.base/attach.exp 2014-09-07 19:12:48.601985706 +0200 -@@ -58,6 +58,37 @@ if [get_compiler_info] { - return -1 - } - -+# Start the program running and then wait for a bit, to be sure that -+# it can be attached to. Return the process's PID. -+ -+proc spawn_test_prog { executable } { -+ set testpid [eval exec $executable &] -+ exec sleep 2 -+ if { [istarget "*-*-cygwin*"] } { -+ # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -+ # different due to the way fork/exec works. -+ set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -+ } -+ -+ return $testpid -+} -+ -+# Spawn GDB with CMDLINE_FLAGS appended to the GDBFLAGS global. -+ -+proc gdb_spawn_with_cmdline_opts { cmdline_flags } { -+ global GDBFLAGS -+ -+ set saved_gdbflags $GDBFLAGS -+ -+ append GDBFLAGS $cmdline_flags -+ -+ set res [gdb_spawn] -+ -+ set GDBFLAGS $saved_gdbflags -+ -+ return $res -+} -+ - proc do_attach_tests {} { - global gdb_prompt - global binfile -@@ -70,13 +101,7 @@ proc do_attach_tests {} { - # Start the program running and then wait for a bit, to be sure - # that it can be attached to. - -- set testpid [eval exec $binfile &] -- exec sleep 2 -- if { [istarget "*-*-cygwin*"] } { -- # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -- # different due to the way fork/exec works. -- set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -- } -+ set testpid [spawn_test_prog $binfile] - - # Verify that we cannot attach to nonsense. - -@@ -279,16 +304,7 @@ proc do_attach_tests {} { - - remote_exec build "kill -9 ${testpid}" - -- # Start the program running and then wait for a bit, to be sure -- # that it can be attached to. -- -- set testpid [eval exec $binfile &] -- exec sleep 2 -- if { [istarget "*-*-cygwin*"] } { -- # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -- # different due to the way fork/exec works. -- set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -- } -+ set testpid [spawn_test_prog $binfile] - - # Verify that we can attach to the process, and find its a.out - # when we're cd'd to some directory that doesn't contain the -@@ -335,16 +351,7 @@ proc do_call_attach_tests {} { - global gdb_prompt - global binfile2 - -- # Start the program running and then wait for a bit, to be sure -- # that it can be attached to. -- -- set testpid [eval exec $binfile2 &] -- exec sleep 2 -- if { [istarget "*-*-cygwin*"] } { -- # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -- # different due to the way fork/exec works. -- set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -- } -+ set testpid [spawn_test_prog $binfile2] - - # Attach - -@@ -397,16 +404,7 @@ proc do_command_attach_tests {} { - return 0 - } - -- # Start the program running and then wait for a bit, to be sure -- # that it can be attached to. -- -- set testpid [eval exec $binfile &] -- exec sleep 2 -- if { [istarget "*-*-cygwin*"] } { -- # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -- # different due to the way fork/exec works. -- set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -- } -+ set testpid [spawn_test_prog $binfile] - - gdb_exit - if $verbose>1 then { -@@ -429,6 +427,50 @@ proc do_command_attach_tests {} { - remote_exec build "kill -9 ${testpid}" - } - -+# Test ' gdb --pid PID -ex "run" '. GDB used to have a bug where -+# "run" would run before the attach finished - PR17347. -+ -+proc test_command_line_attach_run {} { -+ global gdb_prompt -+ global binfile -+ global verbose -+ global GDB -+ global INTERNAL_GDBFLAGS -+ -+ if ![isnative] then { -+ unsupported "commandline attach run test" -+ return 0 -+ } -+ -+ with_test_prefix "cmdline attach run" { -+ set testpid [spawn_test_prog $binfile] -+ -+ set test "run to prompt" -+ gdb_exit -+ set res [gdb_spawn_with_cmdline_opts "--pid=$testpid -ex \"start\""] -+ if { $res != 0} { -+ fail $test -+ return $res -+ } -+ gdb_test_multiple "" $test { -+ -re {Attaching to.*Start it from the beginning\? \(y or n\) } { -+ pass $test -+ } -+ } -+ -+ send_gdb "y\n" -+ -+ set test "run to main" -+ gdb_test_multiple "" $test { -+ -re "Temporary breakpoint .* main .*$gdb_prompt $" { -+ pass $test -+ } -+ } -+ -+ # Get rid of the process -+ remote_exec build "kill -9 ${testpid}" -+ } -+} - - # Start with a fresh gdb - -@@ -453,4 +495,6 @@ do_call_attach_tests - - do_command_attach_tests - -+test_command_line_attach_run -+ - return 0 -Index: gdb-7.8/gdb/top.c -=================================================================== ---- gdb-7.8.orig/gdb/top.c 2014-09-07 19:12:45.067981589 +0200 -+++ gdb-7.8/gdb/top.c 2014-09-07 19:12:48.601985706 +0200 -@@ -375,6 +375,21 @@ check_frame_language_change (void) - } - } - -+void -+maybe_wait_sync_command_done (int was_sync) -+{ -+ /* If the interpreter is in sync mode (we're running a user -+ command's list, running command hooks or similars), and we -+ just ran a synchronous command that started the target, wait -+ for that command to end. */ -+ if (!interpreter_async && !was_sync && sync_execution) -+ { -+ while (gdb_do_one_event () >= 0) -+ if (!sync_execution) -+ break; -+ } -+} -+ - /* Execute the line P as a command, in the current user context. - Pass FROM_TTY as second argument to the defining function. */ - -@@ -461,16 +476,7 @@ execute_command (char *p, int from_tty) - else - cmd_func (c, arg, from_tty); - -- /* If the interpreter is in sync mode (we're running a user -- command's list, running command hooks or similars), and we -- just ran a synchronous command that started the target, wait -- for that command to end. */ -- if (!interpreter_async && !was_sync && sync_execution) -- { -- while (gdb_do_one_event () >= 0) -- if (!sync_execution) -- break; -- } -+ maybe_wait_sync_command_done (was_sync); - - /* If this command has been post-hooked, run the hook last. */ - execute_cmd_post_hook (c); -Index: gdb-7.8/gdb/top.h -=================================================================== ---- gdb-7.8.orig/gdb/top.h 2014-09-07 19:12:45.068981590 +0200 -+++ gdb-7.8/gdb/top.h 2014-09-07 19:12:48.601985706 +0200 -@@ -42,6 +42,14 @@ extern void quit_command (char *, int); - extern void quit_cover (void); - extern void execute_command (char *, int); - -+/* If the interpreter is in sync mode (we're running a user command's -+ list, running command hooks or similars), and we just ran a -+ synchronous command that started the target, wait for that command -+ to end. WAS_SYNC indicates whether sync_execution was set before -+ the command was run. */ -+ -+extern void maybe_wait_sync_command_done (int was_sync); -+ - extern void check_frame_language_change (void); - - /* Prepare for execution of a command. diff --git a/SOURCES/gdb-async-stopped-on-pid-arg-2of2.patch b/SOURCES/gdb-async-stopped-on-pid-arg-2of2.patch deleted file mode 100644 index 6683326..0000000 --- a/SOURCES/gdb-async-stopped-on-pid-arg-2of2.patch +++ /dev/null @@ -1,217 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-09/msg00174.html -Subject: Re: Regression: GDB stopped on run with attached process (PR 17347) [Re: [pushed+7.8] Re: [PATCH] Fix "attach" command vs user input race - - ---a8Wt8u1KmwUX3Y2C -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -On Wed, 03 Sep 2014 22:11:03 +0200, Pedro Alves wrote: -> On 09/03/2014 08:58 AM, Jan Kratochvil wrote: -> -> > https://sourceware.org/bugzilla/show_bug.cgi?id=17347 -> -> Thanks Jan. -> -> Here's a fix, test included. Comments? - -In the testsuite run from the Fedora rpm packaging I get: - -GNU gdb (GDB) Fedora 7.8-21.fc21^M -Copyright (C) 2014 Free Software Foundation, Inc.^M -License GPLv3+: GNU GPL version 3 or later ^M -This is free software: you are free to change and redistribute it.^M -There is NO WARRANTY, to the extent permitted by law. Type "show copying"^M -and "show warranty" for details.^M -This GDB was configured as "i686-redhat-linux-gnu".^M -Type "show configuration" for configuration details.^M -For bug reporting instructions, please see:^M -.^M -Find the GDB manual and other documentation resources online at:^M -.^M -For help, type "help".^M -Type "apropos word" to search for commands related to "word".^M -Attaching to process 27028^M -Reading symbols from /unsafebuild-i686-redhat-linux-gnu/gdb/testsuite.unix.-m32/outputs/gdb.base/attach/attach...done.^M -Reading symbols from /lib/libm.so.6...Reading symbols from /usr/lib/debug/usr/lib/libm-2.19.90.so.debug...done.^M -done.^M -Loaded symbols for /lib/libm.so.6^M -Reading symbols from /lib/libc.so.6...Reading symbols from /usr/lib/debug/usr/lib/libc-2.19.90.so.debug...done.^M -done.^M -Loaded symbols for /lib/libc.so.6^M -Reading symbols from /lib/ld-linux.so.2...Reading symbols from /usr/lib/debug/usr/lib/ld-2.19.90.so.debug...done.^M -done.^M -Loaded symbols for /lib/ld-linux.so.2^M -main ()^M - at gdb/testsuite/gdb.base/attach.c:15^M -15 while (! should_exit)^M -The program being debugged has been started already.^M -Start it from the beginning? (y or n) PASS: gdb.base/attach.exp: cmdline attach run: run to prompt -y^M -^M -Temporary breakpoint 1 at 0x8048481: file gdb/testsuite/gdb.base/attach.c, line 13.^M -Starting program: /unsafe/home/jkratoch/hammock/20140907fedorarel21-f21/fedora-2---Type to continue, or q to quit---ERROR: Window too small. -UNRESOLVED: gdb.base/attach.exp: cmdline attach run: run to main - - -While I do not fully understand why that happens in every run of that Fedora -testsuite while it never happens during my reproducibility attempts by hand -I find it understandable and the Fedora testsuite issues does get fixed by the -attached patch. - - -> --- a/gdb/testsuite/gdb.base/attach.exp -> +++ b/gdb/testsuite/gdb.base/attach.exp -> @@ -58,6 +58,37 @@ if [get_compiler_info] { -> return -1 -> } -> -> +# Start the program running and then wait for a bit, to be sure that -> +# it can be attached to. Return the process's PID. -> + -> +proc spawn_test_prog { executable } { -> + set testpid [eval exec $executable &] -> + exec sleep 2 - -Unrelated to this patch - this patch only moved the code. Also the code move -could be a separate patch: - -I do not see why the testsuite commonly uses "exec sleep" while it also uses -"sleep" itself which also works fine. - - -> + if { [istarget "*-*-cygwin*"] } { -> + # testpid is the Cygwin PID, GDB uses the Windows PID, which might be -> + # different due to the way fork/exec works. -> + set testpid [ exec ps -e | gawk "{ if (\$1 == $testpid) print \$4; }" ] -> + } -> + -> + return $testpid -> +} -[...] -> @@ -429,6 +427,50 @@ proc do_command_attach_tests {} { -> remote_exec build "kill -9 ${testpid}" -> } -> -> +# Test ' gdb --pid PID -ex "run" '. GDB used to have a bug where -> +# "run" would run before the attach finished - PR17347. -> + -> +proc test_command_line_attach_run {} { -> + global gdb_prompt -> + global binfile - -> + global verbose -> + global GDB -> + global INTERNAL_GDBFLAGS - -These 3 lines are unused. - - -> + -> + if ![isnative] then { -> + unsupported "commandline attach run test" -> + return 0 -> + } -> + -> + with_test_prefix "cmdline attach run" { -> + set testpid [spawn_test_prog $binfile] -> + -> + set test "run to prompt" -> + gdb_exit -> + set res [gdb_spawn_with_cmdline_opts "--pid=$testpid -ex \"start\""] - -Here see the attachment. - - -> + if { $res != 0} { -> + fail $test -> + return $res -> + } -> + gdb_test_multiple "" $test { -> + -re {Attaching to.*Start it from the beginning\? \(y or n\) } { -> + pass $test -> + } -> + } -> + -> + send_gdb "y\n" -> + -> + set test "run to main" -> + gdb_test_multiple "" $test { -> + -re "Temporary breakpoint .* main .*$gdb_prompt $" { -> + pass $test -> + } -> + } -> + -> + # Get rid of the process -> + remote_exec build "kill -9 ${testpid}" -> + } -> +} -> -> # Start with a fresh gdb -> -> @@ -453,4 +495,6 @@ do_call_attach_tests -> -> do_command_attach_tests -> -> +test_command_line_attach_run -> + -> return 0 -> diff --git a/gdb/top.c b/gdb/top.c -> index fc2b84d..ba71f8f 100644 -> --- a/gdb/top.c -> +++ b/gdb/top.c -> @@ -373,6 +373,21 @@ check_frame_language_change (void) -> } -> } -> - -Missing: -/* See top.h. */ - -Unless that rule from me has been abandoned. - - -> +void -> +maybe_wait_sync_command_done (int was_sync) -> +{ -> + /* If the interpreter is in sync mode (we're running a user -> + command's list, running command hooks or similars), and we -> + just ran a synchronous command that started the target, wait -> + for that command to end. */ -> + if (!interpreter_async && !was_sync && sync_execution) -> + { -> + while (gdb_do_one_event () >= 0) -> + if (!sync_execution) -> + break; -> + } -> +} -> + -> /* Execute the line P as a command, in the current user context. -> Pass FROM_TTY as second argument to the defining function. */ -> - - -Thanks, -Jan - ---a8Wt8u1KmwUX3Y2C -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename=1 - -diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp -index c94c127..6e566a3 100644 ---- a/gdb/testsuite/gdb.base/attach.exp -+++ b/gdb/testsuite/gdb.base/attach.exp -@@ -447,7 +444,8 @@ proc test_command_line_attach_run {} { - - set test "run to prompt" - gdb_exit -- set res [gdb_spawn_with_cmdline_opts "--pid=$testpid -ex \"start\""] -+ set res [gdb_spawn_with_cmdline_opts \ -+ "-iex set\\ height\\ 0 -iex set\\ width\\ 0 --pid=$testpid -ex \"start\""] - if { $res != 0} { - fail $test - return $res - ---a8Wt8u1KmwUX3Y2C-- - diff --git a/SOURCES/gdb-async-stopped-on-pid-arg-testsuite.patch b/SOURCES/gdb-async-stopped-on-pid-arg-testsuite.patch new file mode 100644 index 0000000..d516695 --- /dev/null +++ b/SOURCES/gdb-async-stopped-on-pid-arg-testsuite.patch @@ -0,0 +1,86 @@ +http://sourceware.org/ml/gdb-patches/2014-09/msg00381.html +Subject: [testsuite patch] runaway attach processes [Re: Regression: GDB stopped on run with attached process (PR 17347)] + + +--RnlQjJ0d97Da+TV1 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +On Thu, 11 Sep 2014 14:35:53 +0200, Pedro Alves wrote: +> Thanks, pushed to both master and 7.8. + +I have started seeing occasional runaway 'attach' processes these days. +I cannot be certain it is really caused by this patch, for example +grep 'FAIL.*cmdline attach run' does not show anything in my logs. + +But as I remember this 'attach' runaway process always happened in GDB (but +I do not remember it in the past months) I think it would be most safe to just +solve it forever by [attached]. + + +Jan + +--RnlQjJ0d97Da+TV1 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline; filename=1 + +gdb/testsuite/ +2014-09-12 Jan Kratochvil + + * gdb.base/attach.c: Include unistd.h. + (main): Call alarm. Add label postloop. + * gdb.base/attach.exp (do_attach_tests): Use gdb_get_line_number, + gdb_breakpoint, gdb_continue_to_breakpoint. + (test_command_line_attach_run): Kill ${testpid} in one exit path. + +Index: gdb-7.8.1/gdb/testsuite/gdb.base/attach.c +=================================================================== +--- gdb-7.8.1.orig/gdb/testsuite/gdb.base/attach.c 2014-10-30 20:23:01.311595725 +0100 ++++ gdb-7.8.1/gdb/testsuite/gdb.base/attach.c 2014-10-30 20:23:38.653574999 +0100 +@@ -5,6 +5,7 @@ + exit unless/until gdb sets the variable to non-zero.) + */ + #include ++#include + + int should_exit = 0; + +@@ -12,9 +13,11 @@ int main () + { + int local_i = 0; + ++ alarm (60); ++ + while (! should_exit) + { + local_i++; + } +- return 0; ++ return 0; /* postloop */ + } +Index: gdb-7.8.1/gdb/testsuite/gdb.base/attach.exp +=================================================================== +--- gdb-7.8.1.orig/gdb/testsuite/gdb.base/attach.exp 2014-10-30 20:23:01.311595725 +0100 ++++ gdb-7.8.1/gdb/testsuite/gdb.base/attach.exp 2014-10-30 20:23:54.151562867 +0100 +@@ -256,11 +256,8 @@ proc do_attach_tests {} { + + # Verify that the modification really happened. + +- gdb_test "tbreak 19" "Temporary breakpoint .*at.*$srcfile, line 19.*" \ +- "after attach2, set tbreak postloop" +- +- gdb_test "continue" "main.*at.*$srcfile:19.*" \ +- "after attach2, reach tbreak postloop" ++ gdb_breakpoint [gdb_get_line_number "postloop"] temporary ++ gdb_continue_to_breakpoint "postloop" ".* postloop .*" + + # Allow the test process to exit, to cleanup after ourselves. + +@@ -418,6 +415,7 @@ proc test_command_line_attach_run {} { + "-iex \"set height 0\" -iex \"set width 0\" --pid=$testpid -ex \"start\""] + if { $res != 0} { + fail $test ++ remote_exec build "kill -9 ${testpid}" + return $res + } + gdb_test_multiple "" $test { diff --git a/SOURCES/gdb-attach-fail-reasons-5of5.patch b/SOURCES/gdb-attach-fail-reasons-5of5.patch index 1bb028b..75a7a5f 100644 --- a/SOURCES/gdb-attach-fail-reasons-5of5.patch +++ b/SOURCES/gdb-attach-fail-reasons-5of5.patch @@ -37,10 +37,10 @@ gdb/gdbserver/ (linux_create_inferior, linux_tracefork_child): Call it instead of direct ptrace. -Index: gdb-7.8/gdb/common/linux-ptrace.c +Index: gdb-7.8.1/gdb/common/linux-ptrace.c =================================================================== ---- gdb-7.8.orig/gdb/common/linux-ptrace.c 2014-07-29 19:31:01.893149317 +0200 -+++ gdb-7.8/gdb/common/linux-ptrace.c 2014-07-29 19:31:05.806154887 +0200 +--- gdb-7.8.1.orig/gdb/common/linux-ptrace.c 2014-10-30 18:33:37.271097644 +0100 ++++ gdb-7.8.1/gdb/common/linux-ptrace.c 2014-10-30 18:33:39.641092763 +0100 @@ -32,6 +32,10 @@ #include @@ -81,10 +81,10 @@ Index: gdb-7.8/gdb/common/linux-ptrace.c + "(gdb) shell sudo setsebool deny_ptrace=0")); +#endif /* HAVE_LIBSELINUX */ +} -Index: gdb-7.8/gdb/common/linux-ptrace.h +Index: gdb-7.8.1/gdb/common/linux-ptrace.h =================================================================== ---- gdb-7.8.orig/gdb/common/linux-ptrace.h 2014-07-29 19:31:01.893149317 +0200 -+++ gdb-7.8/gdb/common/linux-ptrace.h 2014-07-29 19:31:05.807154887 +0200 +--- gdb-7.8.1.orig/gdb/common/linux-ptrace.h 2014-10-30 18:33:37.271097644 +0100 ++++ gdb-7.8.1/gdb/common/linux-ptrace.h 2014-10-30 18:33:39.642092761 +0100 @@ -85,6 +85,7 @@ struct buffer; extern void linux_ptrace_attach_fail_reason (pid_t pid, struct buffer *buffer); @@ -93,11 +93,11 @@ Index: gdb-7.8/gdb/common/linux-ptrace.h extern void linux_enable_event_reporting (pid_t pid); extern void linux_disable_event_reporting (pid_t pid); extern int linux_supports_tracefork (void); -Index: gdb-7.8/gdb/configure.ac +Index: gdb-7.8.1/gdb/configure.ac =================================================================== ---- gdb-7.8.orig/gdb/configure.ac 2014-07-29 19:31:01.894149319 +0200 -+++ gdb-7.8/gdb/configure.ac 2014-07-29 19:31:05.807154887 +0200 -@@ -2158,6 +2158,10 @@ case $host_os in +--- gdb-7.8.1.orig/gdb/configure.ac 2014-10-30 18:33:37.272097642 +0100 ++++ gdb-7.8.1/gdb/configure.ac 2014-10-30 18:33:39.643092759 +0100 +@@ -2161,6 +2161,10 @@ case $host_os in esac AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.]) @@ -108,10 +108,10 @@ Index: gdb-7.8/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.8/gdb/gdbserver/configure.ac +Index: gdb-7.8.1/gdb/gdbserver/configure.ac =================================================================== ---- gdb-7.8.orig/gdb/gdbserver/configure.ac 2014-07-29 19:31:01.895149320 +0200 -+++ gdb-7.8/gdb/gdbserver/configure.ac 2014-07-29 19:31:05.808154887 +0200 +--- gdb-7.8.1.orig/gdb/gdbserver/configure.ac 2014-10-30 18:33:37.273097640 +0100 ++++ gdb-7.8.1/gdb/gdbserver/configure.ac 2014-10-30 18:33:39.643092759 +0100 @@ -454,6 +454,10 @@ if $want_ipa ; then fi fi @@ -123,10 +123,10 @@ Index: gdb-7.8/gdb/gdbserver/configure.ac AC_SUBST(GDBSERVER_DEPFILES) AC_SUBST(GDBSERVER_LIBS) AC_SUBST(srv_xmlbuiltin) -Index: gdb-7.8/gdb/gdbserver/linux-low.c +Index: gdb-7.8.1/gdb/gdbserver/linux-low.c =================================================================== ---- gdb-7.8.orig/gdb/gdbserver/linux-low.c 2014-07-29 19:31:01.897149323 +0200 -+++ gdb-7.8/gdb/gdbserver/linux-low.c 2014-07-29 19:31:05.809154889 +0200 +--- gdb-7.8.1.orig/gdb/gdbserver/linux-low.c 2014-10-30 18:33:37.275097636 +0100 ++++ gdb-7.8.1/gdb/gdbserver/linux-low.c 2014-10-30 18:33:39.644092757 +0100 @@ -541,6 +541,29 @@ add_lwp (ptid_t ptid) return lwp; } @@ -166,10 +166,10 @@ Index: gdb-7.8/gdb/gdbserver/linux-low.c #ifndef __ANDROID__ /* Bionic doesn't use SIGRTMIN the way glibc does. */ signal (__SIGRTMIN + 1, SIG_DFL); -Index: gdb-7.8/gdb/inf-ptrace.c +Index: gdb-7.8.1/gdb/inf-ptrace.c =================================================================== ---- gdb-7.8.orig/gdb/inf-ptrace.c 2014-07-29 19:31:01.898149324 +0200 -+++ gdb-7.8/gdb/inf-ptrace.c 2014-07-29 19:31:05.809154889 +0200 +--- gdb-7.8.1.orig/gdb/inf-ptrace.c 2014-10-30 18:33:37.276097634 +0100 ++++ gdb-7.8.1/gdb/inf-ptrace.c 2014-10-30 18:33:39.645092755 +0100 @@ -105,7 +105,15 @@ static void inf_ptrace_me (void) { @@ -186,10 +186,10 @@ Index: gdb-7.8/gdb/inf-ptrace.c } /* Start a new inferior Unix child process. EXEC_FILE is the file to -Index: gdb-7.8/gdb/linux-nat.c +Index: gdb-7.8.1/gdb/linux-nat.c =================================================================== ---- gdb-7.8.orig/gdb/linux-nat.c 2014-07-29 19:31:01.899149326 +0200 -+++ gdb-7.8/gdb/linux-nat.c 2014-07-29 19:31:05.811154893 +0200 +--- gdb-7.8.1.orig/gdb/linux-nat.c 2014-10-30 18:33:37.277097631 +0100 ++++ gdb-7.8.1/gdb/linux-nat.c 2014-10-30 18:33:39.646092753 +0100 @@ -1291,6 +1291,7 @@ linux_nat_create_inferior (struct target #ifdef HAVE_PERSONALITY int personality_orig = 0, personality_set = 0; @@ -235,11 +235,11 @@ Index: gdb-7.8/gdb/linux-nat.c } static void -Index: gdb-7.8/gdb/config.in +Index: gdb-7.8.1/gdb/config.in =================================================================== ---- gdb-7.8.orig/gdb/config.in 2014-07-29 19:31:01.900149327 +0200 -+++ gdb-7.8/gdb/config.in 2014-07-29 19:31:44.600210090 +0200 -@@ -219,6 +219,9 @@ +--- gdb-7.8.1.orig/gdb/config.in 2014-10-30 18:33:37.278097630 +0100 ++++ gdb-7.8.1/gdb/config.in 2014-10-30 18:34:36.165976366 +0100 +@@ -216,6 +216,9 @@ /* Define if librpm library is being used. */ #undef HAVE_LIBRPM @@ -249,21 +249,21 @@ Index: gdb-7.8/gdb/config.in /* Define to 1 if you have the header file. */ #undef HAVE_LIBUNWIND_IA64_H -@@ -354,6 +357,9 @@ +@@ -351,6 +354,9 @@ /* Define to 1 if you have the `scm_new_smob' function. */ #undef HAVE_SCM_NEW_SMOB +/* Define to 1 if you have the header file. */ +#undef HAVE_SELINUX_SELINUX_H + - /* Define to 1 if you have the `setenv' function. */ - #undef HAVE_SETENV + /* Define to 1 if you have the `setlocale' function. */ + #undef HAVE_SETLOCALE -Index: gdb-7.8/gdb/configure +Index: gdb-7.8.1/gdb/configure =================================================================== ---- gdb-7.8.orig/gdb/configure 2014-07-29 19:31:01.903149331 +0200 -+++ gdb-7.8/gdb/configure 2014-07-29 19:31:05.815154898 +0200 -@@ -13392,6 +13392,64 @@ cat >>confdefs.h <<_ACEOF +--- gdb-7.8.1.orig/gdb/configure 2014-10-30 18:33:37.281097623 +0100 ++++ gdb-7.8.1/gdb/configure 2014-10-30 18:33:39.649092747 +0100 +@@ -13400,6 +13400,64 @@ cat >>confdefs.h <<_ACEOF _ACEOF @@ -328,10 +328,10 @@ Index: gdb-7.8/gdb/configure # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR, # except that the argument to --with-sysroot is optional. -Index: gdb-7.8/gdb/gdbserver/config.in +Index: gdb-7.8.1/gdb/gdbserver/config.in =================================================================== ---- gdb-7.8.orig/gdb/gdbserver/config.in 2014-07-29 19:31:01.904149333 +0200 -+++ gdb-7.8/gdb/gdbserver/config.in 2014-07-29 19:31:05.815154898 +0200 +--- gdb-7.8.1.orig/gdb/gdbserver/config.in 2014-10-30 18:33:37.282097621 +0100 ++++ gdb-7.8.1/gdb/gdbserver/config.in 2014-10-30 18:33:39.649092747 +0100 @@ -81,6 +81,9 @@ /* Define to 1 if you have the `mcheck' library (-lmcheck). */ #undef HAVE_LIBMCHECK @@ -352,10 +352,10 @@ Index: gdb-7.8/gdb/gdbserver/config.in /* Define to 1 if you have the header file. */ #undef HAVE_SGTTY_H -Index: gdb-7.8/gdb/gdbserver/configure +Index: gdb-7.8.1/gdb/gdbserver/configure =================================================================== ---- gdb-7.8.orig/gdb/gdbserver/configure 2014-07-29 19:31:01.905149334 +0200 -+++ gdb-7.8/gdb/gdbserver/configure 2014-07-29 19:31:05.817154901 +0200 +--- gdb-7.8.1.orig/gdb/gdbserver/configure 2014-10-30 18:33:37.283097619 +0100 ++++ gdb-7.8.1/gdb/gdbserver/configure 2014-10-30 18:33:39.650092745 +0100 @@ -6170,6 +6170,64 @@ if $want_ipa ; then fi fi diff --git a/SOURCES/gdb-babeltrace-configure.patch b/SOURCES/gdb-babeltrace-configure.patch deleted file mode 100644 index 3ac029d..0000000 --- a/SOURCES/gdb-babeltrace-configure.patch +++ /dev/null @@ -1,85 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-08/msg00045.html -Subject: [patch] Fix --with-babeltrace with gcc-4.9.1 - - ---qMm9M+Fa2AknHoGS -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -Hi, - -when I tried to use --with-babeltrace on Fedora Rawhide x86_64 -using gcc-4.9.1-3.fc22.x86_64 I got: - -checking for libbabeltrace... no -configure: error: babeltrace is missing or unusable -Makefile:7973: recipe for target 'configure-gdb' failed - -configure:15890: checking for libbabeltrace -configure:15918: gcc -o conftest -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Werror -static-libstdc++ -static-libgcc -Wl,-z,relro conftest.c -lselinux -lncurses -lz -lm -ldl /usr/lib64/libbabeltrace.so /usr/lib64/libbabeltrace-ctf.so >&5 -conftest.c: In function 'main': -conftest.c:198:21: error: unused variable 'pos' [-Werror=unused-variable] - struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL)); - ^ -cc1: all warnings being treated as errors -configure:15918: $? = 1 -configure: failed program was: - -The patch below fixes it for me. - -In configure.ac there is above this check: - # Append -Werror to CFLAGS so that configure can catch the warning - # "assignment from incompatible pointer type", which is related to - # the babeltrace change from 1.0.3 to 1.1.0. Babeltrace 1.1.0 works - # in GDB, while babeltrace 1.0.3 is broken. - # AC_LIB_HAVE_LINKFLAGS may modify CPPFLAGS in it, so it should be - # safe to save and restore CFLAGS here. - saved_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS -Werror" - -Maybe it would be easier to use there: - CFLAGS="$CFLAGS -Werror -Wno-unused-variable" - -But maybe -Werror is cross-compiler compatible while -Wno-unused-variable is -not, I have no idea. - - -Jan - ---qMm9M+Fa2AknHoGS -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename="gdb-babeltrace-configure.patch" - -gdb/ -2014-08-04 Jan Kratochvil - - * configure.ac (--with-babeltrace): Use 'pos'. - * configure: Regenerate. - -diff --git a/gdb/configure.ac b/gdb/configure.ac -index 70d0964..07d2f00 100644 ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -2437,6 +2437,7 @@ else - struct bt_ctf_event *event = NULL; - const struct bt_definition *scope; - -+ (void) pos; /* Prevent -Werror=unused-variable. */ - scope = bt_ctf_get_top_level_scope (event, - BT_STREAM_EVENT_HEADER); - bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id")); -diff --git a/gdb/configure b/gdb/configure -index 809326a..b983d16 100755 ---- a/gdb/configure -+++ b/gdb/configure -@@ -15344,6 +15344,7 @@ struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL)); - struct bt_ctf_event *event = NULL; - const struct bt_definition *scope; - -+ (void) pos; /* Prevent -Werror=unused-variable. */ - scope = bt_ctf_get_top_level_scope (event, - BT_STREAM_EVENT_HEADER); - bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id")); - ---qMm9M+Fa2AknHoGS-- - diff --git a/SOURCES/gdb-babeltrace-minsize.patch b/SOURCES/gdb-babeltrace-minsize.patch deleted file mode 100644 index d261277..0000000 --- a/SOURCES/gdb-babeltrace-minsize.patch +++ /dev/null @@ -1,237 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-08/msg00376.html -Subject: Re: --with-babeltrace generates many FAILs - -On 08/19/2014 10:07 PM, Jan Kratochvil wrote: -> * '#if HAVE_LIBBABELTRACE1_1_0' could have a comment that >=1.1.1 rejects the -> faked packet (what you described in the mail but not in the patch). - -Fixed. To be precise, >= 1.1.2 rejects the faked packet, 1.1.1 -doesn't. See the table I posted. - -> * It is always better to check for feature/defect than to check for version. -> For example because various distros backport various fixes (unfortunately -> including their possible regressions/defects) and so version checks may be -> misleading then. At least in this case it seems to me as possible to check -> how libbacktrace behaves from configure; although maybe it is not easy -> enough, not sure. - -In order to check libbabeltrace's behaviour in configure, we have to write -a c program to generate CTF data and read the trace data via -babeltrace or any program (using libbabeltrace) written by ourselves. -It is not easy to do so. - -The patch is updated. OK to apply? - --- -Yao (齐尧) - -Subject: [PATCH] Check babeltrace 1.1.0 -Subject: [PATCH] Check babeltrace 1.1.0 - -When GDB uses recent version of babeltrace, such as 1.2.x, we'll see -such error emitted from babeltrace library, - - (gdb) target ctf .../gdb/testsuite/gdb.trace/actions.ctf - [error] Invalid CTF stream: content size is smaller than -packet headers. - [error] Stream index creation error. - [error] Open file stream error. - -The problem can be reproduce out of GDB too, using babeltrace, - - $ babeltrace ./fake-packet.ctf/ - [error] Invalid CTF stream: content size is smaller than packet headers. - [error] Stream index creation error. - [error] Open file stream error. - -Recent babeltrace library becomes more strict on CTF, and complains -about one "faked packet" GDB adds, when saving trace data in ctf -format from GDB. babeltrace 1.1.0 has a bug that it can't read trace -data smaller than a certain size (see https://bugs.lttng.org/issues/450). -We workaround it in GDB to append some meaningless data in a faked -packet to make sure trace file is large enough (see ctf.c:ctf_end). -The babeltrace issue was fixed in 1.1.1 release. However, babeltrace -recent release (since 1.1.2) starts to complain about such faked -packet. Here is a table shows that whether faked packet or no faked -packet is supported by various babeltrace releases, - - faked packet no faked packet -1.1.0 Yes No -1.1.1 Yes Yes -1.1.2 No Yes -1.2.0 No Yes - -We decide to include the code to workaround 1.1.0 issue only if 1.1.0 -is used. We choose pkg-config to check babeltrace's version in -configure. - -gdb: - -2014-08-20 Yao Qi - - * configure.ac: Disable babeltrace support if pkg-config is - missing. Use pkg-config to check whether libbabeltrace is - 1.1.0. - * config.in: Regenerate. - * configure: Regenerate. - * ctf.c (CTF_FILE_MIN_SIZE): Remove. - (ctf_end): Wrap the code with - #if HAVE_LIBBABELTRACE1_1_0 #endif. - [HAVE_LIBBABELTRACE1_1_0] (CTF_FILE_MIN_SIZE): New macro. ---- - gdb/config.in | 3 +++ - gdb/configure | 25 +++++++++++++++++++++++++ - gdb/configure.ac | 22 ++++++++++++++++++++++ - gdb/ctf.c | 25 ++++++++++++++++--------- - 4 files changed, 66 insertions(+), 9 deletions(-) - -diff --git a/gdb/config.in b/gdb/config.in -index b853412..54152cd 100644 ---- a/gdb/config.in -+++ b/gdb/config.in -@@ -183,6 +183,9 @@ - /* Define if you have the babeltrace library. */ - #undef HAVE_LIBBABELTRACE - -+/* Define to 1 if you have libbabeltrace 1.1.0 */ -+#undef HAVE_LIBBABELTRACE1_1_0 -+ - /* Define to 1 if you have the `dl' library (-ldl). */ - #undef HAVE_LIBDL - -diff --git a/gdb/configure b/gdb/configure -index 9253e28..d4e2c6e 100755 ---- a/gdb/configure -+++ b/gdb/configure -@@ -14817,6 +14817,11 @@ $as_echo "$with_babeltrace" >&6; } - if test "x$with_babeltrace" = "xno"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: babletrace support disabled; GDB is unable to read CTF data." >&5 - $as_echo "$as_me: WARNING: babletrace support disabled; GDB is unable to read CTF data." >&2;} -+elif test "${pkg_config_prog_path}" = "missing"; then -+ # pkg-config is used to check the version of libbabeltrace. If pkg-config -+ # is missing, we have to disable babeltrace support. -+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config not found, babletrace support disabled" >&5 -+$as_echo "$as_me: WARNING: pkg-config not found, babletrace support disabled" >&2;} - else - # Append -Werror to CFLAGS so that configure can catch the warning - # "assignment from incompatible pointer type", which is related to -@@ -15307,6 +15312,26 @@ $as_echo "$LIBBABELTRACE" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: babeltrace is missing or unusable; GDB is unable to read CTF data." >&5 - $as_echo "$as_me: WARNING: babeltrace is missing or unusable; GDB is unable to read CTF data." >&2;} - fi -+ else -+ # Need to know whether libbabeltrace is 1.1.0. -+ pkg_config_path= -+ for x in $LTLIBBABELTRACE; do -+ case "$x" in -+ -L*) -+ dir=`echo "X$x" | sed -e 's/^X-L//'` -+ if test -d "$dir/pkgconfig"; then -+ pkg_config_path="${pkg_config_path}${pkg_config_path:+:}$dir/pkgconfig" -+ fi -+ ;; -+ esac -+ done -+ -+ `PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$pkg_config_path ${pkg_config_prog_path} babeltrace = 1.1.0` -+ if test "$?" -eq 0 ; then -+ -+$as_echo "#define HAVE_LIBBABELTRACE1_1_0 1" >>confdefs.h -+ -+ fi - fi - fi - -diff --git a/gdb/configure.ac b/gdb/configure.ac -index 61919b4..1d8d400 100644 ---- a/gdb/configure.ac -+++ b/gdb/configure.ac -@@ -2420,6 +2420,10 @@ AC_MSG_RESULT([$with_babeltrace]) - - if test "x$with_babeltrace" = "xno"; then - AC_MSG_WARN([babletrace support disabled; GDB is unable to read CTF data.]) -+elif test "${pkg_config_prog_path}" = "missing"; then -+ # pkg-config is used to check the version of libbabeltrace. If pkg-config -+ # is missing, we have to disable babeltrace support. -+ AC_MSG_WARN([pkg-config not found, babletrace support disabled]) - else - # Append -Werror to CFLAGS so that configure can catch the warning - # "assignment from incompatible pointer type", which is related to -@@ -2450,6 +2454,24 @@ else - else - AC_MSG_WARN([babeltrace is missing or unusable; GDB is unable to read CTF data.]) - fi -+ else -+ # Need to know whether libbabeltrace is 1.1.0. -+ pkg_config_path= -+ for x in $LTLIBBABELTRACE; do -+ case "$x" in -+ -L*) -+ dir=`echo "X$x" | sed -e 's/^X-L//'` -+ if test -d "$dir/pkgconfig"; then -+ pkg_config_path="${pkg_config_path}${pkg_config_path:+:}$dir/pkgconfig" -+ fi -+ ;; -+ esac -+ done -+ -+ `PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$pkg_config_path ${pkg_config_prog_path} babeltrace = 1.1.0` -+ if test "$?" -eq 0 ; then -+ AC_DEFINE([HAVE_LIBBABELTRACE1_1_0], [1], [Define to 1 if you have libbabeltrace 1.1.0]) -+ fi - fi - fi - -diff --git a/gdb/ctf.c b/gdb/ctf.c -index df645c0..684da50 100644 ---- a/gdb/ctf.c -+++ b/gdb/ctf.c -@@ -623,11 +623,6 @@ ctf_write_definition_end (struct trace_file_writer *self) - self->ops->frame_ops->end (self); - } - --/* The minimal file size of data stream. It is required by -- babeltrace. */ -- --#define CTF_FILE_MIN_SIZE 4096 -- - /* This is the implementation of trace_file_write_ops method - end. */ - -@@ -637,10 +632,21 @@ ctf_end (struct trace_file_writer *self) - struct ctf_trace_file_writer *writer = (struct ctf_trace_file_writer *) self; - - gdb_assert (writer->tcs.content_size == 0); -- /* The babeltrace requires or assumes that the size of datastream -- file is greater than 4096 bytes. If we don't generate enough -- packets and events, create a fake packet which has zero event, -- to use up the space. */ -+ -+#if HAVE_LIBBABELTRACE1_1_0 -+ /* The babeltrace-1.1.0 requires or assumes that the size of datastream -+ file is greater than 4096 bytes. This was fixed after 1.1.0 release. -+ See https://bugs.lttng.org/issues/450 -+ If we don't generate enough packets and events, create a fake packet -+ which has zero event, to use up the space. However, babeltrace -+ release (since 1.1.2) starts to complain about such faked packet, -+ we include this workaround only for babeltrace 1.1.0. */ -+ -+ /* The minimal file size of data stream. It is required by -+ babeltrace. */ -+ -+#define CTF_FILE_MIN_SIZE 4096 -+ - if (writer->tcs.packet_start < CTF_FILE_MIN_SIZE) - { - uint32_t u32; -@@ -681,6 +687,7 @@ ctf_end (struct trace_file_writer *self) - ctf_save_write (&writer->tcs, &b, 1); - } - } -+#endif /* HAVE_LIBBABELTRACE1_1_0 */ - } - - /* This is the implementation of trace_frame_write_ops method --- -1.9.3 - diff --git a/SOURCES/gdb-dts-rhel6-python-compat.patch b/SOURCES/gdb-dts-rhel6-python-compat.patch index 3688713..a81e942 100644 --- a/SOURCES/gdb-dts-rhel6-python-compat.patch +++ b/SOURCES/gdb-dts-rhel6-python-compat.patch @@ -1,10 +1,10 @@ https://bugzilla.redhat.com/show_bug.cgi?id=1020004 -Index: gdb-7.7.90.20140613/gdb/data-directory/Makefile.in +Index: gdb-7.8/gdb/data-directory/Makefile.in =================================================================== ---- gdb-7.7.90.20140613.orig/gdb/data-directory/Makefile.in 2014-06-13 23:02:37.597115787 +0200 -+++ gdb-7.7.90.20140613/gdb/data-directory/Makefile.in 2014-06-13 23:03:21.285163909 +0200 -@@ -60,6 +60,8 @@ PYTHON_FILES = \ +--- gdb-7.8.orig/gdb/data-directory/Makefile.in 2014-10-19 18:25:34.187110261 +0200 ++++ gdb-7.8/gdb/data-directory/Makefile.in 2014-10-19 18:25:51.092121706 +0200 +@@ -60,6 +60,8 @@ PYTHON_FILE_LIST = \ gdb/frames.py \ gdb/FrameIterator.py \ gdb/FrameDecorator.py \ @@ -13,18 +13,18 @@ Index: gdb-7.7.90.20140613/gdb/data-directory/Makefile.in gdb/types.py \ gdb/printing.py \ gdb/prompt.py \ -@@ -74,6 +76,7 @@ PYTHON_FILES = \ +@@ -73,6 +75,7 @@ PYTHON_FILE_LIST = \ gdb/command/pretty_printers.py \ gdb/command/prompt.py \ gdb/command/explore.py \ + gdb/command/backtrace.py \ gdb/function/__init__.py \ gdb/function/strfns.py \ - gdb/function/caller_is.py \ -Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py + gdb/printer/__init__.py \ +Index: gdb-7.8/gdb/python/lib/gdb/FrameWrapper.py =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py 2014-06-13 23:02:37.598115788 +0200 ++++ gdb-7.8/gdb/python/lib/gdb/FrameWrapper.py 2014-10-19 18:25:36.808112031 +0200 @@ -0,0 +1,122 @@ +# Wrapper API for frames. + @@ -148,10 +148,10 @@ Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/FrameWrapper.py + + def __getattr__ (self, name): + return getattr (self.frame, name) -Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py +Index: gdb-7.8/gdb/python/lib/gdb/backtrace.py =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py 2014-06-13 23:02:37.598115788 +0200 ++++ gdb-7.8/gdb/python/lib/gdb/backtrace.py 2014-10-19 18:25:36.808112031 +0200 @@ -0,0 +1,42 @@ +# Filtering backtrace. + @@ -195,10 +195,10 @@ Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/backtrace.py + return iter + return old_frame_filter (iter) + -Index: gdb-7.7.90.20140613/gdb/python/lib/gdb/command/backtrace.py +Index: gdb-7.8/gdb/python/lib/gdb/command/backtrace.py =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ gdb-7.7.90.20140613/gdb/python/lib/gdb/command/backtrace.py 2014-06-13 23:02:37.598115788 +0200 ++++ gdb-7.8/gdb/python/lib/gdb/command/backtrace.py 2014-10-19 18:25:36.808112031 +0200 @@ -0,0 +1,106 @@ +# New backtrace command. + diff --git a/SOURCES/gdb-jit-reader-multilib.patch b/SOURCES/gdb-jit-reader-multilib.patch new file mode 100644 index 0000000..04aa397 --- /dev/null +++ b/SOURCES/gdb-jit-reader-multilib.patch @@ -0,0 +1,40 @@ +diff --git a/gdb/configure b/gdb/configure +index 7ff74ba..00a5b5b 100755 +--- a/gdb/configure ++++ b/gdb/configure +@@ -7382,10 +7382,12 @@ _ACEOF + + + +-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then +- TARGET_PTR="unsigned long" +-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then ++# Try to keep TARGET_PTR the same across archs so that jit-reader.h file ++# content is the same for multilib distributions. ++if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then + TARGET_PTR="unsigned long long" ++elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then ++ TARGET_PTR="unsigned long" + elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then + TARGET_PTR="unsigned __int128" + else +diff --git a/gdb/configure.ac b/gdb/configure.ac +index ec776d7..c02ace9 100644 +--- a/gdb/configure.ac ++++ b/gdb/configure.ac +@@ -648,10 +648,12 @@ AC_CHECK_SIZEOF(unsigned long long) + AC_CHECK_SIZEOF(unsigned long) + AC_CHECK_SIZEOF(unsigned __int128) + +-if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then +- TARGET_PTR="unsigned long" +-elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then ++# Try to keep TARGET_PTR the same across archs so that jit-reader.h file ++# content is the same for multilib distributions. ++if test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then + TARGET_PTR="unsigned long long" ++elif test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then ++ TARGET_PTR="unsigned long" + elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then + TARGET_PTR="unsigned __int128" + else diff --git a/SOURCES/gdb-rhbz1163339-add-auto-load-scripts-directory.patch b/SOURCES/gdb-rhbz1163339-add-auto-load-scripts-directory.patch new file mode 100644 index 0000000..2944017 --- /dev/null +++ b/SOURCES/gdb-rhbz1163339-add-auto-load-scripts-directory.patch @@ -0,0 +1,136 @@ +Date: Thu, 13 Nov 2014 16:26:37 +0100 +From: Jan Kratochvil +To: gdb-patches at sourceware dot org +Cc: Jakub Filak +Subject: [patch] Add add-auto-load-scripts-directory + +--jho1yZJdad60DJr+ +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +Hi, + +there is already "add-auto-load-safe-path" which works +like "set auto-load safe-path" but in append mode. + +There was missing an append equivalent for "set auto-load scripts-directory". + +ABRT has directory /var/cache/abrt-di/ as an alternative one +to /usr/lib/debug/ . Therefore ABRT needs to use -iex parameters to add this +/var/cache/abrt-di/ directory as a first-class debuginfo directory. +Using absolute "set auto-load scripts-directory" would hard-code the path +possibly overriding local system directory additions; besides it would not be +nice anyway. + +No regressions on {x86_64,x86_64-m32,i686}-fedora21-linux-gnu; although I have +seen some heavy regressions there today unrelated to this patch. + + +Thanks, +Jan + +--jho1yZJdad60DJr+ +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline; filename="addautoload.patch" + +gdb/ +2014-11-13 Jan Kratochvil + + Add add-auto-load-scripts-directory. + * NEWS (Changes since GDB 7.8): Add add-auto-load-scripts-directory. + * auto-load.c (add_auto_load_dir): New function. + (_initialize_auto_load): Install it. + +gdb/doc/ +2014-11-13 Jan Kratochvil + + Add add-auto-load-scripts-directory. + * gdb.texinfo (Auto-loading): Add add-auto-load-scripts-directory link. + (objfile-gdbdotext file): Add add-auto-load-scripts-directory. + +Index: gdb-7.6.1/gdb/NEWS +=================================================================== +--- gdb-7.6.1.orig/gdb/NEWS ++++ gdb-7.6.1/gdb/NEWS +@@ -1,6 +1,12 @@ + What has changed in GDB? + (Organized release by release) + ++* New commands: ++ ++add-auto-load-scripts-directory directory ++ Add entries to the list of directories from which to load auto-loaded ++ scripts. ++ + *** Changes in GDB 7.8 + + * New command line options +Index: gdb-7.6.1/gdb/auto-load.c +=================================================================== +--- gdb-7.6.1.orig/gdb/auto-load.c ++++ gdb-7.6.1/gdb/auto-load.c +@@ -298,6 +298,22 @@ Use 'set auto-load safe-path /' for disa + auto_load_safe_path_vec_update (); + } + ++/* "add-auto-load-scripts-directory" command for the auto_load_dir configuration ++ variable. */ ++ ++static void ++add_auto_load_dir (char *args, int from_tty) ++{ ++ char *s; ++ ++ if (args == NULL || *args == 0) ++ error (_("Directory argument required.")); ++ ++ s = xstrprintf ("%s%c%s", auto_load_dir, DIRNAME_SEPARATOR, args); ++ xfree (auto_load_dir); ++ auto_load_dir = s; ++} ++ + /* Implementation for filename_is_in_pattern overwriting the caller's FILENAME + and PATTERN. */ + +@@ -1295,6 +1311,15 @@ access the current full list setting."), + &cmdlist); + set_cmd_completer (cmd, filename_completer); + ++ cmd = add_cmd ("add-auto-load-scripts-directory", class_support, ++ add_auto_load_dir, ++ _("Add entries to the list of directories from which to load " ++ "auto-loaded scripts.\n\ ++See the commands 'set auto-load scripts-directory' and\n\ ++'show auto-load scripts-directory' to access the current full list setting."), ++ &cmdlist); ++ set_cmd_completer (cmd, filename_completer); ++ + add_setshow_boolean_cmd ("auto-load", class_maintenance, + &debug_auto_load, _("\ + Set auto-load verifications debugging."), _("\ +Index: gdb-7.6.1/gdb/doc/gdb.texinfo +=================================================================== +--- gdb-7.6.1.orig/gdb/doc/gdb.texinfo ++++ gdb-7.6.1/gdb/doc/gdb.texinfo +@@ -21929,6 +21929,8 @@ These are @value{GDBN} control commands + @tab Control for @value{GDBN} auto-loaded scripts location. + @item @xref{show auto-load scripts-directory}. + @tab Show @value{GDBN} auto-loaded scripts location. ++@item @xref{add-auto-load-scripts-directory}. ++@tab Add directory for auto-loaded scripts location list. + @item @xref{set auto-load local-gdbinit}. + @tab Control for init file in the current directory. + @item @xref{show auto-load local-gdbinit}. +@@ -27213,6 +27215,12 @@ to the @env{PATH} environment variable. + @kindex show auto-load scripts-directory + @item show auto-load scripts-directory + Show @value{GDBN} auto-loaded scripts location. ++ ++@anchor{add-auto-load-scripts-directory} ++@kindex add-auto-load-scripts-directory ++@item add-auto-load-scripts-directory @r{[}@var{directories}@r{]} ++Add an entry (or list of entries) to the list of auto-loaded scripts locations. ++Multiple entries may be delimited by the host platform path separator in use. + @end table + + @value{GDBN} does not track which files it has already auto-loaded this way. diff --git a/SOURCES/gdb-save-breakpoints-fix.patch b/SOURCES/gdb-save-breakpoints-fix.patch new file mode 100644 index 0000000..aa5a3bb --- /dev/null +++ b/SOURCES/gdb-save-breakpoints-fix.patch @@ -0,0 +1,123 @@ +gdb/ +2014-10-03 Miroslav Franc + Jan Kratochvil + + Fix "save breakpoints" for "catch" command. + * break-catch-sig.c (signal_catchpoint_print_recreate): Add trailing + newline. + +gdb/testsuite/ +2014-10-03 Jan Kratochvil + + Fix "save breakpoints" for "catch" command. + * gdb.base/catch-signal.exp: Add gdb_breakpoint "main". + Remove -nonewline. Match also the added "main" line. + +diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c +index c41bf33..579fb78 100644 +--- a/gdb/break-catch-sig.c ++++ b/gdb/break-catch-sig.c +@@ -346,6 +346,7 @@ signal_catchpoint_print_recreate (struct breakpoint *b, struct ui_file *fp) + } + else if (c->catch_all) + fprintf_unfiltered (fp, " all"); ++ fputc_unfiltered ('\n', fp); + } + + /* Implement the "explains_signal" breakpoint_ops method for signal +diff --git a/gdb/testsuite/gdb.base/catch-signal.exp b/gdb/testsuite/gdb.base/catch-signal.exp +index 22caf40..7002f84 100644 +--- a/gdb/testsuite/gdb.base/catch-signal.exp ++++ b/gdb/testsuite/gdb.base/catch-signal.exp +@@ -117,6 +117,7 @@ foreach {arg desc} {"" "standard signals" \ + "set catchpoint '$arg' for printing" + gdb_test "info break" "$decimal.*catchpoint.*signal.*$desc.*" \ + "info break for '$arg'" ++ gdb_breakpoint "main" + gdb_test "save breakpoints [standard_output_file bps.$i]" \ + "Saved to file .*bps.$i.*" \ + "save breakpoints for '$arg'" +@@ -124,15 +125,17 @@ foreach {arg desc} {"" "standard signals" \ + set filename [remote_upload host [standard_output_file bps.$i] \ + [standard_output_file bps-local.$i]] + set fd [open $filename] +- set contents [read -nonewline $fd] ++ set contents [read $fd] + close $fd + ++ set nl "\r?\n" + if {$arg == ""} { +- set pattern "catch signal" ++ set pattern "catch signal$nl" + } else { +- set pattern "catch signal $arg" ++ set pattern "catch signal $arg$nl" + } +- if {[string match $pattern $contents]} { ++ set pattern "${pattern}break main$nl" ++ if {[regexp "$pattern" $contents]} { + pass "results of save breakpoints for '$arg'" + } else { + fail "results of save breakpoints for '$arg'" +gdb/ +2014-10-03 Miroslav Franc + + Fix "save breakpoints" for "disable $bpnum" command. + * breakpoint.c (save_breakpoints): Add $bpnum for disable. + +gdb/testsuite/ +2014-10-03 Jan Kratochvil + + Fix "save breakpoints" for "disable $bpnum" command. + * gdb.base/save-bp.c (main): Add label. + * gdb.base/save-bp.exp: Add 8th disabled breakpoint. Match it. + +diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c +index e2170b4..0a438d1 100644 +--- a/gdb/breakpoint.c ++++ b/gdb/breakpoint.c +@@ -16131,7 +16131,7 @@ save_breakpoints (char *filename, int from_tty, + } + + if (tp->enable_state == bp_disabled) +- fprintf_unfiltered (fp, "disable\n"); ++ fprintf_unfiltered (fp, "disable $bpnum\n"); + + /* If this is a multi-location breakpoint, check if the locations + should be individually disabled. Watchpoint locations are +diff --git a/gdb/testsuite/gdb.base/save-bp.c b/gdb/testsuite/gdb.base/save-bp.c +index 9a72fe8..f01f031 100644 +--- a/gdb/testsuite/gdb.base/save-bp.c ++++ b/gdb/testsuite/gdb.base/save-bp.c +@@ -31,6 +31,6 @@ main (void) + break_me (); /* Try a condition-specific breakpoint. */ + + break_me (); /* Finally, try a breakpoint with commands. */ +- return 0; ++ return 0; /* Return line. */ + } + +diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp +index ba98633..7bc8ab6 100644 +--- a/gdb/testsuite/gdb.base/save-bp.exp ++++ b/gdb/testsuite/gdb.base/save-bp.exp +@@ -47,6 +47,10 @@ gdb_test "commands\nsilent\nend" "End with.*" "add breakpoint commands" + + gdb_test "dprintf ${srcfile}:${loc_bp5},\"At foo entry\\n\"" "Dprintf .*" + ++set loc_bp8 [gdb_get_line_number "Return line"] ++gdb_breakpoint "${srcfile}:${loc_bp8}" ++gdb_test_no_output {disable $bpnum} ++ + # Now, save the breakpoints into a file... + if {[is_remote host]} { + set bps bps +@@ -71,6 +75,7 @@ gdb_test "source $bps" "" "source bps" + + # Now, verify that all breakpoints have been created correctly... + set bp_row_start "\[0-9\]+ +breakpoint +keep +y +0x\[0-9a-f\]+ +in" ++set disabled_row_start "\[0-9\]+ +breakpoint +keep +n +0x\[0-9a-f\]+ +in" + set dprintf_row_start "\[0-9\]+ +dprintf +keep +y +0x\[0-9a-f\]+ +in" + gdb_test "info break" \ +- " *Num +Type +Disp +Enb +Address +What\r\n$bp_row_start break_me at .*$srcfile:\[0-9\]+\r\n$bp_row_start main at .*$srcfile:$loc_bp2\r\n$bp_row_start main at .*$srcfile:$loc_bp3 +thread 1\r\n\[ \t]+stop only in thread 1\r\n$bp_row_start main at .*$srcfile:$loc_bp4\r\n\[ \t\]+stop only if i == 1( \\((host|target) evals\\))?\r\n$bp_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+silent\r\n$dprintf_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+printf.*" ++ " *Num +Type +Disp +Enb +Address +What\r\n$bp_row_start break_me at .*$srcfile:\[0-9\]+\r\n$bp_row_start main at .*$srcfile:$loc_bp2\r\n$bp_row_start main at .*$srcfile:$loc_bp3 +thread 1\r\n\[ \t]+stop only in thread 1\r\n$bp_row_start main at .*$srcfile:$loc_bp4\r\n\[ \t\]+stop only if i == 1( \\((host|target) evals\\))?\r\n$bp_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+silent\r\n$dprintf_row_start main at .*$srcfile:$loc_bp5\r\n\[ \t\]+printf\[^\r\n\]+\r\n$disabled_row_start main at .*$srcfile:$loc_bp8" diff --git a/SOURCES/gdb-slow-gstack-performance.patch b/SOURCES/gdb-slow-gstack-performance.patch new file mode 100644 index 0000000..6a93988 --- /dev/null +++ b/SOURCES/gdb-slow-gstack-performance.patch @@ -0,0 +1,349 @@ +Date: Thu, 2 Oct 2014 17:56:53 +0200 +From: Jan Kratochvil +To: Doug Evans +Cc: gdb-patches at sourceware dot org +Subject: [patchv2] Fix 100x slowdown regression on DWZ files +Message-ID: <20141002155653.GA9001@host2.jankratochvil.net> + +--cNdxnHkX5QqsyA0e +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +On Thu, 02 Oct 2014 01:51:38 +0200, Doug Evans wrote: +> I tested this patch with --target_board=dwarf4-gdb-index +> and got a failure in m-static.exp: + +That is particularly with -fdebug-types-section. + + +> Type units read the line table in a separate path, + +OK, therefore I dropped that separate struct dwarf2_lineinfo +and reused struct line_header instead. + + +> OTOH, I do want to avoid any confusion that this patch may inadvertently +> introduce. For example, IIUC with your patch as is, +> if we read a partial_unit first, before a compile_unit +> that has the same stmt_list value, we'll do more processing in +> dwarf_decode_lines than we really need to since we only need a file +> number to symtab mapping. And if we later read in a compile_unit +> with the same stmt_value we'll call dwarf_decode_lines again, +> and this time we need the pc/line mapping it computes. +> Whereas if we process these in the opposite order we'll only call +> dwarf_decode_lines once. I'm sure this will be confusing at first +> to some later developer going through this code. +> [I could be missing something of course, and I'm happy for any corrections.] + +Implemented (omitting some story why I did not include it before). + + +> The code that processes stmt_list for type_units is in setup_type_unit_groups. +> Note that this code goes to the trouble of re-initializing the buildsym +> machinery (see the calls to restart_symtab in dwarf2read.c) when we process +> the second and subsequent type units that share a stmt_list value. +> This is something that used to be done before your patch and will no +> longer be done with your patch (since if we get a cache hit we exit). +> It may be that the type_unit support is doing this unnecessarily, +> which would be great because we can then simplify it. + +I hope this patch should no longer break -fdebug-types-section. +If it additionally enables some future optimization for -fdebug-types-section +the better. + + +> > + /* Offset of line number information in .debug_line section. */ +> > + sect_offset offset; +> > + unsigned offset_in_dwz : 1; +> +> IWBN to document why offset_in_dwz is here. +> It's not obvious why it's needed. ++ +On Thu, 02 Oct 2014 01:57:03 +0200, Doug Evans wrote: +> Ah, I guess the offset_in_dwz flag will ensure dwarf_decode_lines gets called +> twice regardless of order. But is that the only reason for the flag? + +I have added there now: ++ /* OFFSET is for struct dwz_file associated with dwarf2_per_objfile. */ + +If one removes it regressions really happen. What happens is that this +line_header_hash (former lineinfo_hash) is in struct dwarf2_per_objfile which +is common for both objfile and its objfile.dwz (that one is normally in +/usr/lib/debug/.dwz/ - common for multiple objfiles). And there are two +different DIEs at offset 0xb - one in objfile and one in objfile.dwz - which +would match single line_header if offset_in_dwz was not there. + +Also existing dwarf2read.c code usually transfers "dwz flag" together with DIE +offset, such as: + dwarf2_find_containing_comp_unit (sect_offset offset, + unsigned int offset_in_dwz, + struct objfile *objfile) +This reminds me - why doesn't similar ambiguity happen also for dwp_file? +I am unfortunately not much aware of the dwp implementation details. + + +> > - struct line_header *line_header +> > - = dwarf_decode_line_header (line_offset, cu); +> > + dwarf2_per_objfile->lineinfo_hash = +> +> As much as I prefer "=" going here, convention says to put it on the +> next line. + +I have changed it but this was just blind copy from existing line 21818. + + +> > + htab_create_alloc_ex (127, dwarf2_lineinfo_hash, dwarf2_lineinfo_eq, +> +> I don't have any data, but 127 seems high. + +I have not changed it but this was just blind copy from existing line 21818. + + +> I wouldn't change it, I just wanted to ask if you have any data +> guiding this choice. + +Tuning some constants really makes no sense when GDB has missing + insanely +complicated data structures and in consequence GDB is using inappropriate data +structures with bad algorithmic complexity. One needs to switch GDB to C++ +and its STL before one can start talking about data structures performance. + + +No regressions on {x86_64,x86_64-m32,i686}-fedora20-linux-gnu in DWZ mode and +in -fdebug-types-section mode. + + +Thanks, +Jan + +--cNdxnHkX5QqsyA0e +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline; filename="partialunit5.patch" + +gdb/ +2014-10-02 Jan Kratochvil + + Fix 100x slowdown regression on DWZ files. + * dwarf2read.c (struct dwarf2_per_objfile): Add line_header_hash. + (struct line_header): Add offset and offset_in_dwz. + (dwarf_decode_lines): Add parameter decode_mapping to the declaration. + (free_line_header_voidp): New declaration. + (line_header_hash, line_header_eq): New functions. + (dwarf2_build_include_psymtabs): Update dwarf_decode_lines caller. + (handle_DW_AT_stmt_list): Use dwarf2_per_objfile->line_header_hash. + (free_line_header_voidp): New function. + (dwarf_decode_line_header): Initialize offset and offset_in_dwz. + (dwarf_decode_lines): New parameter decode_mapping, use it. + +Index: gdb-7.8/gdb/dwarf2read.c +=================================================================== +--- gdb-7.8.orig/gdb/dwarf2read.c ++++ gdb-7.8/gdb/dwarf2read.c +@@ -312,6 +312,9 @@ struct dwarf2_per_objfile + + /* The CUs we recently read. */ + VEC (dwarf2_per_cu_ptr) *just_read_cus; ++ ++ /* Table containing line_header indexed by offset and offset_in_dwz. */ ++ htab_t line_header_hash; + }; + + static struct dwarf2_per_objfile *dwarf2_per_objfile; +@@ -1028,6 +1031,12 @@ typedef void (die_reader_func_ftype) (co + which contains the following information. */ + struct line_header + { ++ /* Offset of line number information in .debug_line section. */ ++ sect_offset offset; ++ ++ /* OFFSET is for struct dwz_file associated with dwarf2_per_objfile. */ ++ unsigned offset_in_dwz : 1; ++ + unsigned int total_length; + unsigned short version; + unsigned int header_length; +@@ -1516,7 +1525,7 @@ static struct line_header *dwarf_decode_ + + static void dwarf_decode_lines (struct line_header *, const char *, + struct dwarf2_cu *, struct partial_symtab *, +- int); ++ int, int decode_mapping); + + static void dwarf2_start_subfile (const char *, const char *, const char *); + +@@ -1849,6 +1858,8 @@ static void process_cu_includes (void); + + static void check_producer (struct dwarf2_cu *cu); + ++static void free_line_header_voidp (void *arg); ++ + static int + attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, + struct dwarf2_cu *cu, struct dynamic_prop *prop, +@@ -1920,6 +1931,29 @@ dwarf2_invalid_attrib_class_complaint (c + _("invalid attribute class or form for '%s' in '%s'"), + arg1, arg2); + } ++ ++/* Hash function for line_header_hash. */ ++ ++static hashval_t ++line_header_hash (const void *item) ++{ ++ const struct line_header *ofs = item; ++ ++ return ofs->offset.sect_off ^ ofs->offset_in_dwz; ++} ++ ++/* Equality function for line_header_hash. */ ++ ++static int ++line_header_eq (const void *item_lhs, const void *item_rhs) ++{ ++ const struct line_header *ofs_lhs = item_lhs; ++ const struct line_header *ofs_rhs = item_rhs; ++ ++ return (ofs_lhs->offset.sect_off == ofs_rhs->offset.sect_off ++ && ofs_lhs->offset_in_dwz == ofs_rhs->offset_in_dwz); ++} ++ + + #if WORDS_BIGENDIAN + +@@ -4459,7 +4493,7 @@ dwarf2_build_include_psymtabs (struct dw + return; /* No linetable, so no includes. */ + + /* NOTE: pst->dirname is DW_AT_comp_dir (if present). */ +- dwarf_decode_lines (lh, pst->dirname, cu, pst, 1); ++ dwarf_decode_lines (lh, pst->dirname, cu, pst, 1, 1); + + free_line_header (lh); + } +@@ -8989,24 +9023,64 @@ static void + handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu, + const char *comp_dir) /* ARI: editCase function */ + { ++ struct objfile *objfile = dwarf2_per_objfile->objfile; + struct attribute *attr; ++ unsigned int line_offset; ++ struct line_header *line_header, line_header_local; ++ unsigned u; ++ void **slot; ++ int decode_mapping; + + gdb_assert (! cu->per_cu->is_debug_types); + + attr = dwarf2_attr (die, DW_AT_stmt_list, cu); +- if (attr) ++ if (attr == NULL) ++ return; ++ ++ line_offset = DW_UNSND (attr); ++ ++ if (dwarf2_per_objfile->line_header_hash == NULL) + { +- unsigned int line_offset = DW_UNSND (attr); +- struct line_header *line_header +- = dwarf_decode_line_header (line_offset, cu); +- +- if (line_header) +- { +- cu->line_header = line_header; +- make_cleanup (free_cu_line_header, cu); +- dwarf_decode_lines (line_header, comp_dir, cu, NULL, 1); +- } ++ dwarf2_per_objfile->line_header_hash ++ = htab_create_alloc_ex (127, line_header_hash, line_header_eq, ++ free_line_header_voidp, ++ &objfile->objfile_obstack, ++ hashtab_obstack_allocate, ++ dummy_obstack_deallocate); ++ } ++ ++ line_header_local.offset.sect_off = line_offset; ++ line_header_local.offset_in_dwz = cu->per_cu->is_dwz; ++ slot = htab_find_slot (dwarf2_per_objfile->line_header_hash, ++ &line_header_local, NO_INSERT); ++ ++ /* For DW_TAG_compile_unit we need info like symtab::linetable which ++ is not present in *SLOT. */ ++ if (die->tag == DW_TAG_partial_unit && slot != NULL) ++ { ++ gdb_assert (*slot != NULL); ++ cu->line_header = *slot; ++ return; ++ } ++ ++ line_header = dwarf_decode_line_header (line_offset, cu); ++ if (line_header == NULL) ++ return; ++ cu->line_header = line_header; ++ ++ slot = htab_find_slot (dwarf2_per_objfile->line_header_hash, ++ &line_header_local, INSERT); ++ gdb_assert (slot != NULL); ++ if (*slot == NULL) ++ *slot = line_header; ++ else ++ { ++ gdb_assert (die->tag != DW_TAG_partial_unit); ++ make_cleanup (free_cu_line_header, cu); + } ++ decode_mapping = (die->tag != DW_TAG_partial_unit); ++ dwarf_decode_lines (line_header, comp_dir, cu, NULL, 1, ++ decode_mapping); + } + + /* Process DW_TAG_compile_unit or DW_TAG_partial_unit. */ +@@ -16969,6 +17043,16 @@ free_line_header (struct line_header *lh + xfree (lh); + } + ++/* Stub for free_line_header to match void * callback types. */ ++ ++static void ++free_line_header_voidp (void *arg) ++{ ++ struct line_header *lh = arg; ++ ++ free_line_header (lh); ++} ++ + /* Add an entry to LH's include directory table. */ + + static void +@@ -17099,6 +17183,9 @@ dwarf_decode_line_header (unsigned int o + back_to = make_cleanup ((make_cleanup_ftype *) free_line_header, + (void *) lh); + ++ lh->offset.sect_off = offset; ++ lh->offset_in_dwz = cu->per_cu->is_dwz; ++ + line_ptr = section->buffer + offset; + + /* Read in the header. */ +@@ -17596,18 +17683,22 @@ dwarf_decode_lines_1 (struct line_header + as the corresponding symtab. Since COMP_DIR is not used in the name of the + symtab we don't use it in the name of the psymtabs we create. + E.g. expand_line_sal requires this when finding psymtabs to expand. +- A good testcase for this is mb-inline.exp. */ ++ A good testcase for this is mb-inline.exp. ++ ++ Boolean DECODE_MAPPING specifies we need to fully decode .debug_line ++ for its PC<->lines mapping information. Otherwise only filenames ++ tables is read in. */ + + static void + dwarf_decode_lines (struct line_header *lh, const char *comp_dir, + struct dwarf2_cu *cu, struct partial_symtab *pst, +- int want_line_info) ++ int want_line_info, int decode_mapping) + { + struct objfile *objfile = cu->objfile; + const int decode_for_pst_p = (pst != NULL); + struct subfile *first_subfile = current_subfile; + +- if (want_line_info) ++ if (want_line_info && decode_mapping) + dwarf_decode_lines_1 (lh, comp_dir, cu, pst); + + if (decode_for_pst_p) diff --git a/SOURCES/gdb-symbols-lookup-accel.patch b/SOURCES/gdb-symbols-lookup-accel.patch new file mode 100644 index 0000000..1901d07 --- /dev/null +++ b/SOURCES/gdb-symbols-lookup-accel.patch @@ -0,0 +1,191 @@ +http://sourceware.org/ml/gdb-patches/2014-10/msg00524.html +Subject: [patch 1/2] Accelerate iter_match_first_hashed 1.8x + + +--17pEHd4RhPHOinZp +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +Hi, + +very simple caching. dict_hash() is being called again and again for the same +string. + +#0 in skip_spaces_const (chp=0x7fffb10f9bb6 "ts, std::allocator >::npos") at ./cli/cli-utils.c:244 +#1 in msymbol_hash_iw (string=0x7fffb10f9bb6 "ts, std::allocator >::npos") at minsyms.c:89 +#2 in dict_hash ( string0=0x7fffb10f9b90 "std::basic_string, std::allocator >::npos") at dictionary.c:840 +#3 in iter_match_first_hashed (dict=0x105a7840, name=0x7fffb10f9b90 "std::basic_string, std::allocator >::npos", compare=0x8b82f8 , iterator=0x7fffb10f9970) at dictionary.c:659 +#4 in dict_iter_match_first (dict=0x105a7840, name=0x7fffb10f9b90 "std::basic_string, std::allocator >::npos", compare=0x8b82f8 , iterator=0x7fffb10f9970) at dictionary.c:555 +#5 in dict_iter_name_first (dict=0x105a7840, name=0x7fffb10f9b90 "std::basic_string, std::allocator >::npos", iterator=0x7fffb10f9970) at dictionary.c:541 +#6 in block_iter_name_step (iterator=0x7fffb10f9960, name=0x7fffb10f9b90 "std::basic_string, std::allocator >::npos", first=1) at block.c:580 +#7 in block_iter_name_first (block=0x10593e10, name=0x7fffb10f9b90 "std::basic_string, std::allocator >::npos", iterator=0x7fffb10f9960) at block.c:609 +#8 in lookup_block_symbol (block=0x10593e10, name=0x7fffb10f9b90 "std::basic_string, std::allocator >::npos", domain=VAR_DOMAIN) at symtab.c:2062 +#9 in lookup_symbol_aux_objfile (objfile=0x466f870, block_index=0, name=0x7fffb10f9b90 "std::basic_string, std::allocator >::npos", domain=VAR_DOMAIN) at symtab.c:1664 +#10 in lookup_symbol_global_iterator_cb (objfile=0x466f870, cb_data=0x7fffb10f9ad0) at symtab.c:1868 + + +Maybe it could get cached at the caller but: + * We would need to pass the hash value along the whole {dict,block}_iter_* + call chain. + * The DICT_VECTOR virtualization would get violated as dict_linear*_vector do + not use any hash values. + + +Jan + +--17pEHd4RhPHOinZp +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline; filename="idxcache1.patch" + +gdb/ +2014-10-20 Jan Kratochvil + + * dictionary.c (iter_match_first_hashed): Provide state cache for + hash_index from NAME. + +diff --git a/gdb/dictionary.c b/gdb/dictionary.c +index 055c87e..90bcd6d 100644 +--- a/gdb/dictionary.c ++++ b/gdb/dictionary.c +@@ -656,9 +656,26 @@ iter_match_first_hashed (const struct dictionary *dict, const char *name, + symbol_compare_ftype *compare, + struct dict_iterator *iterator) + { +- unsigned int hash_index = dict_hash (name) % DICT_HASHED_NBUCKETS (dict); ++ unsigned int hash_index; + struct symbol *sym; + ++ /* Cache HASH_INDEX. */ ++ { ++ static const char *name_ptr_cached; ++ static char *name_content_cached; ++ static unsigned int dict_hash_cached; ++ ++ if (name_ptr_cached != name || strcmp (name_content_cached, name) != 0) ++ { ++ dict_hash_cached = dict_hash (name); ++ name_ptr_cached = name; ++ xfree (name_content_cached); ++ name_content_cached = xstrdup (name); ++ } ++ hash_index = dict_hash_cached; ++ } ++ hash_index %= DICT_HASHED_NBUCKETS (dict); ++ + DICT_ITERATOR_DICT (iterator) = dict; + + /* Loop through the symbols in the given bucket, breaking when SYM + +--17pEHd4RhPHOinZp-- + + + +http://sourceware.org/ml/gdb-patches/2014-10/msg00612.html +Subject: [patchv2 2/2] Accelerate lookup_symbol_aux_objfile 14.5x [Re: [patch 0/2] Accelerate symbol lookups 15x] + + +--vtzGhvizbBRQ85DL +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline + +On Wed, 22 Oct 2014 10:55:18 +0200, Doug Evans wrote: +> For example, the count of calls to dict_hash before/after goes from 13.8M to 31. +> I'm guessing one t hing we're doing here is coping with an artifact of +> dwz: + +During my simple test on non-DWZ file (./gdb itself) it went 3684->3484. + +The problem is that dict_cash(val) is called for the same val for each block +(== symtab). + +On DWZ the saving is probably much larger as there are many more symtabs due +to DW_TAG_partial_unit ones. + + +> what was once one global block to represent the entire objfile is +> now N. + +Without DWZ there are X global blocks for X primary symtabs for X CUs of +objfile. With DWZ there are X+Y global blocks for X+Y primary symtabs for +X+Y CUs where Y are 'DW_TAG_partial_unit's. + +For 'DW_TAG_partial_unit's (Ys) their blockvector is usually empty. But not +always, I have found there typedef symbols, there can IMO be optimized-out +static variables etc. + + +> [I'm sure the patches help in the non-dwz case, but I suspect it's less. +> Which isn't to say the patches aren't useful. +> I just need play with a few more examples.] + +I agree. + +[patch 2/2] could needlessly performance-regress non-DWZ cases, therefore +I have put back original ALL_OBJFILE_PRIMARY_SYMTABS (instead of my +ALL_OBJFILE_SYMTABS) as it is perfectly sufficient. For the performance +testcase of mine: + +Benchmark on non-trivial application with 'p ': +Command execution time: 4.215000 (cpu), 4.241466 (wall) --- both fixes with new [patch 2/2] +Command execution time: 7.373000 (cpu), 7.395095 (wall) --- both fixes +Command execution time: 13.572000 (cpu), 13.592689 (wall) --- just lookup_symbol_aux_objfile fix +Command execution time: 113.036000 (cpu), 113.067995 (wall) --- FSF GDB HEAD + +That is additional 1.75x improvement, making the total improvement 26.8x. + + +No regressions on {x86_64,x86_64-m32,i686}-fedora21pre-linux-gnu in standard +and .gdb_index-enabled runs. Neither of the patches should cause any visible +behavior change. + + +Thanks, +Jan + +--vtzGhvizbBRQ85DL +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline; filename="idxcache2doug.patch" + +gdb/ +2014-10-23 Jan Kratochvil + + * symtab.c (lookup_symbol_aux_objfile): Use ALL_OBJFILE_SYMTABS, inline + lookup_block_symbol. + +diff --git a/gdb/symtab.c b/gdb/symtab.c +index c530d50..da13861 100644 +--- a/gdb/symtab.c ++++ b/gdb/symtab.c +@@ -1657,15 +1657,25 @@ lookup_symbol_aux_objfile (struct objfile *objfile, int block_index, + const struct block *block; + struct symtab *s; + ++ gdb_assert (block_index == GLOBAL_BLOCK || block_index == STATIC_BLOCK); ++ + ALL_OBJFILE_PRIMARY_SYMTABS (objfile, s) + { ++ struct dict_iterator dict_iter; ++ + bv = BLOCKVECTOR (s); + block = BLOCKVECTOR_BLOCK (bv, block_index); +- sym = lookup_block_symbol (block, name, domain); +- if (sym) ++ ++ for (sym = dict_iter_name_first (block->dict, name, &dict_iter); ++ sym != NULL; ++ sym = dict_iter_name_next (name, &dict_iter)) + { +- block_found = block; +- return fixup_symbol_section (sym, objfile); ++ if (symbol_matches_domain (SYMBOL_LANGUAGE (sym), ++ SYMBOL_DOMAIN (sym), domain)) ++ { ++ block_found = block; ++ return fixup_symbol_section (sym, objfile); ++ } + } + } + + +--vtzGhvizbBRQ85DL-- + diff --git a/SOURCES/gdb-vla-intel.patch b/SOURCES/gdb-vla-intel.patch index d4f9eed..7a8674b 100644 --- a/SOURCES/gdb-vla-intel.patch +++ b/SOURCES/gdb-vla-intel.patch @@ -6,25 +6,11 @@ GIT snapshot: commit 511bff520372ffc10fa2ff569c176bdf1e6e475d -diff --git a/gdb/NEWS b/gdb/NEWS -index d9a19ae..e6885d2 100644 -### a/gdb/NEWS -### b/gdb/NEWS -@@ -3,6 +3,9 @@ - - *** Changes since GDB 7.8 - -+* Fortran dynamic array support: It allows the user to evaluate -+ dynamic arrays like an ordinary static array. -+ - *** Changes in GDB 7.8 - - * New command line options -diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c -index f4694b0..8c45276 100644 ---- a/gdb/c-valprint.c -+++ b/gdb/c-valprint.c -@@ -538,7 +538,16 @@ c_value_print (struct value *val, struct ui_file *stream, +Index: gdb-7.8.1/gdb/c-valprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/c-valprint.c 2014-12-13 15:52:07.695310276 +0100 ++++ gdb-7.8.1/gdb/c-valprint.c 2014-12-13 15:52:10.817307138 +0100 +@@ -538,7 +538,16 @@ c_value_print (struct value *val, struct { /* normal case */ fprintf_filtered (stream, "("); @@ -42,11 +28,11 @@ index f4694b0..8c45276 100644 fprintf_filtered (stream, ") "); } } -diff --git a/gdb/dwarf2expr.c b/gdb/dwarf2expr.c -index 36c9f66..274ba62 100644 ---- a/gdb/dwarf2expr.c -+++ b/gdb/dwarf2expr.c -@@ -1478,6 +1478,12 @@ execute_stack_op (struct dwarf_expr_context *ctx, +Index: gdb-7.8.1/gdb/dwarf2expr.c +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2expr.c 2014-12-13 15:52:07.695310276 +0100 ++++ gdb-7.8.1/gdb/dwarf2expr.c 2014-12-13 15:52:10.817307138 +0100 +@@ -1478,6 +1478,12 @@ execute_stack_op (struct dwarf_expr_cont } break; @@ -59,10 +45,10 @@ index 36c9f66..274ba62 100644 default: error (_("Unhandled dwarf expression opcode 0x%x"), op); } -diff --git a/gdb/dwarf2expr.h b/gdb/dwarf2expr.h -index 39dadf3..8cebbe8 100644 ---- a/gdb/dwarf2expr.h -+++ b/gdb/dwarf2expr.h +Index: gdb-7.8.1/gdb/dwarf2expr.h +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2expr.h 2014-12-13 15:52:07.696310275 +0100 ++++ gdb-7.8.1/gdb/dwarf2expr.h 2014-12-13 15:52:10.817307138 +0100 @@ -84,12 +84,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); @@ -76,10 +62,10 @@ index 39dadf3..8cebbe8 100644 }; /* The location of a value. */ -diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c -index fcab9b9..a624dac 100644 ---- a/gdb/dwarf2loc.c -+++ b/gdb/dwarf2loc.c +Index: gdb-7.8.1/gdb/dwarf2loc.c +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2loc.c 2014-12-13 15:52:07.697310274 +0100 ++++ gdb-7.8.1/gdb/dwarf2loc.c 2014-12-13 15:52:10.818307137 +0100 @@ -306,6 +306,7 @@ struct dwarf_expr_baton { struct frame_info *frame; @@ -88,7 +74,7 @@ index fcab9b9..a624dac 100644 }; /* Helper functions for dwarf2_evaluate_loc_desc. */ -@@ -1209,6 +1210,7 @@ dwarf_expr_push_dwarf_reg_entry_value (struct dwarf_expr_context *ctx, +@@ -1209,6 +1210,7 @@ dwarf_expr_push_dwarf_reg_entry_value (s baton_local.frame = caller_frame; baton_local.per_cu = caller_per_cu; @@ -96,7 +82,7 @@ index fcab9b9..a624dac 100644 saved_ctx.gdbarch = ctx->gdbarch; saved_ctx.addr_size = ctx->addr_size; -@@ -1238,6 +1240,22 @@ dwarf_expr_get_addr_index (void *baton, unsigned int index) +@@ -1238,6 +1240,22 @@ dwarf_expr_get_addr_index (void *baton, return dwarf2_read_addr_index (debaton->per_cu, index); } @@ -119,7 +105,7 @@ index fcab9b9..a624dac 100644 /* VALUE must be of type lval_computed with entry_data_value_funcs. Perform the indirect method on it, that is use its stored target value, the sole purpose of entry_data_value_funcs.. */ -@@ -2202,7 +2220,8 @@ static const struct dwarf_expr_context_funcs dwarf_expr_ctx_funcs = +@@ -2202,7 +2220,8 @@ static const struct dwarf_expr_context_f dwarf_expr_dwarf_call, dwarf_expr_get_base_type, dwarf_expr_push_dwarf_reg_entry_value, @@ -129,7 +115,7 @@ index fcab9b9..a624dac 100644 }; /* Evaluate a location description, starting at DATA and with length -@@ -2231,6 +2250,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2231,6 +2250,7 @@ dwarf2_evaluate_loc_desc_full (struct ty baton.frame = frame; baton.per_cu = per_cu; @@ -137,7 +123,7 @@ index fcab9b9..a624dac 100644 ctx = new_dwarf_expr_context (); old_chain = make_cleanup_free_dwarf_expr_context (ctx); -@@ -2326,6 +2346,11 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame, +@@ -2326,6 +2346,11 @@ dwarf2_evaluate_loc_desc_full (struct ty int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0); do_cleanups (value_chain); @@ -149,7 +135,7 @@ index fcab9b9..a624dac 100644 retval = value_at_lazy (type, address + byte_offset); if (in_stack_memory) set_value_stack (retval, 1); -@@ -2436,6 +2461,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame, +@@ -2436,6 +2461,7 @@ dwarf2_evaluate_loc_desc (struct type *t static int dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, @@ -157,7 +143,7 @@ index fcab9b9..a624dac 100644 CORE_ADDR *valp) { struct dwarf_expr_context *ctx; -@@ -2451,6 +2477,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, +@@ -2451,6 +2477,7 @@ dwarf2_locexpr_baton_eval (const struct baton.frame = get_selected_frame (NULL); baton.per_cu = dlbaton->per_cu; @@ -165,7 +151,7 @@ index fcab9b9..a624dac 100644 objfile = dwarf2_per_cu_objfile (dlbaton->per_cu); -@@ -2491,7 +2518,8 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, +@@ -2491,7 +2518,8 @@ dwarf2_locexpr_baton_eval (const struct /* See dwarf2loc.h. */ int @@ -175,7 +161,7 @@ index fcab9b9..a624dac 100644 { if (prop == NULL) return 0; -@@ -2502,7 +2530,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value) +@@ -2502,7 +2530,7 @@ dwarf2_evaluate_property (const struct d { const struct dwarf2_property_baton *baton = prop->data.baton; @@ -184,7 +170,7 @@ index fcab9b9..a624dac 100644 { if (baton->referenced_type) { -@@ -2546,6 +2574,20 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value) +@@ -2546,6 +2574,20 @@ dwarf2_evaluate_property (const struct d return 0; } @@ -205,7 +191,7 @@ index fcab9b9..a624dac 100644 /* Helper functions and baton for dwarf2_loc_desc_needs_frame. */ -@@ -2653,6 +2695,15 @@ needs_get_addr_index (void *baton, unsigned int index) +@@ -2653,6 +2695,15 @@ needs_get_addr_index (void *baton, unsig return 1; } @@ -221,7 +207,7 @@ index fcab9b9..a624dac 100644 /* Virtual method table for dwarf2_loc_desc_needs_frame below. */ static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs = -@@ -2667,7 +2718,8 @@ static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs = +@@ -2667,7 +2718,8 @@ static const struct dwarf_expr_context_f needs_frame_dwarf_call, NULL, /* get_base_type */ needs_dwarf_reg_entry_value, @@ -231,7 +217,7 @@ index fcab9b9..a624dac 100644 }; /* Return non-zero iff the location expression at DATA (length SIZE) -@@ -3316,6 +3368,10 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, +@@ -3316,6 +3368,10 @@ dwarf2_compile_expr_to_ax (struct agent_ unimplemented (op); break; @@ -242,11 +228,11 @@ index fcab9b9..a624dac 100644 case DW_OP_skip: offset = extract_signed_integer (op_ptr, 2, byte_order); op_ptr += 2; -diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h -index 8ad5fa9..fb65c5c 100644 ---- a/gdb/dwarf2loc.h -+++ b/gdb/dwarf2loc.h -@@ -96,11 +96,18 @@ struct value *dwarf2_evaluate_loc_desc (struct type *type, +Index: gdb-7.8.1/gdb/dwarf2loc.h +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2loc.h 2014-12-13 15:52:07.697310274 +0100 ++++ gdb-7.8.1/gdb/dwarf2loc.h 2014-12-13 15:52:10.819307136 +0100 +@@ -96,11 +96,18 @@ struct value *dwarf2_evaluate_loc_desc ( into VALUE, otherwise returns 0. */ int dwarf2_evaluate_property (const struct dynamic_prop *prop, @@ -265,11 +251,11 @@ index 8ad5fa9..fb65c5c 100644 /* The symbol location baton types used by the DWARF-2 reader (i.e. SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct dwarf2_locexpr_baton" is for a symbol with a single location -diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c -index 276d2f1..fbf13ce 100644 ---- a/gdb/dwarf2read.c -+++ b/gdb/dwarf2read.c -@@ -1847,6 +1847,12 @@ static void free_dwo_file_cleanup (void *); +Index: gdb-7.8.1/gdb/dwarf2read.c +=================================================================== +--- gdb-7.8.1.orig/gdb/dwarf2read.c 2014-12-13 15:52:07.704310267 +0100 ++++ gdb-7.8.1/gdb/dwarf2read.c 2014-12-13 15:52:10.823307132 +0100 +@@ -1847,6 +1847,12 @@ static void free_dwo_file_cleanup (void static void process_cu_includes (void); static void check_producer (struct dwarf2_cu *cu); @@ -282,16 +268,16 @@ index 276d2f1..fbf13ce 100644 /* Various complaints about symbol reading that don't abort the process. */ -@@ -14201,29 +14207,92 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14182,29 +14188,92 @@ read_tag_string_type (struct die_info *d struct gdbarch *gdbarch = get_objfile_arch (objfile); struct type *type, *range_type, *index_type, *char_type; struct attribute *attr; - unsigned int length; + unsigned int length = UINT_MAX; -+ + + index_type = objfile_type (objfile)->builtin_int; + range_type = create_static_range_type (NULL, index_type, 1, length); - ++ + /* If DW_AT_string_length is defined, the length is stored at some location + * in memory. */ attr = dwarf2_attr (die, DW_AT_string_length, cu); @@ -382,7 +368,7 @@ index 276d2f1..fbf13ce 100644 char_type = language_string_char_type (cu->language_defn, gdbarch); type = create_string_type (NULL, char_type, range_type); -@@ -14540,13 +14609,15 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14521,13 +14590,15 @@ read_base_type (struct die_info *die, st return set_die_type (die, type, cu); } @@ -399,7 +385,7 @@ index 276d2f1..fbf13ce 100644 { struct dwarf2_property_baton *baton; struct obstack *obstack = &cu->objfile->objfile_obstack; -@@ -14559,8 +14630,25 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -14540,8 +14611,25 @@ attr_to_dynamic_prop (const struct attri baton = obstack_alloc (obstack, sizeof (*baton)); baton->referenced_type = NULL; baton->locexpr.per_cu = cu->per_cu; @@ -427,7 +413,7 @@ index 276d2f1..fbf13ce 100644 prop->data.baton = baton; prop->kind = PROP_LOCEXPR; gdb_assert (prop->data.baton != NULL); -@@ -14590,8 +14678,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die, +@@ -14571,8 +14659,28 @@ attr_to_dynamic_prop (const struct attri baton = obstack_alloc (obstack, sizeof (*baton)); baton->referenced_type = die_type (target_die, target_cu); baton->locexpr.per_cu = cu->per_cu; @@ -458,7 +444,7 @@ index 276d2f1..fbf13ce 100644 prop->data.baton = baton; prop->kind = PROP_LOCEXPR; gdb_assert (prop->data.baton != NULL); -@@ -14626,7 +14734,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14607,7 +14715,7 @@ read_subrange_type (struct die_info *die struct type *base_type, *orig_base_type; struct type *range_type; struct attribute *attr; @@ -467,7 +453,7 @@ index 276d2f1..fbf13ce 100644 int low_default_is_valid; int high_bound_is_count = 0; const char *name; -@@ -14646,7 +14754,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14627,7 +14735,9 @@ read_subrange_type (struct die_info *die low.kind = PROP_CONST; high.kind = PROP_CONST; @@ -477,7 +463,7 @@ index 276d2f1..fbf13ce 100644 /* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow omitting DW_AT_lower_bound. */ -@@ -14679,19 +14789,26 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14660,19 +14770,26 @@ read_subrange_type (struct die_info *die break; } @@ -507,7 +493,7 @@ index 276d2f1..fbf13ce 100644 { /* If bounds are constant do the final calculation here. */ if (low.kind == PROP_CONST && high.kind == PROP_CONST) -@@ -14755,7 +14872,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) +@@ -14736,7 +14853,7 @@ read_subrange_type (struct die_info *die && !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask)) high.data.const_val |= negative_mask; @@ -516,7 +502,7 @@ index 276d2f1..fbf13ce 100644 if (high_bound_is_count) TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1; -@@ -21673,6 +21790,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -21654,6 +21771,8 @@ set_die_type (struct die_info *die, stru { struct dwarf2_per_cu_offset_and_type **slot, ofs; struct objfile *objfile = cu->objfile; @@ -525,7 +511,7 @@ index 276d2f1..fbf13ce 100644 /* For Ada types, make sure that the gnat-specific data is always initialized (if not already set). There are a few types where -@@ -21687,6 +21806,43 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu) +@@ -21668,6 +21787,43 @@ set_die_type (struct die_info *die, stru && !HAVE_GNAT_AUX_INFO (type)) INIT_GNAT_SPECIFIC (type); @@ -569,10 +555,10 @@ index 276d2f1..fbf13ce 100644 if (dwarf2_per_objfile->die_type_hash == NULL) { dwarf2_per_objfile->die_type_hash = -diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c -index 8356aab..69e67f4 100644 ---- a/gdb/f-typeprint.c -+++ b/gdb/f-typeprint.c +Index: gdb-7.8.1/gdb/f-typeprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/f-typeprint.c 2014-12-13 15:52:07.705310266 +0100 ++++ gdb-7.8.1/gdb/f-typeprint.c 2014-12-13 15:52:10.823307132 +0100 @@ -30,6 +30,7 @@ #include "gdbcore.h" #include "target.h" @@ -581,7 +567,7 @@ index 8356aab..69e67f4 100644 #include #include -@@ -56,6 +57,17 @@ f_print_type (struct type *type, const char *varstring, struct ui_file *stream, +@@ -56,6 +57,17 @@ f_print_type (struct type *type, const c enum type_code code; int demangled_args; @@ -599,7 +585,7 @@ index 8356aab..69e67f4 100644 f_type_print_base (type, stream, show, level); code = TYPE_CODE (type); if ((varstring != NULL && *varstring != '\0') -@@ -170,28 +182,36 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream, +@@ -170,28 +182,36 @@ f_type_print_varspec_suffix (struct type if (arrayprint_recurse_level == 1) fprintf_filtered (stream, "("); @@ -657,10 +643,10 @@ index 8356aab..69e67f4 100644 if (arrayprint_recurse_level == 1) fprintf_filtered (stream, ")"); else -diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c -index 408c8cc..38f32e0 100644 ---- a/gdb/f-valprint.c -+++ b/gdb/f-valprint.c +Index: gdb-7.8.1/gdb/f-valprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/f-valprint.c 2014-12-13 15:52:07.705310266 +0100 ++++ gdb-7.8.1/gdb/f-valprint.c 2014-12-13 15:52:10.824307131 +0100 @@ -39,8 +39,6 @@ extern void _initialize_f_valprint (void); @@ -670,7 +656,7 @@ index 408c8cc..38f32e0 100644 static void f77_get_dynamic_length_of_aggregate (struct type *); int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; -@@ -48,15 +46,6 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2]; +@@ -48,15 +46,6 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIM /* 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. */ @@ -686,7 +672,7 @@ index 408c8cc..38f32e0 100644 int f77_get_lowerbound (struct type *type) { -@@ -114,47 +103,6 @@ f77_get_dynamic_length_of_aggregate (struct type *type) +@@ -114,47 +103,6 @@ f77_get_dynamic_length_of_aggregate (str * TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type))); } @@ -734,7 +720,7 @@ index 408c8cc..38f32e0 100644 /* Actual function which prints out F77 arrays, Valaddr == address in the superior. Address == the address in the inferior. */ -@@ -167,41 +115,62 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, +@@ -167,41 +115,62 @@ f77_print_array_1 (int nss, int ndimensi const struct value_print_options *options, int *elts) { @@ -813,7 +799,7 @@ index 408c8cc..38f32e0 100644 fprintf_filtered (stream, "..."); } } -@@ -228,12 +197,6 @@ f77_print_array (struct type *type, const gdb_byte *valaddr, +@@ -228,12 +197,6 @@ f77_print_array (struct type *type, cons Type node corrupt! F77 arrays cannot have %d subscripts (%d Max)"), ndimensions, MAX_FORTRAN_DIMS); @@ -826,7 +812,7 @@ index 408c8cc..38f32e0 100644 f77_print_array_1 (1, ndimensions, type, valaddr, embedded_offset, address, stream, recurse, val, options, &elts); } -@@ -378,12 +341,15 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, +@@ -378,12 +341,15 @@ f_val_print (struct type *type, const gd fprintf_filtered (stream, "( "); for (index = 0; index < TYPE_NFIELDS (type); index++) { @@ -847,10 +833,10 @@ index 408c8cc..38f32e0 100644 if (index != TYPE_NFIELDS (type) - 1) fputs_filtered (", ", stream); } -diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c -index e99a2f3..53cae2c 100644 ---- a/gdb/gdbtypes.c -+++ b/gdb/gdbtypes.c +Index: gdb-7.8.1/gdb/gdbtypes.c +=================================================================== +--- gdb-7.8.1.orig/gdb/gdbtypes.c 2014-12-13 15:52:07.707310264 +0100 ++++ gdb-7.8.1/gdb/gdbtypes.c 2014-12-13 15:53:10.675246976 +0100 @@ -805,7 +805,8 @@ allocate_stub_method (struct type *type) struct type * create_range_type (struct type *result_type, struct type *index_type, @@ -861,7 +847,7 @@ index e99a2f3..53cae2c 100644 { if (result_type == NULL) result_type = alloc_type_copy (index_type); -@@ -820,6 +821,7 @@ create_range_type (struct type *result_type, struct type *index_type, +@@ -820,6 +821,7 @@ create_range_type (struct type *result_t TYPE_ZALLOC (result_type, sizeof (struct range_bounds)); TYPE_RANGE_DATA (result_type)->low = *low_bound; TYPE_RANGE_DATA (result_type)->high = *high_bound; @@ -878,7 +864,7 @@ index e99a2f3..53cae2c 100644 low.kind = PROP_CONST; low.data.const_val = low_bound; -@@ -849,7 +851,11 @@ create_static_range_type (struct type *result_type, struct type *index_type, +@@ -849,7 +851,11 @@ create_static_range_type (struct type *r high.kind = PROP_CONST; high.data.const_val = high_bound; @@ -891,7 +877,7 @@ index e99a2f3..53cae2c 100644 return result_type; } -@@ -1003,18 +1009,24 @@ create_array_type_with_stride (struct type *result_type, +@@ -1003,18 +1009,24 @@ create_array_type_with_stride (struct ty TYPE_CODE (result_type) = TYPE_CODE_ARRAY; TYPE_TARGET_TYPE (result_type) = element_type; @@ -950,7 +936,7 @@ index e99a2f3..53cae2c 100644 switch (TYPE_CODE (type)) { case TYPE_CODE_RANGE: -@@ -1631,11 +1662,19 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1631,11 +1662,19 @@ is_dynamic_type_internal (struct type *t { gdb_assert (TYPE_NFIELDS (type) == 1); @@ -973,7 +959,7 @@ index e99a2f3..53cae2c 100644 } case TYPE_CODE_STRUCT: -@@ -1648,6 +1687,17 @@ is_dynamic_type_internal (struct type *type, int top_level) +@@ -1648,6 +1687,17 @@ is_dynamic_type_internal (struct type *t && is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0)) return 1; } @@ -991,7 +977,7 @@ index e99a2f3..53cae2c 100644 break; } -@@ -1666,22 +1716,23 @@ static struct type *resolve_dynamic_type_internal (struct type *type, +@@ -1666,22 +1716,23 @@ static struct type *resolve_dynamic_type CORE_ADDR addr, int top_level); @@ -1020,7 +1006,7 @@ index e99a2f3..53cae2c 100644 { low_bound.kind = PROP_CONST; low_bound.data.const_val = value; -@@ -1693,7 +1744,7 @@ resolve_dynamic_range (struct type *dyn_range_type) +@@ -1693,7 +1744,7 @@ resolve_dynamic_range (struct type *dyn_ } prop = &TYPE_RANGE_DATA (dyn_range_type)->high; @@ -1029,7 +1015,7 @@ index e99a2f3..53cae2c 100644 { high_bound.kind = PROP_CONST; high_bound.data.const_val = value; -@@ -1707,10 +1758,17 @@ resolve_dynamic_range (struct type *dyn_range_type) +@@ -1707,10 +1758,17 @@ resolve_dynamic_range (struct type *dyn_ high_bound.kind = PROP_UNDEFINED; high_bound.data.const_val = 0; } @@ -1050,7 +1036,7 @@ index e99a2f3..53cae2c 100644 TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1; return static_range_type; } -@@ -1720,29 +1778,52 @@ resolve_dynamic_range (struct type *dyn_range_type) +@@ -1720,29 +1778,52 @@ resolve_dynamic_range (struct type *dyn_ of the associated array. */ static struct type * @@ -1111,7 +1097,7 @@ index e99a2f3..53cae2c 100644 } /* Resolve dynamic bounds of members of the union TYPE to static -@@ -1846,6 +1927,8 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr, +@@ -1846,6 +1927,8 @@ resolve_dynamic_type_internal (struct ty { struct type *real_type = check_typedef (type); struct type *resolved_type = type; @@ -1120,23 +1106,23 @@ index e99a2f3..53cae2c 100644 if (!is_dynamic_type_internal (real_type, top_level)) return type; -@@ -1871,11 +1954,12 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr, - } +@@ -1876,11 +1959,12 @@ resolve_dynamic_type_internal (struct ty + } - case TYPE_CODE_ARRAY: -- resolved_type = resolve_dynamic_array (type); -+ case TYPE_CODE_STRING: -+ resolved_type = resolve_dynamic_array (type, addr); - break; + case TYPE_CODE_ARRAY: +- resolved_type = resolve_dynamic_array (type); ++ case TYPE_CODE_STRING: ++ resolved_type = resolve_dynamic_array (type, addr); + break; - case TYPE_CODE_RANGE: -- resolved_type = resolve_dynamic_range (type); -+ resolved_type = resolve_dynamic_range (type, addr); - break; + case TYPE_CODE_RANGE: +- resolved_type = resolve_dynamic_range (type); ++ resolved_type = resolve_dynamic_range (type, addr); + break; - case TYPE_CODE_UNION: -@@ -1887,6 +1971,25 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr, - break; + case TYPE_CODE_UNION: +@@ -1893,6 +1977,25 @@ resolve_dynamic_type_internal (struct ty + } } + /* Resolve data_location attribute. */ @@ -1161,7 +1147,7 @@ index e99a2f3..53cae2c 100644 return resolved_type; } -@@ -4104,6 +4207,27 @@ copy_type_recursive (struct objfile *objfile, +@@ -4110,6 +4213,27 @@ copy_type_recursive (struct objfile *obj *TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type); } @@ -1189,7 +1175,7 @@ index e99a2f3..53cae2c 100644 /* Copy pointers to other types. */ if (TYPE_TARGET_TYPE (type)) TYPE_TARGET_TYPE (new_type) = -@@ -4150,6 +4274,44 @@ copy_type (const struct type *type) +@@ -4156,6 +4280,44 @@ copy_type (const struct type *type) memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type), sizeof (struct main_type)); @@ -1234,11 +1220,11 @@ index e99a2f3..53cae2c 100644 return new_type; } -diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h -index 5008ef4..436edf8 100644 ---- a/gdb/gdbtypes.h -+++ b/gdb/gdbtypes.h -@@ -669,6 +669,10 @@ struct main_type +Index: gdb-7.8.1/gdb/gdbtypes.h +=================================================================== +--- gdb-7.8.1.orig/gdb/gdbtypes.h 2014-12-13 15:52:07.708310263 +0100 ++++ gdb-7.8.1/gdb/gdbtypes.h 2014-12-13 15:52:10.825307130 +0100 +@@ -670,6 +670,10 @@ struct main_type struct dynamic_prop high; @@ -1249,7 +1235,7 @@ index 5008ef4..436edf8 100644 /* True if HIGH range bound contains the number of elements in the subrange. This affects how the final hight bound is computed. */ -@@ -724,6 +728,23 @@ struct main_type +@@ -725,6 +729,23 @@ struct main_type struct func_type *func_stuff; } type_specific; @@ -1273,7 +1259,7 @@ index 5008ef4..436edf8 100644 }; /* * A ``struct type'' describes a particular instance of a type, with -@@ -1202,6 +1223,39 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -1203,6 +1224,39 @@ extern void allocate_gnat_aux_type (stru TYPE_RANGE_DATA(range_type)->high.kind #define TYPE_LOW_BOUND_KIND(range_type) \ TYPE_RANGE_DATA(range_type)->low.kind @@ -1313,7 +1299,7 @@ index 5008ef4..436edf8 100644 /* Moto-specific stuff for FORTRAN arrays. */ -@@ -1209,6 +1263,9 @@ extern void allocate_gnat_aux_type (struct type *); +@@ -1210,6 +1264,9 @@ extern void allocate_gnat_aux_type (stru TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) #define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \ TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype)) @@ -1323,7 +1309,7 @@ index 5008ef4..436edf8 100644 #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \ (TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype)))) -@@ -1677,6 +1734,7 @@ extern struct type *create_array_type_with_stride +@@ -1678,6 +1735,7 @@ extern struct type *create_array_type_wi extern struct type *create_range_type (struct type *, struct type *, const struct dynamic_prop *, @@ -1331,11 +1317,10 @@ index 5008ef4..436edf8 100644 const struct dynamic_prop *); extern struct type *create_array_type (struct type *, struct type *, -diff --git a/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp -new file mode 100644 -index 0000000..20607c3 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-alloc-assoc.exp 2014-12-13 15:52:10.825307130 +0100 @@ -0,0 +1,65 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1402,11 +1387,10 @@ index 0000000..20607c3 +gdb_continue_to_breakpoint "vla2-deallocated" +gdb_test "print l" " = \\.FALSE\\." "print vla2 deallocated" +gdb_test "print vla2" " = " "print deallocated vla2" -diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp -new file mode 100644 -index 0000000..20276d6 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-datatypes.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-datatypes.exp 2014-12-13 15:52:10.825307130 +0100 @@ -0,0 +1,82 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1490,11 +1474,10 @@ index 0000000..20276d6 + "print logicalvla(5,5,5) (2nd)" +gdb_test "print charactervla(5,5,5)" " = 'X'" \ + "print charactervla(5,5,5) (2nd)" -diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.f90 b/gdb/testsuite/gdb.fortran/vla-datatypes.f90 -new file mode 100644 -index 0000000..b11879a ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-datatypes.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-datatypes.f90 2014-12-13 15:52:10.825307130 +0100 @@ -0,0 +1,51 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -1547,11 +1530,10 @@ index 0000000..b11879a + ! dummy statement for bp + l = .FALSE. ! vlas-modified +end program vla_primitives -diff --git a/gdb/testsuite/gdb.fortran/vla-func.exp b/gdb/testsuite/gdb.fortran/vla-func.exp -new file mode 100644 -index 0000000..f0f236b ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-func.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-func.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-func.exp 2014-12-13 15:52:10.825307130 +0100 @@ -0,0 +1,61 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1614,11 +1596,10 @@ index 0000000..f0f236b + "print vla3 (after func2)" +gdb_test "ptype vla3" "type = integer\\\(kind=4\\\) \\\(10\\\)" \ + "ptype vla3 (after func2)" -diff --git a/gdb/testsuite/gdb.fortran/vla-func.f90 b/gdb/testsuite/gdb.fortran/vla-func.f90 -new file mode 100644 -index 0000000..4f45da1 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-func.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-func.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-func.f90 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,71 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -1691,11 +1672,10 @@ index 0000000..4f45da1 + + ret = .TRUE. ! func2-returned +end program vla_func -diff --git a/gdb/testsuite/gdb.fortran/vla-history.exp b/gdb/testsuite/gdb.fortran/vla-history.exp -new file mode 100644 -index 0000000..170e1eb ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-history.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-history.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-history.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,62 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1759,11 +1739,10 @@ index 0000000..170e1eb +# Try to access history values for vla values. +gdb_test "print \$9" " = 1311" "print \$9" +gdb_test "print \$10" " = 1001" "print \$10" -diff --git a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp -new file mode 100644 -index 0000000..2ee2914 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,87 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1852,11 +1831,10 @@ index 0000000..2ee2914 + "ptype array1(100) (arbitrary length)" +gdb_test "ptype array2(4,100)" "type = integer\\\(kind=4\\\)" \ + "ptype array2(4,100) (arbitrary length)" -diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp -new file mode 100644 -index 0000000..9267723 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-ptype.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-ptype.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,96 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -1954,11 +1932,10 @@ index 0000000..9267723 +gdb_test "ptype vla2(5, 45, 20)" \ + "no such vector element because not allocated" \ + "ptype vla2(5, 45, 20) not allocated" -diff --git a/gdb/testsuite/gdb.fortran/vla-sizeof.exp b/gdb/testsuite/gdb.fortran/vla-sizeof.exp -new file mode 100644 -index 0000000..6053c17 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-sizeof.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-sizeof.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-sizeof.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,46 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2006,11 +1983,10 @@ index 0000000..6053c17 +gdb_breakpoint [gdb_get_line_number "pvla-associated"] +gdb_continue_to_breakpoint "pvla-associated" +gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla" -diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp -new file mode 100644 -index 0000000..35f585d ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-stride.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-stride.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-stride.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,44 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2056,11 +2032,10 @@ index 0000000..35f585d +gdb_continue_to_breakpoint "single-element" +gdb_test "print pvla" " = \\\(5\\\)" "print single-element" +gdb_test "print pvla(1)" " = 5" "print one single-element" -diff --git a/gdb/testsuite/gdb.fortran/vla-stride.f90 b/gdb/testsuite/gdb.fortran/vla-stride.f90 -new file mode 100644 -index 0000000..6aa4f2b ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-stride.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-stride.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-stride.f90 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,30 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2092,11 +2067,10 @@ index 0000000..6aa4f2b + + pvla => null() ! single-element +end program vla_stride -diff --git a/gdb/testsuite/gdb.fortran/vla-strings.exp b/gdb/testsuite/gdb.fortran/vla-strings.exp -new file mode 100644 -index 0000000..7fc1734 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-strings.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-strings.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-strings.exp 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,104 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2202,11 +2176,10 @@ index 0000000..7fc1734 + "whatis var_char_p after associated" +gdb_test "ptype var_char_p" "type = PTR TO -> \\( character\\*7 \\)" \ + "ptype var_char_p after associated" -diff --git a/gdb/testsuite/gdb.fortran/vla-strings.f90 b/gdb/testsuite/gdb.fortran/vla-strings.f90 -new file mode 100644 -index 0000000..0a1d522 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-strings.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-strings.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-strings.f90 2014-12-13 15:52:10.826307129 +0100 @@ -0,0 +1,40 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2248,11 +2221,10 @@ index 0000000..0a1d522 + var_char_p => null() + l = associated(var_char_p) ! var_char_p-not-associated +end program vla_strings -diff --git a/gdb/testsuite/gdb.fortran/vla-sub.f90 b/gdb/testsuite/gdb.fortran/vla-sub.f90 -new file mode 100644 -index 0000000..8c2c9ff ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-sub.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-sub.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-sub.f90 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,82 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2336,11 +2308,10 @@ index 0000000..8c2c9ff + + call bar(sub_arr3, sub_arr1) +end program vla_sub -diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp -new file mode 100644 -index 0000000..fd11adb ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub-arbitrary.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,35 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2377,11 +2348,10 @@ index 0000000..fd11adb +gdb_test "p array1(100)" " = 100" "print arbitary array1(100)" +gdb_test "p array2(4,10)" " = 1" "print arbitary array2(4,10)" +gdb_test "p array2(4,100)" " = 1" "print arbitary array2(4,100)" -diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp -new file mode 100644 -index 0000000..a163617 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub-finish.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,49 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2432,11 +2402,10 @@ index 0000000..a163617 +gdb_test "p sub_arr2(1, 1, 1)" " = 30" "sub_arr2(1, 1, 1) after finish" +gdb_test "p sub_arr2(2, 1, 1)" " = 20" "sub_arr2(2, 1, 1) after finish" + -diff --git a/gdb/testsuite/gdb.fortran/vla-value-sub.exp b/gdb/testsuite/gdb.fortran/vla-value-sub.exp -new file mode 100644 -index 0000000..848f9d7 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-value-sub.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value-sub.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,90 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2528,11 +2497,10 @@ index 0000000..848f9d7 + "set array(2,2,2) to 20 in subroutine (passed vla)" +gdb_test "print array2" " = \\( *\\( *\\( *30, *20, *3,\[()3, .\]*\\)" \ + "print array2 in foo after it was mofified in debugger (passed vla)" -diff --git a/gdb/testsuite/gdb.fortran/vla-value.exp b/gdb/testsuite/gdb.fortran/vla-value.exp -new file mode 100644 -index 0000000..d7b8a1e ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla-value.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla-value.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,148 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2682,11 +2650,10 @@ index 0000000..d7b8a1e +gdb_continue_to_breakpoint "pvla-deassociated" +gdb_test "print \$mypvar(1,3,8)" " = 1001" \ + "print \$mypvar(1,3,8) after deallocated" -diff --git a/gdb/testsuite/gdb.fortran/vla.f90 b/gdb/testsuite/gdb.fortran/vla.f90 -new file mode 100644 -index 0000000..73425f3 ---- /dev/null -+++ b/gdb/testsuite/gdb.fortran/vla.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.fortran/vla.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.fortran/vla.f90 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,56 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2744,11 +2711,10 @@ index 0000000..73425f3 + allocate (vla3 (2,2)) ! vla2-deallocated + vla3(:,:) = 13 +end program vla -diff --git a/gdb/testsuite/gdb.mi/mi-vla-fortran.exp b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp -new file mode 100644 -index 0000000..72b0be2 ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +Index: gdb-7.8.1/gdb/testsuite/gdb.mi/mi-vla-fortran.exp +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.mi/mi-vla-fortran.exp 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,182 @@ +# Copyright 2014 Free Software Foundation, Inc. + @@ -2932,11 +2898,10 @@ index 0000000..72b0be2 + +mi_gdb_exit +return 0 -diff --git a/gdb/testsuite/gdb.mi/vla.f90 b/gdb/testsuite/gdb.mi/vla.f90 -new file mode 100644 -index 0000000..46edad2 ---- /dev/null -+++ b/gdb/testsuite/gdb.mi/vla.f90 +Index: gdb-7.8.1/gdb/testsuite/gdb.mi/vla.f90 +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ gdb-7.8.1/gdb/testsuite/gdb.mi/vla.f90 2014-12-13 15:52:10.827307128 +0100 @@ -0,0 +1,42 @@ +! Copyright 2014 Free Software Foundation, Inc. +! @@ -2980,10 +2945,10 @@ index 0000000..46edad2 + pvla2 => null() + l = associated(pvla2) ! pvla2-set-to-null +end program vla -diff --git a/gdb/typeprint.c b/gdb/typeprint.c -index 026f3a2..4c861ac 100644 ---- a/gdb/typeprint.c -+++ b/gdb/typeprint.c +Index: gdb-7.8.1/gdb/typeprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/typeprint.c 2014-12-13 15:52:07.710310261 +0100 ++++ gdb-7.8.1/gdb/typeprint.c 2014-12-13 15:52:10.828307127 +0100 @@ -459,6 +459,13 @@ whatis_exp (char *exp, int show) type = value_type (val); @@ -2998,11 +2963,11 @@ index 026f3a2..4c861ac 100644 get_user_print_options (&opts); if (opts.objectprint) { -diff --git a/gdb/valarith.c b/gdb/valarith.c -index 4da41cb..fb9671b 100644 ---- a/gdb/valarith.c -+++ b/gdb/valarith.c -@@ -195,12 +195,31 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) +Index: gdb-7.8.1/gdb/valarith.c +=================================================================== +--- gdb-7.8.1.orig/gdb/valarith.c 2014-12-13 15:52:07.711310260 +0100 ++++ gdb-7.8.1/gdb/valarith.c 2014-12-13 15:52:10.828307127 +0100 +@@ -195,12 +195,31 @@ value_subscripted_rvalue (struct value * 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); @@ -3036,11 +3001,11 @@ index 4da41cb..fb9671b 100644 if (VALUE_LVAL (array) == lval_memory && value_lazy (array)) v = allocate_value_lazy (elt_type); -diff --git a/gdb/valprint.c b/gdb/valprint.c -index 8600b34..2f8eac1 100644 ---- a/gdb/valprint.c -+++ b/gdb/valprint.c -@@ -307,6 +307,18 @@ valprint_check_validity (struct ui_file *stream, +Index: gdb-7.8.1/gdb/valprint.c +=================================================================== +--- gdb-7.8.1.orig/gdb/valprint.c 2014-12-13 15:52:07.712310259 +0100 ++++ gdb-7.8.1/gdb/valprint.c 2014-12-13 15:52:10.828307127 +0100 +@@ -307,6 +307,18 @@ valprint_check_validity (struct ui_file { CHECK_TYPEDEF (type); @@ -3059,7 +3024,7 @@ index 8600b34..2f8eac1 100644 if (TYPE_CODE (type) != TYPE_CODE_UNION && TYPE_CODE (type) != TYPE_CODE_STRUCT && TYPE_CODE (type) != TYPE_CODE_ARRAY) -@@ -362,6 +374,18 @@ val_print_invalid_address (struct ui_file *stream) +@@ -362,6 +374,18 @@ val_print_invalid_address (struct ui_fil fprintf_filtered (stream, _("")); } @@ -3095,7 +3060,7 @@ index 8600b34..2f8eac1 100644 if (value_entirely_optimized_out (val)) { if (options->summary && !val_print_scalar_type_p (value_type (val))) -@@ -834,6 +862,18 @@ value_check_printable (struct value *val, struct ui_file *stream, +@@ -834,6 +862,18 @@ value_check_printable (struct value *val return 0; } @@ -3114,11 +3079,11 @@ index 8600b34..2f8eac1 100644 return 1; } -diff --git a/gdb/valprint.h b/gdb/valprint.h -index 6698247..7a415cf 100644 ---- a/gdb/valprint.h -+++ b/gdb/valprint.h -@@ -217,4 +217,8 @@ extern void output_command_const (const char *args, int from_tty); +Index: gdb-7.8.1/gdb/valprint.h +=================================================================== +--- gdb-7.8.1.orig/gdb/valprint.h 2014-12-13 15:52:07.712310259 +0100 ++++ gdb-7.8.1/gdb/valprint.h 2014-12-13 15:52:10.828307127 +0100 +@@ -217,4 +217,8 @@ extern void output_command_const (const extern int val_print_scalar_type_p (struct type *type); @@ -3127,10 +3092,10 @@ index 6698247..7a415cf 100644 +extern void val_print_not_associated (struct ui_file *stream); + #endif -diff --git a/gdb/value.c b/gdb/value.c -index 29abe5f..5efea89 100644 ---- a/gdb/value.c -+++ b/gdb/value.c +Index: gdb-7.8.1/gdb/value.c +=================================================================== +--- gdb-7.8.1.orig/gdb/value.c 2014-12-13 15:52:07.713310258 +0100 ++++ gdb-7.8.1/gdb/value.c 2014-12-13 15:52:10.829307126 +0100 @@ -43,6 +43,7 @@ #include "tracepoint.h" #include "cp-abi.h" @@ -3139,7 +3104,7 @@ index 29abe5f..5efea89 100644 /* Prototypes for exported functions. */ -@@ -1627,6 +1628,25 @@ set_value_component_location (struct value *component, +@@ -1649,6 +1650,25 @@ set_value_component_location (struct val if (funcs->copy_closure) component->location.computed.closure = funcs->copy_closure (whole); } @@ -3165,7 +3130,7 @@ index 29abe5f..5efea89 100644 } -@@ -2931,13 +2951,22 @@ value_primitive_field (struct value *arg1, int offset, +@@ -2953,13 +2973,22 @@ value_primitive_field (struct value *arg v = allocate_value_lazy (type); else { @@ -3194,7 +3159,7 @@ index 29abe5f..5efea89 100644 } set_value_component_location (v, arg1); VALUE_REGNUM (v) = VALUE_REGNUM (arg1); -@@ -3520,7 +3549,8 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type, +@@ -3542,7 +3571,8 @@ readjust_indirect_value_type (struct val struct value *original_value) { /* Re-adjust type. */ @@ -3204,7 +3169,7 @@ index 29abe5f..5efea89 100644 /* Add embedding info. */ set_value_enclosing_type (value, enc_type); -@@ -3537,6 +3567,12 @@ coerce_ref (struct value *arg) +@@ -3559,6 +3589,12 @@ coerce_ref (struct value *arg) struct value *retval; struct type *enc_type; @@ -3217,7 +3182,7 @@ index 29abe5f..5efea89 100644 retval = coerce_ref_if_computed (arg); if (retval) return retval; -@@ -3680,8 +3716,14 @@ value_fetch_lazy (struct value *val) +@@ -3702,8 +3738,14 @@ value_fetch_lazy (struct value *val) } else if (VALUE_LVAL (val) == lval_memory) { diff --git a/SOURCES/python-framefilter-invalidarg.patch b/SOURCES/python-framefilter-invalidarg.patch deleted file mode 100644 index 4c1f16b..0000000 --- a/SOURCES/python-framefilter-invalidarg.patch +++ /dev/null @@ -1,596 +0,0 @@ -http://sourceware.org/ml/gdb-patches/2014-08/msg00364.html -Subject: [patch+7.8?] Fix crash on Python frame filters with unreadable arg - - ---d6Gm4EdcadzBjdND -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline - -Hi, - -https://bugzilla.redhat.com/show_bug.cgi?id=1126177 - -ERROR: AddressSanitizer: SEGV on unknown address 0x000000000050 (pc 0x000000992bef sp 0x7ffff9039530 bp 0x7ffff9039540 T0) - #0 0x992bee in value_type .../gdb/value.c:925 - #1 0x87c951 in py_print_single_arg python/py-framefilter.c:445 - #2 0x87cfae in enumerate_args python/py-framefilter.c:596 - #3 0x87e0b0 in py_print_args python/py-framefilter.c:968 - -It crashes because frame_arg::val is documented it may contain NULL -(frame_arg::error is then non-NULL) but the code does not handle it. - -Another bug is that py_print_single_arg() calls goto out of its TRY_CATCH -which messes up GDB cleanup chain crashing GDB later. - -I tried to somehow separate it to two patches first but it in the end kept -them merged. - -No regressions on {x86_64,x86_64-m32,i686}-fedorarawhide-linux-gnu. - -It is probably 7.7 regression (I have not verified it) due to the introduction -of Python frame filters. - -I am not sure if it is more suitable for gdb.arch/ or gdb.python/ , used the -latter. - - -Thanks, -Jan - ---d6Gm4EdcadzBjdND -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename="pyinvalidarg.patch" - -gdb/ -2014-08-19 Jan Kratochvil - - * python/py-framefilter.c (py_print_single_arg): Handle NULL FA->VAL. - Fix goto out of TRY_CATCH. - -gdb/testsuite/ -2014-08-19 Jan Kratochvil - - * gdb.python/amd64-py-framefilter-invalidarg.S: New file. - * gdb.python/py-framefilter-invalidarg-gdb.py.in: New file. - * gdb.python/py-framefilter-invalidarg.exp: New file. - * gdb.python/py-framefilter-invalidarg.py: New file. - -diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c -index 9db83c7..d53282f 100644 ---- a/gdb/python/py-framefilter.c -+++ b/gdb/python/py-framefilter.c -@@ -365,9 +365,12 @@ py_print_single_arg (struct ui_out *out, - { - struct value *val; - volatile struct gdb_exception except; -+ enum ext_lang_bt_status retval = EXT_LANG_BT_OK; - - if (fa != NULL) - { -+ if (fa->val == NULL && fa->error == NULL) -+ return EXT_LANG_BT_OK; - language = language_def (SYMBOL_LANGUAGE (fa->sym)); - val = fa->val; - } -@@ -433,16 +436,18 @@ py_print_single_arg (struct ui_out *out, - /* For MI print the type, but only for simple values. This seems - weird, but this is how MI choose to format the various output - types. */ -- if (args_type == MI_PRINT_SIMPLE_VALUES) -+ if (args_type == MI_PRINT_SIMPLE_VALUES && val != NULL) - { - if (py_print_type (out, val) == EXT_LANG_BT_ERROR) - { -+ retval = EXT_LANG_BT_ERROR; - do_cleanups (cleanups); -- goto error; -+ continue; - } - } - -- annotate_arg_value (value_type (val)); -+ if (val != NULL) -+ annotate_arg_value (value_type (val)); - - /* If the output is to the CLI, and the user option "set print - frame-arguments" is set to none, just output "...". */ -@@ -454,27 +459,25 @@ py_print_single_arg (struct ui_out *out, - for the case of MI_PRINT_NO_VALUES. */ - if (args_type != NO_VALUES) - { -- if (py_print_value (out, val, opts, 0, args_type, language) -- == EXT_LANG_BT_ERROR) -+ if (val == NULL) - { -- do_cleanups (cleanups); -- goto error; -+ gdb_assert (fa != NULL && fa->error != NULL); -+ ui_out_field_fmt (out, "value", -+ _(""), -+ fa->error); - } -+ else if (py_print_value (out, val, opts, 0, args_type, language) -+ == EXT_LANG_BT_ERROR) -+ retval = EXT_LANG_BT_ERROR; - } - } - - do_cleanups (cleanups); - } - if (except.reason < 0) -- { -- gdbpy_convert_exception (except); -- goto error; -- } -- -- return EXT_LANG_BT_OK; -+ gdbpy_convert_exception (except); - -- error: -- return EXT_LANG_BT_ERROR; -+ return retval; - } - - /* Helper function to loop over frame arguments provided by the -diff --git a/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S b/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S -new file mode 100755 -index 0000000..3ac1b23 ---- /dev/null -+++ b/gdb/testsuite/gdb.python/amd64-py-framefilter-invalidarg.S -@@ -0,0 +1,261 @@ -+/* This testcase is part of GDB, the GNU debugger. -+ -+ Copyright 2014 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 a single line -+ int main (int argc, char **argv) { return 0; } -+ using -g -dA -S -O2 and patched as #if-ed below. */ -+ -+ .file "py-framefilter-invalidarg.c" -+ .text -+.Ltext0: -+ .globl main -+ .type main, @function -+main: -+.LFB0: -+ .file 1 "py-framefilter-invalidarg.c" -+ # py-framefilter-invalidarg.c:1 -+ .loc 1 1 0 -+ .cfi_startproc -+# BLOCK 2 seq:0 -+# PRED: ENTRY (FALLTHRU) -+ pushq %rbp -+ .cfi_def_cfa_offset 16 -+ .cfi_offset 6, -16 -+ movq %rsp, %rbp -+ .cfi_def_cfa_register 6 -+ movl %edi, -4(%rbp) -+ movq %rsi, -16(%rbp) -+ # py-framefilter-invalidarg.c:2 -+ .loc 1 2 0 -+ movl $0, %eax -+ # py-framefilter-invalidarg.c:3 -+ .loc 1 3 0 -+ popq %rbp -+ .cfi_def_cfa 7, 8 -+# SUCC: EXIT [100.0%] -+ ret -+ .cfi_endproc -+.LFE0: -+ .size main, .-main -+.Letext0: -+ .section .debug_info,"",@progbits -+.Ldebug_info0: -+ .long .Le - .Ls # Length of Compilation Unit Info -+.Ls: -+ .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 .LASF3 # DW_AT_producer: "GNU C 4.9.1 20140813 (Red Hat 4.9.1-7) -mtune=generic -march=x86-64 -g" -+ .byte 0x1 # DW_AT_language -+ .long .LASF4 # DW_AT_name: "py-framefilter-invalidarg.c" -+ .long .LASF5 # DW_AT_comp_dir: "" -+ .quad .Ltext0 # DW_AT_low_pc -+ .quad .Letext0-.Ltext0 # DW_AT_high_pc -+ .long .Ldebug_line0 # DW_AT_stmt_list -+die2d: -+ .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram) -+ # DW_AT_external -+ .long .LASF6 # DW_AT_name: "main" -+ .byte 0x1 # DW_AT_decl_file (py-framefilter-invalidarg.c) -+ .byte 0x1 # DW_AT_decl_line -+ # DW_AT_prototyped -+ .long die6b-.Ldebug_info0 # DW_AT_type -+ .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 -+die4e: -+ .uleb128 0x3 # (DIE (0x4e) DW_TAG_formal_parameter) -+ .long .LASF0 # DW_AT_name: "argc" -+ .byte 0x1 # DW_AT_decl_file (py-framefilter-invalidarg.c) -+ .byte 0x1 # DW_AT_decl_line -+ .long die6b-.Ldebug_info0 # DW_AT_type -+#if 0 -+ .uleb128 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -20 -+#endif -+#if 0 -+ .uleb128 1f - 2f # DW_AT_location -+2: -+ .byte 0x03 # DW_OP_addr -+ .quad 0 -+1: -+#endif -+#if 1 -+ .uleb128 1f - 2f # DW_AT_location -+2: -+ .byte 0x13 # DW_OP_drop -+ .quad 0 -+1: -+#endif -+die5c: -+ .uleb128 0x3 # (DIE (0x5c) DW_TAG_formal_parameter) -+ .long .LASF1 # DW_AT_name: "argv" -+ .byte 0x1 # DW_AT_decl_file (py-framefilter-invalidarg.c) -+ .byte 0x1 # DW_AT_decl_line -+ .long die72-.Ldebug_info0 # DW_AT_type -+ .uleb128 0x2 # DW_AT_location -+ .byte 0x91 # DW_OP_fbreg -+ .sleb128 -32 -+ .byte 0 # end of children of DIE 0x2d -+die6b: -+ .uleb128 0x4 # (DIE (0x6b) DW_TAG_base_type) -+ .byte 0x4 # DW_AT_byte_size -+ .byte 0x5 # DW_AT_encoding -+ .ascii "int\0" # DW_AT_name -+die72: -+ .uleb128 0x5 # (DIE (0x72) DW_TAG_pointer_type) -+ .byte 0x8 # DW_AT_byte_size -+ .long die78-.Ldebug_info0 # DW_AT_type -+die78: -+ .uleb128 0x5 # (DIE (0x78) DW_TAG_pointer_type) -+ .byte 0x8 # DW_AT_byte_size -+ .long die7e-.Ldebug_info0 # DW_AT_type -+die7e: -+ .uleb128 0x6 # (DIE (0x7e) DW_TAG_base_type) -+ .byte 0x1 # DW_AT_byte_size -+ .byte 0x6 # DW_AT_encoding -+ .long .LASF2 # DW_AT_name: "char" -+ .byte 0 # end of children of DIE 0xb -+.Le: -+ .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 0x11 # (DW_AT_low_pc) -+ .uleb128 0x1 # (DW_FORM_addr) -+ .uleb128 0x12 # (DW_AT_high_pc) -+ .uleb128 0x7 # (DW_FORM_data8) -+ .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 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 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) -+ .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 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 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 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 -+ .uleb128 0x6 # (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 -+ .byte 0 -+ .section .debug_aranges,"",@progbits -+ .long 0x2c # 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 0 -+ .quad 0 -+ .section .debug_line,"",@progbits -+.Ldebug_line0: -+ .section .debug_str,"MS",@progbits,1 -+.LASF1: -+ .string "argv" -+.LASF4: -+ .string "py-framefilter-invalidarg.c" -+.LASF5: -+ .string "" -+.LASF0: -+ .string "argc" -+.LASF3: -+ .string "GNU C 4.9.1 20140813 (Red Hat 4.9.1-7) -mtune=generic -march=x86-64 -g" -+.LASF6: -+ .string "main" -+.LASF2: -+ .string "char" -+ .ident "GCC: (GNU) 4.9.1 20140813 (Red Hat 4.9.1-7)" -+ .section .note.GNU-stack,"",@progbits -diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py.in b/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py.in -new file mode 100644 -index 0000000..1fa6ffc ---- /dev/null -+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg-gdb.py.in -@@ -0,0 +1,48 @@ -+# Copyright (C) 2014 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 tests Python-based -+# frame-filters. -+import gdb -+import itertools -+from gdb.FrameDecorator import FrameDecorator -+ -+ -+class FrameObjFile (): -+ -+ def __init__ (self): -+ self.name = "Filter1" -+ self.priority = 1 -+ self.enabled = False -+ gdb.current_progspace().frame_filters ["Progspace" + self.name] = self -+ gdb.current_objfile().frame_filters ["ObjectFile" + self.name] = self -+ -+ def filter (self, frame_iter): -+ return frame_iter -+ -+class FrameObjFile2 (): -+ -+ def __init__ (self): -+ self.name = "Filter2" -+ self.priority = 100 -+ self.enabled = True -+ gdb.current_progspace().frame_filters ["Progspace" + self.name] = self -+ gdb.current_objfile().frame_filters ["ObjectFile" + self.name] = self -+ -+ def filter (self, frame_iter): -+ return frame_iter -+ -+FrameObjFile() -+FrameObjFile2() -diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp -new file mode 100644 -index 0000000..f70d16e ---- /dev/null -+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp -@@ -0,0 +1,67 @@ -+# Copyright (C) 2014 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 . -+ -+load_lib gdb-python.exp -+ -+standard_testfile amd64-py-framefilter-invalidarg.S -+ -+if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { -+ verbose "Skipping py-framefilter-invalidarg." -+ return -+} -+ -+# We cannot use prepare_for_testing as we have to set the safe-patch -+# to check objfile and progspace printers. -+if {[build_executable $testfile.exp $testfile $srcfile {}] == -1} { -+ return -1 -+} -+ -+# Start with a fresh gdb. -+gdb_exit -+gdb_start -+ -+# Skip all tests if Python scripting is not enabled. -+if { [skip_python_tests] } { continue } -+ -+# Make the -gdb.py script available to gdb, it is automagically loaded by gdb. -+# Care is taken to put it in the same directory as the binary so that -+# gdb will find it. -+set remote_obj_python_file \ -+ [remote_download \ -+ host ${srcdir}/${subdir}/${testfile}-gdb.py.in \ -+ [standard_output_file ${testfile}-gdb.py]] -+ -+gdb_reinitialize_dir $srcdir/$subdir -+gdb_test_no_output "set auto-load safe-path ${remote_obj_python_file}" \ -+ "set auto-load safe-path" -+gdb_load ${binfile} -+# Verify gdb loaded the script. -+gdb_test "info auto-load python-scripts" "Yes.*/${testfile}-gdb.py.*" \ -+ "Test auto-load had loaded python scripts" -+ -+if ![runto_main] then { -+ perror "couldn't run to breakpoint" -+ return -+} -+gdb_test_no_output "set python print-stack full" \ -+ "Set python print-stack to full" -+ -+# Load global frame-filters -+set remote_python_file [gdb_remote_download host \ -+ ${srcdir}/${subdir}/${testfile}.py] -+gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \ -+ "Load python file" -+ -+gdb_test "bt" " in niam \\(argc=, argv=0x\[0-9a-f\]+\\) at py-framefilter-invalidarg.c:\[0-9\]+" "bt full with filters" -diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py -new file mode 100644 -index 0000000..d5f92cb ---- /dev/null -+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.py -@@ -0,0 +1,59 @@ -+# Copyright (C) 2014 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 tests Python-based -+# frame-filters. -+import gdb -+import itertools -+from gdb.FrameDecorator import FrameDecorator -+import copy -+ -+class Reverse_Function (FrameDecorator): -+ -+ def __init__(self, fobj): -+ super(Reverse_Function, self).__init__(fobj) -+ self.fobj = fobj -+ -+ def function (self): -+ fname = str (self.fobj.function()) -+ if (fname == None or fname == ""): -+ return None -+ if fname == 'end_func': -+ extra = self.fobj.inferior_frame().read_var('str').string() -+ else: -+ extra = '' -+ fname = fname[::-1] + extra -+ return fname -+ -+class FrameFilter (): -+ -+ def __init__ (self): -+ self.name = "Reverse" -+ self.priority = 100 -+ self.enabled = True -+ gdb.frame_filters [self.name] = self -+ -+ def filter (self, frame_iter): -+ # Python 3.x moved the itertools.imap functionality to map(), -+ # so check if it is available. -+ if hasattr(itertools, "imap"): -+ frame_iter = itertools.imap (Reverse_Function, -+ frame_iter) -+ else: -+ frame_iter = map(Reverse_Function, frame_iter) -+ -+ return frame_iter -+ -+FrameFilter() - ---d6Gm4EdcadzBjdND-- - diff --git a/SPECS/gdb.spec b/SPECS/gdb.spec index 850398d..ea01ffc 100644 --- a/SPECS/gdb.spec +++ b/SPECS/gdb.spec @@ -22,17 +22,17 @@ Name: %{?scl_prefix}gdb # See timestamp of source gnulib installed into gdb/gnulib/ . %global snapgnulib 20121213 %global tarname gdb-%{version} -Version: 7.8 +Version: 7.8.2 # The release always contains a leading reserved number, start it at 1. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. -Release: 21%{?dist} +Release: 38%{?dist} License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL Group: Development/Debuggers # Do not provide URL for snapshots as the file lasts there only for 2 days. -# ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.gz -Source: %{tarname}.tar.gz +# ftp://sourceware.org/pub/gdb/releases/gdb-%{version}.tar.xz +Source: %{tarname}.tar.xz Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) URL: http://gnu.org/software/gdb/ @@ -524,20 +524,28 @@ Patch921: gdb-python-completer-2of2.patch # Display Fortran strings in backtraces. Patch925: gdb-fortran-frame-string.patch -# Fix -Werror=unused-variable error configuring babeltrace. -# Fix babeltrace errors (Yao Qi). -Patch926: gdb-babeltrace-configure.patch -Patch928: gdb-babeltrace-minsize.patch - # Fix Python GIL with gdb.execute("continue") (Phil Muldoon, BZ 1116957). Patch927: gdb-python-gil.patch -# Fix crash on Python frame filters with unreadable arg (BZ 1126177). -Patch929: python-framefilter-invalidarg.patch - # Fix GDB SIGTT* Stopped when using the PID argument (BZ 1136704, Pedro Alves). -Patch930: gdb-async-stopped-on-pid-arg-1of2.patch -Patch931: gdb-async-stopped-on-pid-arg-2of2.patch +Patch970: gdb-async-stopped-on-pid-arg-testsuite.patch + +# Fix "save breakpoints" for signal catchpoints and disabled breakpoints +# (BZ 1146170, Miroslav Franc). +Patch971: gdb-save-breakpoints-fix.patch + +# Fix 'Slow gstack performance' (RH BZ 1103894, Jan Kratochvil). +Patch973: gdb-slow-gstack-performance.patch + +# Accelerate interactive symbols lookup 15x. +Patch975: gdb-symbols-lookup-accel.patch + +# Fix '[RFE] please add add-auto-load-scripts-directory command' (RH +# BZ 1163339, Jan Kratochvil). +Patch976: gdb-rhbz1163339-add-auto-load-scripts-directory.patch + +# Fix jit-reader.h for multi-lib. +Patch978: gdb-jit-reader-multilib.patch %if 0%{!?rhel:1} || 0%{?rhel} > 6 # RL_STATE_FEDORA_GDB would not be found for: @@ -714,8 +722,8 @@ find -name "*.info*"|xargs rm -f # Match the Fedora's version info. %patch2 -p1 -%patch349 -p1 %patch232 -p1 +%patch349 -p1 %patch888 -p1 %patch912 -p1 %patch889 -p1 @@ -822,12 +830,13 @@ find -name "*.info*"|xargs rm -f %patch920 -p1 %patch921 -p1 %patch925 -p1 -%patch926 -p1 -%patch928 -p1 %patch927 -p1 -%patch929 -p1 -%patch930 -p1 -%patch931 -p1 +%patch970 -p1 +%patch971 -p1 +%patch973 -p1 +%patch975 -p1 +%patch976 -p1 +%patch978 -p1 %patch848 -p1 %if 0%{!?el6:1} @@ -1192,7 +1201,9 @@ rm -rf $RPM_BUILD_ROOT%{_datadir}/locale/ rm -f $RPM_BUILD_ROOT%{_infodir}/bfd* rm -f $RPM_BUILD_ROOT%{_infodir}/standard* rm -f $RPM_BUILD_ROOT%{_infodir}/configure* -rm -rf $RPM_BUILD_ROOT%{_includedir} +# Just exclude the header files in the top directory, and don't exclude +# the gdb/ directory, as it contains jit-reader.h. +rm -rf $RPM_BUILD_ROOT%{_includedir}/*.h rm -rf $RPM_BUILD_ROOT/%{_libdir}/lib{bfd*,opcodes*,iberty*} # pstack obsoletion @@ -1264,6 +1275,9 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/pstack %{_mandir}/*/pstack.1* %{_datadir}/gdb +# Provide jit-reader.h so that users are able to write their own GDB JIT +# plugins. +%{_includedir}/gdb # don't include the files in include, they are part of binutils @@ -1323,6 +1337,61 @@ then fi %changelog +* Thu Jan 15 2015 Jan Kratochvil - 7.8.2-38.fc21 +- Rebase to 7.8.2. + +* Wed Jan 7 2015 Jan Kratochvil - 7.8.1-37.fc21 +- Fix jit-reader.h for multi-lib. + +* Sun Dec 28 2014 Jan Kratochvil - 7.8.1-36.fc21 +- Rebase to 7.8.1.20141228 for a performance fix (PR binutils/17677). + +* Sat Dec 13 2014 Jan Kratochvil - 7.8.1-35.fc21 +- Fix resolve_dynamic_struct: Assertion `TYPE_NFIELDS (type) > 0' (PR 17642). + +* Sat Nov 22 2014 Jan Kratochvil - 7.8.1-34.fc21 +- [ppc64] Fix compatibility of Fedora errno workaround (for RH BZ 1166549). + +* Fri Nov 21 2014 Jan Kratochvil - 7.8.1-33.fc21 +- Fix regression accessing errno from a core file (RH BZ 1166549). + +* Thu Nov 20 2014 Sergio Durigan Junior - 7.8.1-32.fc21 +- Fix 'Unowned dir /usr/include/gdb/' (RH BZ 1164991). + +* Sat Nov 15 2014 Jan Kratochvil - 7.8.1-31.fc21 +- Fix '[RFE] please add add-auto-load-scripts-directory command' (RH + BZ 1163339, Jan Kratochvil). + +* Thu Oct 30 2014 Jan Kratochvil - 7.8.1-30.fc21 +- Rebase to FSF GDB 7.8.1. + +* Mon Oct 27 2014 Jan Kratochvil - 7.8-29.fc21 +- Backport vDSO regression. +- Revert the makeinfo workaround from 7.8-27.fc21. +- Further 1.75x improvement of the interactive symbols lookup (Doug Evans). + +* Mon Oct 20 2014 Jan Kratochvil - 7.8-28.fc21 +- Accelerate interactive symbols lookup 15x. + +* Sun Oct 19 2014 Jan Kratochvil - 7.8-27.fc21 +- Workaround makeinfo F-22 Bug 1154436. + +* Sun Oct 19 2014 Jan Kratochvil - 7.8-26.fc21 +- Import 5 upstream gdb-7.8 branch fixes (async fix by Pedro Alves). + +* Fri Oct 03 2014 Sergio Durigan Junior - 7.8-25.fc21 +- Fix 'Slow gstack performance' (RH BZ 1103894, Jan Kratochvil). + +* Fri Oct 3 2014 Jan Kratochvil - 7.8-24.fc21 +- Fix "save breakpoints" for signal catchpoints and disabled breakpoints + (BZ 1146170, Miroslav Franc). + +* Mon Sep 15 2014 Sergio Durigan Junior - 7.8-23.fc21 +- Install gdb/jit-reader.h on include directory (BZ 1141968). + +* Sun Sep 14 2014 Jan Kratochvil - 7.8-22.fc21 +- [testsuite] Fix runaway gdb.base/attach processes. + * Sun Sep 7 2014 Jan Kratochvil - 7.8-21.fc21 - Fix GDB SIGTT* Stopped when using the PID argument (BZ 1136704, Pedro Alves).