Testsuite: Ensure stack protection is off for GCC
authorAlan Hayward <alan.hayward@arm.com>
Mon, 21 Jan 2019 10:43:53 +0000 (10:43 +0000)
committerAlan Hayward <alan.hayward@arm.com>
Mon, 21 Jan 2019 10:43:53 +0000 (10:43 +0000)
commitfc65c7dbe0607dfb1fc3d1019c46df73854cc896
treeefac77da6f7d09dbe6d2f6bd5e8aa1fcfec87b90
parent111f47f3e4b685acc2378e46d0221e562c608ffc
Testsuite: Ensure stack protection is off for GCC

Using -fstack-protector-strong will cause GDB to break on the wrong line
when placing a breakpoint on a function.  This is due to inadequate dwarf
line numbering, and is being tracked by the GCC bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88432

GCC (and Clang) provided by Debian/Ubuntu default to stack protector
being enabled.

Ensure that when running the GDB testsuite, stack protector is always
turned off for GCC 4.1.0 (when stack protector was added) and above.

Ensure that this does not cause infinite recursion due to
test_compiler_info having to compile a file itself.

Add a test to explicitly test breakpoints with various levels of stack
protection on both GCC and Clang, with xfail for the known errors.

Restore change in ovldbreak.exp which worked around the issue.

gdb/testsuite/ChangeLog:

2019-01-18  Alan Hayward  <alan.hayward@arm.com>

* gdb.base/stack-protector.c: New test.
* gdb.base/stack-protector.exp: New file.
* gdb.cp/ovldbreak.exp: Only allow a single break line.
* lib/gdb.exp (get_compiler_info): Use getting_compiler_info
option.
(gdb_compile): Remove stack protector for GCC and prevent
recursion.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/stack-protector.c [new file with mode: 0644]
gdb/testsuite/gdb.base/stack-protector.exp [new file with mode: 0644]
gdb/testsuite/gdb.cp/ovldbreak.exp
gdb/testsuite/lib/gdb.exp