diff options
author | Yao Qi <yao.qi@linaro.org> | 2016-03-30 16:36:51 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2016-03-30 16:36:51 +0100 |
commit | e6359af3fdda6b9265565ecbd213763244ed8594 (patch) | |
tree | f710668a99ae71d113847779ca08d35046f796d8 /gdb/testsuite/gdb.reverse | |
parent | c6025a80cc284ae2781278de6f44c672d5077797 (diff) | |
download | binutils-gdb-e6359af3fdda6b9265565ecbd213763244ed8594.tar.gz |
Simplify gdb.reverse/until-reverse.c
Nowadays, functions fprintf, printf and malloc are executed in
gdb.reverse/until-reverse.c, so that it takes much time to record
instructions inside them. This may cause timeout, and we had several
fixes to bump the timeout,
https://sourceware.org/ml/gdb-patches/2012-02/msg00038.html
https://sourceware.org/ml/gdb-patches/2015-08/msg00186.html
also I still see this on arm-linux,
continue
Continuing.
Do you want to auto delete previous execution log entries when record/replay buffer becomes full (record full stop-at-limit)?([y] or n) n
Process record: stopped by user.
Program stopped.
0xf77021e6 in __linkin_atfork (newp=0xf7751748 <atfork_mem>) at ../nptl/sysdeps/unix/sysv/linux/register-atfork.c:117
117 ../nptl/sysdeps/unix/sysv/linux/register-atfork.c: No such file or directory.
(gdb) FAIL: gdb.reverse/until-precsave.exp: run to end of main (got interactive prompt)
however, I can't figure out how these functions (fprintf, printf and
malloc) are related to the test itself. marker1 is a function from
shared library too so we don't need these complicated libc functions
at all. IMO, recording the instructions in these libc functions has
nothing to do with the test itself except slow down the test. This
patch is to remove the usage of fprintf and printf, and also move
malloc to a dead code path.
gdb/testsuite:
2016-03-30 Yao Qi <yao.qi@linaro.org>
* gdb.reverse/until-precsave.exp: Match function name only.
* gdb.reverse/until-reverse.c (main): Don't call fprintf nor printf.
Move malloc to a condition block.
* gdb.reverse/until-reverse.exp: Match function name only.
Diffstat (limited to 'gdb/testsuite/gdb.reverse')
-rw-r--r-- | gdb/testsuite/gdb.reverse/until-precsave.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.reverse/until-reverse.c | 15 | ||||
-rw-r--r-- | gdb/testsuite/gdb.reverse/until-reverse.exp | 2 |
3 files changed, 10 insertions, 9 deletions
diff --git a/gdb/testsuite/gdb.reverse/until-precsave.exp b/gdb/testsuite/gdb.reverse/until-precsave.exp index b5afa522722..f06b6622d05 100644 --- a/gdb/testsuite/gdb.reverse/until-precsave.exp +++ b/gdb/testsuite/gdb.reverse/until-precsave.exp @@ -91,7 +91,7 @@ gdb_test "until $bp_location19" \ # Finish out to main scope # gdb_test "finish" \ - " in main .*$srcfile:$bp_location1.*" \ + "main .*$srcfile:.*" \ "finish to main" # Advance to a function called by main (marker2) diff --git a/gdb/testsuite/gdb.reverse/until-reverse.c b/gdb/testsuite/gdb.reverse/until-reverse.c index 51f949e6e75..d3311b78273 100644 --- a/gdb/testsuite/gdb.reverse/until-reverse.c +++ b/gdb/testsuite/gdb.reverse/until-reverse.c @@ -33,19 +33,20 @@ int factorial(int); int main (int argc, char **argv, char **envp) { - if (argc == 12345) { /* an unlikely value < 2^16, in case uninited */ /* set breakpoint 6 here */ - fprintf (stderr, "usage: factorial <number>\n"); - return 1; + if (argc == 12345) + { + /* We're used by a test that requires malloc, so make sure it is + in the executable. */ + (void) malloc (1); + return 1; } - printf ("%d\n", factorial (atoi ("6"))); /* set breakpoint 1 here */ + + factorial (atoi ("6")); /* set breakpoint 1 here */ /* set breakpoint 12 here */ marker1 (); /* set breakpoint 11 here */ marker2 (43); /* set breakpoint 20 here */ marker3 ("stack", "trace"); /* set breakpoint 21 here */ marker4 (177601976L); - /* We're used by a test that requires malloc, so make sure it is - in the executable. */ - (void)malloc (1); argc = (argc == 12345); /* This is silly, but we can step off of it */ /* set breakpoint 2 here */ return argc; /* set breakpoint 10 here */ diff --git a/gdb/testsuite/gdb.reverse/until-reverse.exp b/gdb/testsuite/gdb.reverse/until-reverse.exp index 07193a82a4d..07870f672b4 100644 --- a/gdb/testsuite/gdb.reverse/until-reverse.exp +++ b/gdb/testsuite/gdb.reverse/until-reverse.exp @@ -64,7 +64,7 @@ gdb_test "until $bp_location19" \ # Finish out to main scope # gdb_test "finish" \ - " in main .*$srcfile:$bp_location1.*" \ + "main .*$srcfile:.*" \ "finish to main" # Advance to a function called by main (marker2) |