From: Michael Snyder Date: Thu, 6 Jun 2002 20:26:10 +0000 (+0000) Subject: 2002-06-06 Michael Snyder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c5984d701278f402a88234f7c0a6bf5f15577fcc;p=binutils-gdb.git 2002-06-06 Michael Snyder * gdb.base/overlays.exp: Record addresses of overlay functions in TCL variables rather than in GDB variables, to avoid having GDB convert them to pointers (with loss of information). --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cc625d5e7fb..f015dad4cf1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2002-06-06 Michael Snyder + * gdb.base/overlays.exp: Record addresses of overlay + functions in TCL variables rather than in GDB variables, + to avoid having GDB convert them to pointers (with loss + of information). + * gdb.base/d10v.ld: Merge in several years worth of default linker script changes. * gdb.base/long_long.exp: Add check for sizeof (long double). diff --git a/gdb/testsuite/gdb.base/overlays.exp b/gdb/testsuite/gdb.base/overlays.exp index 9188b278014..c31da4e5ad4 100644 --- a/gdb/testsuite/gdb.base/overlays.exp +++ b/gdb/testsuite/gdb.base/overlays.exp @@ -1,4 +1,4 @@ -# Copyright 1997, 1998 Free Software Foundation, Inc. +# Copyright 1997, 1998, 2002 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 @@ -86,22 +86,42 @@ if ![runto_main] then { } # couple of convenience variables -set fptrcast [string_to_regexp "(int (*)(int))"] +set fptrcast [string_to_regexp "{int (int)}"] set iptrcast [string_to_regexp "(int *)"] +set hexx "0x\[0-9abcdefABCDEF\]+" gdb_test "overlay manual" "" gdb_test "overlay list" "No sections are mapped." "List with none mapped" # capture the LMA addresses of [foo bar baz grbx foox barx bazx grbxx] -gdb_test "print \$foo_lma = &foo" \ - ".* $fptrcast 0x.* <\\*foo\\*>" "foo load addr" -gdb_test "print \$bar_lma = &bar" \ - ".* $fptrcast 0x.* <\\*bar\\*>" "bar load addr" -gdb_test "print \$baz_lma = &baz" \ - ".* $fptrcast 0x.* <\\*baz\\*>" "baz load addr" -gdb_test "print \$grbx_lma = &grbx" \ - ".* $fptrcast 0x.* <\\*grbx\\*>" "grbx load addr" +proc get_func_address { func func_sym msg } { + global gdb_prompt + global fptrcast + global hexx + + set func_addr 0 + send_gdb "print $func\n" + gdb_expect { + -re "\\$\[0-9\]+ = $fptrcast (${hexx}) <$func_sym>.*$gdb_prompt $" { + set func_addr $expect_out(1,string) + pass "get $msg" + } + -re ".*$gdb_prompt $" { + fail "get $msg" + } + default { + fail "get $msg (timeout)" + } + } + return $func_addr +} + +set foo_lma [get_func_address "foo" "\\*foo\\*" "foo load address"] +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" \ ".* $iptrcast 0x.*" "foox load addr" gdb_test "print \$barx_lma = &barx" \ @@ -116,23 +136,19 @@ gdb_test "print \$grbxx_lma = &grbxx" \ gdb_test "overlay map .ovly0" "" gdb_test "overlay list" "Section .ovly0, loaded at.*, mapped at.*" "List ovly0" -gdb_test "print \$foo_vma = &foo" \ - ".* $fptrcast 0x.* " "foo runtime addr" +set foo_vma [get_func_address "foo" "foo" "foo runtime address"] gdb_test "overlay map .ovly1" "" gdb_test "overlay list" "Section .ovly1, loaded at.*, mapped at.*" "List ovly1" -gdb_test "print \$bar_vma = &bar" \ - ".* $fptrcast 0x.* " "bar runtime addr" +set bar_vma [get_func_address "bar" "bar" "bar runtime address"] gdb_test "overlay map .ovly2" "" gdb_test "overlay list" "Section .ovly2, loaded at.*, mapped at.*" "List ovly2" -gdb_test "print \$baz_vma = &baz" \ - ".* $fptrcast 0x.* " "baz runtime addr" +set baz_vma [get_func_address "baz" "baz" "baz runtime address"] gdb_test "overlay map .ovly3" "" gdb_test "overlay list" "Section .ovly3, loaded at.*, mapped at.*" "List ovly3" -gdb_test "print \$grbx_vma = &grbx" \ - ".* $fptrcast 0x.* " "grbx runtime addr" +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" @@ -156,10 +172,10 @@ gdb_test "print \$grbxx_vma = &grbxx" \ # 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 $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"