From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7862) id 6C874385840F; Thu, 22 Sep 2022 09:04:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6C874385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663837494; bh=FWFwTkSfykEdhj6UlN7N9Xs71xVL8AlFbtKrivGMtck=; h=From:To:Subject:Date:From; b=XGAOmbDQthacXxLGLuRM5XZ6zU46zEwkl+yh0r/tqPChn9rL8U841r8cAQ+tHuZKm UxP8pe5ZB+7IxaDLLxy2EF9PzERa74XfVvtSOUNN15dciHsadZLhXGMSJW1XqNvAiO 9LR6R5VcwqCbYzkOQLEz+pyx6i4eVU2BB3Bb3pcg= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Bruno Larsen To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/testsuite: Add a proc to test where compiler links the epilogue X-Act-Checkin: binutils-gdb X-Git-Author: Bruno Larsen X-Git-Refname: refs/heads/master X-Git-Oldrev: b59f8a90ba0866a8605106fdb09389833c7fe8ad X-Git-Newrev: 07bb02de7232c7d0974007296540d9887532b952 Message-Id: <20220922090454.6C874385840F@sourceware.org> Date: Thu, 22 Sep 2022 09:04:54 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D07bb02de7232= c7d0974007296540d9887532b952 commit 07bb02de7232c7d0974007296540d9887532b952 Author: Bruno Larsen Date: Wed Jul 20 16:44:28 2022 -0300 gdb/testsuite: Add a proc to test where compiler links the epilogue =20 Different compilers link the epilogue of functions to different lines. As an example, gcc links it to the closing brace of the function, whereas clang links it to the last statement of the function. This difference is important for the testsuite, since the where GDB will land after a step can be wildly different. Where possible, this dependency should be side-stepped in the testsuite, but it isn't always possible, so this commit adds a gdb_caching_proc that is able to detect where the epilogue is linked, so tests can react accordingly. Diff: --- gdb/testsuite/lib/gdb.exp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0f6bb20b49c..68536b00f14 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -8872,5 +8872,37 @@ proc gdb_step_until { regexp {test_name ""} {max_ste= ps 10} } { } } =20 +# Check if the compiler emits epilogue information associated +# with the closing brace or with the last statement line. +# +# This proc restarts GDB +# +# Returns True if it is associated with the closing brace, +# False if it is the last statement +gdb_caching_proc have_epilogue_line_info { + + set main { + int + main () + { + return 0; + } + } + if {![gdb_simple_compile "simple_program" $main]} { + return False + } + + clean_restart $obj + + gdb_test_multiple "info line 6" "epilogue test" { + -re -wrap ".*starts at address.*and ends at.*" { + return True + } + -re -wrap ".*" { + return False + } + } +} + # Always load compatibility stuff. load_lib future.exp