From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25801 invoked by alias); 4 Dec 2009 22:08:34 -0000 Received: (qmail 25573 invoked by uid 22791); 4 Dec 2009 22:08:33 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Dec 2009 22:08:28 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 68FD110A34; Fri, 4 Dec 2009 22:08:26 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 4682E10548; Fri, 4 Dec 2009 22:08:26 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1NGgK9-0003qv-3V; Fri, 04 Dec 2009 17:08:25 -0500 Date: Fri, 04 Dec 2009 22:08:00 -0000 From: Daniel Jacobowitz To: Dave Korn Cc: gdb@sourceware.org Subject: Re: Software-vs-hardware single-step vs. sim/non-sim targets. Message-ID: <20091204220825.GA12336@caradoc.them.org> Mail-Followup-To: Dave Korn , gdb@sourceware.org References: <4B197BC0.5010708@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B197BC0.5010708@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2009-12/txt/msg00034.txt.bz2 On Fri, Dec 04, 2009 at 09:14:40PM +0000, Dave Korn wrote: > So is there a way I can get gdb to use (simulated) hardware single stepping > for the simulator target and software single stepping for the remote target? > And dynamically switch when the target changes? Or do I have to compile two > different builds, only one of which sets the software single step method in > the gdbarch? > > I'm trying not to do anything too hacky or break the architectural layering > in GDB, but can I perhaps examine the current_target in my arch init function > and frig the value of the single_step hook in the gdbarch that I either lookup > or allocate before returning it? Does the arch init function always get > called when switching between targets or otherwise altering the layers in the > stratum stack? Answering the last question first, no, it does not necessarily get called. There's no obvious easy solution to this, but the basic problem has been discussed many times. It's gotten more complicated since I last thought about it, too, by the addition of support for software stepping atomic sequences. There are several mixed-up questions: (SSS = software single-step; got tired of typing it.) * Does my architecture code support SSS for anything? * Does my architecture require SSS for the current instruction or instruction sequence? * Does my target support hardware single-step? IMO the remote protocol hook you need is already present: implement vCont, even though it's overkill for an embedded single-threaded processor. Report that you don't support s or S in the vCont? reply. Current GDB will choke. So you have to somehow separate the above questions, so that when we ask the architecture whether to single-step, it knows whether the target needs SSS or not. -- Daniel Jacobowitz CodeSourcery