From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gaEmK2mSmmr7/ScAWB0awg (envelope-from ) for ; Fri, 04 Sep 2026 05:42:01 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=OKtYxW/D; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=lcFUbiAU; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Jdcv7Svw; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=deFn/jO8; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A9AC61E166; Fri, 04 Sep 2026 05:42:01 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 74B951E09B for ; Fri, 04 Sep 2026 05:41:59 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 045CF48FBC8B for ; Fri, 4 Sep 2026 09:41:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 045CF48FBC8B Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=OKtYxW/D; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=lcFUbiAU; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Jdcv7Svw; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=deFn/jO8 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 5273D4A9BE5F for ; Fri, 4 Sep 2026 09:39:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5273D4A9BE5F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5273D4A9BE5F Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788514749; cv=none; b=h7fNCiUc6w+FpzngFffv+Xt7/Te6YCOYPxx/gHt3FPiI6v2ubzkdUAXHVa2w02tz9ZLNSJahqoL+Sxm3/TSBwAMVIWKXE0V27XdC5r6nhZbPqQKWI87An47WS5/qvuCxfDdUOFQNo6u2GTT7c+j6T0r/Mzn3dojBC/lGHNJ7NBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788514749; c=relaxed/simple; bh=ciKx/v1nJf4O4FRW145211EX2NxLGaM+75e8vRMM6ss=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=ix9xj5KXGCmH5aK+ycID7VJ9l7cMmGJq2Hj9Qmt8raLjaXjqh5SbWs6ELzakXj4waSWmAeF3eJEAzNOicjvH9sNDeDabKdYCCLktrq40FT1MqMW5Y7D346WxMw1x3NLVvbgcgcxsH+1SqV62JeHg+163Tqlo4B2m0L7ZIgJTdow= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=OKtYxW/D; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=lcFUbiAU; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=Jdcv7Svw; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=deFn/jO8 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5273D4A9BE5F Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 02CC5203A3 for ; Fri, 4 Sep 2026 09:39:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788514744; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f4bF/CeM/fmRm20wwghRwLSZZcBnBUrUhF6EH/Rj1gw=; b=OKtYxW/Dpgo5AlrDCH9LB08xDB+S9NCXsAGHROzxyv4IMknkFWyOSkrhgagyg5MaWAKise QuEkRmc2+dLzE0yu5CJZvFxFpCcB2KageYyBj/u7eJ8N3EbyXccUR06SUsEREFzMnFvK07 putv5JpigNmUjOkmE1wifejK3c3ZcuE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788514744; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f4bF/CeM/fmRm20wwghRwLSZZcBnBUrUhF6EH/Rj1gw=; b=lcFUbiAUbqUnGHxn2VGnkcxMLAXQRfIi29kw91llShaBiCH4CC1vfAglFFhcgejXPou+qG EdKB3TCng1IuaeDQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788514740; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f4bF/CeM/fmRm20wwghRwLSZZcBnBUrUhF6EH/Rj1gw=; b=Jdcv7Svw62lpsSwdXtFB7GlqQ0HVBF4i9HZ7J62CP4woUw3tAlYDx7XqnO+PrnniSrV0Tl 4t2Hbo1Ibq3IpSomFHO7JevxwGlxZZwDTeObUMvkf/L6f7uoJrVIIwdM61n4pkYKTytTyF eVJYJeG1gOam+Qxz8m4sk6kCqB4XO5Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788514740; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f4bF/CeM/fmRm20wwghRwLSZZcBnBUrUhF6EH/Rj1gw=; b=deFn/jO8/VziWqhsAbj/Z+LdAMZ2UNgb0gc17yoa1ZwmiV4UpEthf02FxS5+P8VYRLmggu lLzqJkwX0xC04XCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 934F513869 for ; Fri, 4 Sep 2026 09:38:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id sMCUIrORmmqyFQAAD6G6ig (envelope-from ) for ; Fri, 04 Sep 2026 09:38:59 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [RFC 4/5] [gdb/testsuite] Reformat lib/gdb.exp Date: Fri, 4 Sep 2026 11:38:54 +0200 Message-ID: <20260904093858.359604-4-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260904093858.359604-1-tdevries@suse.de> References: <20260904093858.359604-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.997]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Reformat gdb/testsuite/lib/gdb.exp using: ... $ pre-commit run \ --hook-stage manual \ indent-exp \ --files gdb/testsuite/lib/gdb.exp ... --- gdb/testsuite/lib/gdb.exp | 484 +++++++++++++++++++------------------- 1 file changed, 242 insertions(+), 242 deletions(-) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index b0a4cc1b39f..2cf54437acf 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -145,15 +145,15 @@ rename load_lib saved_load_lib proc load_lib { file } { array set known_global {} foreach varname [info globals] { - set known_globals($varname) 1 + set known_globals($varname) 1 } set code [catch {saved_load_lib $file} result] foreach varname [info globals] { - if { ![info exists known_globals($varname)] } { - gdb_persistent_global_no_decl $varname - } + if { ![info exists known_globals($varname)] } { + gdb_persistent_global_no_decl $varname + } } if {$code == 1} { @@ -619,10 +619,10 @@ proc gdb_run_cmd { {inferior_args {}} } { } } send_gdb "run $inferior_args\n" -# This doesn't work quite right yet. -# Use -notransfer here so that test cases (like chng-sym.exp) -# may test for additional start-up messages. - gdb_expect 60 { + # This doesn't work quite right yet. + # Use -notransfer here so that test cases (like chng-sym.exp) + # may test for additional start-up messages. + gdb_expect 60 { -re "The program .* has been started already.*y or n. $" { send_gdb "y\n" answer exp_continue @@ -787,16 +787,16 @@ proc gdb_breakpoint { linespec args } { -re "$break_message \[0-9\]*: file .*, line $decimal.\r\n$gdb_prompt $" {} -re "$break_message \[0-9\]* at .*$gdb_prompt $" {} -re "$break_message \[0-9\]* \\(.*\\) pending.*$gdb_prompt $" { - if {$pending_response == "n"} { - if { $print_fail } { - fail $gdb_test_name - } - return 0 + if {$pending_response == "n"} { + if { $print_fail } { + fail $gdb_test_name } + return 0 + } } -re "Make breakpoint pending.*y or \\\[n\\\]. $" { - send_gdb "$pending_response\n" - exp_continue + send_gdb "$pending_response\n" + exp_continue } -re "$gdb_prompt $" { if { $print_fail } { @@ -1267,7 +1267,7 @@ proc gdb_test_multiple { command message args } { if {$use_gdb_stub && [regexp -nocase {^\s*(r|run|star|start|at|att|atta|attac|attach)\M} \ - $command]} { + $command]} { error "gdbserver does not support $command without extended-remote" } @@ -1532,11 +1532,11 @@ proc gdb_test_multiple { command message args } { } if {$line_by_line} { - append code { - -re "\r\n\[^\r\n\]*(?=\r\n)" { - exp_continue - } - } + append code { + -re "\r\n\[^\r\n\]*(?=\r\n)" { + exp_continue + } + } } # Now patterns that apply to any spawn id specified. @@ -2672,7 +2672,7 @@ proc gdb_file_cmd { arg {kill_flag 1} } { -re "$gdb_prompt $" { perror "Couldn't load $basename into GDB." return -1 - } + } timeout { perror "Couldn't load $basename into GDB (timeout)." return -1 @@ -3812,7 +3812,7 @@ proc get_largest_timeout {} { set tmt 0 if {[info exists timeout]} { - set tmt $timeout + set tmt $timeout } if { [info exists gtimeout] && $gtimeout > $tmt } { set tmt $gtimeout @@ -3913,7 +3913,7 @@ gdb_caching_proc supports_memtag {} { gdb_test_multiple "memory-tag check" "" { -re "Memory tagging not supported or disabled by the current architecture\..*$gdb_prompt $" { - return 0 + return 0 } -re "Argument required \\(address or pointer\\).*$gdb_prompt $" { return 1 @@ -4366,7 +4366,7 @@ gdb_caching_proc allow_altivec_tests {} { set allow_vmx_tests 1 } default { - warning "\n$me: default case taken" + warning "\n$me: default case taken" set allow_vmx_tests 0 } } @@ -4386,11 +4386,11 @@ gdb_caching_proc allow_power_isa_3_1_tests {} { # Compile a test program containing ISA 3.1 instructions. set src { int main() { - asm volatile ("pnop"); // marker - asm volatile ("nop"); - return 0; - } + asm volatile ("pnop"); // marker + asm volatile ("nop"); + return 0; } + } if {![gdb_simple_compile $me $src executable ]} { return 0 @@ -4482,7 +4482,7 @@ gdb_caching_proc allow_vsx_tests {} { set allow_vsx_tests 1 } default { - warning "\n$me: default case taken" + warning "\n$me: default case taken" set allow_vsx_tests 0 } } @@ -4729,23 +4729,23 @@ gdb_caching_proc allow_lam_tests {} { # Compile a test program. set src { - #define _GNU_SOURCE - #include - #include - #include - #include - #include + #define _GNU_SOURCE + #include + #include + #include + #include + #include - int configure_lam () - { - errno = 0; - syscall (SYS_arch_prctl, ARCH_ENABLE_TAGGED_ADDR, 6); - assert_perror (errno); - return errno; - } + int configure_lam () + { + errno = 0; + syscall (SYS_arch_prctl, ARCH_ENABLE_TAGGED_ADDR, 6); + assert_perror (errno); + return errno; + } - int - main () { return configure_lam (); } + int + main () { return configure_lam (); } } if {![gdb_simple_compile $me $src executable ""]} { @@ -4898,8 +4898,8 @@ gdb_caching_proc allow_btrace_ptw_tests {} { int main () { - _ptwrite32 (0x42); - return 0; + _ptwrite32 (0x42); + return 0; } } @@ -4937,15 +4937,15 @@ gdb_caching_proc allow_btrace_ptw_tests {} { gdb_test_multiple "maintenance btrace packet-history 0,1000" \ "$me: check decoding support" { - -re "ptw" { - verbose -log "$me: ptwrite decoding support detected." - set allow_btrace_ptw_tests 1 - } - -re -wrap "" { - verbose -log "$me: ptwrite decoding support not detected." - set allow_btrace_ptw_tests 0 + -re "ptw" { + verbose -log "$me: ptwrite decoding support detected." + set allow_btrace_ptw_tests 1 + } + -re -wrap "" { + verbose -log "$me: ptwrite decoding support not detected." + set allow_btrace_ptw_tests 0 + } } - } } gdb_exit @@ -4968,7 +4968,7 @@ gdb_caching_proc allow_btrace_pt_event_trace_tests {} { int main () { - return 0; + return 0; } } @@ -5051,7 +5051,7 @@ gdb_caching_proc allow_aarch64_sve_tests {} { set allow_sve_tests 1 } default { - warning "\n$me: default case taken" + warning "\n$me: default case taken" set allow_sve_tests 0 } } @@ -5112,12 +5112,12 @@ gdb_caching_proc aarch64_initialize_sve_information { } { # Go through the data and extract the supported SVE vector lengths. set vl_count [get_valueof "" "supported_vl_count" "0" \ - "fetch value of supported_vl_count"] + "fetch value of supported_vl_count"] verbose -log "Found $vl_count supported SVE vector length values" for {set vl_index 0} {$vl_index < $vl_count} {incr vl_index} { set test_vl [get_valueof "" "supported_vl\[$vl_index\]" "0" \ - "fetch value of supported_vl\[$vl_index\]"] + "fetch value of supported_vl\[$vl_index\]"] # Mark this vector length as supported. if {$test_vl != 0} { @@ -5210,7 +5210,7 @@ gdb_caching_proc allow_aarch64_sme_tests {} { set allow_sme_tests 1 } default { - warning "\n$me: default case taken" + warning "\n$me: default case taken" set allow_sme_tests 0 } } @@ -5271,12 +5271,12 @@ gdb_caching_proc aarch64_initialize_sme_information { } { # Go through the data and extract the supported SME vector lengths. set svl_count [get_valueof "" "supported_svl_count" "0" \ - "fetch value of supported_svl_count"] + "fetch value of supported_svl_count"] verbose -log "Found $svl_count supported SME vector length values" for {set svl_index 0} {$svl_index < $svl_count} {incr svl_index} { set test_svl [get_valueof "" "supported_svl\[$svl_index\]" "0" \ - "fetch value of supported_svl\[$svl_index\]"] + "fetch value of supported_svl\[$svl_index\]"] # Mark this streaming vector length as supported. if {$test_svl != 0} { @@ -5370,7 +5370,7 @@ gdb_caching_proc allow_aarch64_fpmr_tests {} { set allow_fpmr_tests 1 } default { - warning "\n$me: default case taken" + warning "\n$me: default case taken" set allow_fpmr_tests 0 } } @@ -5424,7 +5424,7 @@ gdb_caching_proc allow_aarch64_lrcpc3_tests {} { gdb_load $obj gdb_run_cmd gdb_expect { - -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { + -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { verbose -log "\n$me: lrcpc3 support detected" set allow_lrcpc3_tests 1 } @@ -5463,7 +5463,7 @@ gdb_caching_proc allow_aarch64_cssc_tests {} { } if {![gdb_simple_compile $me $src executable $compile_flags]} { - return 0 + return 0 } # Compilation succeeded so now run it via gdb. @@ -5481,7 +5481,7 @@ gdb_caching_proc allow_aarch64_cssc_tests {} { set allow_cssc_tests 1 } default { - warning "\n$me: default case taken" + warning "\n$me: default case taken" set allow_cssc_tests 0 } } @@ -5508,9 +5508,9 @@ gdb_caching_proc allow_aarch64_lse128_tests {} { # Compile a test program reading LSE128. set src { - #include + #include - int main() { + int main() { __attribute__((aligned(16))) uint64_t mem[2] = { 0x0, 0x1 }; uint64_t *ptr = mem; __asm__ volatile ("ldclrp x0, x1, [%0]\n" :: "r"(ptr) : "x0", "x1", "memory"); @@ -5519,7 +5519,7 @@ gdb_caching_proc allow_aarch64_lse128_tests {} { } if {![gdb_simple_compile $me $src executable $compile_flags]} { - return 0 + return 0 } # Compilation succeeded so now run it via gdb. @@ -5537,7 +5537,7 @@ gdb_caching_proc allow_aarch64_lse128_tests {} { set allow_lse128_tests 1 } default { - warning "\n$me: default case taken" + warning "\n$me: default case taken" set allow_lse128_tests 0 } } @@ -5599,7 +5599,7 @@ gdb_caching_proc allow_aarch64_mops_tests {} { set allow_mops_tests 1 } default { - warning "\n$me: default case taken" + warning "\n$me: default case taken" set allow_mops_tests 0 } } @@ -5955,13 +5955,13 @@ proc is_any_target {args} { # check for skipping respective tests. proc use_gdb_stub {} { - global use_gdb_stub + global use_gdb_stub - if {[info exists use_gdb_stub]} { - return $use_gdb_stub - } + if {[info exists use_gdb_stub]} { + return $use_gdb_stub + } - return [target_info exists use_gdb_stub] + return [target_info exists use_gdb_stub] } # Return 1 if the current remote target is an instance of our GDBserver, 0 @@ -6399,7 +6399,7 @@ proc escape_for_host { str } { if { [is_remote host] } { set map { {$} {\\$} - } + } } else { set map { {$} {\$} @@ -6783,7 +6783,7 @@ proc gdb_compile {source dest type options} { || [istarget *-*-pe*])} { lappend source "${shlib_name}.a" } else { - lappend source $shlib_name + lappend source $shlib_name } if { $shlib_found == 0 } { set shlib_found 1 @@ -6852,7 +6852,7 @@ proc gdb_compile {source dest type options} { } elseif { $opt == "dwarf5" } { if {[test_compiler_info {gcc-*}] \ - || [test_compiler_info {clang-*}]} { + || [test_compiler_info {clang-*}]} { lappend new_options "additional_flags=-gdwarf-5" } else { error "No idea how to force DWARF-5 in this compiler" @@ -7017,16 +7017,16 @@ proc gdb_compile {source dest type options} { lappend options "$flag" } - set macros [lsearch -exact $options macros] - if {$macros != -1} { - if { [test_compiler_info "clang-*"] } { - set flag "additional_flags=-fdebug-macro" - } else { - set flag "additional_flags=-g3" - } + set macros [lsearch -exact $options macros] + if {$macros != -1} { + if { [test_compiler_info "clang-*"] } { + set flag "additional_flags=-fdebug-macro" + } else { + set flag "additional_flags=-g3" + } - set options [lreplace $options $macros $macros $flag] - } + set options [lreplace $options $macros $macros $flag] + } if { $type == "executable" } { if { ([istarget "*-*-mingw*"] @@ -7154,8 +7154,8 @@ proc gdb_compile {source dest type options} { cond_wrap [expr {$pie != -1 || $nopie != -1}] \ with_PIE_multilib_flags_filtered { - set result [target_compile $source $dest $type $options] - } + set result [target_compile $source $dest $type $options] + } # Prune uninteresting compiler (and linker) output. regsub "Creating library file: \[^\r\n\]*\[\r\n\]+" $result "" result @@ -7263,17 +7263,17 @@ proc gdb_compile_shlib_1 {sources dest options} { } "gcc-*" { if { [istarget "powerpc*-*-aix*"] - || [istarget "rs6000*-*-aix*"] - || [istarget "*-*-cygwin*"] - || [istarget "*-*-mingw*"] - || [istarget "*-*-pe*"] } { + || [istarget "rs6000*-*-aix*"] + || [istarget "*-*-cygwin*"] + || [istarget "*-*-mingw*"] + || [istarget "*-*-pe*"] } { lappend obj_options "additional_flags=-fPIC" } else { lappend obj_options "additional_flags=-fpic" } } "icc-*" { - lappend obj_options "additional_flags=-fpic" + lappend obj_options "additional_flags=-fpic" } default { # don't know what the compiler is... @@ -7560,7 +7560,7 @@ proc gdb_expect { args } { } set code [catch \ - {uplevel remote_expect host $tmt $expcode} string] + {uplevel remote_expect host $tmt $expcode} string] if {$code == 1} { global errorInfo errorCode @@ -8084,10 +8084,10 @@ proc exec_symbol_file { binfile } { # to BINFILE2, but some targets require multiple binary files. proc gdb_rename_execfile { binfile1 binfile2 } { file rename -force [exec_target_file ${binfile1}] \ - [exec_target_file ${binfile2}] + [exec_target_file ${binfile2}] if { [exec_target_file ${binfile1}] != [exec_symbol_file ${binfile1}] } { file rename -force [exec_symbol_file ${binfile1}] \ - [exec_symbol_file ${binfile2}] + [exec_symbol_file ${binfile2}] } } @@ -8660,7 +8660,7 @@ proc standard_output_file_with_gdb_instance {basename} { set count $gdb_instances if {$count == 0} { - return [standard_output_file $basename] + return [standard_output_file $basename] } return [standard_output_file ${basename}.${count}] } @@ -9121,87 +9121,87 @@ proc gdb_get_line_number { text { file "" } } { # is accepted. proc gdb_continue_to_end {{mssg ""} {command continue} {allow_extra 0}} { - global inferior_exited_re use_gdb_stub - - if {$mssg == ""} { - set text "continue until exit" - } else { - set text "continue until exit at $mssg" - } - - if {$allow_extra} { - set extra ".*" - } elseif {[istarget *-*-cygwin*] || [istarget *-*-mingw*]} { - # On Windows, even on supposedly single-threaded programs, we - # may see thread exit output when running to end, for threads - # spawned by the runtime. E.g.: - # - # (gdb) continue - # Continuing. - # [Thread 14364.0x21d4 exited with code 0] - # [Thread 14364.0x4374 exited with code 0] - # [Thread 14364.0x3aec exited with code 0] - # [Thread 14364.0x3368 exited with code 0] - # [Inferior 1 (process 14364) exited normally] - # - set extra "(\\\[Thread \[^\r\n\]+ exited with code $::decimal\\\]\r\n)*" - } else { - set extra "" - } - - # By default, we don't rely on exit() behavior of remote stubs -- - # it's common for exit() to be implemented as a simple infinite - # loop, or a forced crash/reset. For native targets, by default, we - # assume process exit is reported as such. If a non-reliable target - # is used, we set a breakpoint at exit, and continue to that. - if { [target_info exists exit_is_reliable] } { - set exit_is_reliable [target_info exit_is_reliable] - } else { - set exit_is_reliable [expr {! $use_gdb_stub}] - } - - if { ! $exit_is_reliable } { - if {![gdb_breakpoint "exit"]} { - return 0 - } - gdb_test $command "Continuing..*Breakpoint .*exit.*" \ - $text - } else { - # Continue until we exit. Should not stop again. - # Don't bother to check the output of the program, that may be - # extremely tough for some remote systems. - gdb_test $command \ - "Continuing.\[\r\n0-9\]+${extra}(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\ - $text - } + global inferior_exited_re use_gdb_stub + + if {$mssg == ""} { + set text "continue until exit" + } else { + set text "continue until exit at $mssg" + } + + if {$allow_extra} { + set extra ".*" + } elseif {[istarget *-*-cygwin*] || [istarget *-*-mingw*]} { + # On Windows, even on supposedly single-threaded programs, we + # may see thread exit output when running to end, for threads + # spawned by the runtime. E.g.: + # + # (gdb) continue + # Continuing. + # [Thread 14364.0x21d4 exited with code 0] + # [Thread 14364.0x4374 exited with code 0] + # [Thread 14364.0x3aec exited with code 0] + # [Thread 14364.0x3368 exited with code 0] + # [Inferior 1 (process 14364) exited normally] + # + set extra "(\\\[Thread \[^\r\n\]+ exited with code $::decimal\\\]\r\n)*" + } else { + set extra "" + } + + # By default, we don't rely on exit() behavior of remote stubs -- + # it's common for exit() to be implemented as a simple infinite + # loop, or a forced crash/reset. For native targets, by default, we + # assume process exit is reported as such. If a non-reliable target + # is used, we set a breakpoint at exit, and continue to that. + if { [target_info exists exit_is_reliable] } { + set exit_is_reliable [target_info exit_is_reliable] + } else { + set exit_is_reliable [expr {! $use_gdb_stub}] + } + + if { ! $exit_is_reliable } { + if {![gdb_breakpoint "exit"]} { + return 0 + } + gdb_test $command "Continuing..*Breakpoint .*exit.*" \ + $text + } else { + # Continue until we exit. Should not stop again. + # Don't bother to check the output of the program, that may be + # extremely tough for some remote systems. + gdb_test $command \ + "Continuing.\[\r\n0-9\]+${extra}(... EXIT code 0\[\r\n\]+|$inferior_exited_re normally).*"\ + $text + } } proc rerun_to_main {} { - global gdb_prompt use_gdb_stub + global gdb_prompt use_gdb_stub - if {$use_gdb_stub} { - gdb_run_cmd - gdb_expect { - -re ".*Breakpoint .*main .*$gdb_prompt $"\ - {pass "rerun to main" ; return 0} - -re "$gdb_prompt $"\ - {fail "rerun to main" ; return 0} - timeout {fail "(timeout) rerun to main" ; return 0} - } - } else { - send_gdb "run\n" - gdb_expect { - -re "The program .* has been started already.*y or n. $" { - send_gdb "y\n" answer - exp_continue - } - -re "Starting program.*$gdb_prompt $"\ - {pass "rerun to main" ; return 0} - -re "$gdb_prompt $"\ - {fail "rerun to main" ; return 0} - timeout {fail "(timeout) rerun to main" ; return 0} + if {$use_gdb_stub} { + gdb_run_cmd + gdb_expect { + -re ".*Breakpoint .*main .*$gdb_prompt $"\ + {pass "rerun to main" ; return 0} + -re "$gdb_prompt $"\ + {fail "rerun to main" ; return 0} + timeout {fail "(timeout) rerun to main" ; return 0} + } + } else { + send_gdb "run\n" + gdb_expect { + -re "The program .* has been started already.*y or n. $" { + send_gdb "y\n" answer + exp_continue + } + -re "Starting program.*$gdb_prompt $"\ + {pass "rerun to main" ; return 0} + -re "$gdb_prompt $"\ + {fail "rerun to main" ; return 0} + timeout {fail "(timeout) rerun to main" ; return 0} + } } - } } # Return true if EXECUTABLE contains a .gdb_index or .debug_names index section. @@ -9500,21 +9500,21 @@ gdb_caching_proc gdb_has_argv0 {} { file delete $obj if { !$result - && ([istarget *-*-linux*] - || [istarget *-*-freebsd*] || [istarget *-*-kfreebsd*] - || [istarget *-*-netbsd*] || [istarget *-*-knetbsd*] - || [istarget *-*-openbsd*] - || [istarget *-*-darwin*] - || [istarget *-*-solaris*] - || [istarget *-*-aix*] - || [istarget *-*-gnu*] - || [istarget *-*-cygwin*] || [istarget *-*-mingw32*] - || [istarget *-*-*djgpp*] || [istarget *-*-go32*] - || [istarget *-wince-pe] || [istarget *-*-mingw32ce*] - || [istarget *-*-osf*] - || [istarget *-*-dicos*] - || [istarget *-*-*vms*] - || [istarget *-*-lynx*178]) } { + && ([istarget *-*-linux*] + || [istarget *-*-freebsd*] || [istarget *-*-kfreebsd*] + || [istarget *-*-netbsd*] || [istarget *-*-knetbsd*] + || [istarget *-*-openbsd*] + || [istarget *-*-darwin*] + || [istarget *-*-solaris*] + || [istarget *-*-aix*] + || [istarget *-*-gnu*] + || [istarget *-*-cygwin*] || [istarget *-*-mingw32*] + || [istarget *-*-*djgpp*] || [istarget *-*-go32*] + || [istarget *-wince-pe] || [istarget *-*-mingw32ce*] + || [istarget *-*-osf*] + || [istarget *-*-dicos*] + || [istarget *-*-*vms*] + || [istarget *-*-lynx*178]) } { fail "argv\[0\] should be available on this target" } @@ -9627,7 +9627,7 @@ proc gdb_gnu_strip_debug { dest args } { verbose "result is $result" verbose "output is $output" if {$result == 1} { - return 1 + return 1 } # Workaround PR binutils/10802: @@ -9641,7 +9641,7 @@ proc gdb_gnu_strip_debug { dest args } { verbose "result is $result" verbose "output is $output" if {$result == 1} { - return 1 + return 1 } # If no-main is passed, strip the symbol for main from the separate @@ -9733,7 +9733,7 @@ proc test_class_help { command_class expected_initial_lines {list_of_commands {} "Type \"help\" followed by command name for full documentation\.[\r\n]+" } set l_entire_body [concat $expected_initial_lines $l_list_of_commands \ - $l_stock_body $help_list_trailer] + $l_stock_body $help_list_trailer] help_test_raw "help ${command_class}" $l_entire_body $testname } @@ -9766,8 +9766,8 @@ proc test_prefix_command_help { command_list expected_initial_lines args } { # Use 'list' and not just {} because we want variables to # be expanded in this list. set l_stock_body [list\ - "List of \"$full_command\" subcommands\:.*\[\r\n\]+"\ - "Type \"help $full_command\" followed by subcommand name for full documentation\.\[\r\n\]+"] + "List of \"$full_command\" subcommands\:.*\[\r\n\]+"\ + "Type \"help $full_command\" followed by subcommand name for full documentation\.\[\r\n\]+"] set l_entire_body [concat $expected_initial_lines $l_stock_body $help_list_trailer] if {[llength $args]>0} { help_test_raw "help ${command}" $l_entire_body [lindex $args 0] @@ -10389,8 +10389,8 @@ gdb_caching_proc gdb_target_symbol_prefix {} { set result [catch {exec $objdump_program --syms $obj} output] if { $result == 0 \ - && ![regexp -lineanchor \ - { ([^ a-zA-Z0-9]*)main$} $output dummy prefix] } { + && ![regexp -lineanchor \ + { ([^ a-zA-Z0-9]*)main$} $output dummy prefix] } { verbose "gdb_target_symbol_prefix: Could not find main in objdump output; returning null prefix" 2 } @@ -10477,8 +10477,8 @@ gdb_caching_proc support_nested_function_tests {} { # prepended. (See gdb_target_symbol_prefix, above.) proc gdb_target_symbol { symbol } { - set prefix [gdb_target_symbol_prefix] - return "${prefix}${symbol}" + set prefix [gdb_target_symbol_prefix] + return "${prefix}${symbol}" } # gdb_target_symbol_prefix_flags_asm returns a string that can be @@ -10891,7 +10891,7 @@ proc gdb_debug_init { } { global gdb_prompt if {![gdb_debug_enabled]} { - return; + return; } # First ensure logging is off. @@ -10904,7 +10904,7 @@ proc gdb_debug_init { } { global gdbdebug foreach entry [split $gdbdebug ,] { - send_gdb "set debug $entry 1\n" + send_gdb "set debug $entry 1\n" } # Now that everything is set, enable logging. @@ -10955,7 +10955,7 @@ proc gdb_stdin_log_write { message {type standard} } { global in_file if {![info exists in_file]} { - return + return } # Check message types. @@ -11071,7 +11071,7 @@ gdb_caching_proc supports_fcf_protection {} { int main () { return 0; } - } executable "additional_flags=-fcf-protection=full"] + } executable "additional_flags=-fcf-protection=full"] } # Return true if symbols were read in using -readnow. Otherwise, @@ -11489,20 +11489,20 @@ gdb_caching_proc have_avx {} { # Compile a test program. set src { - #include "nat/x86-cpuid.h" + #include "nat/x86-cpuid.h" int main() { - unsigned int eax, ebx, ecx, edx; + unsigned int eax, ebx, ecx, edx; - if (!x86_cpuid (1, &eax, &ebx, &ecx, &edx)) { - return 0; - } + if (!x86_cpuid (1, &eax, &ebx, &ecx, &edx)) { + return 0; + } - if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) { - return 1; - } else { - return 0; - } + if ((ecx & (bit_AVX | bit_OSXSAVE)) == (bit_AVX | bit_OSXSAVE)) { + return 1; + } else { + return 0; + } } } set compile_flags "incdir=${srcdir}/.." @@ -11526,49 +11526,49 @@ gdb_caching_proc have_avx {} { # Return 1 if target supports avx2, otherwise return 0. gdb_caching_proc have_avx2 {} { - global srcdir + global srcdir - set me "have_avx2" - if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } { - verbose "$me: target does not support avx2, returning 0" 2 - return 0 - } + set me "have_avx2" + if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } { + verbose "$me: target does not support avx2, returning 0" 2 + return 0 + } - # Compile a test program. - set src { - #include "nat/x86-cpuid.h" + # Compile a test program. + set src { + #include "nat/x86-cpuid.h" - int main() { - unsigned int eax, ebx, ecx, edx; + int main() { + unsigned int eax, ebx, ecx, edx; if (!x86_cpuid_count (7, 0, &eax, &ebx, &ecx, &edx)) { return 0; } if ((ebx & bit_AVX2) == bit_AVX2) { - return 1; + return 1; } else { - return 0; - } + return 0; } } - set compile_flags "incdir=${srcdir}/.." - if {![gdb_simple_compile $me $src executable $compile_flags]} { - return 0 - } + } + set compile_flags "incdir=${srcdir}/.." + if {![gdb_simple_compile $me $src executable $compile_flags]} { + return 0 + } - set target_obj [gdb_remote_download target $obj] - set result [remote_exec target $target_obj] - set status [lindex $result 0] - set output [lindex $result 1] - if { $output != "" } { - set status 0 - } + set target_obj [gdb_remote_download target $obj] + set result [remote_exec target $target_obj] + set status [lindex $result 0] + set output [lindex $result 1] + if { $output != "" } { + set status 0 + } - remote_file build delete $obj + remote_file build delete $obj - verbose "$me: returning $status" 2 - return $status + verbose "$me: returning $status" 2 + return $status } # Called as @@ -11952,7 +11952,7 @@ gdb_caching_proc have_epilogue_line_info {} { } } if {![gdb_simple_compile "simple_program" $main]} { - return False + return False } clean_restart -- 2.51.0