diff options
author | Bruno Larsen <blarsen@redhat.com> | 2022-07-20 16:44:28 -0300 |
---|---|---|
committer | Bruno Larsen <blarsen@redhat.com> | 2022-09-22 11:04:17 +0200 |
commit | 07bb02de7232c7d0974007296540d9887532b952 (patch) | |
tree | 1ff959244be541033afb99595f975e495107add2 /gdb/testsuite | |
parent | b59f8a90ba0866a8605106fdb09389833c7fe8ad (diff) | |
download | gdb-07bb02de7232c7d0974007296540d9887532b952.zip gdb-07bb02de7232c7d0974007296540d9887532b952.tar.gz gdb-07bb02de7232c7d0974007296540d9887532b952.tar.bz2 |
gdb/testsuite: Add a proc to test where compiler links the epilogue
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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0f6bb20..68536b0 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_steps 10} } { } } +# 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 |