old-cross-binutils/gdb/testsuite/gdb.perf/disassemble.exp
Doug Evans 3714cea7d4 Pass plain-text prompt to with_gdb_prompt.
I had occasion to use with_gdb_prompt in a test for the patch for PR 17314
and was passing the plain text prompt as the value, "(top-gdb)",
instead of a regexp, "\(top-gdb\)" (expressed as "\\(top-gdb\\)" in TCL).

I then discovered that in order to restore the prompt gdb passes the
original value of $gdb_prompt to "set prompt", which works because
"set prompt \(gdb\) " is equivalent to "set prompt (gdb) ".
Perhaps I'm being overly cautious but this feels a bit subtle,
but at any rate as an API choice I'd much rather pass the plain text
form to with_gdb_prompt.

I also discovered that the initial value of gdb_prompt is set in
two places to two different values.
At the global level gdb.exp sets it to "\[(\]gdb\[)\]"
and default_gdb_init sets it to "\\(gdb\\)".
The former form is undesirable as an argument to "set prompt",
but it's not clear to me that just deleting this code won't break
anything.  Thus I just changed the value to be consistent and added
a comment.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_prompt): Add comment and change initial value to
	be consistent with what default_gdb_init uses.
	(with_gdb_prompt): Change form of PROMPT argument from a regexp to
	the plain text of the prompt.  Add some logging printfs.
	* gdb.perf/disassemble.exp: Update call to with_gdb_prompt.
2014-09-13 15:52:15 -07:00

57 lines
1.7 KiB
Text

# Copyright (C) 2013-2014 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This test case is to test the speed of GDB when it is doing disassemble
# some large functions in GDB.
load_lib perftest.exp
if [skip_perf_tests] {
return 0
}
global GDB
standard_testfile .c
# Overwrite $binfile
set binfile $GDB
PerfTest::assemble {
# Don't have compilation step.
return 0
} {
global srcdir subdir
global binfile
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
# When GDB is debugging GDB, the prompt is changed to "(top-gdb) ".
# In order to avoid the confusion of pattern matching, set the
# gdb_prompt to '(top-gdb)' temporarily.
with_gdb_prompt "(top-gdb)" {
gdb_load ${binfile}
}
# The prompt of both parent GDB and child GDB is '(gdb)', but
# child GDB's prompt doesn't confuse pattern matching because but
# we only run to main function of child GDB, so child GDB's
# prompt can't be printed out.
if ![runto_main] {
return -1
}
} {
gdb_test "python Disassemble\(\).run()"
}