From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 528 invoked by alias); 29 Apr 2010 18:12:55 -0000 Received: (qmail 518 invoked by uid 22791); 29 Apr 2010 18:12:55 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 29 Apr 2010 18:12:48 +0000 Received: from jupiter.vmware.com (mailhost5.vmware.com [10.16.68.131]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 8EA3122039; Thu, 29 Apr 2010 11:12:45 -0700 (PDT) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by jupiter.vmware.com (Postfix) with ESMTP id 84C62DC0DD; Thu, 29 Apr 2010 11:12:45 -0700 (PDT) Message-ID: <4BD9CC1D.9040104@vmware.com> Date: Thu, 29 Apr 2010 18:12:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.22 (X11/20090609) MIME-Version: 1.0 To: Stan Shebs CC: "gdb-patches@sourceware.org" Subject: Re: [RFC] Observer mode References: <4BD9C057.9090805@codesourcery.com> In-Reply-To: <4BD9C057.9090805@codesourcery.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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: 2010-04/txt/msg00963.txt.bz2 Stan Shebs wrote: > Here is another patch that pushes the envelope a bit, and for which I > would like to get some prior agreement that it's a good idea. > > The basic idea here is that GDB is to be used to look at targets > installed in the field and in use. In such a situation it may connect > to the target and examine state, but not alter that state or interrupt > anything. In our particular target, tracing is allowed, but only using > fast tracepoints, because they are done using jumps and thus act as if > they were part of the program; taking a trap, even for a slow > tracepoint, disrupts thread execution unacceptably. We have been > calling this "observer mode", and the customer's GDB is actually > configured to launch in this mode, to reduce the chance of accidental > stopping - the debugger user has to ask specifically to change it to > normal debugging mode. > > The patch for this is conceptually straightforward, merely introducing a > set of user-settable variables, such as may-write-memory, which gate all > user attempts to write memory, being tested at the target vector level. > Later patches in the series add a "set observer" variable which > set/clears all of the individual permissions together, and also ensure > that non-stop mode is on. > > Although enabling/disabling at the target vector is somewhat brute > force, it seems to work reasonably well in practice; GDB doesn't get > knotted into weird states, and the error messages from failed > modification attempts (direct or indirect) are reasonable. > > If people like this idea, I'll update the old patch and resubmit. How different is this from async mode? > 2009-05-19 Stan Shebs > > * target.h (target_insert_breakpoint): Change macro to function. > (target_remove_breakpoint): Ditto. > (target_stop): Ditto. > * target.c (may_write_registers): New global. > (may_write_memory): New global. > (may_insert_breakpoints): New global. > (may_insert_tracepoints): New global. > (may_insert_fast_tracepoints): New global. > (may_stop): New global. > (target_xfer_partial): Test for write permission. > (target_store_registers): Ditto. > (target_insert_breakpoint): New function. > (target_remove_breakpoint): New function. > (target_stop): New function. > (_initialize_targets): Add new set/show variables. > * tracepoint.c (download_target): Check permission, > return a success/fail result. > (trace_start_command): Don't start tracing if no > tracepoints were downloaded. > > gdb/doc/ > * gdb.texinfo (Observation Mode): New section. >