From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14120 invoked by alias); 4 Dec 2009 20:58:48 -0000 Received: (qmail 14109 invoked by uid 22791); 4 Dec 2009 20:58:47 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from ey-out-1920.google.com (HELO ey-out-1920.google.com) (74.125.78.147) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Dec 2009 20:58:42 +0000 Received: by ey-out-1920.google.com with SMTP id 5so705792eyb.42 for ; Fri, 04 Dec 2009 12:58:40 -0800 (PST) Received: by 10.216.86.137 with SMTP id w9mr1262749wee.104.1259960319453; Fri, 04 Dec 2009 12:58:39 -0800 (PST) Received: from ?192.168.2.99? (cpc2-cmbg8-0-0-cust61.cmbg.cable.ntl.com [82.6.108.62]) by mx.google.com with ESMTPS id 28sm9971871eye.3.2009.12.04.12.58.37 (version=SSLv3 cipher=RC4-MD5); Fri, 04 Dec 2009 12:58:38 -0800 (PST) Message-ID: <4B197BC0.5010708@gmail.com> Date: Fri, 04 Dec 2009 20:58:00 -0000 From: Dave Korn User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: gdb@sourceware.org Subject: Software-vs-hardware single-step vs. sim/non-sim targets. Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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/msg00033.txt.bz2 Hi all, I have a GDB port for a custom target, a sim-based simulator, and a gdbstub for use on the real thing. GDB can single step the simulator of course, since the support for simulated hardware-single-step is built in, but I'd like to save bytes in the gdbstub by not implementing support for the "s" command. 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? cheers, DaveK