From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oHWZN51BlWIQVAkAWB0awg (envelope-from ) for ; Mon, 30 May 2022 18:13:49 -0400 Received: by simark.ca (Postfix, from userid 112) id DC4BB1E221; Mon, 30 May 2022 18:13:49 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=G72uj5Ov; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 24BA01E01D for ; Mon, 30 May 2022 18:13:49 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B2E4538485A4 for ; Mon, 30 May 2022 22:13:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B2E4538485A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1653948828; bh=AuwkAhP47eXfsVtk/mxNnSv5t+pOWOX+FHcUz9xR2r4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=G72uj5Ovg8FvLnn/ulN2PYGuCRywn7txtjIO970snZrEKWJa/Dr8Tw1+pwnS2v9p/ x+WW1hG8SdlMPd7ggjAgxizPr6k8UAUYa1lbsFxfn1vv4WeINxZpi4tiJVqwUXTLC6 zqmL+gXpwk5sdg7OnZ5OVT47xVV7TyyQKsnDALbU= Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 7C37B38485A5 for ; Mon, 30 May 2022 22:12:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7C37B38485A5 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24UHupPG012781; Mon, 30 May 2022 22:12:23 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gd2s43e0q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 May 2022 22:12:23 +0000 Received: from m0098417.ppops.net (m0098417.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 24UMCJC3015044; Mon, 30 May 2022 22:12:23 GMT Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3gd2s43e0c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 May 2022 22:12:22 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 24UM7Ikm006079; Mon, 30 May 2022 22:12:21 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04ams.nl.ibm.com with ESMTP id 3gbcae377a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 30 May 2022 22:12:21 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 24UMCGim21365070 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 30 May 2022 22:12:16 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 646F74C04A; Mon, 30 May 2022 22:12:16 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 097664C040; Mon, 30 May 2022 22:12:16 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.171.0.196]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 30 May 2022 22:12:15 +0000 (GMT) To: Tom Tromey , Andrew Burgess Subject: [PATCH v2 3/7] gdb.perf/: Allow adjusting GenPerfTest compile options Date: Tue, 31 May 2022 00:11:43 +0200 Message-Id: <20220530221147.1991835-4-iii@linux.ibm.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220530221147.1991835-1-iii@linux.ibm.com> References: <20220530221147.1991835-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 8MtGwaqoWHwf4TfKfL8yCU79YbfV6VSA X-Proofpoint-ORIG-GUID: uDC5JXd9L_SZPeAbSTyjFLjruOzMcuFT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.517,FMLib:17.11.64.514 definitions=2022-05-30_09,2022-05-30_03,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 suspectscore=0 spamscore=0 bulkscore=0 adultscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2204290000 definitions=main-2205300117 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Ilya Leoshkevich via Gdb-patches Reply-To: Ilya Leoshkevich Cc: Ulrich Weigand , Andreas Arnez , gdb-patches@sourceware.org, Pedro Alves , Ilya Leoshkevich Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Introduce new callbacks to adjust the compile options based on certain criteria: the total number of shared objects for the binary and the shared object index for shared objects (no criteria are defined for the tail shared object at the moment). This is useful for setting shared objects' load addresses in performance tests. --- gdb/testsuite/lib/gen-perf-test.exp | 32 ++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/lib/gen-perf-test.exp b/gdb/testsuite/lib/gen-perf-test.exp index 07007db0834..eab6b5499d4 100644 --- a/gdb/testsuite/lib/gen-perf-test.exp +++ b/gdb/testsuite/lib/gen-perf-test.exp @@ -76,6 +76,9 @@ namespace eval GenPerfTest { # Header files used by generated files and extra sources. set DEFAULT_BINARY_EXTRA_HEADERS {} + # The name of the function that adjusts binary's compile options. + set DEFAULT_BINARY_ADJUST_COMPILE_OPTIONS GenPerfTest::default_adjust_compile_options + # Extra source files for each generated shlib. # The compiler passes -DSHLIB=NNN which the source can use, for example, # to define unique symbols for each shlib. @@ -84,6 +87,10 @@ namespace eval GenPerfTest { # Header files used by generated files and extra sources. set DEFAULT_GEN_SHLIB_EXTRA_HEADERS {} + # The name of the function that adjusts each generated shlib's compile + # options. + set DEFAULT_GEN_SHLIB_ADJUST_COMPILE_OPTIONS GenPerfTest::default_adjust_compile_options + # Source files for a tail shlib, or empty if none. # This library is loaded after all other shlibs (except any system shlibs # like libstdc++). It is useful for exercising issues that can appear @@ -94,6 +101,9 @@ namespace eval GenPerfTest { # Header files for the tail shlib. set DEFAULT_TAIL_SHLIB_HEADERS {} + # The name of the function that adjusts tail shlib's compile options. + set DEFAULT_TAIL_SHLIB_ADJUST_COMPILE_OPTIONS GenPerfTest::default_adjust_compile_options + # The number of shared libraries to create. set DEFAULT_NR_GEN_SHLIBS 0 @@ -184,6 +194,12 @@ namespace eval GenPerfTest { set source_suffixes(c) "c" set source_suffixes(c++) "cc" + # Do not adjust any compile options by default. + + proc default_adjust_compile_options { options args } { + return $options + } + # Generate .worker files that control building all the "pieces" of the # testcase. This doesn't include "main" or any test-specific stuff. # This mostly consists of the "bulk" (aka "crap" :-)) of the testcase to @@ -251,10 +267,13 @@ namespace eval GenPerfTest { set testcase(run_names) [list $name] set testcase(binary_extra_sources) $GenPerfTest::DEFAULT_BINARY_EXTRA_SOURCES set testcase(binary_extra_headers) $GenPerfTest::DEFAULT_BINARY_EXTRA_HEADERS + set testcase(binary_adjust_compile_options) $GenPerfTest::DEFAULT_BINARY_ADJUST_COMPILE_OPTIONS set testcase(gen_shlib_extra_sources) $GenPerfTest::DEFAULT_GEN_SHLIB_EXTRA_SOURCES set testcase(gen_shlib_extra_headers) $GenPerfTest::DEFAULT_GEN_SHLIB_EXTRA_HEADERS + set testcase(gen_shlib_adjust_compile_options) $GenPerfTest::DEFAULT_GEN_SHLIB_ADJUST_COMPILE_OPTIONS set testcase(tail_shlib_sources) $GenPerfTest::DEFAULT_TAIL_SHLIB_SOURCES set testcase(tail_shlib_headers) $GenPerfTest::DEFAULT_TAIL_SHLIB_HEADERS + set testcase(tail_shlib_adjust_compile_options) $GenPerfTest::DEFAULT_TAIL_SHLIB_ADJUST_COMPILE_OPTIONS set testcase(nr_gen_shlibs) $GenPerfTest::DEFAULT_NR_GEN_SHLIBS set testcase(nr_compunits) $GenPerfTest::DEFAULT_NR_COMPUNITS set testcase(binary_link_with_shlibs) $GenPerfTest::DEFAULT_BINARY_LINK_WITH_SHLIBS @@ -282,9 +301,9 @@ namespace eval GenPerfTest { proc _verify_parameter_lengths { self_var } { upvar 1 $self_var self set params { - binary_extra_sources binary_extra_headers - gen_shlib_extra_sources gen_shlib_extra_headers - tail_shlib_sources tail_shlib_headers + binary_extra_sources binary_extra_headers binary_adjust_compile_options + gen_shlib_extra_sources gen_shlib_extra_headers gen_shlib_adjust_compile_options + tail_shlib_sources tail_shlib_headers tail_shlib_adjust_compile_options nr_gen_shlibs nr_compunits binary_link_with_shlibs nr_extern_globals nr_static_globals nr_extern_functions nr_static_functions @@ -1174,6 +1193,8 @@ namespace eval GenPerfTest { set extra_headers [_get_param $self(gen_shlib_extra_headers) $run_nr] set shlib_file [_make_shlib_name self $static $run_nr $so_nr] set compile_options "[_compile_options self] additional_flags=-DSHLIB=$so_nr" + set adjust_compile_options [_get_param $self(gen_shlib_adjust_compile_options) $run_nr] + set compile_options [$adjust_compile_options $compile_options [expr $so_nr + 1]] set all_header_files $header_files append all_header_files $extra_headers set compile_result [_perftest_compile self $source_files $all_header_files $shlib_file shlib $compile_options] @@ -1218,6 +1239,8 @@ namespace eval GenPerfTest { set header_files [_get_param $self(tail_shlib_headers) $run_nr] set shlib_file [_make_tail_shlib_name self $static $run_nr] set compile_options [_compile_options self] + set adjust_compile_options [_get_param $self(tail_shlib_adjust_compile_options) $run_nr] + set compile_options [$adjust_compile_options $compile_options] set compile_result [_perftest_compile self $source_files $header_files $shlib_file shlib $compile_options] if { $compile_result != "" } { verbose -log "_compile_tail_shlib failed: $compile_result" @@ -1322,6 +1345,9 @@ namespace eval GenPerfTest { set extra_headers [_get_param $self(binary_extra_headers) $run_nr] set binary_file [_make_binary_name self $run_nr] set compile_options [_compile_options self] + set adjust_compile_options [_get_param $self(binary_adjust_compile_options) $run_nr] + set nr_gen_shlibs [_get_param $self(nr_gen_shlibs) $run_nr] + set compile_options [$adjust_compile_options $compile_options $nr_gen_shlibs] set shlib_options [_make_shlib_options self $static $run_nr] if { [llength $shlib_options] > 0 } { append compile_options " " $shlib_options -- 2.35.3