From 83547f02b76a49b6899e65a5302e72e0a5ef8fe8 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 11 May 2007 20:00:29 +0000 Subject: [PATCH] * gdb.base/overlays.exp: Add support for targets with only code overlay support, not data overlay. Support spu-*-* target in this mode. * gdb.base/ovlymgr.c: Provide stubs for spu target. * gdb.base/spu.ld: New file. --- gdb/testsuite/ChangeLog | 8 ++ gdb/testsuite/gdb.base/overlays.exp | 62 +++++---- gdb/testsuite/gdb.base/ovlymgr.c | 13 ++ gdb/testsuite/gdb.base/spu.ld | 202 ++++++++++++++++++++++++++++ 4 files changed, 260 insertions(+), 25 deletions(-) create mode 100644 gdb/testsuite/gdb.base/spu.ld diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ac1e20a38f9..908bd3fd979 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2007-05-11 Ulrich Weigand + + * gdb.base/overlays.exp: Add support for targets with only code + overlay support, not data overlay. Support spu-*-* target in + this mode. + * gdb.base/ovlymgr.c: Provide stubs for spu target. + * gdb.base/spu.ld: New file. + 2007-05-07 Daniel Jacobowitz * gdb.cp/virtfunc.exp (proc do_tests): Test stepping through a thunk. diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp index 1a11c464cf4..f6dc322b589 100644 --- a/gdb/testsuite/gdb.base/overlays.exp +++ b/gdb/testsuite/gdb.base/overlays.exp @@ -31,10 +31,15 @@ if $tracelevel then { set prms_id 0 set bug_id 0 +set data_overlays 1 + if [istarget "d10v-*-*"] then { set linker_script "${srcdir}/${subdir}/d10v.ld"; } elseif [istarget "m32r-*-*"] then { set linker_script "${srcdir}/${subdir}/m32r.ld"; +} elseif [istarget "spu-*-*"] then { + set linker_script "${srcdir}/${subdir}/spu.ld"; + set data_overlays 0 } else { verbose "Skipping overlay test -- not implemented for this target." return @@ -131,14 +136,16 @@ set bar_lma [get_func_address "bar" "\\*bar\\*" "bar load address"] set baz_lma [get_func_address "baz" "\\*baz\\*" "baz load address"] set grbx_lma [get_func_address "grbx" "\\*grbx\\*" "grbx load address"] -gdb_test "print \$foox_lma = &foox" \ +if $data_overlays then { + gdb_test "print \$foox_lma = &foox" \ ".* $iptrcast 0x.*" "foox load addr" -gdb_test "print \$barx_lma = &barx" \ + gdb_test "print \$barx_lma = &barx" \ ".* $iptrcast 0x.*" "barx load addr" -gdb_test "print \$bazx_lma = &bazx" \ + gdb_test "print \$bazx_lma = &bazx" \ ".* $iptrcast 0x.*" "bazx load addr" -gdb_test "print \$grbxx_lma = &grbxx" \ + gdb_test "print \$grbxx_lma = &grbxx" \ ".* $iptrcast 0x.*" "grbxx load addr" +} # map each overlay successively, and # capture the VMA addresses of [foo bar baz grbx foox barx bazx grbxx] @@ -159,36 +166,39 @@ gdb_test "overlay map .ovly3" "" gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "List ovly3" set grbx_vma [get_func_address "grbx" "grbx" "grbx runtime address"] -gdb_test "overlay map .data00" "" -gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "List data00" -gdb_test "print \$foox_vma = &foox" \ +if $data_overlays then { + gdb_test "overlay map .data00" "" + gdb_test "overlay list" "Section .data00, loaded .*, mapped .*" "List data00" + gdb_test "print \$foox_vma = &foox" \ ".* $iptrcast 0x.*" "foox runtime addr" -gdb_test "overlay map .data01" "" -gdb_test "overlay list" "Section .data01, loaded .*, mapped .*" "List data01" -gdb_test "print \$barx_vma = &barx" \ + gdb_test "overlay map .data01" "" + gdb_test "overlay list" "Section .data01, loaded .*, mapped .*" "List data01" + gdb_test "print \$barx_vma = &barx" \ ".* $iptrcast 0x.*" "barx runtime addr" -gdb_test "overlay map .data02" "" -gdb_test "overlay list" "Section .data02, loaded .*, mapped .*" "List data02" -gdb_test "print \$bazx_vma = &bazx" \ + gdb_test "overlay map .data02" "" + gdb_test "overlay list" "Section .data02, loaded .*, mapped .*" "List data02" + gdb_test "print \$bazx_vma = &bazx" \ ".* $iptrcast 0x.*" "bazx runtime addr" -gdb_test "overlay map .data03" "" -gdb_test "overlay list" "Section .data03, loaded .*, mapped .*" "List data03" -gdb_test "print \$grbxx_vma = &grbxx" \ + gdb_test "overlay map .data03" "" + gdb_test "overlay list" "Section .data03, loaded .*, mapped .*" "List data03" + gdb_test "print \$grbxx_vma = &grbxx" \ ".* $iptrcast 0x.*" "grbxx runtime addr" - +} # Verify that LMA != VMA gdb_test "print $foo_lma != $foo_vma" ".* = 1" "foo's LMA != VMA" gdb_test "print $bar_lma != $bar_vma" ".* = 1" "bar's LMA != VMA" gdb_test "print $baz_lma != $baz_vma" ".* = 1" "baz's LMA != VMA" gdb_test "print $grbx_lma != $grbx_vma" ".* = 1" "grbx's LMA != VMA" -gdb_test "print \$foox_lma != \$foox_vma" ".* = 1" "foox's LMA != VMA" -gdb_test "print \$barx_lma != \$barx_vma" ".* = 1" "barx's LMA != VMA" -gdb_test "print \$bazx_lma != \$bazx_vma" ".* = 1" "bazx's LMA != VMA" -gdb_test "print \$grbxx_lma != \$grbxx_vma" ".* = 1" "grbxx's LMA != VMA" +if $data_overlays then { + gdb_test "print \$foox_lma != \$foox_vma" ".* = 1" "foox's LMA != VMA" + gdb_test "print \$barx_lma != \$barx_vma" ".* = 1" "barx's LMA != VMA" + gdb_test "print \$bazx_lma != \$bazx_vma" ".* = 1" "bazx's LMA != VMA" + gdb_test "print \$grbxx_lma != \$grbxx_vma" ".* = 1" "grbxx's LMA != VMA" +} # Verify that early-mapped overlays have been bumped out # by later-mapped overlays layed over in the same VMA range. @@ -234,10 +244,12 @@ simultaneous_pair .ovly0 .ovly3 simultaneous_pair .ovly1 .ovly2 simultaneous_pair .ovly1 .ovly3 -simultaneous_pair .data00 .data02 -simultaneous_pair .data00 .data03 -simultaneous_pair .data01 .data02 -simultaneous_pair .data01 .data03 +if $data_overlays then { + simultaneous_pair .data00 .data02 + simultaneous_pair .data00 .data03 + simultaneous_pair .data01 .data02 + simultaneous_pair .data01 .data03 +} # test automatic mode diff --git a/gdb/testsuite/gdb.base/ovlymgr.c b/gdb/testsuite/gdb.base/ovlymgr.c index f4958ed14a3..533606b036f 100644 --- a/gdb/testsuite/gdb.base/ovlymgr.c +++ b/gdb/testsuite/gdb.base/ovlymgr.c @@ -5,6 +5,18 @@ #include "ovlymgr.h" +#ifdef __SPU__ +/* SPU tool chain provides its own overlay manager. */ +bool +OverlayLoad (unsigned long ovlyno) +{ +} +bool +OverlayUnload (unsigned long ovlyno) +{ +} +#else /* __SPU__ */ + /* Local functions and data: */ extern unsigned long _ovly_table[][4]; @@ -231,3 +243,4 @@ ovly_copy (unsigned long dst, unsigned long src, long size) return; } +#endif /* __SPU__ */ diff --git a/gdb/testsuite/gdb.base/spu.ld b/gdb/testsuite/gdb.base/spu.ld new file mode 100644 index 00000000000..0cd5a854053 --- /dev/null +++ b/gdb/testsuite/gdb.base/spu.ld @@ -0,0 +1,202 @@ +/* Script for -z combreloc: combine and sort reloc sections */ +OUTPUT_FORMAT("elf32-spu", "elf32-spu", + "elf32-spu") +OUTPUT_ARCH(spu) +ENTRY(_start) +SEARCH_DIR("/usr/spu/lib"); +/* Do we need any of these for elf? + __DYNAMIC = 0; */ +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__executable_start = 0); . = 0; + .interrupt : { KEEP(*(.interrupt)) } + .interp : { *(.interp) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.dyn : + { + *(.rel.init) + *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) + *(.rel.fini) + *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) + *(.rel.data.rel.ro*) + *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) + *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) + *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) + *(.rel.ctors) + *(.rel.dtors) + *(.rel.got) + *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) + } + .rela.dyn : + { + *(.rela.init) + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rela.fini) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) + *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) + *(.rela.ctors) + *(.rela.dtors) + *(.rela.got) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .text : + { + *(EXCLUDE_FILE (foo.o bar.o baz.o grbx.o) .text .stub .text.* .gnu.linkonce.t.*) + KEEP (*(.text.*personality*)) + *(.spu.elf) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + } =0 + .fini : + { + KEEP (*(.fini)) + } =0 + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + .eh_frame_hdr : { *(.eh_frame_hdr) } + .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(0x80); + /* Exception handling */ + .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } + .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } + /* Thread Local Storage sections */ + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + /* Ensure the __preinit_array_start label is properly aligned. We + could instead move the label definition inside the section, but + the linker would then create the section even if it turns out to + be empty, which isn't pretty. */ + . = ALIGN(16); + PROVIDE (__preinit_array_start = .); + .preinit_array : { KEEP (*(.preinit_array)) } + PROVIDE (__preinit_array_end = .); + PROVIDE (__init_array_start = .); + .init_array : { KEEP (*(.init_array)) } + PROVIDE (__init_array_end = .); + PROVIDE (__fini_array_start = .); + .fini_array : { KEEP (*(.fini_array)) } + PROVIDE (__fini_array_end = .); + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin*.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + .dtors : + { + KEEP (*crtbegin*.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + .jcr : { KEEP (*(.jcr)) } + .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } + .dynamic : { *(.dynamic) } + .got : { *(.got.plt) *(.got) } + .data : + { + *(.data .data.* .gnu.linkonce.d.*) + KEEP (*(.gnu.linkonce.d.*personality*)) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + .bss : + { + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(16); + } + .toe ALIGN(128) : { *(.toe) } = 0 + . = ALIGN(16); + OVERLAY : + { + .ovly0 { foo.o(.text) } + .ovly1 { bar.o(.text) } + } + OVERLAY : + { + .ovly2 { baz.o(.text) } + .ovly3 { grbx.o(.text) } + } + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + .note.spu_name 0 : { *(.note.spu_name) } + PROVIDE (__stack = 0x3fff0); + /DISCARD/ : { *(.note.GNU-stack) } +} + -- 2.30.2