Fix problem that alias can be defined or not depending on the order.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.trace / entry-values.exp
index 07aaa228eaba81a02dbd9408a5257baebfe5be9b..8822950826a887efa7a276a3441fbbd849b4f20d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 2013-2015 Free Software Foundation, Inc.
+# Copyright 2013-2020 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -26,14 +26,19 @@ if  {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
     return -1
 }
 
-# Start GDB and load object file, compute the offset of the
+if  {[gdb_compile [list ${binfile}1.o] \
+         "${binfile}1" executable {}] != ""} {
+    return -1
+}
+
+# Start GDB and load executable file, compute the offset of the
 # instruction in bar returned from foo.  It is needed in the Dwarf
 # Assembler.
 
 gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}1.o
+gdb_load ${binfile}1
 
 set returned_from_foo ""
 
@@ -57,6 +62,8 @@ if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
     # returns.  The only exception is JALRC, in which case execution
     # resumes from `insn1' instead.
     set call_insn {jalrc|[jb]al[sxr]*[ \t][^\r\n]+\r\n}
+} elseif [is_amd64_regs_target] {
+    set call_insn "callq"
 } else {
     set call_insn "call"
 }
@@ -64,7 +71,7 @@ if { [istarget "arm*-*-*"] || [istarget "aarch64*-*-*"] } {
 # Calculate the offset of the instruction in bar returned from foo.
 set test "disassemble bar"
 gdb_test_multiple $test $test {
-    -re ".*$hex <\\+$decimal>:\[ \t\]+$call_insn\[^\r\n\]+\r\n\[ \]+$hex <\\+($decimal)>:.*$gdb_prompt $" {
+    -re ".*$hex <\\+$decimal>:\[ \t\]+\\y$call_insn\\y\[^\r\n\]+\r\n\[ \]+$hex <\\+($decimal)>:.*$gdb_prompt $" {
        set returned_from_foo $expect_out(1,string)
     }
     -re ".*$gdb_prompt $" {
@@ -73,7 +80,7 @@ gdb_test_multiple $test $test {
 }
 
 if { [string equal $returned_from_foo ""] } {
-    fail "Find the call or branch instruction offset in bar"
+    fail "find the call or branch instruction offset in bar"
     # The following test makes no sense if the offset is unknown.  We need
     # to update the pattern above to match call or branch instruction for
     # the target architecture.
@@ -102,7 +109,7 @@ Dwarf::assemble $asm_file {
            }
 
            foo_label: subprogram {
-               {decl_file 1 sdata}
+               {decl_file 0 udata}
                {MACRO_AT_func { foo ${srcdir}/${subdir}/${srcfile} }}
            } {
                formal_parameter {
@@ -119,7 +126,7 @@ Dwarf::assemble $asm_file {
 
            subprogram {
                {name bar}
-               {decl_file 1 sdata}
+               {decl_file 0 udata}
                {low_pc $bar_start addr}
                {high_pc "$bar_start + $bar_length" addr}
                {GNU_all_call_sites 1 sdata}
@@ -168,7 +175,7 @@ if  {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \
 clean_restart ${testfile}
 
 if ![runto_main] {
-    fail "Can't run to main"
+    fail "can't run to main"
     return -1
 }
 
@@ -181,19 +188,19 @@ gdb_test_no_output "set print entry-values both"
 gdb_test_sequence "bt" "bt (1)" {
     "\[\r\n\]#0 .* foo \\(i=[-]?[0-9]+, i@entry=2, j=[-]?[0-9]+, j@entry=3\\)"
     "\[\r\n\]#1 .* bar \\(i=<optimized out>, i@entry=<optimized out>\\)"
-    "\[\r\n\]#2 .* main \\(\\)"
+    "\[\r\n\]#2 .* \.?main \\(\\)"
 }
 
 # Update global variables 'global1' and 'global2' and test that the
 # entry values are updated too.
 
-gdb_test_no_output "set var global1=10"
-gdb_test_no_output "set var global2=11"
+gdb_test_no_output "set var *(int *) &global1=10"
+gdb_test_no_output "set var *(int *) &global2=11"
 
 gdb_test_sequence "bt" "bt (2)" {
     "\[\r\n\]#0 .* foo \\(i=[-]?[0-9]+, i@entry=10, j=[-]?[0-9]+, j@entry=11\\)"
     "\[\r\n\]#1 .* bar \\(i=<optimized out>, i@entry=<optimized out>\\)"
-    "\[\r\n\]#2 .* main \\(\\)"
+    "\[\r\n\]#2 .* \.?main \\(\\)"
 }
 
 # Restart GDB and trace.
@@ -203,7 +210,7 @@ clean_restart $binfile
 load_lib "trace-support.exp"
 
 if ![runto_main] {
-    fail "Can't run to main to check for trace support"
+    fail "can't run to main to check for trace support"
     return -1
 }
 
@@ -219,7 +226,7 @@ gdb_test "trace foo" "Tracepoint $decimal at .*"
 # argument j.
 
 gdb_trace_setactions "set action for tracepoint 1" "" \
-    "collect i, j, global1, \(\*\(void \*\*\) \(\$$spreg\)\) @ 64" "^$"
+    "collect i, j, (int) global1, \(\*\(void \*\*\) \(\$$spreg\)\) @ 128" "^$"
 
 gdb_test_no_output "tstart"
 
This page took 0.027232 seconds and 4 git commands to generate.