From: Tom Tromey Date: Fri, 10 Jul 2009 18:48:41 +0000 (+0000) Subject: gdb/doc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=812f73424775824b59fe27c6e87f183c72571c80;p=binutils-gdb.git gdb/doc * gdbint.texinfo (Testsuite): Document test transcripts. gdb/testsuite * lib/gdb.exp: Handle TRANSCRIPT. (remote_spawn, remote_close, send_gdb): New procs. --- diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index ff5bff653a9..1455a1e5f00 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2009-07-09 Tom Tromey + + * gdbint.texinfo (Testsuite): Document test transcripts. + 2009-07-10 Phil Muldoon * gdb.texinfo (Values From Inferior): Add length parameter diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index a51f0778bf5..3351a15fde4 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -7560,6 +7560,27 @@ will give a result of ``UNRESOLVED'', like this: UNRESOLVED: gdb.base/example.exp: This test script does not work on a remote host. @end smallexample +Sometimes it is convenient to get a transcript of the commands which +the testsuite sends to @value{GDBN}. For example, if @value{GDBN} +crashes during testing, a transcript can be used to more easily +reconstruct the failure when running @value{GDBN} under @value{GDBN}. + +You can instruct the @value{GDBN} testsuite to write transcripts by +setting the DejaGNU variable @code{TRANSCRIPT} (to any value) +before invoking @code{runtest} or @kbd{make check}. The transcripts +will be written into DejaGNU's output directory. One transcript will +be made for each invocation of @value{GDBN}; they will be named +@file{transcript.@var{n}}, where @var{n} is an integer. The first +line of the transcript file will show how @value{GDBN} was invoked; +each subsequent line is a command sent as input to @value{GDBN}. + +@smallexample +make check RUNTESTFLAGS=TRANSCRIPT=y +@end smallexample + +Note that the transcript is not always complete. In particular, tests +of completion can yield partial command lines. + @section Testsuite Organization @cindex test suite organization diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d1ac5a46cbe..ff692caddbd 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-07-09 Tom Tromey + + * lib/gdb.exp: Handle TRANSCRIPT. + (remote_spawn, remote_close, send_gdb): New procs. + 2009-07-10 Phil Muldoon * gdb.python/python-prettyprint.c: Add counted null string diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 200ab35db54..96f7d02376b 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -2983,3 +2983,49 @@ proc get_sizeof { type default } { return [get_integer_valueof "sizeof (${type})" $default] } +# Log gdb command line and script if requested. +if {[info exists TRANSCRIPT]} { + rename send_gdb real_send_gdb + rename remote_spawn real_remote_spawn + rename remote_close real_remote_close + + global gdb_transcript + set gdb_transcript "" + + global gdb_trans_count + set gdb_trans_count 1 + + proc remote_spawn {args} { + global gdb_transcript gdb_trans_count outdir + + if {$gdb_transcript != ""} { + close $gdb_transcript + } + set gdb_transcript [open [file join $outdir transcript.$gdb_trans_count] w] + puts $gdb_transcript [lindex $args 1] + incr gdb_trans_count + + return [uplevel real_remote_spawn $args] + } + + proc remote_close {args} { + global gdb_transcript + + if {$gdb_transcript != ""} { + close $gdb_transcript + set gdb_transcript "" + } + + return [uplevel real_remote_close $args] + } + + proc send_gdb {args} { + global gdb_transcript + + if {$gdb_transcript != ""} { + puts -nonewline $gdb_transcript [lindex $args 0] + } + + return [uplevel real_send_gdb $args] + } +}