From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30728 invoked by alias); 22 Jul 2012 17:31:46 -0000 Received: (qmail 30719 invoked by uid 22791); 22 Jul 2012 17:31:45 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,SPF_HELO_PASS,TW_XC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 22 Jul 2012 17:31:29 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6MHV3fg017578 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 22 Jul 2012 13:31:03 -0400 Received: from host2.jankratochvil.net (ovpn-116-30.ams2.redhat.com [10.36.116.30]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6MHUwvi005308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 22 Jul 2012 13:31:01 -0400 Date: Sun, 22 Jul 2012 17:31:00 -0000 From: Jan Kratochvil To: Philippe Waroquiers Cc: Joel Brobecker , gdb@sourceware.org, Pedro Alves Subject: Re: GDB 7.4.91 available for testing Message-ID: <20120722173053.GA22036@host2.jankratochvil.net> References: <20120718163413.GA17548@adacore.com> <1342739016.2220.32.camel@soleil> <20120720071158.GA7053@host2.jankratochvil.net> <1342817409.2149.41.camel@soleil> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1342817409.2149.41.camel@soleil> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00069.txt.bz2 On Fri, 20 Jul 2012 22:50:09 +0200, Philippe Waroquiers wrote: > Note that I am wondering how this ON_STACK technique works. > E.g. on gcc20, readelf -a indicates the GNU_STACK is RW, but not E or X > or similar. Then it may be for example SIGSEGV instead of SIGTRAP but GDB recognizes any such trap on breakpoint address as a breakpoint hit. > The tricky part will be to guess that a breakpoint is for the > 'return address for an inferior call', as Valgrind is not expected > (or allowed) to modify the code sections of the guest client being > executed. As Z0 should insert the 0xcc instruction this issue of never-modified inferior memory needs to be resolved anyway: (gdb) monitor help general valgrind monitor commands: [...] (gdb) maintenance info breakpoints Num Type Disp Enb Address What -1 shlib events keep n 0x0000000004003702 inf 1 -2 shlib events keep y 0x0000000004003f92 inf 1 [...] (gdb) set debug remote 1 (gdb) stepi Sending packet: $Z0,4003f92,1#ab...Packet received: OK Packet Z0 (software-breakpoint) is supported [...] (gdb) show remote Z-packet Support for the `Z0' packet is auto-detected, currently enabled. Maybe it would be enough to treat Z0 packets like Z1 (hardware-breakpoint) packets? The valgrind simulator should be able to trap on specified addresses, shouldn't it? I am not aware how make GDB to automatically use Z1 packets but I do not have an idea why it would hurt if Z0 packets behave like Z1 ones. Just report (on x86*) PC+1 for SIGTRAP during the breakpoint hit. > For this guess, I am thinking to use the following conditions: > 1. the stack pointer in the register cache has been changed > to grow the stack > and > 2. the breakpoint address is in this "grown zone" With current default 'set breakpoint always-inserted auto' (acting like 'off') GDB continually removes and re-inserts all the breakpoints. The "grow" check will not work on breakpoint re-insertions. Thanks, Jan