mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-12-01 16:35:04 +00:00
2004-07-16 Andrew Cagney <cagney@gnu.org>
* gdb.base/restore.c: Append "prologue" to comments marking the a function's prologue. * gdb.base/restore.exp: Update copyright, re-indent. (restore_tests): Use gdb_test_multiple. Add "calleeN calls callerN" prefix where needed. Update patterns that match a function's prologue.
This commit is contained in:
parent
f263249b3d
commit
029d220040
@ -1,3 +1,12 @@
|
||||
2004-07-16 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* gdb.base/restore.c: Append "prologue" to comments marking the a
|
||||
function's prologue.
|
||||
* gdb.base/restore.exp: Update copyright, re-indent.
|
||||
(restore_tests): Use gdb_test_multiple. Add "calleeN calls
|
||||
callerN" prefix where needed. Update patterns that match a
|
||||
function's prologue.
|
||||
|
||||
2004-07-16 Michael Chastain <mec.gnu@mindspring.com>
|
||||
|
||||
* gdb.base/restore.c: Add copyright notice.
|
||||
|
@ -46,7 +46,7 @@
|
||||
" = increment (" previous ");")
|
||||
(if first-end
|
||||
(progn
|
||||
(insert " /" "* " first-end " *" "/")
|
||||
(insert " /" "* " first-end " prologue *" "/")
|
||||
(setq first-end nil)))
|
||||
(insert "\n")
|
||||
(setq previous (local j))
|
||||
@ -129,7 +129,7 @@ callee0 (int n)
|
||||
int
|
||||
callee1 (int n)
|
||||
{
|
||||
register int l1 = increment (n); /* callee1 */
|
||||
register int l1 = increment (n); /* callee1 prologue */
|
||||
return l1;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ callee1 (int n)
|
||||
int
|
||||
callee2 (int n)
|
||||
{
|
||||
register int l1 = increment (n); /* callee2 */
|
||||
register int l1 = increment (n); /* callee2 prologue */
|
||||
register int l2 = increment (l1);
|
||||
return l1+l2;
|
||||
}
|
||||
@ -146,7 +146,7 @@ callee2 (int n)
|
||||
int
|
||||
callee3 (int n)
|
||||
{
|
||||
register int l1 = increment (n); /* callee3 */
|
||||
register int l1 = increment (n); /* callee3 prologue */
|
||||
register int l2 = increment (l1);
|
||||
register int l3 = increment (l2);
|
||||
return l1+l2+l3;
|
||||
@ -156,7 +156,7 @@ callee3 (int n)
|
||||
int
|
||||
callee4 (int n)
|
||||
{
|
||||
register int l1 = increment (n); /* callee4 */
|
||||
register int l1 = increment (n); /* callee4 prologue */
|
||||
register int l2 = increment (l1);
|
||||
register int l3 = increment (l2);
|
||||
register int l4 = increment (l3);
|
||||
@ -167,7 +167,7 @@ callee4 (int n)
|
||||
int
|
||||
callee5 (int n)
|
||||
{
|
||||
register int l1 = increment (n); /* callee5 */
|
||||
register int l1 = increment (n); /* callee5 prologue */
|
||||
register int l2 = increment (l1);
|
||||
register int l3 = increment (l2);
|
||||
register int l4 = increment (l3);
|
||||
@ -178,7 +178,7 @@ callee5 (int n)
|
||||
int
|
||||
caller1 (void)
|
||||
{
|
||||
register int l1 = increment (0x7eeb); /* caller1 */
|
||||
register int l1 = increment (0x7eeb); /* caller1 prologue */
|
||||
register int n;
|
||||
n = callee0 (l1);
|
||||
n = callee1 (n + l1);
|
||||
@ -192,7 +192,7 @@ caller1 (void)
|
||||
int
|
||||
caller2 (void)
|
||||
{
|
||||
register int l1 = increment (0x7eeb); /* caller2 */
|
||||
register int l1 = increment (0x7eeb); /* caller2 prologue */
|
||||
register int l2 = increment (l1);
|
||||
register int n;
|
||||
n = callee0 (l2);
|
||||
@ -207,7 +207,7 @@ caller2 (void)
|
||||
int
|
||||
caller3 (void)
|
||||
{
|
||||
register int l1 = increment (0x7eeb); /* caller3 */
|
||||
register int l1 = increment (0x7eeb); /* caller3 prologue */
|
||||
register int l2 = increment (l1);
|
||||
register int l3 = increment (l2);
|
||||
register int n;
|
||||
@ -223,7 +223,7 @@ caller3 (void)
|
||||
int
|
||||
caller4 (void)
|
||||
{
|
||||
register int l1 = increment (0x7eeb); /* caller4 */
|
||||
register int l1 = increment (0x7eeb); /* caller4 prologue */
|
||||
register int l2 = increment (l1);
|
||||
register int l3 = increment (l2);
|
||||
register int l4 = increment (l3);
|
||||
@ -240,7 +240,7 @@ caller4 (void)
|
||||
int
|
||||
caller5 (void)
|
||||
{
|
||||
register int l1 = increment (0x7eeb); /* caller5 */
|
||||
register int l1 = increment (0x7eeb); /* caller5 prologue */
|
||||
register int l2 = increment (l1);
|
||||
register int l3 = increment (l2);
|
||||
register int l4 = increment (l3);
|
||||
|
@ -1,4 +1,7 @@
|
||||
# Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
# This testcase is part of GDB, the GNU debugger.
|
||||
|
||||
# Copyright 1998, 1999, 2000, 2001, 2002, 2004 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
|
||||
@ -14,9 +17,6 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# Please email any bugs, comments, and/or additions to this file to:
|
||||
# bug-gdb@prep.ai.mit.edu
|
||||
|
||||
# Test GDB's ability to restore saved registers from stack frames
|
||||
# when using the `return' command.
|
||||
#
|
||||
@ -24,7 +24,7 @@
|
||||
# fragments borrowed from return.exp.
|
||||
|
||||
if $tracelevel then {
|
||||
strace $tracelevel
|
||||
strace $tracelevel
|
||||
}
|
||||
|
||||
set prms_id 0
|
||||
@ -34,13 +34,15 @@ set testfile "restore"
|
||||
set srcfile ${testfile}.c
|
||||
set binfile ${objdir}/${subdir}/${testfile}
|
||||
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
||||
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
|
||||
}
|
||||
|
||||
proc restore_tests { } {
|
||||
global gdb_prompt
|
||||
|
||||
if { ! [ runto driver ] } then { return 0 }
|
||||
if { ! [ runto driver ] } {
|
||||
return 0
|
||||
}
|
||||
|
||||
set limit 5
|
||||
|
||||
@ -48,30 +50,35 @@ proc restore_tests { } {
|
||||
# call each of the callee functions,
|
||||
# force a return from the callee, and
|
||||
# make sure that the local variables still have the right values.
|
||||
|
||||
for {set c 1} {$c <= $limit} {incr c} {
|
||||
|
||||
# Set a breakpoint at the next caller function.
|
||||
gdb_test "tbreak caller$c" "Breakpoint.*\[0-9\]*\\." "tbreak caller$c"
|
||||
gdb_test "tbreak caller$c" "Breakpoint.*\[0-9\]*\\." \
|
||||
"tbreak caller$c"
|
||||
|
||||
# Continue to the next caller function.
|
||||
gdb_test "continue" ".*/\\* caller$c \\*/" "run to caller$c"
|
||||
gdb_test "continue" " caller$c prologue .*" "run to caller$c"
|
||||
|
||||
# Do each callee function.
|
||||
for {set e 1} {$e <= $limit} {incr e} {
|
||||
|
||||
gdb_test "tbreak callee$e" "Breakpoint.*\[0-9\]*\\." \
|
||||
"tbreak callee$e"
|
||||
"caller$c calls callee$e; tbreak callee"
|
||||
|
||||
gdb_test "continue" ".*/\\* callee$e \\*/" "run to callee$e"
|
||||
|
||||
gdb_test "continue" " callee$e prologue .*/" \
|
||||
"caller$c calls callee$e; continue to callee"
|
||||
|
||||
# Do a forced return from the callee.
|
||||
send_gdb "return 0\n"
|
||||
gdb_expect {
|
||||
set test "caller$c calls callee$e; return callee now"
|
||||
gdb_test_multiple "return 0" "$test" {
|
||||
-re "Make .* return now.*y or n. $" {
|
||||
send_gdb "y\n"
|
||||
exp_continue
|
||||
}
|
||||
-re "$gdb_prompt $" { }
|
||||
-re " caller$c .*$gdb_prompt $" {
|
||||
pass "$test"
|
||||
}
|
||||
}
|
||||
|
||||
# Check that the values of the local variables are what
|
||||
@ -79,7 +86,7 @@ proc restore_tests { } {
|
||||
for {set var 1} {$var <= $c} {incr var} {
|
||||
set expected [expr 0x7eeb + $var]
|
||||
gdb_test "print l$var" " = $expected" \
|
||||
"caller$c called callee$e; variable l$var restored to $expected"
|
||||
"caller$c calls callee$e; return restored l$var to $expected"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user