From: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
To: <gdb-patches@sourceware.org>
Subject: [RFA] testsuite: Avoid buffer overrun in gdb.base/default.exp
Date: Fri, 06 Aug 2010 14:59:00 -0000 [thread overview]
Message-ID: <001801cb3578$15f7a550$41e6eff0$@muller@ics-cnrs.unistra.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 1734 bytes --]
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 <muller@ics.u-strasbg.fr>
* gdb.base/default.exp (info set): Avoid full buffer error and force
reading up to final gdb prompt.
(show): Likewise.
[-- Attachment #2: testsuite-default.exp --]
[-- Type: application/octet-stream, Size: 4439 bytes --]
projecttype:gdb
revision:HEAD
email:muller@ics.u-strasbg.fr
2010-08-06 Pierre Muller <muller@ics.u-strasbg.fr>
* gdb.base/default.exp (info set): Avoid full buffer error and force
reading up to final gdb prompt.
(show): Likewise.
Index: src/gdb/testsuite/gdb.base/default.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/default.exp,v
retrieving revision 1.43
diff -u -p -r1.43 default.exp
--- src/gdb/testsuite/gdb.base/default.exp 7 Jul 2010 18:49:51 -0000 1.43
+++ src/gdb/testsuite/gdb.base/default.exp 6 Aug 2010 13:41:24 -0000
@@ -316,10 +316,37 @@ gdb_test "info s" "No stack." "info stac
#test info stack
gdb_test "info stack" "No stack." "info stack"
#test info set
-# FIXME -- needs to match the entire output
-# FIXME -- on native solaris 2.8, this test fails due to this line:
+# Test improved to check three parts:
+# 1) confirm
+# 2) prompt
+# 3) write
+# And only succeed if all three are matched.
+# This should fix an old problem on native solaris 2.8,
+# where this test fails due to this line:
# prompt: Gdb's prompt is "(gdb) ".^M
-gdb_test "info set" "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 source lines gdb will list by default is 10.*" "info set"
+set set_confirm_seen 0
+set set_prompt_seen 0
+gdb_test_multiple "info set" "info set" {
+ -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 source lines gdb will list by default is 10.*" {
+ verbose "Confirm dislayed"
+ set set_confirm_seen 1
+ exp_continue
+ }
+ -re "Gdb's prompt is \"$gdb_prompt \"" {
+ verbose "GDB prompt displayed"
+ set set_prompt_seen 1
+ exp_continue
+ }
+ -re "Writing into executable.*$gdb_prompt $" {
+ verbose "write displayed"
+ if { $set_prompt_seen && $set_confirm_seen } {
+ pass "info set"
+ } else {
+ verbose "prompt $set_prompt_seen confirm $set_confirm_seen"
+ fail "info set (incomplete output)"
+ }
+ }
+}
gdb_test "info symbol" "Argument required .address.."
#test info source
gdb_test "info source" "No current source file..*" "info source"
@@ -651,7 +678,29 @@ gdb_test "show width" "Number of charact
# This is only supported on targets which use exec.o.
gdb_test "show write" "Writing into executable and core files is o.*" "show write"
#test show
-gdb_test "show" "confirm: *Whether to confirm potentially dangerous operations is on.(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which to record 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..*" "show"
+set show_confirm_seen 0
+set show_prompt_seen 0
+gdb_test_multiple "show" "show" {
+ -re "confirm: *Whether to confirm potentially dangerous operations is on.(\[^\r\n\]*\[\r\n\])+history filename: *The filename in which to record 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..*" {
+ verbose "Confirm dislayed"
+ set show_confirm_seen 1
+ exp_continue
+ }
+ -re "Gdb's prompt is \"$gdb_prompt \"" {
+ verbose "GDB prompt displayed"
+ set show_prompt_seen 1
+ exp_continue
+ }
+ -re "Writing into executable.*$gdb_prompt $" {
+ verbose "write displayed"
+ if { $show_prompt_seen && $show_confirm_seen } {
+ pass "show"
+ } else {
+ verbose "prompt $show_prompt_seen confirm $show_confirm_seen"
+ fail "show (incomplete output)"
+ }
+ }
+}
#test stepi "si" abbreviation
gdb_test "si" "The program is not being run." "stepi \"si\" abbreviation"
#test stepi
next reply other threads:[~2010-08-06 14:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-06 14:59 Pierre Muller [this message]
2010-08-06 15:08 ` Jan Kratochvil
2010-08-06 15:47 ` Pierre Muller
2010-08-09 9:10 ` Pierre Muller
[not found] ` <44545.549437362$1281345013@news.gmane.org>
2010-08-18 22:26 ` Tom Tromey
2010-08-19 7:08 ` Pierre Muller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001801cb3578$15f7a550$41e6eff0$@muller@ics-cnrs.unistra.fr' \
--to=pierre.muller@ics-cnrs.unistra.fr \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox