From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4394 invoked by alias); 4 Aug 2017 13:17:45 -0000 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 Received: (qmail 4139 invoked by uid 89); 4 Aug 2017 13:17:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 04 Aug 2017 13:17:42 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v74DHasB017827 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 4 Aug 2017 09:17:41 -0400 Received: by simark.ca (Postfix, from userid 112) id 5F41E1EA09; Fri, 4 Aug 2017 09:17:36 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 3555C1E5AF; Fri, 4 Aug 2017 09:17:35 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 04 Aug 2017 13:17:00 -0000 From: Simon Marchi To: "Maciej W. Rozycki" Cc: gdb-patches@sourceware.org, Yao Qi , Joel Brobecker Subject: Re: [PATCH] mem-break: Fix breakpoint insertion location In-Reply-To: References: Message-ID: <172ea7a987fae99d7438bee77a704c76@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 4 Aug 2017 13:17:36 +0000 X-IsSubscribed: yes X-SW-Source: 2017-08/txt/msg00070.txt.bz2 On 2017-08-01 18:36, Maciej W. Rozycki wrote: > Fix a commit cd6c3b4ffc4e ("New gdbarch methods breakpoint_kind_from_pc > and sw_breakpoint_from_kind") regression and restore the use of > ->placed_size rather than ->reqstd_address as the location for a memory > breakpoint to be inserted at. Previously `gdbarch_breakpoint_from_pc' > was used that made that adjustment in > `default_memory_insert_breakpoint' > from the preinitialized value, however with the said commit that call > is > gone, so the passed ->placed_size has to be used for the > initialization. > > The regression manifests itself as the inability to debug any > MIPS/Linux > compressed ISA dynamic executable as GDB corrupts the dynamic loader > with one of its implicit breakpoints, causing the program to crash, as > seen for example with the `mips-linux-gnu' target, o32 ABI, MIPS16 > code, > and the gdb.base/advance.exp test case: > > (gdb) continue > Continuing. > > Program received signal SIGBUS, Bus error. > _dl_debug_initialize (ldbase=0, ns=0) at dl-debug.c:51 > 51 r = &_r_debug; > (gdb) FAIL: gdb.base/advance.exp: Can't run to main > > gdb/ > * mem-break.c (default_memory_insert_breakpoint): Use > `->placed_address' rather than `->reqstd_address' for the > breakpoint location. > --- > Hi, > > No regressions between plain commit cd6c3b4ffc4e^ and commit > cd6c3b4ffc4e > with this change applied in `mips-linux-gnu', o32, MIPS16 testing. > This > brings that configuration back to sanity. > > OK for master and (as a grave regression) for 8.0? > > Maciej > > --- > gdb/mem-break.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > gdb-mem-break-placed-address.diff > Index: binutils/gdb/mem-break.c > =================================================================== > --- binutils.orig/gdb/mem-break.c 2017-07-30 22:45:34.000000000 +0100 > +++ binutils/gdb/mem-break.c 2017-07-30 23:41:28.595612206 +0100 > @@ -37,7 +37,7 @@ int > default_memory_insert_breakpoint (struct gdbarch *gdbarch, > struct bp_target_info *bp_tgt) > { > - CORE_ADDR addr = bp_tgt->reqstd_address; > + CORE_ADDR addr = bp_tgt->placed_address; > const unsigned char *bp; > gdb_byte *readbuf; > int bplen; IIUC, we end up writing the good breakpoint kind, but at the wrong address? For example, if the requested address is 0x1001, it means that there should be a micro/compressed MIPS breakpoint at address 0x1000, but that bug caused the breakpoint to be written at address 0x1001 instead. Is that right? If so, I think the patch makes sense, I think Yao should have the final say. Thanks, Simon