From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13985 invoked by alias); 23 Jul 2012 20:07:48 -0000 Received: (qmail 13882 invoked by uid 22791); 23 Jul 2012 20:07:38 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mailrelay011.isp.belgacom.be (HELO mailrelay011.isp.belgacom.be) (195.238.6.178) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jul 2012 20:07:25 +0000 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuUBAOStDVBR9oD+/2dsb2JhbAANOIVvsA2BQ4VHAQEBBCNWEAsYAgImAgJXBrBzbpJlgSCKLYVBgRIDnnSJQw Received: from 254.128-246-81.adsl-dyn.isp.belgacom.be (HELO [192.168.1.2]) ([81.246.128.254]) by relay.skynet.be with ESMTP; 23 Jul 2012 22:07:23 +0200 Subject: Re: [patch] [i386] Put hlt at the ON_STACK breakpoint [Re: GDB 7.4.91 available for testing] From: Philippe Waroquiers To: Jan Kratochvil Cc: Joel Brobecker , gdb-patches@sourceware.org, Pedro Alves In-Reply-To: <20120723163513.GA1222@host2.jankratochvil.net> References: <20120718163413.GA17548@adacore.com> <1342739016.2220.32.camel@soleil> <20120720071158.GA7053@host2.jankratochvil.net> <1342817409.2149.41.camel@soleil> <20120722173053.GA22036@host2.jankratochvil.net> <1342983655.2301.55.camel@soleil> <20120723072125.GA12958@host2.jankratochvil.net> <20120723155951.GA24718@adacore.com> <20120723163513.GA1222@host2.jankratochvil.net> Content-Type: text/plain; charset="UTF-8" Date: Mon, 23 Jul 2012 20:07:00 -0000 Message-ID: <1343074047.2209.23.camel@soleil> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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-07/txt/msg00471.txt.bz2 On Mon, 2012-07-23 at 18:35 +0200, Jan Kratochvil wrote: > On Mon, 23 Jul 2012 17:59:51 +0200, Joel Brobecker wrote: > > It even seems to me that this should be done on all platforms, no? > > Yes; just looking at the other archs it was not trivial to me so I wanted to > be sure it at least really helps valgrind. Yes, that will help. To avoid the need for the "grow" guess, Valgrind gdbsrv will need both the Z0 packet (so as to have the breakpoint helperc inserted at translation time) and the breakpoint trap instruction (to avoid encountering random instruction when translating the instructions on the stack). Valgrind decoder stops decoding when it encounters the trap instruction. So, writing the trap instruction + Z0 packet is good enough, there is no need for an hlt instruction (but I see no problem of having this hlt instruction). Note that the trap instruction should only be written by the push_dummy_code function : for Normal breakpoints, only a Z0 packet should be done, as Valgrind will not allow to modify the guest executable code (it is not mapped writable). I will currently not commit the "grow guess" patch in Valgrind, waiting to see if the above approach is done in GDB (as this is a lot cleaner that the "grow guess", which is a somewhat fragile heuristic kludge). Thanks for all that, Philippe