+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
__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;
}
[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
# 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 } {
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"