OSDN Git Service

Updated copyright notices for most files.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / testsuite / gdb.opt / clobbered-registers-O2.exp
1 # Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 #
17 # This file is part of the gdb testsuite.
18
19 if $tracelevel then {
20     strace $tracelevel
21 }
22
23 # Test displaying call clobbered registers in optimized binaries.
24 # GDB should not show incorrect values.
25
26 set testfile clobbered-registers-O2
27 set srcfile ${testfile}.c
28 set binfile ${objdir}/${subdir}/${testfile}
29
30 # What compiler are we using?
31 #
32 if [get_compiler_info ${binfile}] {
33     return -1
34 }
35
36 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug optimize=-O2 nowarnings]] != "" } {
37      untested clobbered-registers-O2.exp
38      return -1
39 }
40
41 # use this to debug:
42 #log_user 1
43
44 gdb_exit
45 gdb_start
46 gdb_reinitialize_dir $srcdir/$subdir
47 gdb_load ${binfile}
48
49 if { ![runto start_sequence] } then {
50    fail "run to start_sequence"
51    return
52 }
53
54 gdb_test "frame 1" "#1.*in gen_movsd.*" "Backtracing"
55
56 gdb_test_multiple "print operand0" "print operand0" {
57     -re "\\\$$decimal = <value optimized out>\r\n$gdb_prompt $" { pass "print operand0"}
58     -re "$hex\r\n$gdb_prompt $" { gdb_test "print *operand0" "13" "print operand0" }
59 }
60
61 gdb_test_multiple "print operand1" "print operand1" {
62     -re "\\\$$decimal = <value optimized out>\r\n$gdb_prompt $" { pass "print operand1"}
63     -re "$hex\r\n$gdb_prompt $" { gdb_test "print *operand1" "14" "print operand1" }
64 }
65