From: Tom de Vries Date: Tue, 21 Jul 2020 13:27:18 +0000 (+0200) Subject: [gdb/testsuite] Fix step-reverse.c with gcc-10 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=803d0592abc57fe0f9c93ca33e9af6a6f698f23f;p=binutils-gdb.git [gdb/testsuite] Fix step-reverse.c with gcc-10 The file gdb.reverse/step-reverse.c is used in test-cases: - gdb.reverse/step-reverse.exp - gdb.reverse/next-reverse-bkpt-over-sr.exp - gdb.reverse/step-precsave.exp With gcc-7, there are only PASSes (apart from one KFAIL), but with gcc-10, we have the following FAILs: ... FAIL: gdb.reverse/step-reverse.exp: reverse stepi from a function call \ (start statement) FAIL: gdb.reverse/step-reverse.exp: simple reverse stepi FAIL: gdb.reverse/step-reverse.exp: reverse step out of called fn FAIL: gdb.reverse/step-reverse.exp: reverse next over call FAIL: gdb.reverse/step-reverse.exp: reverse step test 1 FAIL: gdb.reverse/step-reverse.exp: reverse next test 1 FAIL: gdb.reverse/step-reverse.exp: reverse step test 2 FAIL: gdb.reverse/step-reverse.exp: reverse next test 2 FAIL: gdb.reverse/step-precsave.exp: reverse stepi from a function call \ (start statement) FAIL: gdb.reverse/step-precsave.exp: simple reverse stepi FAIL: gdb.reverse/step-precsave.exp: reverse step out of called fn FAIL: gdb.reverse/step-precsave.exp: reverse next over call FAIL: gdb.reverse/step-precsave.exp: reverse step test 1 FAIL: gdb.reverse/step-precsave.exp: reverse next test 1 FAIL: gdb.reverse/step-precsave.exp: reverse step test 2 FAIL: gdb.reverse/step-precsave.exp: reverse next test 2 ... Looking at the first step-precsave.exp FAIL, we have: ... (gdb) stepi^M 26 myglob++; return 0; /* ARRIVED IN CALLEE */^M (gdb) PASS: gdb.reverse/step-precsave.exp: reverse stepi thru function return stepi^M 0x000000000040055f 26 myglob++; return 0; /* ARRIVED IN CALLEE */^M (gdb) FAIL: gdb.reverse/step-precsave.exp: reverse stepi from a function call \ (start statement) ... There's a difference in line info for callee: ... 25 int callee() { /* ENTER CALLEE */ 26 myglob++; return 0; /* ARRIVED IN CALLEE */ 27 } /* RETURN FROM CALLEE */ ... between gcc-7: ... Line number Starting address View Stmt 25 0x400557 x 26 0x40055b x 27 0x40056f x ... and gcc-10: ... 25 0x400552 x 26 0x400556 x 26 0x400565 x 27 0x40056a x ... The two "recommend breakpoint location" entries at line 26 are for the two statements ("myglob++" and "return 0"), but the test-case expects to hit line 26 only once. Fix this by rewriting the two statements into a single statement: ... - myglob++; return 0; /* ARRIVED IN CALLEE */ + return myglob++; /* ARRIVED IN CALLEE */ ... Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-07-21 Tom de Vries * gdb.reverse/step-reverse.c (callee): Merge statements. --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index b14544e1ec7..b67ad738518 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-07-21 Tom de Vries + + * gdb.reverse/step-reverse.c (callee): Merge statements. + 2020-07-21 Tom de Vries * gdb.fortran/info-modules.exp (info module variables): Allow missing diff --git a/gdb/testsuite/gdb.reverse/step-reverse.c b/gdb/testsuite/gdb.reverse/step-reverse.c index 40466a63943..4b8fa8251b8 100644 --- a/gdb/testsuite/gdb.reverse/step-reverse.c +++ b/gdb/testsuite/gdb.reverse/step-reverse.c @@ -23,7 +23,7 @@ int myglob = 0; int callee() { /* ENTER CALLEE */ - myglob++; return 0; /* ARRIVED IN CALLEE */ + return myglob++; /* ARRIVED IN CALLEE */ } /* RETURN FROM CALLEE */ /* A structure which, we hope, will need to be passed using memcpy. */