| OLD | NEW |
| 1 # Copyright 1998, 2000-2004, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 1998, 2000-2004, 2007-2012 Free Software Foundation, Inc. |
| 2 # | 2 # |
| 3 # This program is free software; you can redistribute it and/or modify | 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 | 4 # it under the terms of the GNU General Public License as published by |
| 5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
| 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 # | 15 # |
| 16 # This file was written by Kendra. | 16 # This file was written by Kendra. |
| 17 | 17 |
| 18 if $tracelevel then { | |
| 19 strace $tracelevel | |
| 20 } | |
| 21 | |
| 22 # | 18 # |
| 23 # Test debugging assembly level programs. | 19 # Test debugging assembly level programs. |
| 24 # This file uses asmsrc[12].s for input. | 20 # This file uses asmsrc[12].s for input. |
| 25 # | 21 # |
| 26 | 22 |
| 27 | 23 |
| 28 set asm-arch "" | 24 set asm-arch "" |
| 29 set asm-note "empty" | 25 set asm-note "empty" |
| 30 set asm-flags "" | 26 set asm-flags "" |
| 31 set link-flags "-e _start" | 27 set link-flags "-e _start" |
| 32 set debug-flags "" | 28 set debug-flags "" |
| 33 | 29 |
| 30 set obj_include -I[standard_output_file {}] |
| 31 |
| 34 switch -glob -- [istarget] { | 32 switch -glob -- [istarget] { |
| 35 "alpha*-*-*" { | 33 "alpha*-*-*" { |
| 36 set asm-arch alpha | 34 set asm-arch alpha |
| 37 # ??? Won't work with ecoff systems like Tru64, but then we also | 35 # ??? Won't work with ecoff systems like Tru64, but then we also |
| 38 # don't have any other -g flag that creates mdebug output. | 36 # don't have any other -g flag that creates mdebug output. |
| 39 set asm-flags "-no-mdebug -I${srcdir}/${subdir} -I${objdir}/${subdir}" | 37 set asm-flags "-no-mdebug -I${srcdir}/${subdir} $obj_include" |
| 40 set debug-flags "-gdwarf-2" | 38 set debug-flags "-gdwarf-2" |
| 41 } | 39 } |
| 42 "arm*-*-*" { | 40 "arm*-*-*" { |
| 43 set asm-arch arm | 41 set asm-arch arm |
| 44 } | 42 } |
| 45 "bfin-*-*" { | 43 "bfin-*-*" { |
| 46 set asm-arch bfin | 44 set asm-arch bfin |
| 47 } | 45 } |
| 48 "frv-*-*" { | 46 "frv-*-*" { |
| 49 set asm-arch frv | 47 set asm-arch frv |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 } | 67 } |
| 70 "m32c-*-*" { | 68 "m32c-*-*" { |
| 71 set asm-arch m32c | 69 set asm-arch m32c |
| 72 } | 70 } |
| 73 "m32r*-*" { | 71 "m32r*-*" { |
| 74 set asm-arch m32r | 72 set asm-arch m32r |
| 75 append link-flags "--whole-archive -lgloss --no-whole-archive" | 73 append link-flags "--whole-archive -lgloss --no-whole-archive" |
| 76 } | 74 } |
| 77 "m6811-*-*" { | 75 "m6811-*-*" { |
| 78 set asm-arch m68hc11 | 76 set asm-arch m68hc11 |
| 79 set asm-flags "-mshort-double -m68hc11 --no-warn -I${srcdir}/${subdir} -
I${objdir}/${subdir}" | 77 set asm-flags "-mshort-double -m68hc11 --no-warn -I${srcdir}/${subdir} $
obj_include" |
| 80 set debug-flags "-gdwarf-2" | 78 set debug-flags "-gdwarf-2" |
| 81 # This asm test is specific and uses the linker directly. | 79 # This asm test is specific and uses the linker directly. |
| 82 # We must not use the target board linker script defined for other | 80 # We must not use the target board linker script defined for other |
| 83 # tests. Remove it and restore it later on. | 81 # tests. Remove it and restore it later on. |
| 84 set board [target_info name] | 82 set board [target_info name] |
| 85 set old_ldscript [board_info $board ldscript] | 83 set old_ldscript [board_info $board ldscript] |
| 86 unset_board_info "ldscript" | 84 unset_board_info "ldscript" |
| 87 } | 85 } |
| 88 "m6812-*-*" { | 86 "m6812-*-*" { |
| 89 set asm-arch m68hc11 | 87 set asm-arch m68hc11 |
| 90 set asm-flags "-mshort-double -m68hc12 --no-warn -I${srcdir}/${subdir} -
I${objdir}/${subdir}" | 88 set asm-flags "-mshort-double -m68hc12 --no-warn -I${srcdir}/${subdir} $
obj_include" |
| 91 set debug-flags "-gdwarf-2" | 89 set debug-flags "-gdwarf-2" |
| 92 # This asm test is specific and uses the linker directly. | 90 # This asm test is specific and uses the linker directly. |
| 93 # We must not use the target board linker script defined for other | 91 # We must not use the target board linker script defined for other |
| 94 # tests. Remove it and restore it later on. | 92 # tests. Remove it and restore it later on. |
| 95 set board [target_info name] | 93 set board [target_info name] |
| 96 set old_ldscript [board_info $board ldscript] | 94 set old_ldscript [board_info $board ldscript] |
| 97 set_board_info ldscript "" | 95 set_board_info ldscript "" |
| 98 } | 96 } |
| 99 "mips*-*" { | 97 "mips*-*" { |
| 100 set asm-arch mips | 98 set asm-arch mips |
| 101 } | 99 } |
| 102 "powerpc*-*" { | 100 "powerpc*-*" { |
| 103 if { [is_lp64_target] } { | 101 if { [is_lp64_target] } { |
| 104 set asm-arch powerpc64 | 102 set asm-arch powerpc64 |
| 105 set asm-flags "-a64 -I${srcdir}/${subdir} -I${objdir}/${subdir}" | 103 set asm-flags "-a64 -I${srcdir}/${subdir} $obj_include" |
| 106 append link-flags " -m elf64ppc" | 104 append link-flags " -m elf64ppc" |
| 107 } else { | 105 } else { |
| 108 set asm-arch powerpc | 106 set asm-arch powerpc |
| 109 set asm-flags "-a32 -I${srcdir}/${subdir} -I${objdir}/${subdir}" | 107 set asm-flags "-a32 -I${srcdir}/${subdir} $obj_include" |
| 110 append link-flags " -m elf32ppc" | 108 append link-flags " -m elf32ppc" |
| 111 } | 109 } |
| 112 } | 110 } |
| 113 "sh*-*-*" { | 111 "sh*-*-*" { |
| 114 set asm-arch sh | 112 set asm-arch sh |
| 115 set debug-flags "-gdwarf-2" | 113 set debug-flags "-gdwarf-2" |
| 116 } | 114 } |
| 117 "sparc-*-*" { | 115 "sparc-*-*" { |
| 118 set asm-arch sparc | 116 set asm-arch sparc |
| 119 } | 117 } |
| 120 "sparc64-*-*" { | 118 "sparc64-*-*" { |
| 121 set asm-arch sparc64 | 119 set asm-arch sparc64 |
| 122 set asm-flags "-xarch=v9 -I${srcdir}/${subdir} -I${objdir}/${subdir}" | 120 set asm-flags "-xarch=v9 -I${srcdir}/${subdir} $obj_include" |
| 123 set debug-flags "-gdwarf-2" | 121 set debug-flags "-gdwarf-2" |
| 124 } | 122 } |
| 125 "spu*-*-*" { | 123 "spu*-*-*" { |
| 126 set asm-arch spu | 124 set asm-arch spu |
| 127 set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir} --no-warn" | 125 set asm-flags "-I${srcdir}/${subdir} $obj_include --no-warn" |
| 128 set debug-flags "-gdwarf-2" | 126 set debug-flags "-gdwarf-2" |
| 129 } | 127 } |
| 130 "xstormy16-*-*" { | 128 "xstormy16-*-*" { |
| 131 set asm-arch xstormy16 | 129 set asm-arch xstormy16 |
| 132 set debug-flags "-gdwarf-2" | 130 set debug-flags "-gdwarf-2" |
| 133 } | 131 } |
| 134 "v850-*-*" { | 132 "v850-*-*" { |
| 135 set asm-arch v850 | 133 set asm-arch v850 |
| 136 set gdb_wrapper_initialized 1 | 134 set gdb_wrapper_initialized 1 |
| 137 } | 135 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 set dest [target_info name] | 191 set dest [target_info name] |
| 194 if [board_info $dest exists multilib_flags] { | 192 if [board_info $dest exists multilib_flags] { |
| 195 set multilib_flags [board_info $dest multilib_flags] | 193 set multilib_flags [board_info $dest multilib_flags] |
| 196 if { "${multilib_flags}" != "" } { | 194 if { "${multilib_flags}" != "" } { |
| 197 untested asm-source.exp | 195 untested asm-source.exp |
| 198 return -1 | 196 return -1 |
| 199 return; | 197 return; |
| 200 } | 198 } |
| 201 } | 199 } |
| 202 | 200 |
| 203 set testfile "asm-source" | 201 standard_testfile asmsrc1.s asmsrc2.s |
| 204 set binfile ${objdir}/${subdir}/${testfile} | |
| 205 set srcfile1 asmsrc1.s | |
| 206 set srcfile2 asmsrc2.s | |
| 207 | 202 |
| 208 remote_exec build "rm -f ${subdir}/arch.inc" | 203 remote_exec build "rm -f ${subdir}/arch.inc" |
| 209 remote_download host ${srcdir}/${subdir}/${asm-arch}.inc ${subdir}/arch.inc | 204 remote_download host ${srcdir}/${subdir}/${asm-arch}.inc ${subdir}/arch.inc |
| 210 remote_exec build "rm -f ${subdir}/note.inc" | 205 remote_exec build "rm -f ${subdir}/note.inc" |
| 211 remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc | 206 remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc |
| 212 | 207 |
| 213 if { [string equal ${asm-flags} ""] } { | 208 if { [string equal ${asm-flags} ""] } { |
| 214 set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}" | 209 set asm-flags "-I${srcdir}/${subdir} $obj_include" |
| 215 } | 210 } |
| 216 | 211 |
| 217 if { [string equal ${debug-flags} ""] } { | 212 if { [string equal ${debug-flags} ""] } { |
| 218 set debug-flags "-gstabs" | 213 set debug-flags "-gstabs" |
| 219 } | 214 } |
| 220 | 215 |
| 221 # Allow the target board to override the debug flags. | 216 # Allow the target board to override the debug flags. |
| 222 if { [board_info $dest exists debug_flags] } then { | 217 if { [board_info $dest exists debug_flags] } then { |
| 223 set debug-flags "[board_info $dest debug_flags]" | 218 set debug-flags "[board_info $dest debug_flags]" |
| 224 } | 219 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 236 | 231 |
| 237 # The GNU assembler spells "dwarf-2" as "dwarf2". | 232 # The GNU assembler spells "dwarf-2" as "dwarf2". |
| 238 regsub "--" "-gdwarf-2" "${debug-flags}" "-gdwarf2" debug-flags | 233 regsub "--" "-gdwarf-2" "${debug-flags}" "-gdwarf2" debug-flags |
| 239 | 234 |
| 240 # The GNU assembler before 2.15 did not support "stabs+". | 235 # The GNU assembler before 2.15 did not support "stabs+". |
| 241 regsub "--" "-gstabs\[+\]" "${debug-flags}" "-gstabs" debug-flags | 236 regsub "--" "-gstabs\[+\]" "${debug-flags}" "-gstabs" debug-flags |
| 242 | 237 |
| 243 # The GNU assembler does not support level options like "-g2" or "-g3". | 238 # The GNU assembler does not support level options like "-g2" or "-g3". |
| 244 regsub "--" "-g\[0-9\]" "${debug-flags}" "" debug-flags | 239 regsub "--" "-g\[0-9\]" "${debug-flags}" "" debug-flags |
| 245 | 240 |
| 246 if {[target_assemble ${srcdir}/${subdir}/${srcfile1} asmsrc1.o "${asm-flags} ${d
ebug-flags}"] != ""} then { | 241 set asm1obj [standard_output_file asmrc1.o] |
| 242 set asm2obj [standard_output_file asmrc2.o] |
| 243 |
| 244 if {[target_assemble ${srcdir}/${subdir}/${srcfile} $asm1obj "${asm-flags} ${deb
ug-flags}"] != ""} then { |
| 247 untested asm-source.exp | 245 untested asm-source.exp |
| 248 return -1 | 246 return -1 |
| 249 } | 247 } |
| 250 if {[target_assemble ${srcdir}/${subdir}/${srcfile2} asmsrc2.o "${asm-flags} ${d
ebug-flags}"] != ""} then { | 248 if {[target_assemble ${srcdir}/${subdir}/${srcfile2} $asm2obj "${asm-flags} ${de
bug-flags}"] != ""} then { |
| 251 untested asm-source.exp | 249 untested asm-source.exp |
| 252 return -1 | 250 return -1 |
| 253 } | 251 } |
| 254 | 252 |
| 255 # We deliberately don't use gdb_compile here to link together the | 253 # We deliberately don't use gdb_compile here to link together the |
| 256 # assembled object files. Using gdb_compile, and therefore the C | 254 # assembled object files. Using gdb_compile, and therefore the C |
| 257 # compiler, is conceptually wrong, since we're testing raw assembler | 255 # compiler, is conceptually wrong, since we're testing raw assembler |
| 258 # code here that provides its own startup code. Using target_link | 256 # code here that provides its own startup code. Using target_link |
| 259 # also avoids a lot of problems on many systems, most notably on | 257 # also avoids a lot of problems on many systems, most notably on |
| 260 # *-*-*bsd* and *-*-solaris2*. | 258 # *-*-*bsd* and *-*-solaris2*. |
| 261 if {[target_link "asmsrc1.o asmsrc2.o" "${binfile}" ${link-flags}] != "" } then
{ | 259 if {[target_link [list $asm1obj $asm2obj] "${binfile}" ${link-flags}] != "" } th
en { |
| 262 untested asm-source.exp | 260 untested asm-source.exp |
| 263 return -1 | 261 return -1 |
| 264 } | 262 } |
| 265 | 263 |
| 266 # Restore the target board linker script for HC11/HC12. | 264 # Restore the target board linker script for HC11/HC12. |
| 267 if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { | 265 if { [istarget "m6811-*-*"] || [istarget "m6812-*-*"] } { |
| 268 set_board_info ldscript $old_ldscript | 266 set_board_info ldscript $old_ldscript |
| 269 } | 267 } |
| 270 | 268 |
| 271 remote_exec build "mv asmsrc1.o asmsrc2.o ${objdir}/${subdir}" | |
| 272 | |
| 273 # Collect some line numbers. | 269 # Collect some line numbers. |
| 274 set line_main [expr [gdb_get_line_number "main start" "asmsrc1.s"] + 1] | 270 set line_main [expr [gdb_get_line_number "main start" "asmsrc1.s"] + 1] |
| 275 set line_call_foo2 [expr [gdb_get_line_number "call foo2" "asmsrc1.s"] + 1] | 271 set line_call_foo2 [expr [gdb_get_line_number "call foo2" "asmsrc1.s"] + 1] |
| 276 set line_search_comment [expr [gdb_get_line_number "search" "asmsrc1.s"] + 1] | 272 set line_search_comment [expr [gdb_get_line_number "search" "asmsrc1.s"] + 1] |
| 277 set line_foo3 [expr [gdb_get_line_number "foo3 start" "asmsrc1.s"] + 1] | 273 set line_foo3 [expr [gdb_get_line_number "foo3 start" "asmsrc1.s"] + 1] |
| 278 set line_main_exit [expr [gdb_get_line_number "main exit" "asmsrc1.s"] + 1] | 274 set line_main_exit [expr [gdb_get_line_number "main exit" "asmsrc1.s"] + 1] |
| 279 set line_foo2 [expr [gdb_get_line_number "foo2 start" "asmsrc2.s"] + 1] | 275 set line_foo2 [expr [gdb_get_line_number "foo2 start" "asmsrc2.s"] + 1] |
| 280 set line_call_foo3 [expr [gdb_get_line_number "call foo3" "asmsrc2.s"] + 1] | 276 set line_call_foo3 [expr [gdb_get_line_number "call foo3" "asmsrc2.s"] + 1] |
| 281 set line_call_foo3_again [expr $line_call_foo3 + 1] | 277 set line_call_foo3_again [expr $line_call_foo3 + 1] |
| 282 set line_foo2_leave [expr [gdb_get_line_number "foo2 leave" "asmsrc2.s"] + 1] | 278 set line_foo2_leave [expr [gdb_get_line_number "foo2 leave" "asmsrc2.s"] + 1] |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 gdb_test "print staticvar" ".* = 5" "look at static variable" | 462 gdb_test "print staticvar" ".* = 5" "look at static variable" |
| 467 test_dis "x/i &staticvar" "staticvar" | 463 test_dis "x/i &staticvar" "staticvar" |
| 468 test_dis "disassem &staticvar, &staticvar+1" "staticvar" | 464 test_dis "disassem &staticvar, &staticvar+1" "staticvar" |
| 469 | 465 |
| 470 # See if we can look at a static function | 466 # See if we can look at a static function |
| 471 gdb_test "disassem foostatic" ".*<\\+0>:.*End of assembler dump." \ | 467 gdb_test "disassem foostatic" ".*<\\+0>:.*End of assembler dump." \ |
| 472 "look at static function" | 468 "look at static function" |
| 473 | 469 |
| 474 remote_exec build "rm -f ${subdir}/arch.inc" | 470 remote_exec build "rm -f ${subdir}/arch.inc" |
| 475 remote_exec build "rm -f ${subdir}/note.inc" | 471 remote_exec build "rm -f ${subdir}/note.inc" |
| OLD | NEW |