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. Stan 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.