From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16764 invoked by alias); 6 Aug 2010 14:59:20 -0000 Received: (qmail 16756 invoked by uid 22791); 6 Aug 2010 14:59:20 -0000 X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_40,MIME_QP_LONG_LINE,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Aug 2010 14:59:14 +0000 Received: from baal.u-strasbg.fr (baal.u-strasbg.fr [IPv6:2001:660:2402::41]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id o76ExB8Q089766 for ; Fri, 6 Aug 2010 16:59:11 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms8.u-strasbg.fr [IPv6:2001:660:2402:d::17]) by baal.u-strasbg.fr (8.14.0/jtpda-5.5pre1) with ESMTP id o76ExBe7049090 for ; Fri, 6 Aug 2010 16:59:11 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from d620muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id o76ExAoP069872 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Fri, 6 Aug 2010 16:59:10 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Subject: [RFA] testsuite: Avoid buffer overrun in gdb.base/default.exp Date: Fri, 06 Aug 2010 14:59:00 -0000 Message-ID: <001801cb3578$15f7a550$41e6eff0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0019_01CB3588.D9807550" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00067.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0019_01CB3588.D9807550 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 1734 The attached patch fixes a full internal buffer problem inside gdb.base/default.exp, this is achieved by using gdb_test_multiple that will empty the buffer on each regular expression match. It also avoids an early return as it specifically checks the prompt output that appear in the middle. OK to apply: Pierre Muller Pascal language support maintainer for GDB Tested on a GCC compile farm x86_64 linux machine: diff pristine/gdb.sum patched/gdb.sum < Test Run By muller on Fri Aug 6 12:10:06 2010 --- > Test Run By muller on Fri Aug 6 16:30:14 2010 3421,3424c3421,3423 < ERROR: internal buffer is full. < UNRESOLVED: gdb.base/default.exp: info set < FAIL: gdb.base/default.exp: info symbol < FAIL: gdb.base/default.exp: info source --- > PASS: gdb.base/default.exp: info set > PASS: gdb.base/default.exp: info symbol > PASS: gdb.base/default.exp: info source 3553,3555c3552,3553 < ERROR: internal buffer is full. < UNRESOLVED: gdb.base/default.exp: show < FAIL: gdb.base/default.exp: stepi "si" abbreviation --- > PASS: gdb.base/default.exp: show > PASS: gdb.base/default.exp: stepi "si" abbreviation 17026c17024 < KFAIL: gdb.threads/watchthreads2.exp: gdb can drop watchpoints in multithreade d app (PRMS: gdb/10116) --- > PASS: gdb.threads/watchthreads2.exp: all threads incremented x 17318,17319c17316,17317 < # of expected passes 16310 < # of unexpected failures 132 --- > # of expected passes 16316 > # of unexpected failures 129 17323d17320 < # of unresolved testcases 2 testsuite ChangeLog entry: 2010-08-06 Pierre Muller * gdb.base/default.exp (info set): Avoid full buffer error and force reading up to final gdb prompt. (show): Likewise. ------=_NextPart_000_0019_01CB3588.D9807550 Content-Type: application/octet-stream; name="testsuite-default.exp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="testsuite-default.exp" Content-length: 4888 projecttype:gdb=0A= revision:HEAD=0A= email:muller@ics.u-strasbg.fr=0A= =0A= 2010-08-06 Pierre Muller =0A= =0A= * gdb.base/default.exp (info set): Avoid full buffer error and force=0A= reading up to final gdb prompt.=0A= (show): Likewise.=0A= =0A= Index: src/gdb/testsuite/gdb.base/default.exp=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/testsuite/gdb.base/default.exp,v=0A= retrieving revision 1.43=0A= diff -u -p -r1.43 default.exp=0A= --- src/gdb/testsuite/gdb.base/default.exp 7 Jul 2010 18:49:51 -0000 1.43= =0A= +++ src/gdb/testsuite/gdb.base/default.exp 6 Aug 2010 13:41:24 -0000=0A= @@ -316,10 +316,37 @@ gdb_test "info s" "No stack." "info stac=0A= #test info stack=0A= gdb_test "info stack" "No stack." "info stack"=0A= #test info set=0A= -# FIXME -- needs to match the entire output=0A= -# FIXME -- on native solaris 2.8, this test fails due to this line:=0A= +# Test improved to check three parts:=0A= +# 1) confirm=0A= +# 2) prompt=0A= +# 3) write=0A= +# And only succeed if all three are matched.=0A= +# This should fix an old problem on native solaris 2.8,=0A= +# where this test fails due to this line:=0A= # prompt: Gdb's prompt is "(gdb) ".^M=0A= -gdb_test "info set" "confirm: Whether to confirm potentially dangerous op= erations is o\[a-z\]*.(\[^\r\n\]*\[\r\n\])+history filename: The filename = in which to record the command history is (\[^\r\n\]*\[\r\n\])+listsize: N= umber of source lines gdb will list by default is 10.*" "info set"=0A= +set set_confirm_seen 0=0A= +set set_prompt_seen 0=0A= +gdb_test_multiple "info set" "info set" {=0A= + -re "confirm: Whether to confirm potentially dangerous operations is = o\[a-z\]*.(\[^\r\n\]*\[\r\n\])+history filename: The filename in which to = record the command history is (\[^\r\n\]*\[\r\n\])+listsize: Number of sou= rce lines gdb will list by default is 10.*" {=0A= + verbose "Confirm dislayed"=0A= + set set_confirm_seen 1=0A= + exp_continue=0A= + }=0A= + -re "Gdb's prompt is \"$gdb_prompt \"" {=0A= + verbose "GDB prompt displayed"=0A= + set set_prompt_seen 1=0A= + exp_continue=0A= + }=0A= + -re "Writing into executable.*$gdb_prompt $" {=0A= + verbose "write displayed"=0A= + if { $set_prompt_seen && $set_confirm_seen } {=0A= + pass "info set"=0A= + } else {=0A= + verbose "prompt $set_prompt_seen confirm $set_confirm_seen"=0A= + fail "info set (incomplete output)"=0A= + }=0A= + }=0A= +}=0A= gdb_test "info symbol" "Argument required .address.."=0A= #test info source=0A= gdb_test "info source" "No current source file..*" "info source"=0A= @@ -651,7 +678,29 @@ gdb_test "show width" "Number of charact=0A= # This is only supported on targets which use exec.o.=0A= gdb_test "show write" "Writing into executable and core files is o.*" "sho= w write"=0A= #test show=0A= -gdb_test "show" "confirm: *Whether to confirm potentially dangerous opera= tions is on.(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which = to record the command history is (\[^\r\n\]*\[\r\n\])+history save: *Savin= g of the history record on exit is on.(\[^\r\n\]*\[\r\n\])+history size: *= The size of the command history is(\[^\r\n\]*\[\r\n\])+listsize: *Number o= f source lines gdb will list by default is 10(\[^\r\n]*\[\r\n\])+print elem= ents: *Limit on string chars or array elements to print is 200..*" "show"= =0A= +set show_confirm_seen 0=0A= +set show_prompt_seen 0=0A= +gdb_test_multiple "show" "show" {=0A= + -re "confirm: *Whether to confirm potentially dangerous operations is= on.(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which to recor= d the command history is (\[^\r\n\]*\[\r\n\])+history save: *Saving of the= history record on exit is on.(\[^\r\n\]*\[\r\n\])+history size: *The size= of the command history is(\[^\r\n\]*\[\r\n\])+listsize: *Number of source= lines gdb will list by default is 10(\[^\r\n]*\[\r\n\])+print elements: *= Limit on string chars or array elements to print is 200..*" {=0A= + verbose "Confirm dislayed"=0A= + set show_confirm_seen 1=0A= + exp_continue=0A= + }=0A= + -re "Gdb's prompt is \"$gdb_prompt \"" {=0A= + verbose "GDB prompt displayed"=0A= + set show_prompt_seen 1=0A= + exp_continue=0A= + }=0A= + -re "Writing into executable.*$gdb_prompt $" {=0A= + verbose "write displayed"=0A= + if { $show_prompt_seen && $show_confirm_seen } {=0A= + pass "show"=0A= + } else {=0A= + verbose "prompt $show_prompt_seen confirm $show_confirm_seen"=0A= + fail "show (incomplete output)"=0A= + }=0A= + }=0A= +}=0A= #test stepi "si" abbreviation=0A= gdb_test "si" "The program is not being run." "stepi \"si\" abbreviation"= =0A= #test stepi=0A= ------=_NextPart_000_0019_01CB3588.D9807550--