Message ID | alpine.DEB.1.10.1409162318090.27075@tp.orcam.me.uk |
---|---|
State | Committed |
Headers |
Received: (qmail 4836 invoked by alias); 17 Sep 2014 23:03:21 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 4725 invoked by uid 89); 17 Sep 2014 23:03:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Sep 2014 23:03:18 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1XUOFn-0005gH-26 from Maciej_Rozycki@mentor.com for gdb-patches@sourceware.org; Wed, 17 Sep 2014 16:03:15 -0700 Received: from localhost (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server (TLS) id 14.3.181.6; Thu, 18 Sep 2014 00:03:13 +0100 Date: Thu, 18 Sep 2014 00:03:09 +0100 From: "Maciej W. Rozycki" <macro@codesourcery.com> To: <gdb-patches@sourceware.org> Subject: [PATCH] Also mark ELF solib trampoline minimal symbols special Message-ID: <alpine.DEB.1.10.1409162318090.27075@tp.orcam.me.uk> User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" |
Commit Message
Maciej W. Rozycki
Sept. 17, 2014, 11:03 p.m. UTC
Hi, In installing minimal symbols for ELF shared library trampolines we "forget" to make individual symbols special where required. This leads to problems on the MIPS target using microMIPS SVR4 lazy stubs. Lacking the special annotation these stubs are treated as standard MIPS code and this makes GDB insert the wrong software breakpoint instruction, breaking e.g. single-stepping through these stubs. This is not a very frequent scenario as microMIPS SVR4 lazy stubs are typically only used in shared libraries with the main executable using PLT, handled elsewhere. Still it triggers e.g. when a software watchpoint has been installed. The symptom is SIGILL or the program going astray, depending on the endianness. Disassembly of these stubs is also wrong. Regression-tested with the mips-linux-gnu target and the following multilibs: -EB -EB -msoft-float -EB -mips16 -EB -mips16 -msoft-float -EB -mmicromips -EB -mmicromips -msoft-float -EB -mabi=n32 -EB -mabi=n32 -msoft-float -EB -mabi=64 -EB -mabi=64 -msoft-float and the -EL variants of same with no regressions and the following big-endian failures removed: (gdb) PASS: gdb.base/watchpoint-solib.exp: rerun to main continue Continuing. Program received signal SIGILL, Illegal instruction. 0x2aad36ab in _dl_sym () at dl-sym.c:282 282 { (gdb) FAIL: gdb.base/watchpoint-solib.exp: continue to foo again continue Continuing. Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb) FAIL: gdb.base/watchpoint-solib.exp: continue to watchpoint hit again and similarly for the little endianness: (gdb) PASS: gdb.base/watchpoint-solib.exp: rerun to main continue Continuing. FAIL: gdb.base/watchpoint-solib.exp: continue to foo again (timeout) continue FAIL: gdb.base/watchpoint-solib.exp: continue to watchpoint hit again (timeout) -- across the -mmicromips multilibs. OK to apply? 2014-09-17 Maciej W. Rozycki <macro@codesourcery.com> gdb/ * elfread.c (elf_symtab_read): Also mark solib trampoline minimal symbols special. Maciej gdb-msymbol-solib-trampoline-special.diff
Comments
On Thu, 18 Sep 2014, Maciej W. Rozycki wrote: > In installing minimal symbols for ELF shared library trampolines we > "forget" to make individual symbols special where required. This leads to > problems on the MIPS target using microMIPS SVR4 lazy stubs. Lacking the > special annotation these stubs are treated as standard MIPS code and this > makes GDB insert the wrong software breakpoint instruction, breaking e.g. > single-stepping through these stubs. This is not a very frequent scenario > as microMIPS SVR4 lazy stubs are typically only used in shared libraries > with the main executable using PLT, handled elsewhere. Still it triggers > e.g. when a software watchpoint has been installed. The symptom is SIGILL > or the program going astray, depending on the endianness. Disassembly of > these stubs is also wrong. > > Regression-tested with the mips-linux-gnu target and the following > multilibs: > > -EB > -EB -msoft-float > -EB -mips16 > -EB -mips16 -msoft-float > -EB -mmicromips > -EB -mmicromips -msoft-float > -EB -mabi=n32 > -EB -mabi=n32 -msoft-float > -EB -mabi=64 > -EB -mabi=64 -msoft-float > > and the -EL variants of same with no regressions and the following > big-endian failures removed: > > (gdb) PASS: gdb.base/watchpoint-solib.exp: rerun to main > continue > Continuing. > > Program received signal SIGILL, Illegal instruction. > 0x2aad36ab in _dl_sym () at dl-sym.c:282 > 282 { > (gdb) FAIL: gdb.base/watchpoint-solib.exp: continue to foo again > continue > Continuing. > > Program terminated with signal SIGILL, Illegal instruction. > The program no longer exists. > (gdb) FAIL: gdb.base/watchpoint-solib.exp: continue to watchpoint hit again > > and similarly for the little endianness: > > (gdb) PASS: gdb.base/watchpoint-solib.exp: rerun to main > continue > Continuing. > FAIL: gdb.base/watchpoint-solib.exp: continue to foo again (timeout) > continue > FAIL: gdb.base/watchpoint-solib.exp: continue to watchpoint hit again (timeout) > > -- across the -mmicromips multilibs. > > OK to apply? > > 2014-09-17 Maciej W. Rozycki <macro@codesourcery.com> > > gdb/ > * elfread.c (elf_symtab_read): Also mark solib trampoline minimal > symbols special. Ping! Maciej
Hi, This patch: http://sourceware.org/ml/gdb-patches/2014-09/msg00602.html is still waiting, please review. Thanks, Maciej
On 09/18/2014 12:03 AM, Maciej W. Rozycki wrote:
> OK to apply?
OK.
Thanks,
Pedro Alves
On Fri, 3 Oct 2014, Pedro Alves wrote: > > OK to apply? > > OK. Applied, thanks. Maciej
Index: gdb-fsf-trunk-quilt/gdb/elfread.c =================================================================== --- gdb-fsf-trunk-quilt.orig/gdb/elfread.c 2014-08-23 01:11:20.000000000 +0100 +++ gdb-fsf-trunk-quilt/gdb/elfread.c 2014-09-16 22:56:52.318922758 +0100 @@ -328,7 +328,10 @@ elf_symtab_read (struct objfile *objfile (sym->name, strlen (sym->name), copy_names, symaddr, mst_solib_trampoline, sect, objfile); if (msym != NULL) - msym->filename = filesymname; + { + msym->filename = filesymname; + gdbarch_elf_make_msymbol_special (gdbarch, sym, msym); + } continue; }