[binutils-gdb] gdb/testsuite: add return after a call to 'untested'

Andrew Burgess aburgess@sourceware.org
Tue Sep 10 14:14:34 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a80935397a191dcf87ab19a0bae5c74c87a263e9

commit a80935397a191dcf87ab19a0bae5c74c87a263e9
Author: Andrew Burgess <aburgess@redhat.com>
Date:   Sat Aug 10 12:26:49 2024 +0100

    gdb/testsuite: add return after a call to 'untested'
    
    In gdb.base/corefile-buildid.exp, in the function
    do_corefile_buildid_tests, if we fail to find the build-id for the
    test binary then we call 'untested', but then push on with the test,
    which inevitably fails as the rest of the test depends on having found
    the build-id.
    
    I think we're missing a 'return' after the call to 'untested' which
    I've now added.
    
    Also I noticed that we call build_id_debug_filename_get and then
    manually remove '.debug' from the end.  This is no longer necessary,
    we can just ask build_id_debug_filename_get to not add the suffix.

Diff:
---
 gdb/testsuite/gdb.base/corefile-buildid.exp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.base/corefile-buildid.exp b/gdb/testsuite/gdb.base/corefile-buildid.exp
index e1b9804d891..fc54cf201d9 100644
--- a/gdb/testsuite/gdb.base/corefile-buildid.exp
+++ b/gdb/testsuite/gdb.base/corefile-buildid.exp
@@ -268,12 +268,13 @@ proc do_corefile_buildid_tests {args} {
 	    return
 	}
 
-	# Grab the build-id from the binary, removing ".debug" from the end.
-	set buildid [build_id_debug_filename_get $program_to_run]
+	# Get the build-id filename without ".debug" on the end.  This
+	# will have the format: '.build-id/xx/xxxxx'
+	set buildid [build_id_debug_filename_get $program_to_run ""]
 	if {$buildid == ""} {
 	    untested "binary has no build-id"
+	    return
 	}
-	regsub {\.debug$} $buildid {} buildid
 	verbose -log "build-id is $buildid"
 
 	locate_exec_from_core_build_id $corefile $buildid \


More information about the Gdb-cvs mailing list