1# Copyright (C) 2013-2023 Free Software Foundation, Inc.
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16# This test case is to test the speed of GDB when it is doing disassemble
17# some large functions in GDB.
18load_lib perftest.exp
19
20if [skip_perf_tests] {
21    return 0
22}
23
24global GDB
25
26standard_testfile .c
27# Overwrite $binfile
28set binfile $GDB
29
30PerfTest::assemble {
31    # Don't have compilation step.
32    return 0
33} {
34    global srcdir subdir
35    global binfile
36
37    gdb_exit
38    gdb_start
39    gdb_reinitialize_dir $srcdir/$subdir
40
41    # When GDB is debugging GDB, the prompt is changed to "(top-gdb) ".
42    # In order to avoid the confusion of pattern matching, set the
43    # gdb_prompt to '(top-gdb)' temporarily.
44    with_gdb_prompt "(top-gdb)" {
45	gdb_load ${binfile}
46    }
47
48    # The prompt of both parent GDB and child GDB is '(gdb)', but
49    # child GDB's prompt doesn't confuse pattern matching because but
50    # we only run to main function of child GDB, so child GDB's
51    # prompt can't be printed out.
52    if ![runto_main] {
53	return -1
54    }
55
56    return 0
57} {
58    gdb_test_python_run "Disassemble\(\)"
59    return 0
60}
61