From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20858 invoked by alias); 21 Jun 2012 22:17:11 -0000 Received: (qmail 20848 invoked by uid 22791); 21 Jun 2012 22:17:09 -0000 X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_50,FSL_RCVD_USER,KHOP_THREADED,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.157) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jun 2012 22:16:55 +0000 Received: from md13.u-strasbg.fr (md13.u-strasbg.fr [130.79.200.248]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q5LMGkmb088318 ; Fri, 22 Jun 2012 00:16:47 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms14.u-strasbg.fr [130.79.204.114]) by md13.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q5LMGkBY021097 ; Fri, 22 Jun 2012 00:16:46 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (lec67-4-82-230-53-140.fbx.proxad.net [82.230.53.140]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id q5LMGifW024549 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Fri, 22 Jun 2012 00:16:45 +0200 (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: "'GDB Patches'" Cc: "'Maciej W. Rozycki'" , "'Daniel Jacobowitz'" References: <00a501cd495e$db6adea0$92409be0$@muller@ics-cnrs.unistra.fr> In-Reply-To: <00a501cd495e$db6adea0$92409be0$@muller@ics-cnrs.unistra.fr> Subject: PING [RFC] Fix MIPS frame prologue scan problem Date: Thu, 21 Jun 2012 22:17:00 -0000 Message-ID: <002701cd4ffb$8a8ca0b0$9fa5e210$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00674.txt.bz2 I got no reaction to this RFC... Maybe Maciej or Daniel? Pierre Muller > -----Message d'origine----- > De=A0: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Pierre Muller > Envoy=E9=A0: mercredi 13 juin 2012 14:20 > =C0=A0: 'GDB Patches' > Objet=A0: [RFC] Fix MIPS frame prologue scan problem >=20 > I am trying to extend the Free Pascal compiler to support > MIPS architecture. >=20 > From what I read so far, register $s8 (register number 30) can be used as > a frame register, > but when I set $s8 to the value of the stack pointer ($sp, register number > 29) > I get all my locals and parameter of functions wrong. >=20 > I traced it down to the fact that GDB seems to use a > 'virtual' frame pointer register called $fp, > but which is miscalculated in my case. >=20 > In GCC generated code, $s8 register gets the same value as > $sp register, so that this problem does not show up in that case, > but for me, if I have a prologue that reserves 80 bytes, > I will typically get >=20 > # Reserve 80 bytes for locals and area for called function parameters > addi $sp,$sp,-80 > # Save $ra and $s8 registers, there could be others... > sw $ra,44($sp) > sw $s8,40($sp) > # Set $s8 to function entry value of $sp > addi $s8,$sp,80 >=20 > Analysis of first instruction leads to setting of > frame_offset to 80. >=20 > The problem is that when the last instruction > is analyzed by mips32_scan_prologue, > it switches the frame_reg from $sp to $s8, > but does not modify frame_offset value. > This leads to a frame pointer $fp > being computed as $s8 + frame_offset > which is equal to $sp + 2*frame_offset. > Thus all my locals are wrong :( >=20 > Substraction of the constant in the last addi instruction (low_word) > to frame_offset seems to cure my problem. >=20 >=20 > I tried to run a testsuite comparison and > I got a bunch of regression, but I have no idea if those > regression are relevant or a problem of stability of results... > See below if you understand those failures. >=20 >=20 > Comments are most welcome, >=20 >=20 > Pierre Muller >=20 >=20 > 2012-06-11 Pierre Muller >=20 > * mips-tdep.c (mpis32_scan_prologue): Fix value of frame_offset > for ADDIU $s8,$sp,FrameSize. >=20 >=20 > Index: src/gdb/mips-tdep.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvs/src/src/gdb/mips-tdep.c,v > retrieving revision 1.556 > diff -u -p -r1.556 mips-tdep.c > --- src/gdb/mips-tdep.c 6 Jun 2012 21:34:12 -0000 1.556 > +++ src/gdb/mips-tdep.c 10 Jun 2012 23:43:44 -0000 > @@ -3226,6 +3226,7 @@ restart: > (this_frame, gdbarch_num_regs (gdbarch) + 30); >=20 > alloca_adjust =3D (unsigned) (frame_addr - (sp + low_word)); > + frame_offset -=3D low_word; > if (alloca_adjust > 0) > { > /* FP > SP + frame_size. This may be because of >=20 > Regressions with my patch: >=20 > muller@gcc42:~/auto-test-gdb/state/patched/2012_06_13_10_34_41$ cat report > Calling update for "HEAD" > cleanup called > Calling git clean -d -x -f > Calling git reset --hard > cleanup called > Calling git clean -d -x -f > Calling git reset --hard > apply_patch called > cleanup called > Calling git clean -d -x -f > Calling git reset --hard > (cat /home/muller/auto-test-gdb/state/testing/patched/report > with your patch there are 23 regressions. > list of regressions with your patch: > gdb.sum gdb.base/checkpoint.exp: break2 10 one > gdb.sum gdb.base/checkpoint.exp: break2 2 one > gdb.sum gdb.base/checkpoint.exp: break2 3 one > gdb.sum gdb.base/checkpoint.exp: break2 4 one > gdb.sum gdb.base/checkpoint.exp: break2 5 one > gdb.sum gdb.base/checkpoint.exp: break2 6 one > gdb.sum gdb.base/checkpoint.exp: break2 7 one > gdb.sum gdb.base/checkpoint.exp: break2 8 one > gdb.sum gdb.base/checkpoint.exp: break2 9 one > gdb.sum gdb.base/checkpoint.exp: break4 one > gdb.sum gdb.base/checkpoint.exp: delete copy1 > gdb.sum gdb.base/checkpoint.exp: outfile still open 1 > gdb.sum gdb.base/checkpoint.exp: outfile still open 10 > gdb.sum gdb.base/checkpoint.exp: outfile still open 2 > gdb.sum gdb.base/checkpoint.exp: outfile still open 3 > gdb.sum gdb.base/checkpoint.exp: outfile still open 4 > gdb.sum gdb.base/checkpoint.exp: outfile still open 5 > gdb.sum gdb.base/checkpoint.exp: outfile still open 6 > gdb.sum gdb.base/checkpoint.exp: outfile still open 7 > gdb.sum gdb.base/checkpoint.exp: outfile still open 8 > gdb.sum gdb.base/checkpoint.exp: outfile still open 9 > gdb.sum gdb.base/checkpoint.exp: restart 0 one > gdb.sum gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint > after > the second fork > tac) > (cat /home/muller/auto-test-gdb/state/testing/patched/gdb.sum.diff > 1c1 > < Test Run By muller on Wed Jun 13 12:04:38 2012 > --- > > Test Run By muller on Wed Jun 13 10:52:26 2012 > 2759,2760c2759,2760 > < FAIL: gdb.base/checkpoint.exp: breakpoint 1 6 one (timeout) > < FAIL: gdb.base/checkpoint.exp: step in 6 two > --- > > PASS: gdb.base/checkpoint.exp: breakpoint 1 6 one > > FAIL: gdb.base/checkpoint.exp: step in 6 two (timeout) > 2767,2772c2767,2775 > < PASS: gdb.base/checkpoint.exp: restart 0 one > < PASS: gdb.base/checkpoint.exp: break4 one > < PASS: gdb.base/checkpoint.exp: delete copy1 > < PASS: gdb.base/checkpoint.exp: restart 1 three > < PASS: gdb.base/checkpoint.exp: break2 1 one > < PASS: gdb.base/checkpoint.exp: outfile still open 1 > --- > > FAIL: gdb.base/checkpoint.exp: restart 0 one > > FAIL: gdb.base/checkpoint.exp: setting breakpoint at 58 > > FAIL: gdb.base/checkpoint.exp: break4 one > > FAIL: gdb.base/checkpoint.exp: delete copy1 > > ERROR: breakpoints not deleted > > UNRESOLVED: gdb.base/checkpoint.exp: setting breakpoint at 53 (timeout) > > FAIL: gdb.base/checkpoint.exp: restart 1 three (got interactive prompt) > > FAIL: gdb.base/checkpoint.exp: break2 1 one (the program exited) > > FAIL: gdb.base/checkpoint.exp: outfile still open 1 > 2774,2775c2777,2778 > < PASS: gdb.base/checkpoint.exp: break2 2 one > < PASS: gdb.base/checkpoint.exp: outfile still open 2 > --- > > FAIL: gdb.base/checkpoint.exp: break2 2 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 2 > 2777,2778c2780,2781 > < PASS: gdb.base/checkpoint.exp: break2 3 one > < PASS: gdb.base/checkpoint.exp: outfile still open 3 > --- > > FAIL: gdb.base/checkpoint.exp: break2 3 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 3 > 2780,2781c2783,2784 > < PASS: gdb.base/checkpoint.exp: break2 4 one > < PASS: gdb.base/checkpoint.exp: outfile still open 4 > --- > > FAIL: gdb.base/checkpoint.exp: break2 4 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 4 > 2783,2784c2786,2787 > < PASS: gdb.base/checkpoint.exp: break2 5 one > < PASS: gdb.base/checkpoint.exp: outfile still open 5 > --- > > FAIL: gdb.base/checkpoint.exp: break2 5 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 5 > 2786,2787c2789,2790 > < PASS: gdb.base/checkpoint.exp: break2 6 one > < PASS: gdb.base/checkpoint.exp: outfile still open 6 > --- > > FAIL: gdb.base/checkpoint.exp: break2 6 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 6 > 2789,2790c2792,2793 > < PASS: gdb.base/checkpoint.exp: break2 7 one > < PASS: gdb.base/checkpoint.exp: outfile still open 7 > --- > > FAIL: gdb.base/checkpoint.exp: break2 7 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 7 > 2792,2793c2795,2796 > < PASS: gdb.base/checkpoint.exp: break2 8 one > < PASS: gdb.base/checkpoint.exp: outfile still open 8 > --- > > FAIL: gdb.base/checkpoint.exp: break2 8 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 8 > 2795,2796c2798,2799 > < PASS: gdb.base/checkpoint.exp: break2 9 one > < PASS: gdb.base/checkpoint.exp: outfile still open 9 > --- > > FAIL: gdb.base/checkpoint.exp: break2 9 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 9 > 2798,2799c2801,2802 > < PASS: gdb.base/checkpoint.exp: break2 10 one > < PASS: gdb.base/checkpoint.exp: outfile still open 10 > --- > > FAIL: gdb.base/checkpoint.exp: break2 10 one > > FAIL: gdb.base/checkpoint.exp: outfile still open 10 > 5022,5023c5025,5026 > < gdb compile failed, /tmp/ccv7IQuN.s: Assembler messages: > < /tmp/ccv7IQuN.s:7: Error: unrecognized symbol type "gnu_indirect_function" > --- > > gdb compile failed, /tmp/cc3V0Vhb.s: Assembler messages: > > /tmp/cc3V0Vhb.s:7: Error: unrecognized symbol type "gnu_indirect_function" > 8861,8867c8864,8870 > < FAIL: gdb.base/sigaltstack.exp: finish from catch LEAF (the program > exited) > < FAIL: gdb.base/sigaltstack.exp: finish to throw INNER (the program is no > longe > r running) > < FAIL: gdb.base/sigaltstack.exp: finish to catch INNER (the program is no > longe > r running) > < FAIL: gdb.base/sigaltstack.exp: finish from catch INNER (the program is no > lon > ger running) > < FAIL: gdb.base/sigaltstack.exp: finish to OUTER (the program is no longer > runn > ing) > < FAIL: gdb.base/sigaltstack.exp: finish to catch MAIN (the program is no > longer > running) > < FAIL: gdb.base/sigaltstack.exp: finish to MAIN (the program is no longer > runni > ng) > --- > > PASS: gdb.base/sigaltstack.exp: finish from catch LEAF > > PASS: gdb.base/sigaltstack.exp: finish to throw INNER > > PASS: gdb.base/sigaltstack.exp: finish to catch INNER > > PASS: gdb.base/sigaltstack.exp: finish from catch INNER > > PASS: gdb.base/sigaltstack.exp: finish to OUTER > > PASS: gdb.base/sigaltstack.exp: finish to catch MAIN > > PASS: gdb.base/sigaltstack.exp: finish to MAIN > 15571c15574 > < FAIL: gdb.java/jprint.exp: unambiguous static call > --- > > FAIL: gdb.java/jprint.exp: unambiguous static call (the program exited) > 19245,19249c19248,19252 > < FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: hardware > breakpo > ints work (timeout) > < FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoints > work >=20 > < FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint > after > the first fork > < FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint > after > the first fork (timeout) > < PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint > after > the second fork > --- > > PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: hardware > breakpo > ints work > > PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoints > work >=20 > > FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint > after > the first fork (timeout) > > FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint > after > the first fork > > FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint > after > the second fork > 19265c19268 > < FAIL: gdb.threads/watchpoint-fork.exp: child: multithreaded: watchpoint A > afte > r the second fork (timeout) > --- > > FAIL: gdb.threads/watchpoint-fork.exp: child: multithreaded: watchpoint A > afte > r the second fork > 19267c19270 > < FAIL: gdb.threads/watchpoint-fork.exp: child: multithreaded: finish > --- > > FAIL: gdb.threads/watchpoint-fork.exp: child: multithreaded: finish > (timeout) > 19564,19565c19567,19568 > < # of expected passes 17184 > < # of unexpected failures 1033 > --- > > # of expected passes 17169 > > # of unexpected failures 1049 > 19570c19573 > < # of unresolved testcases 32 > --- > > # of unresolved testcases 33 > tac) > FAILs with patched version in failed > FAILs with pristine version in pristine-failed > The files used for the validation of your patch are stored in > /home/muller/auto- > test-gdb/state/patched/2012_06_13_10_34_41 on the tester machine.