[gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with gcc-11

Message ID 20210721083134.GA7560@delia.home
State New
Headers show
Series
  • [gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with gcc-11
Related show

Commit Message

Tom de Vries July 21, 2021, 8:31 a.m.
Hi,

When running test-case gdb.cp/step-and-next-inline.exp with gcc-11, I run
into:
...
KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 1 \
  (PRMS symtab/25507)
FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 2
KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 3 \
  (PRMS symtab/25507)
...

[ Note that I get the same result with gcc-11 and target board
unix/gdb:debug_flags=-gdwarf-4, so this is not a dwarf 4 vs 5 issue. ]

With gcc-10, I have this trace:
...
64        get_alias_set (&xx);
get_alias_set (t=0x601038 <xx>) at step-and-next-inline.cc:51
51        if (t != NULL
40        if (t->x != i)
52            && TREE_TYPE (t).z != 1
43        return x;
53            && TREE_TYPE (t).z != 2
43        return x;
54            && TREE_TYPE (t).z != 3)
43        return x;
main () at step-and-next-inline.cc:65
65        return 0;
...
and with gcc-11, I have instead:
...
64        get_alias_set (&xx);
get_alias_set (t=0x601038 <xx>) at step-and-next-inline.cc:51
51        if (t != NULL
52            && TREE_TYPE (t).z != 1
43        return x;
53            && TREE_TYPE (t).z != 2
43        return x;
54            && TREE_TYPE (t).z != 3)
43        return x;
main () at step-and-next-inline.cc:65
65        return 0;
...
and with clang-10, I have instead:
...
64        get_alias_set (&xx);
get_alias_set (t=0x601034 <xx>) at step-and-next-inline.cc:51
51        if (t != NULL
52            && TREE_TYPE (t).z != 1
53            && TREE_TYPE (t).z != 2
54            && TREE_TYPE (t).z != 3)
51        if (t != NULL
57      }
main () at step-and-next-inline.cc:65
65        return 0;
...

The test-case tries to verify that we don't step into inlined function
tree_check (lines 40-43) (so, with the clang trace we get that right).

The test-case then tries to kfail the problems when using gcc, but this is
done in such a way that the testing still gets out of sync after a failure.
That is: the "next step 2" check that is supposed to match
"TREE_TYPE (t).z != 2" is actually matching "TREE_TYPE (t).z != 1":
...
(gdb) next^M
52            && TREE_TYPE (t).z != 1^M
(gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: next step 2
...

Fix this by issuing extra nexts to arrive at the required lines.

Tested on x86_64-linux, with gcc-8, gcc-9, gcc-10, gcc-11, clang-8, clang-10
and clang-12.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with gcc-11

gdb/testsuite/ChangeLog:

2021-07-20  Tom de Vries  <tdevries@suse.de>

	* gdb.cp/step-and-next-inline.cc (tree_check, get_alias_set, main):
	Tag closing brace with comment.
	* gdb.cp/step-and-next-inline.h: Update to keep identical with
	step-and-next-inline.cc.
	* gdb.cp/step-and-next-inline.exp: Issue extra next when required.

---
 gdb/testsuite/gdb.cp/step-and-next-inline.cc  |  6 +-
 gdb/testsuite/gdb.cp/step-and-next-inline.exp | 89 ++++++++++++++++++++++++---
 gdb/testsuite/gdb.cp/step-and-next-inline.h   |  2 +-
 3 files changed, 84 insertions(+), 13 deletions(-)

Comments

Bernd Edlinger July 21, 2021, 2:13 p.m. | #1
On 7/21/21 10:31 AM, Tom de Vries wrote:
> Hi,

> 

> When running test-case gdb.cp/step-and-next-inline.exp with gcc-11, I run

> into:

> ...

> KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 1 \

>   (PRMS symtab/25507)

> FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 2

> KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 3 \

>   (PRMS symtab/25507)

> ...

> 

> [ Note that I get the same result with gcc-11 and target board

> unix/gdb:debug_flags=-gdwarf-4, so this is not a dwarf 4 vs 5 issue. ]

> 

> With gcc-10, I have this trace:

> ...

> 64        get_alias_set (&xx);

> get_alias_set (t=0x601038 <xx>) at step-and-next-inline.cc:51

> 51        if (t != NULL

> 40        if (t->x != i)

> 52            && TREE_TYPE (t).z != 1

> 43        return x;

> 53            && TREE_TYPE (t).z != 2

> 43        return x;

> 54            && TREE_TYPE (t).z != 3)

> 43        return x;

> main () at step-and-next-inline.cc:65

> 65        return 0;

> ...

> and with gcc-11, I have instead:

> ...

> 64        get_alias_set (&xx);

> get_alias_set (t=0x601038 <xx>) at step-and-next-inline.cc:51

> 51        if (t != NULL

> 52            && TREE_TYPE (t).z != 1

> 43        return x;

> 53            && TREE_TYPE (t).z != 2

> 43        return x;

> 54            && TREE_TYPE (t).z != 3)

> 43        return x;

> main () at step-and-next-inline.cc:65

> 65        return 0;

> ...

> and with clang-10, I have instead:

> ...

> 64        get_alias_set (&xx);

> get_alias_set (t=0x601034 <xx>) at step-and-next-inline.cc:51

> 51        if (t != NULL

> 52            && TREE_TYPE (t).z != 1

> 53            && TREE_TYPE (t).z != 2

> 54            && TREE_TYPE (t).z != 3)

> 51        if (t != NULL

> 57      }

> main () at step-and-next-inline.cc:65

> 65        return 0;

> ...

> 

> The test-case tries to verify that we don't step into inlined function

> tree_check (lines 40-43) (so, with the clang trace we get that right).

> 

> The test-case then tries to kfail the problems when using gcc, but this is

> done in such a way that the testing still gets out of sync after a failure.

> That is: the "next step 2" check that is supposed to match

> "TREE_TYPE (t).z != 2" is actually matching "TREE_TYPE (t).z != 1":

> ...

> (gdb) next^M

> 52            && TREE_TYPE (t).z != 1^M

> (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: next step 2

> ...

> 

> Fix this by issuing extra nexts to arrive at the required lines.

> 

> Tested on x86_64-linux, with gcc-8, gcc-9, gcc-10, gcc-11, clang-8, clang-10

> and clang-12.

> 

> Any comments?

> 


Note that I've posted a patch series that would fix this test case for all
gcc/clang versions I've tested, although I admit I've tested fewer versions than you.

 * Improve debugging of optimized code
    https://sourceware.org/pipermail/gdb-patches/2021-January/175617.html

    (2021-05-31) v2 posted at:
      [0/4] https://sourceware.org/pipermail/gdb-patches/2021-May/179367.html
      [1/4] https://sourceware.org/pipermail/gdb-patches/2021-May/179368.html
      [2/4] https://sourceware.org/pipermail/gdb-patches/2021-May/179370.html
      [3/4] https://sourceware.org/pipermail/gdb-patches/2021-May/179369.html


Thanks
Bernd.

> Thanks,

> - Tom

> 

> [gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with gcc-11

> 

> gdb/testsuite/ChangeLog:

> 

> 2021-07-20  Tom de Vries  <tdevries@suse.de>

> 

> 	* gdb.cp/step-and-next-inline.cc (tree_check, get_alias_set, main):

> 	Tag closing brace with comment.

> 	* gdb.cp/step-and-next-inline.h: Update to keep identical with

> 	step-and-next-inline.cc.

> 	* gdb.cp/step-and-next-inline.exp: Issue extra next when required.

> 

> ---

>  gdb/testsuite/gdb.cp/step-and-next-inline.cc  |  6 +-

>  gdb/testsuite/gdb.cp/step-and-next-inline.exp | 89 ++++++++++++++++++++++++---

>  gdb/testsuite/gdb.cp/step-and-next-inline.h   |  2 +-

>  3 files changed, 84 insertions(+), 13 deletions(-)

> 

> diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.cc b/gdb/testsuite/gdb.cp/step-and-next-inline.cc

> index 6f0a7fbda9e..26b29d01777 100644

> --- a/gdb/testsuite/gdb.cp/step-and-next-inline.cc

> +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.cc

> @@ -41,7 +41,7 @@ tree_check (tree *t, int i)

>      abort();

>    tree *x = t;

>    return x;

> -}

> +} // tree-check

>  

>  #endif	/* USE_NEXT_INLINE_H */

>  

> @@ -54,7 +54,7 @@ get_alias_set (tree *t)

>        && TREE_TYPE (t).z != 3)

>      return 0;

>    return 1;

> -}

> +} // get_alias_set

>  

>  tree xx;

>  

> @@ -63,4 +63,4 @@ main()

>  {

>    get_alias_set (&xx);

>    return 0;

> -}

> +} // main

> diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp

> index 85f7b8d5af1..13d801bb539 100644

> --- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp

> +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp

> @@ -67,29 +67,100 @@ proc do_test { use_header } {

>      gdb_test "step" ".*" "step into get_alias_set"

>      gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \

>  	"not in inline 1"

> +

>      # It's possible that this first failure (when not using a header

>      # file) is GCC's fault, though the remaining failures would best

>      # be fixed by adding location views support (though it could be

>      # that some easier heuristic could be figured out).  Still, it is

>      # not certain that the first failure wouldn't also be fixed by

>      # having location view support, so for now it is tagged as such.

> -    if {[test_compiler_info gcc*] && !$use_header} {

> -	setup_kfail "*-*-*" symtab/25507

> +    set have_kfail [expr [test_compiler_info gcc*] && !$use_header]

> +

> +    set ok 1

> +    gdb_test_multiple "next" "next step 1" {

> +	-re -wrap "if \\(t->x != i\\)" {

> +	    set ok 0

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap ".*TREE_TYPE.* != 1" {

> +	    if { $ok } {

> +		pass $gdb_test_name

> +	    } else {

> +		if { $have_kfail } {

> +		    setup_kfail "*-*-*" symtab/25507

> +		}

> +		fail $gdb_test_name

> +	    }

> +	}

>      }

> -    gdb_test "next" ".*TREE_TYPE.*" "next step 1"

>      gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \

>  	"not in inline 2"

> -    gdb_test "next" ".*TREE_TYPE.*" "next step 2"

> +

> +    set ok 1

> +    gdb_test_multiple "next" "next step 2" {

> +	-re -wrap "return x;" {

> +	    set ok 0

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap ".*TREE_TYPE.* != 2" {

> +	    if { $ok } {

> +		pass $gdb_test_name

> +	    } else {

> +		if { $have_kfail } {

> +		    setup_kfail "*-*-*" symtab/25507

> +		}

> +		fail $gdb_test_name

> +	    }

> +	}

> +    }

>      gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \

>  	"not in inline 3"

> -    if {[test_compiler_info gcc*] && !$use_header} {

> -	setup_kfail "*-*-*" symtab/25507

> +

> +    set ok 1

> +    gdb_test_multiple "next" "next step 3" {

> +	-re -wrap "return x;" {

> +	    set ok 0

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap ".*TREE_TYPE.* != 3\\)" {

> +	    if { $ok } {

> +		pass $gdb_test_name

> +	    } else {

> +		if { $have_kfail } {

> +		    setup_kfail "*-*-*" symtab/25507

> +		}

> +		fail $gdb_test_name

> +	    }

> +	}

>      }

> -    gdb_test "next" ".*TREE_TYPE.*" "next step 3"

>      gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \

>  	"not in inline 4"

> -    if {!$use_header} { setup_kfail "*-*-*" symtab/25507 }

> -    gdb_test "next" "return 0.*" "next step 4"

> +

> +    set ok 1

> +    gdb_test_multiple "next" "next step 4" {

> +	-re -wrap "(if \\(t != NULL|\} // get_alias_set)" {

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap "return x;" {

> +	    set ok 0

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap "return 0.*" {

> +	    if { $ok } {

> +		pass $gdb_test_name

> +	    } else {

> +		if { $have_kfail } {

> +		    setup_kfail "*-*-*" symtab/25507

> +		}

> +		fail $gdb_test_name

> +	    }

> +	}

> +    }

>      gdb_test "bt" \

>  	"\\s*\\#0\\s+(main|get_alias_set)\[^\r\]*${srcfile}:.*" \

>  	"not in inline 5"

> diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.h b/gdb/testsuite/gdb.cp/step-and-next-inline.h

> index 8eb4b71d3cc..bf45d8a388c 100644

> --- a/gdb/testsuite/gdb.cp/step-and-next-inline.h

> +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.h

> @@ -35,4 +35,4 @@ tree_check (tree *t, int i)

>      abort();

>    tree *x = t;

>    return x;

> -}

> +} // tree_check

>
Andrew Burgess July 21, 2021, 3:59 p.m. | #2
* Tom de Vries <tdevries@suse.de> [2021-07-21 10:31:36 +0200]:

> Hi,

> 

> When running test-case gdb.cp/step-and-next-inline.exp with gcc-11, I run

> into:

> ...

> KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 1 \

>   (PRMS symtab/25507)

> FAIL: gdb.cp/step-and-next-inline.exp: no_header: next step 2

> KPASS: gdb.cp/step-and-next-inline.exp: no_header: next step 3 \

>   (PRMS symtab/25507)

> ...

> 

> [ Note that I get the same result with gcc-11 and target board

> unix/gdb:debug_flags=-gdwarf-4, so this is not a dwarf 4 vs 5 issue. ]

> 

> With gcc-10, I have this trace:

> ...

> 64        get_alias_set (&xx);

> get_alias_set (t=0x601038 <xx>) at step-and-next-inline.cc:51

> 51        if (t != NULL

> 40        if (t->x != i)

> 52            && TREE_TYPE (t).z != 1

> 43        return x;

> 53            && TREE_TYPE (t).z != 2

> 43        return x;

> 54            && TREE_TYPE (t).z != 3)

> 43        return x;

> main () at step-and-next-inline.cc:65

> 65        return 0;

> ...

> and with gcc-11, I have instead:

> ...

> 64        get_alias_set (&xx);

> get_alias_set (t=0x601038 <xx>) at step-and-next-inline.cc:51

> 51        if (t != NULL

> 52            && TREE_TYPE (t).z != 1

> 43        return x;

> 53            && TREE_TYPE (t).z != 2

> 43        return x;

> 54            && TREE_TYPE (t).z != 3)

> 43        return x;

> main () at step-and-next-inline.cc:65

> 65        return 0;

> ...

> and with clang-10, I have instead:

> ...

> 64        get_alias_set (&xx);

> get_alias_set (t=0x601034 <xx>) at step-and-next-inline.cc:51

> 51        if (t != NULL

> 52            && TREE_TYPE (t).z != 1

> 53            && TREE_TYPE (t).z != 2

> 54            && TREE_TYPE (t).z != 3)

> 51        if (t != NULL

> 57      }

> main () at step-and-next-inline.cc:65

> 65        return 0;

> ...

> 

> The test-case tries to verify that we don't step into inlined function

> tree_check (lines 40-43) (so, with the clang trace we get that right).

> 

> The test-case then tries to kfail the problems when using gcc, but this is

> done in such a way that the testing still gets out of sync after a failure.

> That is: the "next step 2" check that is supposed to match

> "TREE_TYPE (t).z != 2" is actually matching "TREE_TYPE (t).z != 1":

> ...

> (gdb) next^M

> 52            && TREE_TYPE (t).z != 1^M

> (gdb) PASS: gdb.cp/step-and-next-inline.exp: no_header: next step 2

> ...

> 

> Fix this by issuing extra nexts to arrive at the required lines.

> 

> Tested on x86_64-linux, with gcc-8, gcc-9, gcc-10, gcc-11, clang-8, clang-10

> and clang-12.

> 

> Any comments?


LGTM.

Thanks,
Andrew


> 

> Thanks,

> - Tom

> 

> [gdb/testsuite] Fix gdb.cp/step-and-next-inline.exp with gcc-11

> 

> gdb/testsuite/ChangeLog:

> 

> 2021-07-20  Tom de Vries  <tdevries@suse.de>

> 

> 	* gdb.cp/step-and-next-inline.cc (tree_check, get_alias_set, main):

> 	Tag closing brace with comment.

> 	* gdb.cp/step-and-next-inline.h: Update to keep identical with

> 	step-and-next-inline.cc.

> 	* gdb.cp/step-and-next-inline.exp: Issue extra next when required.

> 

> ---

>  gdb/testsuite/gdb.cp/step-and-next-inline.cc  |  6 +-

>  gdb/testsuite/gdb.cp/step-and-next-inline.exp | 89 ++++++++++++++++++++++++---

>  gdb/testsuite/gdb.cp/step-and-next-inline.h   |  2 +-

>  3 files changed, 84 insertions(+), 13 deletions(-)

> 

> diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.cc b/gdb/testsuite/gdb.cp/step-and-next-inline.cc

> index 6f0a7fbda9e..26b29d01777 100644

> --- a/gdb/testsuite/gdb.cp/step-and-next-inline.cc

> +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.cc

> @@ -41,7 +41,7 @@ tree_check (tree *t, int i)

>      abort();

>    tree *x = t;

>    return x;

> -}

> +} // tree-check

>  

>  #endif	/* USE_NEXT_INLINE_H */

>  

> @@ -54,7 +54,7 @@ get_alias_set (tree *t)

>        && TREE_TYPE (t).z != 3)

>      return 0;

>    return 1;

> -}

> +} // get_alias_set

>  

>  tree xx;

>  

> @@ -63,4 +63,4 @@ main()

>  {

>    get_alias_set (&xx);

>    return 0;

> -}

> +} // main

> diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp

> index 85f7b8d5af1..13d801bb539 100644

> --- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp

> +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp

> @@ -67,29 +67,100 @@ proc do_test { use_header } {

>      gdb_test "step" ".*" "step into get_alias_set"

>      gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \

>  	"not in inline 1"

> +

>      # It's possible that this first failure (when not using a header

>      # file) is GCC's fault, though the remaining failures would best

>      # be fixed by adding location views support (though it could be

>      # that some easier heuristic could be figured out).  Still, it is

>      # not certain that the first failure wouldn't also be fixed by

>      # having location view support, so for now it is tagged as such.

> -    if {[test_compiler_info gcc*] && !$use_header} {

> -	setup_kfail "*-*-*" symtab/25507

> +    set have_kfail [expr [test_compiler_info gcc*] && !$use_header]

> +

> +    set ok 1

> +    gdb_test_multiple "next" "next step 1" {

> +	-re -wrap "if \\(t->x != i\\)" {

> +	    set ok 0

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap ".*TREE_TYPE.* != 1" {

> +	    if { $ok } {

> +		pass $gdb_test_name

> +	    } else {

> +		if { $have_kfail } {

> +		    setup_kfail "*-*-*" symtab/25507

> +		}

> +		fail $gdb_test_name

> +	    }

> +	}

>      }

> -    gdb_test "next" ".*TREE_TYPE.*" "next step 1"

>      gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \

>  	"not in inline 2"

> -    gdb_test "next" ".*TREE_TYPE.*" "next step 2"

> +

> +    set ok 1

> +    gdb_test_multiple "next" "next step 2" {

> +	-re -wrap "return x;" {

> +	    set ok 0

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap ".*TREE_TYPE.* != 2" {

> +	    if { $ok } {

> +		pass $gdb_test_name

> +	    } else {

> +		if { $have_kfail } {

> +		    setup_kfail "*-*-*" symtab/25507

> +		}

> +		fail $gdb_test_name

> +	    }

> +	}

> +    }

>      gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \

>  	"not in inline 3"

> -    if {[test_compiler_info gcc*] && !$use_header} {

> -	setup_kfail "*-*-*" symtab/25507

> +

> +    set ok 1

> +    gdb_test_multiple "next" "next step 3" {

> +	-re -wrap "return x;" {

> +	    set ok 0

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap ".*TREE_TYPE.* != 3\\)" {

> +	    if { $ok } {

> +		pass $gdb_test_name

> +	    } else {

> +		if { $have_kfail } {

> +		    setup_kfail "*-*-*" symtab/25507

> +		}

> +		fail $gdb_test_name

> +	    }

> +	}

>      }

> -    gdb_test "next" ".*TREE_TYPE.*" "next step 3"

>      gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \

>  	"not in inline 4"

> -    if {!$use_header} { setup_kfail "*-*-*" symtab/25507 }

> -    gdb_test "next" "return 0.*" "next step 4"

> +

> +    set ok 1

> +    gdb_test_multiple "next" "next step 4" {

> +	-re -wrap "(if \\(t != NULL|\} // get_alias_set)" {

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap "return x;" {

> +	    set ok 0

> +	    send_gdb "next\n"

> +	    exp_continue

> +	}

> +	-re -wrap "return 0.*" {

> +	    if { $ok } {

> +		pass $gdb_test_name

> +	    } else {

> +		if { $have_kfail } {

> +		    setup_kfail "*-*-*" symtab/25507

> +		}

> +		fail $gdb_test_name

> +	    }

> +	}

> +    }

>      gdb_test "bt" \

>  	"\\s*\\#0\\s+(main|get_alias_set)\[^\r\]*${srcfile}:.*" \

>  	"not in inline 5"

> diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.h b/gdb/testsuite/gdb.cp/step-and-next-inline.h

> index 8eb4b71d3cc..bf45d8a388c 100644

> --- a/gdb/testsuite/gdb.cp/step-and-next-inline.h

> +++ b/gdb/testsuite/gdb.cp/step-and-next-inline.h

> @@ -35,4 +35,4 @@ tree_check (tree *t, int i)

>      abort();

>    tree *x = t;

>    return x;

> -}

> +} // tree_check

Patch

diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.cc b/gdb/testsuite/gdb.cp/step-and-next-inline.cc
index 6f0a7fbda9e..26b29d01777 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.cc
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.cc
@@ -41,7 +41,7 @@  tree_check (tree *t, int i)
     abort();
   tree *x = t;
   return x;
-}
+} // tree-check
 
 #endif	/* USE_NEXT_INLINE_H */
 
@@ -54,7 +54,7 @@  get_alias_set (tree *t)
       && TREE_TYPE (t).z != 3)
     return 0;
   return 1;
-}
+} // get_alias_set
 
 tree xx;
 
@@ -63,4 +63,4 @@  main()
 {
   get_alias_set (&xx);
   return 0;
-}
+} // main
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.exp b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
index 85f7b8d5af1..13d801bb539 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.exp
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.exp
@@ -67,29 +67,100 @@  proc do_test { use_header } {
     gdb_test "step" ".*" "step into get_alias_set"
     gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \
 	"not in inline 1"
+
     # It's possible that this first failure (when not using a header
     # file) is GCC's fault, though the remaining failures would best
     # be fixed by adding location views support (though it could be
     # that some easier heuristic could be figured out).  Still, it is
     # not certain that the first failure wouldn't also be fixed by
     # having location view support, so for now it is tagged as such.
-    if {[test_compiler_info gcc*] && !$use_header} {
-	setup_kfail "*-*-*" symtab/25507
+    set have_kfail [expr [test_compiler_info gcc*] && !$use_header]
+
+    set ok 1
+    gdb_test_multiple "next" "next step 1" {
+	-re -wrap "if \\(t->x != i\\)" {
+	    set ok 0
+	    send_gdb "next\n"
+	    exp_continue
+	}
+	-re -wrap ".*TREE_TYPE.* != 1" {
+	    if { $ok } {
+		pass $gdb_test_name
+	    } else {
+		if { $have_kfail } {
+		    setup_kfail "*-*-*" symtab/25507
+		}
+		fail $gdb_test_name
+	    }
+	}
     }
-    gdb_test "next" ".*TREE_TYPE.*" "next step 1"
     gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \
 	"not in inline 2"
-    gdb_test "next" ".*TREE_TYPE.*" "next step 2"
+
+    set ok 1
+    gdb_test_multiple "next" "next step 2" {
+	-re -wrap "return x;" {
+	    set ok 0
+	    send_gdb "next\n"
+	    exp_continue
+	}
+	-re -wrap ".*TREE_TYPE.* != 2" {
+	    if { $ok } {
+		pass $gdb_test_name
+	    } else {
+		if { $have_kfail } {
+		    setup_kfail "*-*-*" symtab/25507
+		}
+		fail $gdb_test_name
+	    }
+	}
+    }
     gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \
 	"not in inline 3"
-    if {[test_compiler_info gcc*] && !$use_header} {
-	setup_kfail "*-*-*" symtab/25507
+
+    set ok 1
+    gdb_test_multiple "next" "next step 3" {
+	-re -wrap "return x;" {
+	    set ok 0
+	    send_gdb "next\n"
+	    exp_continue
+	}
+	-re -wrap ".*TREE_TYPE.* != 3\\)" {
+	    if { $ok } {
+		pass $gdb_test_name
+	    } else {
+		if { $have_kfail } {
+		    setup_kfail "*-*-*" symtab/25507
+		}
+		fail $gdb_test_name
+	    }
+	}
     }
-    gdb_test "next" ".*TREE_TYPE.*" "next step 3"
     gdb_test "bt" "\\s*\\#0\\s+get_alias_set\[^\r\]*${srcfile}:.*" \
 	"not in inline 4"
-    if {!$use_header} { setup_kfail "*-*-*" symtab/25507 }
-    gdb_test "next" "return 0.*" "next step 4"
+
+    set ok 1
+    gdb_test_multiple "next" "next step 4" {
+	-re -wrap "(if \\(t != NULL|\} // get_alias_set)" {
+	    send_gdb "next\n"
+	    exp_continue
+	}
+	-re -wrap "return x;" {
+	    set ok 0
+	    send_gdb "next\n"
+	    exp_continue
+	}
+	-re -wrap "return 0.*" {
+	    if { $ok } {
+		pass $gdb_test_name
+	    } else {
+		if { $have_kfail } {
+		    setup_kfail "*-*-*" symtab/25507
+		}
+		fail $gdb_test_name
+	    }
+	}
+    }
     gdb_test "bt" \
 	"\\s*\\#0\\s+(main|get_alias_set)\[^\r\]*${srcfile}:.*" \
 	"not in inline 5"
diff --git a/gdb/testsuite/gdb.cp/step-and-next-inline.h b/gdb/testsuite/gdb.cp/step-and-next-inline.h
index 8eb4b71d3cc..bf45d8a388c 100644
--- a/gdb/testsuite/gdb.cp/step-and-next-inline.h
+++ b/gdb/testsuite/gdb.cp/step-and-next-inline.h
@@ -35,4 +35,4 @@  tree_check (tree *t, int i)
     abort();
   tree *x = t;
   return x;
-}
+} // tree_check