From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2081 invoked by alias); 20 Apr 2002 17:04:23 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2074 invoked from network); 20 Apr 2002 17:04:21 -0000 Received: from unknown (HELO nevyn.them.org) (128.2.145.6) by sources.redhat.com with SMTP; 20 Apr 2002 17:04:21 -0000 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 16yyI9-00059W-00 for ; Sat, 20 Apr 2002 13:04:53 -0400 Date: Sat, 20 Apr 2002 10:04:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: Re: PATCH: breakpoints for gdbserver Message-ID: <20020420130453.A19720@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20020416013218.A1180@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020416013218.A1180@nevyn.them.org> User-Agent: Mutt/1.3.23i X-SW-Source: 2002-04/txt/msg00682.txt.bz2 On Tue, Apr 16, 2002 at 01:32:18AM -0400, Daniel Jacobowitz wrote: > This gives gdbserver a framework for memory-shadowing breakpoints, invisible > to GDB. They won't behave gracefully if GDB tries to single-step over them > or if the user puts breakpoints at the same places; I intend to control all > the cases where gdbserver might insert them with command line options, so > that if (say) you want to debug LinuxThreads, you can turn off gdbserver > thread support. That's the only way to get reasonable results, IMHO. > > There's a little bit of ugliness here, in that some targets do not support > PTRACE_SINGLESTEP. If gdbserver does not know how to single-step a target, > the backend for that target should supply a function to find a safe > instruction that we know will be reached, to place a temporary breakpoint > on. It can be the next instruction, or it can be the function return > address, since the only places these breakpoints will be used (so far, at > least) are on empty marker functions in the dynamic linker or in > LinuxThreads or in some similar event-based debugging technique. Hurdles > will be dealt with as they arise; I don't want to over-complicate this. > Both single-step and resume breakpoint methods have been tested. > > The only target to actually support breakpoints right now is i386-*-linux-gnu. > I'll go through and add breakpoints for all the other gdbserver targets at a > not-too-future date. > > I'll commit this in a day or so unless someone sees a problem with it. Next > on my list is a per-inferior register cache, and then I'll knuckle down to > the core of an actual threads package. No documentation is needed with this > patch, although when I have a little time I may write a small gdbserver > internals document... on the off chance someone actually wants to resurrect > this on a target I don't have, and all... Committed. > 2002-04-16 Daniel Jacobowitz > > * gdbserver/mem-break.c: New file. > * gdbserver/mem-break.h: New file. > * gdbserver/Makefile.in: Add mem-break.o rule; update server.h > dependencies. > * gdbserver/inferiors.c (struct inferior_info): Add target_data > member. > (clear_inferiors): Free target_data member if set. > (inferior_target_data, set_inferior_target_data): New functions. > * gdbserver/linux-i386-low.c (i386_breakpoint, i386_breakpoint_len) > (i386_stop_pc, i386_set_pc): New. Add to the_low_target. > * gdbserver/linux-low.c (linux_bp_reinsert): New variable. > (struct inferior_linux_data): New. > (linux_create_inferior): Use set_inferior_target_data. > (linux_attach): Likewise. Call add_inferior. > (linux_wait_for_one_inferior): New function. > (linux_wait): Call it. > (linux_write_memory): Add const. > (initialize_low): Call set_breakpoint_data. > * gdbserver/linux-low.h (struct linux_target_ops): Add breakpoint > handling members. > * gdbserver/server.c (attach_inferior): Remove extra add_inferior > call. > * gdbserver/server.h: Include mem-break.h. Update inferior.c > prototypes. > * gdbserver/target.c (read_inferior_memory) > (write_inferior_memory): New functions. > * gdbserver/target.h (read_inferior_memory) > (write_inferior_memory): Change macros to prototypes. > (struct target_ops): Update comments. Add const to write_memory > definition. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer