Re: [committed][gdb/testsuite] Add test-case gdb.dwarf2/break-inline-psymtab.exp

Tom de Vries
2020-04-02T15:14:18Z

[-- Attachment #1: Type: text/plain, Size: 450 bytes --]

On 02-04-2020 16:24, Pedro Alves wrote:
> On 3/18/20 1:48 PM, Tom de Vries wrote:
>> +set sources [list $srcfile $srcfile2]
>> +set opts {debug optimize=-O2}
>> +if { [prepare_for_testing "failed to prepare" ${testfile} $sources $opts] } {
>> + return -1
>> +}
>
> Is that -O2 needed to force inlining?
>
> -O0 and __attribute__((always_inline)) would be better for that.
>

Ack, thanks for noticing, fixed in commit below, committed.

- Tom

[-- Attachment #2: 0001-gdb-testsuite-Don-t-use-O2-for-inlining-in-break-inline-psymtab.exp.patch --]
[-- Type: text/x-patch, Size: 1717 bytes --]

[gdb/testsuite] Don't use O2 for inlining in break-inline-psymtab.exp

In test-case gdb.dwarf2/break-inline-psymtab.exp we use O2 to enable inlining
of bar into foo in break-inline-psymtab-2.c.

Instead, enforce inlining using __attribute__((always_inline)), to avoid any
optimization-related test issues.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-04-02 Tom de Vries <tdevries@suse.de>

* gdb.dwarf2/break-inline-psymtab-2.c (bar): Add
__attribute__((always_inline)).
* gdb.dwarf2/break-inline-psymtab.exp: Don't use -O2.

---
gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c | 2 +-
gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c
index 38c69336f2..b7fe485b3a 100644
--- a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c
+++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c
@@ -19,7 +19,7 @@ extern int foo (void);

int a;

-static inline int
+static inline int __attribute__((always_inline))
bar (void)
{
a = 2;
diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
index adbe8620aa..344d7da0d5 100644
--- a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
+++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp
@@ -16,8 +16,7 @@
standard_testfile break-inline-psymtab.c break-inline-psymtab-2.c

set sources [list $srcfile $srcfile2]
-set opts {debug optimize=-O2}
-if { [prepare_for_testing "failed to prepare" ${testfile} $sources $opts] } {
+if { [prepare_for_testing "failed to prepare" ${testfile} $sources] } {
return -1
}