mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-24 18:32:38 +08:00
Add gmonster-{1,2} perf testcases.
These testcases are mocks of real programs. GDB doesn't care what the programs do, they just have to look and/or behave like the real program. These testcases exercise gdb when debugging really large programs. E.g., gmonster-1 has 10,000 CUs, and gmonster-2 has 1000 shared libs (which is actually a little small, 5000 would be more accurate). gdb/testsuite/ChangeLog: * gdb.perf/lib/perftest/utils.py: New file. * gdb.perf/gm-hello.cc: New file. * gdb.perf/gm-pervasive-typedef.cc: New file. * gdb.perf/gm-pervasive-typedef.h: New file. * gdb.perf/gm-std.cc: New file. * gdb.perf/gm-std.h: New file. * gdb.perf/gm-use-cerr.cc: New file. * gdb.perf/gm-utils.h: New file. * gdb.perf/gmonster-null-lookup.py: New file. * gdb.perf/gmonster-pervasive-typedef.py: New file. * gdb.perf/gmonster-print-cerr.py: New file. * gdb.perf/gmonster-ptype-string.py: New file. * gdb.perf/gmonster-runto-main.py: New file. * gdb.perf/gmonster-select-file.py: New file. * gdb.perf/gmonster1-null-lookup.exp: New file. * gdb.perf/gmonster1-pervasive-typedef.exp: New file. * gdb.perf/gmonster1-print-cerr.exp: New file. * gdb.perf/gmonster1-ptype-string.exp: New file. * gdb.perf/gmonster1-runto-main.exp: New file. * gdb.perf/gmonster1-select-file.exp: New file. * gdb.perf/gmonster1.cc: New file. * gdb.perf/gmonster1.exp: New file. * gdb.perf/gmonster2-null-lookup.exp: New file. * gdb.perf/gmonster2-pervasive-typedef.exp: New file. * gdb.perf/gmonster2-print-cerr.exp: New file. * gdb.perf/gmonster2-ptype-string.exp: New file. * gdb.perf/gmonster2-runto-main.exp: New file. * gdb.perf/gmonster2-select-file.exp: New file. * gdb.perf/gmonster2.cc: New file. * gdb.perf/gmonster2.exp: New file.
This commit is contained in:
gdb/testsuite/gdb.perf
gm-hello.ccgm-pervasive-typedef.ccgm-pervasive-typedef.hgm-std.ccgm-std.hgm-use-cerr.ccgm-utils.hgmonster-null-lookup.pygmonster-pervasive-typedef.pygmonster-print-cerr.pygmonster-ptype-string.pygmonster-runto-main.pygmonster-select-file.pygmonster1-null-lookup.expgmonster1-pervasive-typedef.expgmonster1-print-cerr.expgmonster1-ptype-string.expgmonster1-runto-main.expgmonster1-select-file.expgmonster1.ccgmonster1.expgmonster2-null-lookup.expgmonster2-pervasive-typedef.expgmonster2-print-cerr.expgmonster2-ptype-string.expgmonster2-runto-main.expgmonster2-select-file.expgmonster2.ccgmonster2.exp
lib/perftest
68
gdb/testsuite/gdb.perf/lib/perftest/utils.py
Normal file
68
gdb/testsuite/gdb.perf/lib/perftest/utils.py
Normal file
@ -0,0 +1,68 @@
|
||||
# Copyright (C) 2015 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/>.
|
||||
|
||||
import gdb
|
||||
|
||||
def safe_execute(command):
|
||||
"""Execute command, ignoring any gdb errors."""
|
||||
result = None
|
||||
try:
|
||||
result = gdb.execute(command, to_string=True)
|
||||
except gdb.error:
|
||||
pass
|
||||
return result
|
||||
|
||||
|
||||
def convert_spaces(file_name):
|
||||
"""Return file_name with all spaces replaced with "-"."""
|
||||
return file_name.replace(" ", "-")
|
||||
|
||||
|
||||
def select_file(file_name):
|
||||
"""Select a file for debugging.
|
||||
|
||||
N.B. This turns confirmation off.
|
||||
"""
|
||||
safe_execute("set confirm off")
|
||||
print ("Selecting file %s" % (file_name))
|
||||
if file_name is None:
|
||||
gdb.execute("file")
|
||||
else:
|
||||
gdb.execute("file %s" % (file_name))
|
||||
|
||||
|
||||
def runto(location):
|
||||
"""Run the program to location.
|
||||
|
||||
N.B. This turns confirmation off.
|
||||
"""
|
||||
safe_execute("set confirm off")
|
||||
gdb.execute("tbreak %s" % (location))
|
||||
gdb.execute("run")
|
||||
|
||||
|
||||
def runto_main():
|
||||
"""Run the program to "main".
|
||||
|
||||
N.B. This turns confirmation off.
|
||||
"""
|
||||
runto("main")
|
||||
|
||||
|
||||
def run_n_times(count, func):
|
||||
"""Execute func count times."""
|
||||
while count > 0:
|
||||
func()
|
||||
count -= 1
|
Reference in New Issue
Block a user