From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: markus.t.metzger@intel.com
Cc: palves@redhat.com, tromey@redhat.com, kettenis@gnu.org,
gdb-patches@sourceware.org, markus.t.metzger@gmail.com
Subject: Re: [patch v6 10/12] test, btrace: add branch tracing tests
Date: Mon, 17 Dec 2012 20:26:00 -0000 [thread overview]
Message-ID: <20121217202543.GI14232@host2.jankratochvil.net> (raw)
In-Reply-To: <1355760101-26237-11-git-send-email-markus.t.metzger@intel.com>
On Mon, 17 Dec 2012 17:01:39 +0100, markus.t.metzger@intel.com wrote:
[...]
> --- /dev/null
> +++ b/gdb/testsuite/gdb.btrace/enable.exp
> @@ -0,0 +1,89 @@
[...]
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +
> +if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } {
All these tests could be limited to "XXX-*-linux*" I think, couldn't they?
> + verbose "Tests ignored for all but x86 based targets."
> + return
> +}
[...]
> +# we don't have trace, yet
> +gdb_test "btrace" "No thread\." "btrace enable 2.2"
This way it is equivalent to "No thread\." as \. is no special Tcl sequence so
it equals to '.'. You wanted "No thread\\." so that backslash gets parsed by
the regex parser and not the Tcl parser.
Alternatively one can use {No thread\.} which skips the Tcl unbackslashing
(but then some characters like \n or \r or $variables are not available).
It is more times here.
> +gdb_test "btrace /m" "No thread\." "btrace enable 2.3"
> +gdb_test "btrace list /fal" "No thread\." "btrace enable 2.4"
> +gdb_test "btrace list /t" "No thread\." "btrace enable 2.5"
> +
> +set testfile "x86-list"
Please do not override $testfile to non-basename of the .exp file, see below
for standard_testfile recommendation instead.
> +
> +# start a debuggee program
> +if { [set binfile [btrace_assemble ${testfile}]] == "" } {
> + untested ${testfile}.exp
> + return -1
> +}
> +
> +gdb_reinitialize_dir $srcdir/$subdir
> +gdb_load $binfile
Why not clean_restart?
> +# automatic enabling is off.
> +if ![runto test_1] {
> + fail "runto test function, 1"
> + return -1
> +}
[...]
> --- /dev/null
> +++ b/gdb/testsuite/gdb.btrace/list_function.c
> @@ -0,0 +1,31 @@
[...]
> + You should have received a copy of the GNU General Public License
> + along with this program. If not, see <http://www.gnu.org/licenses/>. */
> +
> +extern int inc (int);
> +extern int dec (int);
> +
> +extern int main (void)
I find "extern" excessive/unusual during function definiton.
> +{
> + int x = 0;
> +
> + x = inc (x);
> + x = dec (x);
> +
> + return x; /* bp.1 */
> +}
> diff --git a/gdb/testsuite/gdb.btrace/list_function.exp b/gdb/testsuite/gdb.btrace/list_function.exp
> new file mode 100644
> index 0000000..180273f
> --- /dev/null
> +++ b/gdb/testsuite/gdb.btrace/list_function.exp
> @@ -0,0 +1,50 @@
[...]
> +load_lib btrace.exp
> +
> +set testfile "list_function"
> +set sources [list $testfile.c inc.c dec.c]
Use standard_testfile instead of these two sets.
> +
> +# check for btrace support
> +if { [skip_btrace_tests] } { return -1 }
[...]
> --- /dev/null
> +++ b/gdb/testsuite/lib/btrace.exp
> @@ -0,0 +1,78 @@
[...]
> +proc btrace_assemble { testfile } {
> + global srcdir
> + global objdir
> + global subdir
> +
> + set srcfile ${srcdir}/${subdir}/${testfile}.S
> + set objfile ${objdir}/${subdir}/${testfile}.o
> + set binfile ${objdir}/${subdir}/${testfile}.x
> +
> + if {[target_assemble ${srcfile} ${objfile} ""] != ""} { return "" }
> +
> + if {[target_link ${objfile} ${binfile} "-Ttext 0x400100"] != ""} { return "" }
Why is here -Ttext? It requires at least a comment but I would prefer to
remove it. Can't you just use additional_flags=-nostdlib for the build?
And can't you just not use -nostdlib, use standard system crt1 and just use
runto_main and no longer define "_start" in your .S file?
This btrace_assemble I find overengineered a bit, there should be
standard_testfile called in each *.exp file which will set srcfile/binfile.
> +
> + return ${binfile}
> +}
> +
> +proc skip_btrace_tests {} {
> + global gdb_prompt
> +
> + set testfile "x86-list"
Please do not override $testfile. $testfile is set by stadnard_testfile and
it should always match the gdb.btrace/TESTFILE.exp name TESTFILE.
> + set skip 0
> +
> + if { [set binfile [btrace_assemble ${testfile}]] == "" } {
> + return 1
> + }
> +
> + gdb_exit
> + gdb_start
> + gdb_load $binfile
> +
> + runto main
You could use clean_restart, couldn't you?
> +
> + gdb_test_multiple "btrace enable" "check btrace support" {
> + -re "You can't do that when your target is.*\r\n$gdb_prompt $" {
> + xfail "check btrace support"
> + set skip 1
> + }
> + -re "Target does not support branch tracing.*\r\n$gdb_prompt $" {
> + xfail "check btrace support"
> + set skip 1
> + }
> + -re "Could not enable branch tracing.*\r\n$gdb_prompt $" {
> + xfail "check btrace support"
> + set skip 1
> + }
> + -re "$gdb_prompt $" {
> + pass "check btrace support"
> + }
Tabs vs. spaces are wrong here. Tab is always 8 characters.
> + }
> + gdb_exit
> + remote_file build delete $testfile
> +
> + return $skip
> +}
> +
> +proc btrace_reset_trace {} {
> + gdb_test_no_output "btr disable"
> + gdb_test_no_output "btr enable"
> +
> + gdb_test "btr list" "No trace." "reset btrace"
> +}
> --
> 1.7.6.5
Thanks,
Jan
next prev parent reply other threads:[~2012-12-17 20:26 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-17 16:02 [patch v6 00/12] branch tracing support for Atom markus.t.metzger
2012-12-17 16:02 ` [patch v6 09/12] gdbserver, linux, btrace: add btrace support for linux-low markus.t.metzger
2012-12-17 16:02 ` [patch v6 06/12] remote, btrace: add branch trace remote ops markus.t.metzger
2012-12-17 19:57 ` Jan Kratochvil
2012-12-17 16:02 ` [patch v6 02/12] cli, btrace: add btrace cli markus.t.metzger
2012-12-17 18:32 ` Jan Kratochvil
2012-12-18 7:36 ` Metzger, Markus T
2012-12-18 8:35 ` Jan Kratochvil
2012-12-18 9:04 ` Jan Kratochvil
2012-12-18 9:11 ` Metzger, Markus T
2012-12-17 16:02 ` [patch v6 12/12] btrace, x86: disable on some processors markus.t.metzger
2012-12-17 17:11 ` Mark Kettenis
2012-12-19 16:13 ` Metzger, Markus T
2012-12-19 16:36 ` Mark Kettenis
2012-12-21 10:38 ` Jan Kratochvil
2012-12-17 17:37 ` H.J. Lu
2012-12-19 15:58 ` Metzger, Markus T
2012-12-17 20:35 ` Jan Kratochvil
2012-12-17 16:02 ` [patch v6 08/12] gdbserver, btrace: add generic btrace support markus.t.metzger
2012-12-17 20:43 ` Jan Kratochvil
2012-12-17 16:02 ` [patch v6 01/12] thread, btrace: add generic branch trace support markus.t.metzger
2012-12-17 16:03 ` [patch v6 10/12] test, btrace: add branch tracing tests markus.t.metzger
2012-12-17 20:26 ` Jan Kratochvil [this message]
2012-12-17 16:03 ` [patch v6 04/12] linux, i386, amd64: enable btrace for 32bit and 64bit linux native markus.t.metzger
2012-12-17 16:03 ` [patch v6 05/12] xml, btrace: define btrace xml document style markus.t.metzger
2012-12-17 19:53 ` Jan Kratochvil
2012-12-18 7:43 ` Metzger, Markus T
2012-12-17 16:03 ` [patch v6 11/12] test, btrace: more branch tracing tests markus.t.metzger
2012-12-17 16:03 ` [patch v6 03/12] linux, btrace: perf_event based branch tracing markus.t.metzger
2012-12-17 16:03 ` [patch v6 07/12] btrace, doc: document remote serial protocol markus.t.metzger
2012-12-17 18:45 ` [patch v6 00/12] branch tracing support for Atom Jan Kratochvil
2012-12-17 19:34 ` Tom Tromey
2012-12-18 7:24 ` Metzger, Markus T
2012-12-18 9:20 ` Jan Kratochvil
2012-12-18 10:14 ` Metzger, Markus T
2012-12-18 13:55 ` Jan Kratochvil
2012-12-19 9:59 ` Metzger, Markus T
2012-12-19 12:13 ` Mark Kettenis
2012-12-19 12:37 ` Jan Kratochvil
2012-12-20 7:17 ` Jan Kratochvil
2012-12-20 9:14 ` Metzger, Markus T
2012-12-20 11:43 ` Jan Kratochvil
2012-12-20 15:20 ` Metzger, Markus T
2012-12-21 19:12 ` Jan Kratochvil
2012-12-22 13:08 ` Jan Kratochvil
2013-01-01 16:35 ` Jan Kratochvil
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=20121217202543.GI14232@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=kettenis@gnu.org \
--cc=markus.t.metzger@gmail.com \
--cc=markus.t.metzger@intel.com \
--cc=palves@redhat.com \
--cc=tromey@redhat.com \
/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