From 3bc96cfbb226922c2eedc9df93a6d18bf532db7f Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Tue, 27 Dec 2011 21:29:41 +0000 Subject: [PATCH] gdb/testsuite/ * gdb.python/py-finish-breakpoint.c (test_exec_exit): Change the parameter to self_exec, adjust the function. (main): Check for argv[1] "exit". Use argv[0] for test_exec_exit. * gdb.python/py-finish-breakpoint.exp (set var self_exec = 0): New test. (set var do_exit = 0): Remove test. (newline at end of file): Add one. --- gdb/testsuite/ChangeLog | 9 +++++++++ gdb/testsuite/gdb.python/py-finish-breakpoint.c | 11 +++++++---- gdb/testsuite/gdb.python/py-finish-breakpoint.exp | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e07ac4709d6..4f4971060dc 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2011-12-27 Jan Kratochvil + + * gdb.python/py-finish-breakpoint.c (test_exec_exit): Change the + parameter to self_exec, adjust the function. + (main): Check for argv[1] "exit". Use argv[0] for test_exec_exit. + * gdb.python/py-finish-breakpoint.exp (set var self_exec = 0): New test. + (set var do_exit = 0): Remove test. + (newline at end of file): Add one. + 2011-12-27 Joel Brobecker * gdb.base/dmsym.c, gdb.base/dmsym_main.c, gdb.base/dmsym.exp: diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.c b/gdb/testsuite/gdb.python/py-finish-breakpoint.c index cf2e06c947b..d8a5c1c8015 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint.c +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.c @@ -59,12 +59,12 @@ call_longjmp (jmp_buf *buf) } void -test_exec_exit (int do_exit) +test_exec_exit (const char *self_exec) { - if (do_exit) + if (self_exec == NULL) exit (0); else - execl ("/bin/echo", "echo", "-1", (char *)0); + execl (self_exec, self_exec, "exit", (char *)0); } int main (int argc, char *argv[]) @@ -74,6 +74,9 @@ int main (int argc, char *argv[]) int bar = 42; int i, j; + if (argc == 2 && strcmp (argv[1], "exit") == 0) + return 0; + do_nothing (); i = 0; @@ -94,7 +97,7 @@ int main (int argc, char *argv[]) else j += 1; /* after longjmp. */ - test_exec_exit (1); + test_exec_exit (argv[0]); return j; /* Break at end. */ } diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp index c7a42a241f3..fbdc5db00e0 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp @@ -247,6 +247,7 @@ if ![runto "test_exec_exit"] then { return 0 } +gdb_test_no_output "set var self_exec = 0" "switch to exit() test" gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exit()" gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exit" @@ -259,7 +260,6 @@ if ![runto "test_exec_exit"] then { return 0 } -gdb_test_no_output "set var do_exit = 0" "switch to execve() test" gdb_test "python SimpleFinishBreakpoint(gdb.newest_frame())" "SimpleFinishBreakpoint init" "set FinishBP after the exec" gdb_test "catch exec" "Catchpoint.*\(exec\).*" "catch exec" -gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exec" \ No newline at end of file +gdb_test "continue" "SimpleFinishBreakpoint out of scope.*" "catch out of scope after exec" -- 2.39.2