From: Iain Sandoe <iain@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [RFA, Patch, testsuite] gdb.base/list.exp: initial state test for stub targets.
Date: Wed, 13 Jun 2012 12:23:00 -0000 [thread overview]
Message-ID: <C6DF26D5-4C9E-4C05-8C30-B226C311393E@codesourcery.com> (raw)
Hi,
At present, gdb.base/list.exp behaves differently for targets that use a stub and those that are native, simulator or gdbserver.
For the latter cases, the test does not cause an inferior to be created, and the default list lines around main works 'as expected'.
For the stub case, an inferior is created and this will generally be stopped in some start-up or exception code. At present, this is handled by running to main and then skipping the default listing, unsupport-ing the 'default list lines around main' test.
I was asked to look into removing that 'unsupported'.
One way to make things consistent would be to avoid creating the inferior for the stub case - since the listing tests only require host-side actions. This could be achieved by replacing the gdb_load in the test with a gdb_file_cmd, in the test; Patch (a) below.
An alternative, is to recognise that there is an expected state from the inferior after run_tomain - and to check for this state; Patch (b) below.
comments/OK for (a) or (b)?
Iain
gdb/testsuite:
* gdb.base/list.exp (test_listsize): Adjust to allow testing of default
lines on targets using stubs.
====
(a)
Index: gdb/testsuite/gdb.base/list.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/list.exp,v
retrieving revision 1.29
diff -u -p -r1.29 list.exp
--- gdb/testsuite/gdb.base/list.exp 16 Jan 2012 16:21:44 -0000 1.29
+++ gdb/testsuite/gdb.base/list.exp 13 Jun 2012 11:58:11 -0000
@@ -77,7 +77,7 @@ proc set_listsize { arg } {
#
proc test_listsize {} {
- global gdb_prompt use_gdb_stub
+ global gdb_prompt
global hp_cc_compiler
global hp_aCC_compiler
@@ -86,16 +86,8 @@ proc test_listsize {} {
gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
# Show the default lines
- # Note that remote targets that have debugging info for _start available will
- # list the lines there instead of main, so we skip this test for remote targets.
- # The second case is for optimized code, it is still correct.
-
- if $use_gdb_stub {
- runto_main;
- unsupported "list default lines around main";
- } else {
- gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
- }
+
+ gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
# Ensure we can limit printouts to one line
@@ -518,7 +510,7 @@ proc test_forward_search {} {
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+gdb_file_cmd ${binfile}
gdb_test_no_output "set width 0"
====
(b)
Index: gdb/testsuite/gdb.base/list.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/list.exp,v
retrieving revision 1.29
diff -u -p -r1.29 list.exp
--- gdb/testsuite/gdb.base/list.exp 16 Jan 2012 16:21:44 -0000 1.29
+++ gdb/testsuite/gdb.base/list.exp 13 Jun 2012 12:22:18 -0000
@@ -86,13 +86,14 @@ proc test_listsize {} {
gdb_test "show listsize" "Number of source lines gdb will list by default is 10.*" "show default list size"
# Show the default lines
- # Note that remote targets that have debugging info for _start available will
- # list the lines there instead of main, so we skip this test for remote targets.
+ # Note that remote targets that have debugging info for _start available
+ # would list the lines there instead of main, so we run to main and then
+ # look for the expected output at that stage.
# The second case is for optimized code, it is still correct.
if $use_gdb_stub {
runto_main;
- unsupported "list default lines around main";
+ gdb_test "list" "(2.*\[ \t\]+int x;.*7\[ \t\]+x = 0;\r\n.*11\[ \t\]+foo .x\[+)\]+;)" "list default lines after running to main"
} else {
gdb_test "list" "(1\[ \t\]+#include \"list0.h\".*7\[ \t\]+x = 0;\r\n.*10\[ \t\]+foo .x\[+)\]+;)" "list default lines around main"
}
next reply other threads:[~2012-06-13 12:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 12:23 Iain Sandoe [this message]
2012-06-13 12:33 ` Pedro Alves
2012-06-15 14:43 ` Iain Sandoe
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=C6DF26D5-4C9E-4C05-8C30-B226C311393E@codesourcery.com \
--to=iain@codesourcery.com \
--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