* [PATCH] Clean up gdb.gdb/selftest.exp
@ 2016-12-14 14:19 Yao Qi
2016-12-14 17:39 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Yao Qi @ 2016-12-14 14:19 UTC (permalink / raw)
To: gdb-patches
I recently see the test fails like this,
(gdb) PASS: gdb.gdb/selftest.exp: step over argv initialization
list^M
487 std::vector<struct cmdarg> cmdarg_vec;^M
(gdb) FAIL: gdb.gdb/selftest.exp: unknown source line (after step over argv initialization)
step^M
std::vector<cmdarg, std::allocator<cmdarg> >::vector (this=0x7fffffffdc10) at ../../binutils-gdb/gdb/main.c:487^M
487 std::vector<struct cmdarg> cmdarg_vec;^M
(gdb) FAIL: gdb.gdb/selftest.exp: step into xmalloc call
These fails are caused by using std::vector in commit
f60ee22ea1d62f7004511ec65a3ad76890032d88. selttest.exp should match
the source code of GDB. This patch adds some new regexp to match
code using std::vector, and also removes some out of date regexp.
proc "do_steps_and_nexts left us ready to execute an xmalloc call",
however, there is no xmalloc called, so I also remove these bits.
I am also wondering the value of do_steps_and_nexts, can we just
remove it completely?
It fixed fails on x86_64-linux and aarch64-linux.
gdb/testsuite:
2016-12-14 Yao Qi <yao.qi@linaro.org>
* gdb.gdb/selftest.exp (do_steps_and_nexts): Add regexp to
match new code, and remove some out of date regexp.
Remove test about stepping into xmalloc.
---
gdb/testsuite/gdb.gdb/selftest.exp | 93 +++++---------------------------------
1 file changed, 11 insertions(+), 82 deletions(-)
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index 340137a..398a071 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -83,12 +83,12 @@ proc do_steps_and_nexts {} {
set description "step over ttyarg initialization"
set command "step"
}
- -re ".*cmdarg_vec = NULL.*$gdb_prompt $" {
- set description "step over cmdarg_vec initialization"
- set command "step"
+ -re ".*std::vector<struct cmdarg> cmdarg_vec.*$gdb_prompt $" {
+ set description "next over cmdarg_vec initialization"
+ set command "next"
}
- -re ".*pre_stat_chain = make_command_stats_cleanup.*$gdb_prompt $" {
- set description "next over make_command_stats_cleanup and everything it calls"
+ -re ".*std::vector<char \\*> dirarg.*$gdb_prompt $" {
+ set description "next over dirarg initialization"
set command "next"
}
-re ".*START_PROGRESS.*$gdb_prompt $" {
@@ -98,10 +98,6 @@ proc do_steps_and_nexts {} {
set description "next over START_PROGRESS and everything it calls"
set command "next"
}
- -re ".*mac_init.*$gdb_prompt $" {
- set description "next over mac_init and everything it calls"
- set command "next"
- }
-re ".*init_malloc.*$gdb_prompt $" {
# gdb 6.2.X is the last gdb which called init_malloc
set description "next over init_malloc and everything it calls"
@@ -111,6 +107,10 @@ proc do_steps_and_nexts {} {
set description "next over lim_at_start initialization"
set command "next"
}
+ -re ".*scoped_command_stats stat_reporter .*$gdb_prompt $" {
+ set description "next over start_reporter"
+ set command "next"
+ }
-re ".*TRY.*$gdb_prompt $" {
set description "next over TRY"
set command "next"
@@ -119,23 +119,7 @@ proc do_steps_and_nexts {} {
set description "step into captured_main (args)"
set command "step"
}
- -re ".*count . 0x3.*$gdb_prompt $" {
- set description "next over conditional stack alignment code 1"
- set command "next"
- }
- -re ".*if .i != 0.*$gdb_prompt $" {
- set description "next over conditional stack alignment code 2"
- set command "next"
- }
- -re ".*alloca .i - 4.*$gdb_prompt $" {
- set description "next over conditional stack alignment alloca"
- set command "next"
- }
- -re ".*dirsize = 1.*$gdb_prompt $" {
- set description "next over dirsize initialization"
- set command "next"
- }
- -re ".*dirarg = .* xmalloc.*$gdb_prompt $" {
+ -re ".*saved_command_line = .* xstrdup.*$gdb_prompt $" {
return
}
-re ".*setlocale .LC_MESSAGES,.*$gdb_prompt $" {
@@ -184,10 +168,6 @@ proc do_steps_and_nexts {} {
set description "step over gdb_sysroot initialization"
set command "step"
}
- -re ".*ndir = 0.*$gdb_prompt $" {
- set description "step over ndir initialization"
- set command "step"
- }
-re ".*instream = stdin.*$gdb_prompt $" {
set description "step over instream initialization"
set command "step"
@@ -199,11 +179,7 @@ proc do_steps_and_nexts {} {
-re ".*gdb_program_name = xstrdup.*$gdb_prompt $" {
set description "next over xstrdup"
set command "next"
- }
- -re ".*quit_flag = 0.*$gdb_prompt $" {
- set description "step over quit_flag initialization"
- set command "step"
- }
+ }
-re ".*gdb_stdout = stdio_fileopen .stdout.;.*$gdb_prompt $" {
set description "step over gdb_stdout initialization"
set command "step"
@@ -301,53 +277,6 @@ proc test_with_self { } {
do_steps_and_nexts
- gdb_test "print \"foo\"" ".\[0-9\]+ = \"foo\"" "print a string"
-
- # do_steps_and_nexts left us ready to execute an xmalloc call,
- # so give that a try.
- # If we don't actually enter the xmalloc call when we give a
- # step command that seems like a genuine bug. It seems to happen
- # on most RISC processors.
- # NOTE drow/2003-06-22: However, if we step back to the preceding two
- # lines, just keep stepping until we enter.
- set stepped_back 0
- setup_xfail "alpha-*-*" "mips-*-*"
- set description "step into xmalloc call"
- gdb_test_multiple "step" "$description" {
- -re "ncmd = 0;.*$gdb_prompt $" {
- set stepped_back 1
- send_gdb "step\n"
- exp_continue
- }
- -re ".*cmdarg = .* xmalloc.*$gdb_prompt $" {
- set stepped_back 1
- send_gdb "step\n"
- exp_continue
- }
- -re "dirsize = 1;.*$gdb_prompt $" {
- set stepped_back 1
- send_gdb "step\n"
- exp_continue
- }
- -re ".*dirarg = .* xmalloc.*$gdb_prompt $" {
- if { $stepped_back == 1 } {
- send_gdb "step\n"
- exp_continue
- } else {
- fail "$description"
- }
- }
- -re "xmalloc.*size=.*at.*utils.c.*$gdb_prompt $" {
- pass "$description"
- }
- -re ".*No such file or directory.\r\n$gdb_prompt $" {
- pass "$description (no source available)"
- }
- -re "A file or directory .* does not exist..\r\n$gdb_prompt $" {
- pass "$description (no source available)"
- }
- }
-
# start the "xgdb" process
if [target_info exists gdb,noinferiorio] {
# With no way to interact with the inferior GDB, all we can do
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Clean up gdb.gdb/selftest.exp
2016-12-14 14:19 [PATCH] Clean up gdb.gdb/selftest.exp Yao Qi
@ 2016-12-14 17:39 ` Pedro Alves
2016-12-19 15:04 ` Yao Qi
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2016-12-14 17:39 UTC (permalink / raw)
To: Yao Qi, gdb-patches
On 12/14/2016 02:19 PM, Yao Qi wrote:
> I recently see the test fails like this,
>
> (gdb) PASS: gdb.gdb/selftest.exp: step over argv initialization
> list^M
> 487 std::vector<struct cmdarg> cmdarg_vec;^M
> (gdb) FAIL: gdb.gdb/selftest.exp: unknown source line (after step over argv initialization)
>
> step^M
> std::vector<cmdarg, std::allocator<cmdarg> >::vector (this=0x7fffffffdc10) at ../../binutils-gdb/gdb/main.c:487^M
> 487 std::vector<struct cmdarg> cmdarg_vec;^M
> (gdb) FAIL: gdb.gdb/selftest.exp: step into xmalloc call
>
> These fails are caused by using std::vector in commit
> f60ee22ea1d62f7004511ec65a3ad76890032d88. selttest.exp should match
> the source code of GDB. This patch adds some new regexp to match
> code using std::vector, and also removes some out of date regexp.
>
> proc "do_steps_and_nexts left us ready to execute an xmalloc call",
> however, there is no xmalloc called, so I also remove these bits.
>
> I am also wondering the value of do_steps_and_nexts, can we just
> remove it completely?
Yeah, I don't see much value either. It's a constant source of
update pain.
I've found the bits of selftest.exp that interact with SIGINT
useful in the past, as that interacts with readline's SIGINT
handler. IIUC, that caught a bug in some local version of my
console work earlier in the year. So I'd prefer to keep those
bits. But I wouldn't miss do_steps_and_nexts for sure.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Clean up gdb.gdb/selftest.exp
2016-12-14 17:39 ` Pedro Alves
@ 2016-12-19 15:04 ` Yao Qi
0 siblings, 0 replies; 3+ messages in thread
From: Yao Qi @ 2016-12-19 15:04 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On 16-12-14 17:39:17, Pedro Alves wrote:
>
> Yeah, I don't see much value either. It's a constant source of
> update pain.
>
> I've found the bits of selftest.exp that interact with SIGINT
> useful in the past, as that interacts with readline's SIGINT
> handler. IIUC, that caught a bug in some local version of my
> console work earlier in the year. So I'd prefer to keep those
> bits. But I wouldn't miss do_steps_and_nexts for sure.
>
OK, patch below removes them. Pushed it in.
--
Yao (é½å°§)
From 16e69324ec7fbe4ea12f2a0a069ad207ac8e3f97 Mon Sep 17 00:00:00 2001
From: Yao Qi <yao.qi@linaro.org>
Date: Mon, 19 Dec 2016 15:00:32 +0000
Subject: [PATCH] Clean up gdb.gdb/selftest.exp
I recently see the test fails like this,
(gdb) PASS: gdb.gdb/selftest.exp: step over argv initialization
list^M
487 std::vector<struct cmdarg> cmdarg_vec;^M
(gdb) FAIL: gdb.gdb/selftest.exp: unknown source line (after step over argv initialization)
step^M
std::vector<cmdarg, std::allocator<cmdarg> >::vector (this=0x7fffffffdc10) at ../../binutils-gdb/gdb/main.c:487^M
487 std::vector<struct cmdarg> cmdarg_vec;^M
(gdb) FAIL: gdb.gdb/selftest.exp: step into xmalloc call
These fails are caused by using std::vector in commit
f60ee22ea1d62f7004511ec65a3ad76890032d88. selttest.exp should match
the source code of GDB. It is a maintenance pain, so this patch
removes do_steps_and_nexts.
gdb/testsuite:
2016-12-19 Yao Qi <yao.qi@linaro.org>
* gdb.gdb/selftest.exp (do_steps_and_nexts): Remove.
(test_with_self): Don't call do_steps_and_nexts, and remove
code about stepping into xmalloc.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 5323c51..12952a5 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2016-12-19 Yao Qi <yao.qi@linaro.org>
+
+ * gdb.gdb/selftest.exp (do_steps_and_nexts): Remove.
+ (test_with_self): Don't call do_steps_and_nexts, and remove
+ code about stepping into xmalloc.
+
2016-12-09 Yao Qi <yao.qi@linaro.org>
* gdb.base/all-architectures.exp.in: Remove kfail for rx.
diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index 340137a..2e9bc89 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -17,250 +17,6 @@
load_lib selftest-support.exp
-# Not all of the lines of code near the start of main are executed for
-# every machine. Also, optimization may reorder some of the lines.
-# So all we do is try to step or next over everything until we get
-# to a line that we know is always executed.
-
-proc do_steps_and_nexts {} {
- global gdb_prompt
- global srcdir
-
- gdb_reinitialize_dir $srcdir/..
-
- set unlikely_line 0
- for {set count 0} {$count < 32} {incr count} {
- # NOTE: carlton/2002-12-11: The "initial brace" and
- # "current_directory initialization" possibilities happen to
- # me with GCC 3.1 on i686-pc-linux-gnu when I compile with
- # optimization.
- gdb_test_multiple "list" "list" {
- -re ".*context = \\(struct captured_main_args \\*\\) data.*$gdb_prompt $" {
- set description "step over context initialization"
- set command "step"
- }
- -re ".*argc = context->argc.*$gdb_prompt $" {
- set description "step over argc initialization"
- set command "step"
- }
- -re ".*argv = context->argv.*$gdb_prompt $" {
- set description "step over argv initialization"
- set command "step"
- }
- -re ".*quiet = 0.*$gdb_prompt $" {
- set description "step over quiet initialization"
- set command "step"
- }
- -re ".*batch = 0.*$gdb_prompt $" {
- set description "step over batch initialization"
- set command "step"
- }
- -re ".*symarg = NULL.*$gdb_prompt $" {
- set description "step over symarg initialization"
- set command "step"
- }
- -re ".*execarg = NULL.*$gdb_prompt $" {
- set description "step over execarg initialization"
- set command "step"
- }
- -re ".*pidarg = NULL.*$gdb_prompt $" {
- set description "step over pidarg initialization"
- set command "step"
- }
- -re ".*corearg = NULL.*$gdb_prompt $" {
- set description "step over corearg initialization"
- set command "step"
- }
- -re ".*pid_or_core_arg = NULL.*$gdb_prompt $" {
- set description "step over pid_or_core_arg initialization"
- set command "step"
- }
- -re ".*cdarg = NULL.*$gdb_prompt $" {
- set description "step over cdarg initialization"
- set command "step"
- }
- -re ".*ttyarg = NULL.*$gdb_prompt $" {
- set description "step over ttyarg initialization"
- set command "step"
- }
- -re ".*cmdarg_vec = NULL.*$gdb_prompt $" {
- set description "step over cmdarg_vec initialization"
- set command "step"
- }
- -re ".*pre_stat_chain = make_command_stats_cleanup.*$gdb_prompt $" {
- set description "next over make_command_stats_cleanup and everything it calls"
- set command "next"
- }
- -re ".*START_PROGRESS.*$gdb_prompt $" {
- # Note: ezannoni/2004/02/17: This check should be
- # removed, since as of today that source line is not
- # in gdb anymore.
- set description "next over START_PROGRESS and everything it calls"
- set command "next"
- }
- -re ".*mac_init.*$gdb_prompt $" {
- set description "next over mac_init and everything it calls"
- set command "next"
- }
- -re ".*init_malloc.*$gdb_prompt $" {
- # gdb 6.2.X is the last gdb which called init_malloc
- set description "next over init_malloc and everything it calls"
- set command "next"
- }
- -re ".*lim_at_start.*$gdb_prompt $" {
- set description "next over lim_at_start initialization"
- set command "next"
- }
- -re ".*TRY.*$gdb_prompt $" {
- set description "next over TRY"
- set command "next"
- }
- -re ".*captured_main \\(args\\);.*$gdb_prompt $" {
- set description "step into captured_main (args)"
- set command "step"
- }
- -re ".*count . 0x3.*$gdb_prompt $" {
- set description "next over conditional stack alignment code 1"
- set command "next"
- }
- -re ".*if .i != 0.*$gdb_prompt $" {
- set description "next over conditional stack alignment code 2"
- set command "next"
- }
- -re ".*alloca .i - 4.*$gdb_prompt $" {
- set description "next over conditional stack alignment alloca"
- set command "next"
- }
- -re ".*dirsize = 1.*$gdb_prompt $" {
- set description "next over dirsize initialization"
- set command "next"
- }
- -re ".*dirarg = .* xmalloc.*$gdb_prompt $" {
- return
- }
- -re ".*setlocale .LC_MESSAGES,.*$gdb_prompt $" {
- set description "next over setlocale LC_MESSAGES"
- set command "next"
- }
- -re ".*setlocale .LC_CTYPE,.*$gdb_prompt $" {
- set description "next over setlocale LC_CTYPE"
- set command "next"
- }
- -re ".*bindtextdomain .PACKAGE, LOCALEDIR.;.*$gdb_prompt $" {
- set description "next over bindtextdomain"
- set command "next"
- }
- -re ".*textdomain .PACKAGE.;.*$gdb_prompt $" {
- set description "next over textdomain PACKAGE"
- set command "next"
- }
- -re ".*bfd_init ..;.*$gdb_prompt $" {
- set description "next over bfd_init"
- set command "next"
- }
- -re ".*notice_open_fds ..;.*$gdb_prompt $" {
- set description "next over notice_open_fds"
- set command "next"
- }
- -re ".*save_original_signals_state ..;.*$gdb_prompt $" {
- set description "next over save_original_signals_state"
- set command "next"
- }
- -re ".*VEC_cleanup .cmdarg_s.*$gdb_prompt $" {
- set description "next over cmdarg_s VEC_cleanup"
- set command "next"
- }
- -re "\[0-9\]+\[\t \]+\{\r\n$gdb_prompt $" {
- set description "step over initial brace"
- set command "step"
- }
- -re ".*current_directory = gdb_dirbuf.*$gdb_prompt $" {
- set description "step over current_directory initialization"
- set command "step"
- }
- -re ".*gdb_sysroot = .*$gdb_prompt $" {
- # NOTE: carlton/2003-01-15: More optimization reordering,
- # observed on GCC 3.1.
- set description "step over gdb_sysroot initialization"
- set command "step"
- }
- -re ".*ndir = 0.*$gdb_prompt $" {
- set description "step over ndir initialization"
- set command "step"
- }
- -re ".*instream = stdin.*$gdb_prompt $" {
- set description "step over instream initialization"
- set command "step"
- }
- -re ".*getcwd .gdb_dirbuf, sizeof .gdb_dirbuf.*$gdb_prompt $" {
- set description "next over getcwd"
- set command "next"
- }
- -re ".*gdb_program_name = xstrdup.*$gdb_prompt $" {
- set description "next over xstrdup"
- set command "next"
- }
- -re ".*quit_flag = 0.*$gdb_prompt $" {
- set description "step over quit_flag initialization"
- set command "step"
- }
- -re ".*gdb_stdout = stdio_fileopen .stdout.;.*$gdb_prompt $" {
- set description "step over gdb_stdout initialization"
- set command "step"
- }
- -re ".*gdb_stderr = stdio_fileopen .stderr.;.*$gdb_prompt $" {
- set description "step over gdb_stderr initialization"
- set command "step"
- }
- -re "ui = current_ui.*$gdb_prompt $" {
- set description "step over top_level initialization"
- set command "step"
- }
- -re ".*main.c.*No such file or directory.*$gdb_prompt $" {
- setup_xfail "rs6000-*-aix3*"
- fail "must be able to list source lines"
- return
- }
- -re ".*interpreter_p = xstrdup.*$gdb_prompt $" {
- if { $unlikely_line == 0 } {
- # This is a GCC optimization bug; a constant has been
- # associated with the wrong line number.
- setup_xfail "*-*-*" gcc/26475
- fail "$description (unlikely line from gcc)"
- set unlikely_line 1
- }
- set description "next over xstrdup"
- set command "next"
- }
- -re ".*$gdb_prompt $" {
- # If $description hasn't been set yet, it's likely the file
- # has been edited but gdb hasn't been recompiled.
- if [info exists description] {
- fail "unknown source line (after $description)"
- } else {
- fail "unknown source line"
- }
- return
- }
- default {
- fail "unknown source line near main"
- return
- }
- }
- gdb_test_multiple "$command" "$description" {
- -re ".*No such file or directory.\r\n$gdb_prompt $" {
- fail "$description (no source available)"
- }
- -re ".*A file or directory .* does not exist..\r\n$gdb_prompt $" {
- fail "$description (no source available)"
- }
- -re ".*$gdb_prompt $" {
- pass "$description"
- }
- }
- }
-}
-
proc test_with_self { } {
global gdb_prompt
global decimal
@@ -299,55 +55,6 @@ proc test_with_self { } {
}
}
- do_steps_and_nexts
-
- gdb_test "print \"foo\"" ".\[0-9\]+ = \"foo\"" "print a string"
-
- # do_steps_and_nexts left us ready to execute an xmalloc call,
- # so give that a try.
- # If we don't actually enter the xmalloc call when we give a
- # step command that seems like a genuine bug. It seems to happen
- # on most RISC processors.
- # NOTE drow/2003-06-22: However, if we step back to the preceding two
- # lines, just keep stepping until we enter.
- set stepped_back 0
- setup_xfail "alpha-*-*" "mips-*-*"
- set description "step into xmalloc call"
- gdb_test_multiple "step" "$description" {
- -re "ncmd = 0;.*$gdb_prompt $" {
- set stepped_back 1
- send_gdb "step\n"
- exp_continue
- }
- -re ".*cmdarg = .* xmalloc.*$gdb_prompt $" {
- set stepped_back 1
- send_gdb "step\n"
- exp_continue
- }
- -re "dirsize = 1;.*$gdb_prompt $" {
- set stepped_back 1
- send_gdb "step\n"
- exp_continue
- }
- -re ".*dirarg = .* xmalloc.*$gdb_prompt $" {
- if { $stepped_back == 1 } {
- send_gdb "step\n"
- exp_continue
- } else {
- fail "$description"
- }
- }
- -re "xmalloc.*size=.*at.*utils.c.*$gdb_prompt $" {
- pass "$description"
- }
- -re ".*No such file or directory.\r\n$gdb_prompt $" {
- pass "$description (no source available)"
- }
- -re "A file or directory .* does not exist..\r\n$gdb_prompt $" {
- pass "$description (no source available)"
- }
- }
-
# start the "xgdb" process
if [target_info exists gdb,noinferiorio] {
# With no way to interact with the inferior GDB, all we can do
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-19 15:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-14 14:19 [PATCH] Clean up gdb.gdb/selftest.exp Yao Qi
2016-12-14 17:39 ` Pedro Alves
2016-12-19 15:04 ` Yao Qi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).