Commit f269206b by Tom de Vries Committed by Tom de Vries

[testsuite/guality] Use relative line numbers in gdb-test

2018-06-30  Tom de Vries  <tdevries@suse.de>

	* gcc.dg/guality/pr45882.c (foo): Use relative line numbers.
	* lib/gcc-dg.exp (dg-final): New proc.
	* lib/gcc-gdb-test.exp (gdb-test): Add and handle additional line number
	argument.

From-SVN: r262269
parent da34ca3f
2018-06-30 Tom de Vries <tdevries@suse.de>
* gcc.dg/guality/pr45882.c (foo): Use relative line numbers.
* lib/gcc-dg.exp (dg-final): New proc.
* lib/gcc-gdb-test.exp (gdb-test): Add and handle additional line number
argument.
2018-06-29 Martin Sebor <msebor@redhat.com>
* gcc.dg/strlenopt-46.c: Define strnlen for targets like Solaris 10
......
......@@ -9,11 +9,11 @@ volatile short int v;
__attribute__((noinline,noclone,used)) int
foo (int i, int j)
{
int b = i; /* { dg-final { gdb-test bpline "b" "7" } } */
int c = i + 4; /* { dg-final { gdb-test bpline "c" "11" } } */
int d = a[i]; /* { dg-final { gdb-test bpline "d" "112" } } */
int e = a[i + 6]; /* { dg-final { gdb-test bpline "e" "142" } } */
++v; /* { dg-line bpline } */
int b = i; /* { dg-final { gdb-test .+4 "b" "7" } } */
int c = i + 4; /* { dg-final { gdb-test .+3 "c" "11" } } */
int d = a[i]; /* { dg-final { gdb-test .+2 "d" "112" } } */
int e = a[i + 6]; /* { dg-final { gdb-test .+1 "e" "142" } } */
++v;
return ++j;
}
......
......@@ -114,6 +114,26 @@ if [info exists ADDITIONAL_TORTURE_OPTIONS] {
[concat $DG_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS]
}
proc dg-final { args } {
upvar dg-final-code final-code
if { [llength $args] > 2 } {
error "[lindex $args 0]: too many arguments"
}
set line [lindex $args 0]
set code [lindex $args 1]
set directive [lindex $code 0]
set withline \
[switch $directive {
gdb-test {expr {1}}
default {expr {0}}
}]
if { $withline == 1 } {
set code [linsert $code 1 $line]
}
append final-code "$code\n"
}
global orig_environment_saved
# Deduce generated files from tool flags, return finalcode string
......
......@@ -26,7 +26,7 @@
# calling print on it in gdb. When asking for the type it is
# the literal string with extra whitespace removed.
# Argument 3 handles expected failures and the like
proc gdb-test { args } {
proc gdb-test { useline args } {
if { ![isnative] || [is_remote target] } { return }
if { [llength $args] >= 4 } {
......@@ -60,7 +60,7 @@ proc gdb-test { args } {
set cmd_file "[file rootname [file tail $prog]].gdb"
set fd [open $cmd_file "w"]
set line [get-absolute-line "" [lindex $args 0]]
set line [get-absolute-line $useline [lindex $args 0]]
puts $fd "break $line"
puts $fd "run"
puts $fd "$command $var"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment