From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46360 invoked by alias); 26 Oct 2016 14:28:12 -0000 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 Received: (qmail 46349 invoked by uid 89); 26 Oct 2016 14:28:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Cohen, cohen, Hx-languages-length:1732, Details X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 26 Oct 2016 14:28:10 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A1B1FA8C6; Wed, 26 Oct 2016 14:28:09 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9QES8mS025532; Wed, 26 Oct 2016 10:28:08 -0400 Subject: Re: False positive permanent breakpoints To: Ofir Cohen , "gdb@sourceware.org" References: From: Pedro Alves Message-ID: <651566f6-e57a-f816-8012-4080d7bc865c@redhat.com> Date: Wed, 26 Oct 2016 14:28:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00048.txt.bz2 On 10/26/2016 03:04 PM, Ofir Cohen wrote: > Hello, > We have debugging support for code running on the iGPU, and we've encountered > something that looks like a limitation of gdb. What's "the iGPU" ? An integrated GPU? > Problem: gdb freaks out on the iGPU when trying to step over/continue when > stopped on a permanent breakpoint. > > Root-cause: gdb *falsely* identifies some instructions as permanent breakpoints. > > > Details > ====== > We don't call set_gdbarch_skip_permanent_breakpoint() on our target, so there > is no support for stepping over permanent breakpoints. Which is fine > since software breakpoints is not something that we support at the > moment. > > While trying to fix the root-cause, > i.e. let gdb determine that instruction is indeed a breakpoint instruction, > I ran into a wall. > > Looks like gdb is being too *coarse* for the check (whether it is a > breakpoint instruction): > if (err || memcmp (buf, bp_opcode (bp), bp_size (bp)) != 0) > > in validate_inserted_breakpoint() function. So this is in gdbserver, not gdb. > > I'm saying coarse here because on the iGPU the breakpoint thingy is mandated > by a single bit, and does not have a unique *opcode*. > Proposed solution > ============== > Could we abstract (delegate away) this predicate to the _target_ ? All can be done, it's just software. :-) But not if no port in the tree is using it... Otherwise it'll just look like unnecessary complication and will likely be "cleaned up" again Are you planning on contributing your port upstream? I'm a bit confused since you said you don't support software breakpoints... > Perhaps setting a default handler for other targets. Thanks, Pedro Alves