aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.reverse/until-reverse.c
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2016-03-30 16:36:51 +0100
committerYao Qi <yao.qi@linaro.org>2016-03-30 16:36:51 +0100
commite6359af3fdda6b9265565ecbd213763244ed8594 (patch)
treef710668a99ae71d113847779ca08d35046f796d8 /gdb/testsuite/gdb.reverse/until-reverse.c
parentc6025a80cc284ae2781278de6f44c672d5077797 (diff)
downloadbinutils-e6359af3fdda6b9265565ecbd213763244ed8594.zip
binutils-e6359af3fdda6b9265565ecbd213763244ed8594.tar.gz
binutils-e6359af3fdda6b9265565ecbd213763244ed8594.tar.bz2
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/until-reverse.c')
-rw-r--r--gdb/testsuite/gdb.reverse/until-reverse.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gdb/testsuite/gdb.reverse/until-reverse.c b/gdb/testsuite/gdb.reverse/until-reverse.c
index 51f949e..d3311b7 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 */