From 902c8e5abca19590075fa0f8457f5d7cec9303ca Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Thu, 24 Jul 2014 20:04:47 +0200 Subject: [PATCH] Rebase to FSF GDB 7.7.91.20140724 (pre-7.8 snapshot). - Import TUI regression fix (Pedro Alves, BZ 1123003). --- .gitignore | 2 +- gdb-testsuite-pagination-read1.patch | 612 +++++++++++++-------------- gdb-upstream.patch | 88 ++++ gdb.spec | 16 +- sources | 2 +- 5 files changed, 402 insertions(+), 318 deletions(-) diff --git a/.gitignore b/.gitignore index bb0d7a7..db344d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /gdb-libstdc++-v3-python-r155978.tar.bz2 -/gdb-7.7.91.20140721.tar.bz2 +/gdb-7.7.91.20140724.tar.bz2 diff --git a/gdb-testsuite-pagination-read1.patch b/gdb-testsuite-pagination-read1.patch index 58fb132..d0c2a82 100644 --- a/gdb-testsuite-pagination-read1.patch +++ b/gdb-testsuite-pagination-read1.patch @@ -1,93 +1,232 @@ -http://sourceware.org/ml/gdb-patches/2014-07/msg00553.html -Subject: [testsuite patch] Fix paginate-*.exp race for "read1" +http://sourceware.org/ml/gdb-patches/2014-07/msg00593.html +Subject: Re: [testsuite patch] Fix paginate-*.exp race for "read1" +Hi Jan, ---17pEHd4RhPHOinZp -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline +Thanks for noticing this. It'd be very nice IMO to put that read1 +trick in the sources somewhere, to make it easy (easier) to use. Ideally +we'd have a simple Makefile flag to activate it, like 'make check READ1="1"' +or some such, but really just putting the files as attached to the PR, as +is, with absolutely no other glue at all, not even a Makefile, under +gdb/contrib/read1 or some such would already be great. We can always +improve and integrate things more incrementally. WDYT? -Hi Pedro, +On 07/22/2014 06:36 PM, Jan Kratochvil wrote: -these testcase have racy results: - gdb.base/double-prompt-target-event-error.exp - gdb.base/paginate-after-ctrl-c-running.exp - gdb.base/paginate-bg-execution.exp - gdb.base/paginate-execution-startup.exp - gdb.base/paginate-inferior-exit.exp +> + global saw_continuing +> set saw_continuing 0 +> set test "continue to pagination" +> - gdb_test_multiple "$command" $test { +> - -re "$pagination_prompt$" { +> - if {$saw_continuing} { +> - pass $test +> - } else { +> - send_gdb "\n" +> - exp_continue +> - } +> + gdb_test_pagination $command $test { +> + global saw_continuing +> + if {$saw_continuing} { +> + pass $test +> + } else { +> + send_gdb "\n" +> + exp_continue +> } +> + } { +> -re "Continuing" { +> + global saw_continuing +> set saw_continuing 1 -reproducible with "read1" from: - reproducer for races of expect incomplete reads - http://sourceware.org/bugzilla/show_bug.cgi?id=12649 +The need for these "global"s indicates an issue +with uplevel/upvar in the new procedure. -# Prevent gdb_test_multiple considering an error -re "" match. -# For unknown reason -notransfer -re "" { exp_continue } does not -# prevent it. +> exp_continue +> } +> - -notransfer -re "" { +> - # Otherwise gdb_test_multiple considers this an error. +> - exp_continue +> - } +> } +> +> # We're now stopped in a pagination query while handling a -Tested on Fedora 20 x86_64 and Fedora Rawhide x86_64 that -notransfer does not -work there: - expect-5.45-10.fc20.x86_64 - expect-5.45-16.fc21.x86_64 +> +proc gdb_test_pagination { command test { code_prompt3 {} } { code_append {} } } { +... +> + append code_append { +... +> + -re "${pagination_prompt3}$" { +> + if { $saw_pagination_prompt != 2 } { +> + fail "$test (3)" +> + } +> + set saw_pagination_prompt 3 +> + eval $code_prompt3 -Sure if someone gets -notransfer working this patch could be dropped. +The issue is that $code_prompt3 and $code_append should really be +evaluated in this function's caller ... +> + } +> + } +> + +> + set saw_pagination_prompt 0 +> + gdb_test_multiple $command $test $code_append -Jan +... but gdb_test_multiple evaluates the passed in $code_append +in the context of "uplevel 1" (and likewise it does a couple +upvar's with level one. To make that work, you'd need to +rename gdb_test_multiple to gdb_test_multiple_with_level or +some such, add a 'level' parameter, and pass that as level to +the existing uplevel/upvar calls. Then in gdb_test_pagination +you'd pass in "two levels up", like: ---17pEHd4RhPHOinZp -Content-Type: text/plain; charset=us-ascii -Content-Disposition: inline; filename=1 + gdb_test_multiple_with_level 2 $command $test $code_append + +instead, and likewise gdb_test_multiple would be reimplemented in +terms of gdb_test_multiple_with_level. + +But... We don't really need ... + +> +# Prevent gdb_test_multiple considering an error -re "" match. +> +# For unknown reason -notransfer -re "" { exp_continue } does not +> +# prevent it. +> + +> +proc gdb_test_pagination { command test { code_prompt3 {} } { code_append {} } } { +> + global pagination_prompt1 pagination_prompt2 pagination_prompt3 +> + global gdb_prompt +> + +> + # A regexp that matches the pagination prompt. +> + set pagination_prompt1 "---Type + set pagination_prompt2 "> to continue, or q + set pagination_prompt3 "> to quit---" +> + + +... this, if we instead tackle what IMO is the root of the +issue, and make gdb_test_multiple match the whole pagination +prompt, like in the patch below. I should really have done +this in the first place. :-/ + +This fixes the races for me, even when stressing them in +parallel mode, as mentioned in the commit log. +Does this fix them for you too? + +---------- +>From 0c6260e734bdb28272119d50b0150fb777a458ab Mon Sep 17 00:00:00 2001 +From: Pedro Alves +Date: Wed, 23 Jul 2014 17:00:21 +0100 +Subject: [PATCH] Fix paginate-*.exp races +Subject: [PATCH] Fix paginate-*.exp races + +These testcases have racy results: + + gdb.base/double-prompt-target-event-error.exp + gdb.base/paginate-after-ctrl-c-running.exp + gdb.base/paginate-bg-execution.exp + gdb.base/paginate-execution-startup.exp + gdb.base/paginate-inferior-exit.exp + +This is easily reproducible with "read1" from: + + [reproducer for races of expect incomplete reads] + http://sourceware.org/bugzilla/show_bug.cgi?id=12649 + +The '-notransfer -re "" { exp_continue }' trick in the current +tests doesn't actually work. + +The issue that led to the -notransfer trick was that + + "---Type to continue, or q to quit---" + +has two ""s. If one wants gdb_test_multiple to not hit the +built-in "" match that results in FAIL, one has to expect the +pagination prompt in chunks, first up to the first "", then +again, up to the second. Something around these lines: + + gdb_test_multiple "" $test { + -re "" { + exp_continue + } + -re "to quit ---" { + pass $test + } + } + +The intent was for -notransfer+exp_continue to make expect fetch more +input, and rerun the matches against the now potentially fuller +buffer, and then eventually the -re that includes the full pagination +prompt regex would match instead (because it's listed higher up, it +would match first). But, once that "" -notransfer -re +matches, it keeps re-matching forever. It seems like with +exp_continue, expect immediately retries matching, instead of first +reading in more data into the buffer, if available. + +Fix this like I should have done in the first place. There's actually +no good reason for gdb_test_multiple to only match "". We can +make gdb_test_multiple expect the whole pagination prompt text +instead, which is store in the 'pagination_prompt' global (similar to +'gdb_prompt'). Then a gdb_test_multiple caller that doesn't want the +default match to trigger, because it wants to see one pagination +prompt, does simply: + + gdb_test_multiple "" $test { + -re "$pagination_prompt$" { + pass $test + } + } + +which is just like when we don't want the default $gdb_prompt match +within gdb_test_multiple to trigger, like: + + gdb_test_multiple "" $test { + -re "$gdb_prompt $" { + pass $test + } + } + +Tested on x86_64 Fedora 20. In addition, I've let the racy tests run +all in parallel in a loop for 30 minutes, and they never failed. gdb/testsuite/ -2014-07-22 Jan Kratochvil +2014-07-24 Pedro Alves - * gdb.base/double-prompt-target-event-error.exp: Use - gdb_test_pagination. - * gdb.base/paginate-after-ctrl-c-running.exp: Likewise. - * gdb.base/paginate-bg-execution.exp: Likewise. - * gdb.base/paginate-execution-startup.exp: Likewise. - * gdb.base/paginate-inferior-exit.exp: Likewise. - * lib/gdb.exp (pagination_prompt): Remove. - (gdb_test_pagination): New. + * gdb.base/double-prompt-target-event-error.exp + (cancel_pagination_in_target_event): Remove '-notransfer ' + match. + (cancel_pagination_in_target_event): Rework double prompt + detection. + * gdb.base/paginate-after-ctrl-c-running.exp + (test_ctrlc_while_target_running_paginates): Remove '-notransfer + ' match. + * gdb.base/paginate-bg-execution.exp + (test_bg_execution_pagination_return) + (test_bg_execution_pagination_cancel): Remove '-notransfer + ' matches. + * gdb.base/paginate-execution-startup.exp + (test_fg_execution_pagination_return) + (test_fg_execution_pagination_cancel): Remove '-notransfer + ' matches. + * gdb.base/paginate-inferior-exit.exp + (test_paginate_inferior_exited): Remove '-notransfer ' + match. + * lib/gdb-utils.exp (string_to_regexp): Move here from lib/gdb.exp. + * lib/gdb.exp (pagination_prompt): Run text through + string_to_regexp. + (gdb_test_multiple): Match $pagination_prompt instead of + "". + (string_to_regexp): Move to lib/gdb-utils.exp. +--- + .../gdb.base/double-prompt-target-event-error.exp | 26 +++++++++++++--------- + .../gdb.base/paginate-after-ctrl-c-running.exp | 4 ---- + gdb/testsuite/gdb.base/paginate-bg-execution.exp | 9 -------- + .../gdb.base/paginate-execution-startup.exp | 8 ------- + gdb/testsuite/gdb.base/paginate-inferior-exit.exp | 4 ---- + gdb/testsuite/lib/gdb-utils.exp | 9 ++++++++ + gdb/testsuite/lib/gdb.exp | 14 +++--------- + 7 files changed, 28 insertions(+), 46 deletions(-) diff --git a/gdb/testsuite/gdb.base/double-prompt-target-event-error.exp b/gdb/testsuite/gdb.base/double-prompt-target-event-error.exp -index 5571cdf..803e256 100644 +index 5571cdf..84c6c45 100644 --- a/gdb/testsuite/gdb.base/double-prompt-target-event-error.exp +++ b/gdb/testsuite/gdb.base/double-prompt-target-event-error.exp -@@ -28,7 +28,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug] == -1} { - - proc cancel_pagination_in_target_event { command } { - global binfile srcfile -- global gdb_prompt pagination_prompt -+ global gdb_prompt - - set testline [gdb_get_line_number "after sleep"] - -@@ -60,25 +60,23 @@ proc cancel_pagination_in_target_event { command } { - - # Wait for pagination prompt after the "Continuing" line, - # indicating the program was running and then stopped. -+ global saw_continuing - set saw_continuing 0 - set test "continue to pagination" -- gdb_test_multiple "$command" $test { -- -re "$pagination_prompt$" { -- if {$saw_continuing} { -- pass $test -- } else { -- send_gdb "\n" -- exp_continue -- } -+ gdb_test_pagination $command $test { -+ global saw_continuing -+ if {$saw_continuing} { -+ pass $test -+ } else { -+ send_gdb "\n" -+ exp_continue - } -+ } { - -re "Continuing" { -+ global saw_continuing +@@ -75,10 +75,6 @@ proc cancel_pagination_in_target_event { command } { set saw_continuing 1 exp_continue } @@ -98,60 +237,46 @@ index 5571cdf..803e256 100644 } # We're now stopped in a pagination query while handling a -@@ -88,15 +86,20 @@ proc cancel_pagination_in_target_event { command } { +@@ -87,18 +83,28 @@ proc cancel_pagination_in_target_event { command } { + # output. send_gdb "\003p 1\n" ++ # Note gdb_test_multiple has a default match for the prompt, ++ # which issues a FAIL. Consume the first prompt. ++ set test "first prompt" ++ gdb_test_multiple "" $test { ++ -re "$gdb_prompt" { ++ pass "first prompt" ++ } ++ } ++ ++ # We should only see one prompt more, and it should be ++ # preceeded by print's output. set test "no double prompt" -- gdb_test_multiple "" $test { + gdb_test_multiple "" $test { - -re "$gdb_prompt.*$gdb_prompt.*$gdb_prompt $" { -- fail $test -- } ++ -re "$gdb_prompt.*$gdb_prompt $" { ++ # The bug is present, and expect managed to read ++ # enough characters into the buffer to fill it with ++ # both prompts. + fail $test + } - -re "$gdb_prompt .* = 1\r\n$gdb_prompt $" { -+ global saw_prompt -+ set saw_prompt 0 -+ gdb_test_pagination "" $test { -+ exp_continue -+ } { + -re " = 1\r\n$gdb_prompt $" { pass $test } - -notransfer -re "" { - # Otherwise gdb_test_multiple considers this an error. -+ -re "\r\n$gdb_prompt " { -+ global saw_prompt -+ if { $saw_prompt != 0 } { -+ fail $test -+ } -+ set saw_prompt 1 - exp_continue - } - } -diff --git a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp -index 0ed8c92..3323fe7 100644 ---- a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp -+++ b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp -@@ -24,7 +24,6 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} { - - proc test_ctrlc_while_target_running_paginates {} { - global binfile srcfile -- global gdb_prompt pagination_prompt - - set testline [gdb_get_line_number "after sleep"] - -@@ -61,19 +60,13 @@ proc test_ctrlc_while_target_running_paginates {} { - # the user can respond to the pagination query. - set test "got prompt" - set saw_pagination_prompt 0 -- gdb_test_multiple "" $test { -- -re "$pagination_prompt$" { -- set saw_pagination_prompt 1 -- send_gdb "\n" - exp_continue - } -+ gdb_test_pagination "" $test { -+ send_gdb "\n" -+ exp_continue -+ } { + } + + # In case the board file wants to send further commands. +diff --git a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp +index 0ed8c92..5898d5b 100644 +--- a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp ++++ b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp +@@ -70,10 +70,6 @@ proc test_ctrlc_while_target_running_paginates {} { -re "$gdb_prompt $" { gdb_assert $saw_pagination_prompt $test } @@ -163,182 +288,63 @@ index 0ed8c92..3323fe7 100644 # Confirm GDB can still process input. diff --git a/gdb/testsuite/gdb.base/paginate-bg-execution.exp b/gdb/testsuite/gdb.base/paginate-bg-execution.exp -index dcff8ad..3ba46a3 100644 +index dcff8ad..116cc2b 100644 --- a/gdb/testsuite/gdb.base/paginate-bg-execution.exp +++ b/gdb/testsuite/gdb.base/paginate-bg-execution.exp -@@ -27,7 +27,6 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} { - - proc test_bg_execution_pagination_return {} { - global binfile -- global pagination_prompt - - with_test_prefix "paginate" { - clean_restart $binfile -@@ -43,21 +42,12 @@ proc test_bg_execution_pagination_return {} { - - gdb_test "continue&" "Continuing\." - -- set test "pagination handled, breakpoint hit" -- set saw_pagination_prompt 0 -- gdb_test_multiple "" $test { -- -re "$pagination_prompt$" { -- set saw_pagination_prompt 1 -- send_gdb "\n" -- exp_continue -- } +@@ -51,11 +51,6 @@ proc test_bg_execution_pagination_return {} { + send_gdb "\n" + exp_continue + } - -notransfer -re "" { - # Otherwise gdb_test_multiple considers this an - # error. - exp_continue - } -+ gdb_test_pagination "" "pagination handled, breakpoint hit" { -+ send_gdb "\n" -+ exp_continue -+ } { -re "after sleep\[^\r\n\]+\r\n$" { -- gdb_assert $saw_pagination_prompt $test -+ gdb_assert { $saw_pagination_prompt == 3 } $test + gdb_assert $saw_pagination_prompt $test + } +@@ -96,10 +91,6 @@ proc test_bg_execution_pagination_cancel { how } { + -re "$pagination_prompt$" { + pass $test } - } - -@@ -75,7 +65,7 @@ proc test_bg_execution_pagination_return {} { - - proc test_bg_execution_pagination_cancel { how } { - global binfile -- global gdb_prompt pagination_prompt -+ global gdb_prompt - - with_test_prefix "cancel with $how" { - clean_restart $binfile -@@ -92,14 +82,8 @@ proc test_bg_execution_pagination_cancel { how } { - gdb_test "continue&" "Continuing\." - - set test "continue& paginates" -- gdb_test_multiple "" $test { -- -re "$pagination_prompt$" { -- pass $test -- } - -notransfer -re "" { - # Otherwise gdb_test_multiple considers this an error. - exp_continue - } -+ gdb_test_pagination "" $test { -+ pass $test } set test "cancel pagination" diff --git a/gdb/testsuite/gdb.base/paginate-execution-startup.exp b/gdb/testsuite/gdb.base/paginate-execution-startup.exp -index dc713ec..4dc2376 100644 +index dc713ec..1628a0f 100644 --- a/gdb/testsuite/gdb.base/paginate-execution-startup.exp +++ b/gdb/testsuite/gdb.base/paginate-execution-startup.exp -@@ -76,7 +76,6 @@ proc probe_can_run_cmdline {} { - proc test_fg_execution_pagination_return {} { - global file_arg - global saved_gdbflags GDBFLAGS -- global gdb_prompt pagination_prompt - - set GDBFLAGS $saved_gdbflags - append GDBFLAGS " -ex \"set height 2\"" -@@ -92,10 +91,9 @@ proc test_fg_execution_pagination_return {} { - fail $test - return $res - } -- gdb_test_multiple "" $test { -- -re "$pagination_prompt$" { -- pass $test -- } -+ gdb_test_pagination "" $test { -+ pass $test -+ } { - -re "$gdb_prompt $" { - fail $test +@@ -111,10 +111,6 @@ proc test_fg_execution_pagination_return {} { + send_gdb "\n" + exp_continue } -@@ -103,20 +101,13 @@ proc test_fg_execution_pagination_return {} { - - send_gdb "\n" - -- set saw_pagination_prompt 0 - set test "send \\n to GDB" -- gdb_test_multiple "" $test { -- -re "$pagination_prompt$" { -- set saw_pagination_prompt 1 -- send_gdb "\n" -- exp_continue -- } - -notransfer -re "" { - # Otherwise gdb_test_multiple considers this an error. - exp_continue - } -+ gdb_test_pagination "" $test { -+ send_gdb "\n" -+ exp_continue -+ } { -re "$gdb_prompt $" { -- gdb_assert $saw_pagination_prompt $test -+ gdb_assert { $saw_pagination_prompt == 3 } $test + gdb_assert $saw_pagination_prompt $test + } +@@ -154,10 +150,6 @@ proc test_fg_execution_pagination_cancel { how } { + -re "$pagination_prompt$" { + pass $test } - } - -@@ -133,7 +124,7 @@ proc test_fg_execution_pagination_return {} { - proc test_fg_execution_pagination_cancel { how } { - global file_arg - global saved_gdbflags GDBFLAGS -- global gdb_prompt pagination_prompt -+ global gdb_prompt - - set GDBFLAGS $saved_gdbflags - -@@ -150,14 +141,8 @@ proc test_fg_execution_pagination_cancel { how } { - fail $test - return $res - } -- gdb_test_multiple "" $test { -- -re "$pagination_prompt$" { -- pass $test -- } - -notransfer -re "" { - # Otherwise gdb_test_multiple considers this an error. - exp_continue - } -+ gdb_test_pagination "" $test { -+ pass $test } set test "cancel pagination" diff --git a/gdb/testsuite/gdb.base/paginate-inferior-exit.exp b/gdb/testsuite/gdb.base/paginate-inferior-exit.exp -index 0e37be9..d43a245 100644 +index 0e37be9..7c63289 100644 --- a/gdb/testsuite/gdb.base/paginate-inferior-exit.exp +++ b/gdb/testsuite/gdb.base/paginate-inferior-exit.exp -@@ -26,7 +26,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} { - # - proc test_paginate_inferior_exited {} { - global binfile -- global gdb_prompt pagination_prompt -+ global gdb_prompt - global inferior_exited_re - - with_test_prefix "paginate" { -@@ -45,23 +45,18 @@ proc test_paginate_inferior_exited {} { - # Wait for the "Starting program" line, indicating the program - # is running. - set saw_starting 0 -- gdb_test_multiple "continue" $test { -- -re "$pagination_prompt" { -- if {$saw_starting} { -- pass $test -- } else { -- send_gdb "\n" -- exp_continue -- } -+ gdb_test_pagination "continue" $test { -+ if {$saw_starting} { -+ pass $test -+ } else { -+ send_gdb "\n" -+ exp_continue - } -+ } { - -re "Continuing" { +@@ -58,10 +58,6 @@ proc test_paginate_inferior_exited {} { set saw_starting 1 exp_continue } @@ -350,66 +356,60 @@ index 0e37be9..d43a245 100644 # We're now stopped in a pagination output while handling a diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp -index 7a00efb..d953a50 100644 +index 7a00efb..8cb98ae 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp -@@ -70,9 +70,6 @@ if ![info exists gdb_prompt] then { - set gdb_prompt "\[(\]gdb\[)\]" +@@ -71,7 +71,15 @@ if ![info exists gdb_prompt] then { } --# A regexp that matches the pagination prompt. + # A regexp that matches the pagination prompt. ++# Given an input string, adds backslashes as needed to create a ++# regexp that will match the string. ++ ++proc string_to_regexp {str} { ++ set result $str ++ regsub -all {[]*+.|()^$\[\\]} $str {\\&} result ++ return $result ++} -set pagination_prompt "---Type to continue, or q to quit---" -- ++set pagination_prompt [string_to_regexp "---Type to continue, or q to quit---"] + # The variable fullname_syntax_POSIX is a regexp which matches a POSIX # absolute path ie. /foo/ - set fullname_syntax_POSIX {/[^\n]*/} -@@ -4846,5 +4843,46 @@ proc capture_command_output { command prefix } { - return $output_string +@@ -649,7 +649,7 @@ proc gdb_internal_error_resync {} { + # + proc gdb_test_multiple { command message user_code } { + global verbose use_gdb_stub +- global gdb_prompt ++ global gdb_prompt pagination_prompt + global GDB + global inferior_exited_re + upvar timeout timeout +@@ -873,7 +873,7 @@ proc gdb_test_multiple { command message user_code } { + } + set result 1 + } +- "" { ++ -re "$pagination_prompt" { + send_gdb "\n" + perror "Window too small." + fail "$message" +@@ -1109,14 +1109,6 @@ proc test_print_reject { args } { + } } + +-# Given an input string, adds backslashes as needed to create a +-# regexp that will match the string. +- +-proc string_to_regexp {str} { +- set result $str +- regsub -all {[]*+.|()^$\[\\]} $str {\\&} result +- return $result +-} -+# Prevent gdb_test_multiple considering an error -re "" match. -+# For unknown reason -notransfer -re "" { exp_continue } does not -+# prevent it. -+ -+proc gdb_test_pagination { command test { code_prompt3 {} } { code_append {} } } { -+ global pagination_prompt1 pagination_prompt2 pagination_prompt3 -+ global gdb_prompt -+ -+ # A regexp that matches the pagination prompt. -+ set pagination_prompt1 "---Type to continue, or q to quit---" -+ -+ append code_append { -+ -re "${pagination_prompt1}" { -+ if { $saw_pagination_prompt != 0 && $saw_pagination_prompt != 3 } { -+ fail "$test (1)" -+ } -+ set saw_pagination_prompt 1 -+ exp_continue -+ } -+ -re "${pagination_prompt2}" { -+ if { $saw_pagination_prompt != 1 } { -+ fail "$test (2)" -+ } -+ set saw_pagination_prompt 2 -+ exp_continue -+ } -+ -re "${pagination_prompt3}$" { -+ if { $saw_pagination_prompt != 2 } { -+ fail "$test (3)" -+ } -+ set saw_pagination_prompt 3 -+ eval $code_prompt3 -+ } -+ } -+ -+ set saw_pagination_prompt 0 -+ gdb_test_multiple $command $test $code_append -+} -+ - # Always load compatibility stuff. - load_lib future.exp + # Same as gdb_test, but the second parameter is not a regexp, + # but a string that must match exactly. +-- +1.9.3 ---17pEHd4RhPHOinZp-- diff --git a/gdb-upstream.patch b/gdb-upstream.patch index 028fe7a..0d17e73 100644 --- a/gdb-upstream.patch +++ b/gdb-upstream.patch @@ -65,3 +65,91 @@ index 0e0202d..d849b4c 100644 # gdbserver does not have this issue. if ![is_remote target] { setup_kfail "*-*-*" gdb/15934 + + + +commit c46269f24eccce534b3cababbf47c6b6b290ed03 +Author: Pedro Alves +Date: Thu Jul 24 16:00:37 2014 +0100 + + Fix pagination crash when the TUI is active + + The TUI currently crashes when the user types in response to + a pagination prompt: + + $ gdb --tui ... + *the TUI is now active* + (gdb) set height 2 + (gdb) help + List of classes of commands: + + Program received signal SIGSEGV, Segmentation fault. + strlen () at ../sysdeps/x86_64/strlen.S:106 + 106 movdqu (%rax), %xmm12 + + (top-gdb) bt + #0 strlen () at ../sysdeps/x86_64/strlen.S:106 + #1 0x000000000086be5f in xstrdup (s=0x0) at ../src/libiberty/xstrdup.c:33 + #2 0x00000000005163f9 in tui_prep_terminal (notused1=1) at ../src/gdb/tui/tui-io.c:296 + #3 0x000000000077a7ee in _rl_callback_newline () at ../src/readline/callback.c:82 + #4 0x000000000077a853 in rl_callback_handler_install (prompt=0x0, linefunc=0x618b60 ) at ../src/readline/callback.c:102 + #5 0x0000000000718a5c in gdb_readline_wrapper_cleanup (arg=0xfd14d0) at ../src/gdb/top.c:788 + #6 0x0000000000596d08 in do_my_cleanups (pmy_chain=0xcf0b38 , old_chain=0x1043d10) at ../src/gdb/cleanups.c:155 + #7 0x0000000000596d75 in do_cleanups (old_chain=0x1043d10) at ../src/gdb/cleanups.c:177 + #8 0x0000000000718bd9 in gdb_readline_wrapper (prompt=0x7fffffffcfa0 "---Type to continue, or q to quit---") + at ../src/gdb/top.c:835 + #9 0x000000000071cf74 in prompt_for_continue () at ../src/gdb/utils.c:1894 + #10 0x000000000071d434 in fputs_maybe_filtered (linebuffer=0x1043db0 "List of classes of commands:\n\n", stream=0xf72e20, filter=1) + at ../src/gdb/utils.c:2111 + #11 0x000000000071da0f in vfprintf_maybe_filtered (stream=0xf72e20, format=0x89aef8 "List of classes of %scommands:\n\n", args=0x7fffffffd118, filter=1) + at ../src/gdb/utils.c:2339 + #12 0x000000000071da4a in vfprintf_filtered (stream=0xf72e20, format=0x89aef8 "List of classes of %scommands:\n\n", args=0x7fffffffd118) + at ../src/gdb/utils.c:2347 + #13 0x000000000071dc72 in fprintf_filtered (stream=0xf72e20, format=0x89aef8 "List of classes of %scommands:\n\n") at ../src/gdb/utils.c:2399 + #14 0x00000000004f90ab in help_list (list=0xe6d100, cmdtype=0x89ad8c "", class=all_classes, stream=0xf72e20) + at ../src/gdb/cli/cli-decode.c:1038 + #15 0x00000000004f8dba in help_cmd (arg=0x0, stream=0xf72e20) at ../src/gdb/cli/cli-decode.c:946 + + Git 0017922 added: + + @@ -776,6 +777,12 @@ gdb_readline_wrapper_cleanup (void *arg) + + gdb_assert (input_handler == gdb_readline_wrapper_line); + input_handler = cleanup->handler_orig; + + + + /* Reinstall INPUT_HANDLER in readline, without displaying a + + prompt. */ + + if (async_command_editing_p) + + rl_callback_handler_install (NULL, input_handler); + + and tui_prep_terminal simply misses handling the case of a NULL + rl_prompt. + + I also checked that readline's sources do similar checks. + + gdb/ + 2014-07-24 Pedro Alves + + * tui/tui-io.c (tui_prep_terminal): Handle NULL rl_prompt. + +### a/gdb/ChangeLog +### b/gdb/ChangeLog +## -1,3 +1,7 @@ ++2014-07-24 Pedro Alves ++ ++ * tui/tui-io.c (tui_prep_terminal): Handle NULL rl_prompt. ++ + 2014-07-22 Jan Kratochvil + + * stack.c (read_frame_arg): Verify value_optimized_out before calling +--- a/gdb/tui/tui-io.c ++++ b/gdb/tui/tui-io.c +@@ -293,7 +293,7 @@ tui_prep_terminal (int notused1) + (we can't use gdb_prompt() due to secondary prompts and can't use + rl_prompt because it points to an alloca buffer). */ + xfree (tui_rl_saved_prompt); +- tui_rl_saved_prompt = xstrdup (rl_prompt); ++ tui_rl_saved_prompt = rl_prompt != NULL ? xstrdup (rl_prompt) : NULL; + } + + /* Readline callback to restore the terminal. It is called once each diff --git a/gdb.spec b/gdb.spec index 8367b22..85ce0b2 100644 --- a/gdb.spec +++ b/gdb.spec @@ -18,7 +18,7 @@ Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages Name: %{?scl_prefix}gdb # Freeze it when GDB gets branched -%global snapsrc 20140721 +%global snapsrc 20140724 # See timestamp of source gnulib installed into gdb/gnulib/ . %global snapgnulib 20121213 %global tarname gdb-7.7.91.%{snapsrc} @@ -26,7 +26,7 @@ Version: 7.8 # 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: 13%{?dist} +Release: 14%{?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 @@ -516,11 +516,6 @@ Patch914: gdb-readline-6.3.5.patch # Continue backtrace even if a frame filter throws an exception (Phil Muldoon). Patch918: gdb-btrobust.patch -# Fix crash on optimized-out entry data values (BZ 1111910). -Patch922: gdb-entryval-crash-1of3.patch -Patch923: gdb-entryval-crash-2of3.patch -Patch919: gdb-entryval-crash-3of3.patch - # Python completion w/overriden completer (Sergio Durigan Junior, BZ 1075199). Patch920: gdb-python-completer-1of2.patch Patch921: gdb-python-completer-2of2.patch @@ -806,9 +801,6 @@ find -name "*.info*"|xargs rm -f %patch918 -p1 %patch920 -p1 %patch921 -p1 -%patch922 -p1 -%patch923 -p1 -%patch919 -p1 %patch924 -p1 %patch848 -p1 @@ -1300,6 +1292,10 @@ then fi %changelog +* Thu Jul 24 2014 Jan Kratochvil - 7.8-14.fc21 +- Rebase to FSF GDB 7.7.91.20140724 (pre-7.8 snapshot). +- Import TUI regression fix (Pedro Alves, BZ 1123003). + * Tue Jul 22 2014 Jan Kratochvil - 7.8-13.fc21 - Bump the package version number to final 7.8; still using 7.7.91.20140721.tar. diff --git a/sources b/sources index 024c845..da00631 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ 4981307aa9619bbec5b73261e4e41c8d gdb-libstdc++-v3-python-r155978.tar.bz2 -e482a840e0bf8e928268c72cb2241646 gdb-7.7.91.20140721.tar.bz2 +8d19580f8559ada4e6a3380a822a1451 gdb-7.7.91.20140724.tar.bz2