From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18728 invoked by alias); 1 Feb 2010 16:09:42 -0000 Received: (qmail 18492 invoked by uid 22791); 1 Feb 2010 16:09:37 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,HK_OBFDOM,HK_OBFDOMREQ,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 01 Feb 2010 16:09:32 +0000 Received: (qmail 28529 invoked from network); 1 Feb 2010 16:09:29 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 1 Feb 2010 16:09:29 -0000 Date: Mon, 01 Feb 2010 16:09:00 -0000 From: Daniel Jacobowitz To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [RFA/doc] Redefine the length argument in remote Z packets Message-ID: <20100201160903.GA21339@caradoc.them.org> Mail-Followup-To: Eli Zaretskii , gdb-patches@sourceware.org References: <20100128222940.GE2813@caradoc.them.org> <831vh9thfo.fsf@gnu.org> <20100129153021.GA30542@caradoc.them.org> <83bpgcskcc.fsf@gnu.org> <20100129210525.GD4757@caradoc.them.org> <833a1osi46.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <833a1osi46.fsf@gnu.org> User-Agent: Mutt/1.5.20 (2009-06-14) 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-02/txt/msg00013.txt.bz2 On Fri, Jan 29, 2010 at 11:42:33PM +0200, Eli Zaretskii wrote: > Yep, that's good. Thanks for the help. Here is what I've committed. -- Daniel Jacobowitz CodeSourcery 2010-02-01 Daniel Jacobowitz gdb/ * arch-utils.c (default_remote_breakpoint_from_pc): New function. * arch-utils.h (default_remote_breakpoint_from_pc): Declare. * gdbarch.c, gdbarch.h: Regenerated. * gdbarch.sh (remote_breakpoint_from_pc): New architecture method. * remote.c (remote_insert_breakpoint, remote_insert_hw_breakpoint): Use gdbarch_remote_breakpoint_from_pc. gdb/doc/ * gdb.texinfo (Architecture-Specific Protocol Details): New section. Document ARM breakpoint types. (Register Packet Format): Move into the new section. (Packets): Describe the KIND argument for Z0, z0, Z1, and z1 packets. Index: arch-utils.c =================================================================== RCS file: /cvs/src/src/gdb/arch-utils.c,v retrieving revision 1.186 diff -u -p -r1.186 arch-utils.c --- arch-utils.c 6 Jan 2010 04:20:26 -0000 1.186 +++ arch-utils.c 1 Feb 2010 16:06:57 -0000 @@ -776,6 +776,13 @@ default_fast_tracepoint_valid_at (struct return 1; } +void +default_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, + int *kindptr) +{ + gdbarch_breakpoint_from_pc (gdbarch, pcptr, kindptr); +} + /* */ extern initialize_file_ftype _initialize_gdbarch_utils; /* -Wmissing-prototypes */ Index: arch-utils.h =================================================================== RCS file: /cvs/src/src/gdb/arch-utils.h,v retrieving revision 1.108 diff -u -p -r1.108 arch-utils.h --- arch-utils.h 6 Jan 2010 04:20:26 -0000 1.108 +++ arch-utils.h 1 Feb 2010 16:06:57 -0000 @@ -159,4 +159,7 @@ extern int default_fast_tracepoint_valid CORE_ADDR addr, int *isize, char **msg); +extern void default_remote_breakpoint_from_pc (struct gdbarch *, + CORE_ADDR *pcptr, int *kindptr); + #endif Index: gdbarch.c =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.c,v retrieving revision 1.458 diff -u -p -r1.458 gdbarch.c --- gdbarch.c 6 Jan 2010 04:20:26 -0000 1.458 +++ gdbarch.c 1 Feb 2010 16:06:57 -0000 @@ -188,6 +188,7 @@ struct gdbarch gdbarch_skip_main_prologue_ftype *skip_main_prologue; gdbarch_inner_than_ftype *inner_than; gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc; + gdbarch_remote_breakpoint_from_pc_ftype *remote_breakpoint_from_pc; gdbarch_adjust_breakpoint_address_ftype *adjust_breakpoint_address; gdbarch_memory_insert_breakpoint_ftype *memory_insert_breakpoint; gdbarch_memory_remove_breakpoint_ftype *memory_remove_breakpoint; @@ -330,6 +331,7 @@ struct gdbarch startup_gdbarch = 0, /* skip_main_prologue */ 0, /* inner_than */ 0, /* breakpoint_from_pc */ + default_remote_breakpoint_from_pc, /* remote_breakpoint_from_pc */ 0, /* adjust_breakpoint_address */ default_memory_insert_breakpoint, /* memory_insert_breakpoint */ default_memory_remove_breakpoint, /* memory_remove_breakpoint */ @@ -456,6 +458,7 @@ gdbarch_alloc (const struct gdbarch_info gdbarch->value_from_register = default_value_from_register; gdbarch->pointer_to_address = unsigned_pointer_to_address; gdbarch->address_to_pointer = unsigned_address_to_pointer; + gdbarch->remote_breakpoint_from_pc = default_remote_breakpoint_from_pc; gdbarch->memory_insert_breakpoint = default_memory_insert_breakpoint; gdbarch->memory_remove_breakpoint = default_memory_remove_breakpoint; gdbarch->remote_register_number = default_remote_register_number; @@ -593,6 +596,8 @@ verify_gdbarch (struct gdbarch *gdbarch) fprintf_unfiltered (log, "\n\tinner_than"); if (gdbarch->breakpoint_from_pc == 0) fprintf_unfiltered (log, "\n\tbreakpoint_from_pc"); + if (gdbarch->remote_breakpoint_from_pc == default_remote_breakpoint_from_pc) + fprintf_unfiltered (log, "\n\tremote_breakpoint_from_pc"); /* Skip verify of adjust_breakpoint_address, has predicate */ /* Skip verify of memory_insert_breakpoint, invalid_p == 0 */ /* Skip verify of memory_remove_breakpoint, invalid_p == 0 */ @@ -1067,6 +1072,9 @@ gdbarch_dump (struct gdbarch *gdbarch, s "gdbarch_dump: regset_from_core_section = <%s>\n", host_address_to_string (gdbarch->regset_from_core_section)); fprintf_unfiltered (file, + "gdbarch_dump: remote_breakpoint_from_pc = <%s>\n", + host_address_to_string (gdbarch->remote_breakpoint_from_pc)); + fprintf_unfiltered (file, "gdbarch_dump: remote_register_number = <%s>\n", host_address_to_string (gdbarch->remote_register_number)); fprintf_unfiltered (file, @@ -2284,6 +2292,23 @@ set_gdbarch_breakpoint_from_pc (struct g gdbarch->breakpoint_from_pc = breakpoint_from_pc; } +void +gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *kindptr) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->remote_breakpoint_from_pc != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_remote_breakpoint_from_pc called\n"); + gdbarch->remote_breakpoint_from_pc (gdbarch, pcptr, kindptr); +} + +void +set_gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch, + gdbarch_remote_breakpoint_from_pc_ftype remote_breakpoint_from_pc) +{ + gdbarch->remote_breakpoint_from_pc = remote_breakpoint_from_pc; +} + int gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch) { Index: gdbarch.h =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.h,v retrieving revision 1.408 diff -u -p -r1.408 gdbarch.h --- gdbarch.h 6 Jan 2010 04:20:26 -0000 1.408 +++ gdbarch.h 1 Feb 2010 16:06:58 -0000 @@ -407,6 +407,14 @@ typedef const gdb_byte * (gdbarch_breakp extern const gdb_byte * gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr); extern void set_gdbarch_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype *breakpoint_from_pc); +/* Return the adjusted address and kind to use for Z0/Z1 packets. + KIND is usually the memory length of the breakpoint, but may have a + different target-specific meaning. */ + +typedef void (gdbarch_remote_breakpoint_from_pc_ftype) (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *kindptr); +extern void gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *kindptr); +extern void set_gdbarch_remote_breakpoint_from_pc (struct gdbarch *gdbarch, gdbarch_remote_breakpoint_from_pc_ftype *remote_breakpoint_from_pc); + extern int gdbarch_adjust_breakpoint_address_p (struct gdbarch *gdbarch); typedef CORE_ADDR (gdbarch_adjust_breakpoint_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR bpaddr); Index: gdbarch.sh =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.sh,v retrieving revision 1.502 diff -u -p -r1.502 gdbarch.sh --- gdbarch.sh 6 Jan 2010 04:20:26 -0000 1.502 +++ gdbarch.sh 1 Feb 2010 16:06:58 -0000 @@ -486,6 +486,10 @@ m:CORE_ADDR:skip_prologue:CORE_ADDR ip:i M:CORE_ADDR:skip_main_prologue:CORE_ADDR ip:ip f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0 m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0: +# Return the adjusted address and kind to use for Z0/Z1 packets. +# KIND is usually the memory length of the breakpoint, but may have a +# different target-specific meaning. +m:void:remote_breakpoint_from_pc:CORE_ADDR *pcptr, int *kindptr:pcptr, kindptr::default_remote_breakpoint_from_pc: M:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr m:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0 m:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0 Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.381 diff -u -p -r1.381 remote.c --- remote.c 15 Jan 2010 22:37:17 -0000 1.381 +++ remote.c 1 Feb 2010 16:06:59 -0000 @@ -7245,7 +7245,7 @@ remote_insert_breakpoint (struct gdbarch char *p; int bpsize; - gdbarch_breakpoint_from_pc (gdbarch, &addr, &bpsize); + gdbarch_remote_breakpoint_from_pc (gdbarch, &addr, &bpsize); rs = get_remote_state (); p = rs->buf; @@ -7447,7 +7447,7 @@ remote_insert_hw_breakpoint (struct gdba /* The length field should be set to the size of a breakpoint instruction, even though we aren't inserting one ourselves. */ - gdbarch_breakpoint_from_pc + gdbarch_remote_breakpoint_from_pc (gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.662 diff -u -p -r1.662 gdb.texinfo --- doc/gdb.texinfo 21 Jan 2010 04:34:51 -0000 1.662 +++ doc/gdb.texinfo 1 Feb 2010 16:07:04 -0000 @@ -28422,7 +28422,7 @@ Show the current setting of the target w * Packets:: * Stop Reply Packets:: * General Query Packets:: -* Register Packet Format:: +* Architecture-Specific Protocol Details:: * Tracepoint Packets:: * Host I/O Packets:: * Interrupts:: @@ -29169,14 +29169,13 @@ for success for an error @end table -@item z @var{type},@var{addr},@var{length} -@itemx Z @var{type},@var{addr},@var{length} +@item z @var{type},@var{addr},@var{kind} +@itemx Z @var{type},@var{addr},@var{kind} @anchor{insert breakpoint or watchpoint packet} @cindex @samp{z} packet @cindex @samp{Z} packets Insert (@samp{Z}) or remove (@samp{z}) a @var{type} breakpoint or -watchpoint starting at address @var{address} and covering the next -@var{length} bytes. +watchpoint starting at address @var{address} of kind @var{kind}. Each breakpoint and watchpoint packet @var{type} is documented separately. @@ -29188,18 +29187,20 @@ remote target shall support either both avoid potential problems with duplicate packets, the operations should be implemented in an idempotent way.} -@item z0,@var{addr},@var{length} -@itemx Z0,@var{addr},@var{length} +@item z0,@var{addr},@var{kind} +@itemx Z0,@var{addr},@var{kind} @cindex @samp{z0} packet @cindex @samp{Z0} packet Insert (@samp{Z0}) or remove (@samp{z0}) a memory breakpoint at address -@var{addr} of size @var{length}. +@var{addr} of type @var{kind}. A memory breakpoint is implemented by replacing the instruction at @var{addr} with a software breakpoint or trap instruction. The -@var{length} is used by targets that indicates the size of the -breakpoint (in bytes) that should be inserted (e.g., the @sc{arm} and -@sc{mips} can insert either a 2 or 4 byte breakpoint). +@var{kind} is target-specific and typically indicates the size of +the breakpoint in bytes that should be inserted. E.g., the @sc{arm} +and @sc{mips} can insert either a 2 or 4 byte breakpoint. Some +architectures have additional meanings for @var{kind}; +see @ref{Architecture-Specific Protocol Details}. @emph{Implementation note: It is possible for a target to copy or move code that contains memory breakpoints (e.g., when implementing @@ -29216,15 +29217,16 @@ not supported for an error @end table -@item z1,@var{addr},@var{length} -@itemx Z1,@var{addr},@var{length} +@item z1,@var{addr},@var{kind} +@itemx Z1,@var{addr},@var{kind} @cindex @samp{z1} packet @cindex @samp{Z1} packet Insert (@samp{Z1}) or remove (@samp{z1}) a hardware breakpoint at -address @var{addr} of size @var{length}. +address @var{addr}. A hardware breakpoint is implemented using a mechanism that is not -dependant on being able to modify the target's memory. +dependant on being able to modify the target's memory. @var{kind} +has the same meaning as in @samp{Z0} packets. @emph{Implementation note: A hardware breakpoint is not affected by code movement.} @@ -29239,11 +29241,12 @@ not supported for an error @end table -@item z2,@var{addr},@var{length} -@itemx Z2,@var{addr},@var{length} +@item z2,@var{addr},@var{kind} +@itemx Z2,@var{addr},@var{kind} @cindex @samp{z2} packet @cindex @samp{Z2} packet -Insert (@samp{Z2}) or remove (@samp{z2}) a write watchpoint. +Insert (@samp{Z2}) or remove (@samp{z2}) a write watchpoint at @var{addr}. +@var{kind} is interpreted as the number of bytes to watch. Reply: @table @samp @@ -29255,11 +29258,12 @@ not supported for an error @end table -@item z3,@var{addr},@var{length} -@itemx Z3,@var{addr},@var{length} +@item z3,@var{addr},@var{kind} +@itemx Z3,@var{addr},@var{kind} @cindex @samp{z3} packet @cindex @samp{Z3} packet -Insert (@samp{Z3}) or remove (@samp{z3}) a read watchpoint. +Insert (@samp{Z3}) or remove (@samp{z3}) a read watchpoint at @var{addr}. +@var{kind} is interpreted as the number of bytes to watch. Reply: @table @samp @@ -29271,11 +29275,12 @@ not supported for an error @end table -@item z4,@var{addr},@var{length} -@itemx Z4,@var{addr},@var{length} +@item z4,@var{addr},@var{kind} +@itemx Z4,@var{addr},@var{kind} @cindex @samp{z4} packet @cindex @samp{Z4} packet -Insert (@samp{Z4}) or remove (@samp{z4}) an access watchpoint. +Insert (@samp{Z4}) or remove (@samp{z4}) an access watchpoint at @var{addr}. +@var{kind} is interpreted as the number of bytes to watch. Reply: @table @samp @@ -30338,8 +30343,35 @@ A badly formed request or an error was e @end table -@node Register Packet Format -@section Register Packet Format +@node Architecture-Specific Protocol Details +@section Architecture-Specific Protocol Details + +This section describes how the remote protocol is applied to specific +target architectures. Also see @ref{Standard Target Features}, for +details of XML target descriptions for each architecture. + +@subsection ARM + +@subsubsection Breakpoint Kinds + +These breakpoint kinds are defined for the @samp{Z0} and @samp{Z1} packets. + +@table @r + +@item 2 +16-bit Thumb mode breakpoint. + +@item 3 +32-bit Thumb mode (Thumb-2) breakpoint. + +@item 4 +32-bit ARM mode breakpoint. + +@end table + +@subsection MIPS + +@subsubsection Register Packet Format The following @code{g}/@code{G} packets have previously been defined. In the below, some thirty-two bit registers are transferred as