From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28872 invoked by alias); 1 Oct 2009 03:48:52 -0000 Received: (qmail 28859 invoked by uid 22791); 1 Oct 2009 03:48:51 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,MIME_QP_LONG_LINE,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-fx0-f225.google.com (HELO mail-fx0-f225.google.com) (209.85.220.225) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Oct 2009 03:48:47 +0000 Received: by fxm25 with SMTP id 25so4447699fxm.0 for ; Wed, 30 Sep 2009 20:48:44 -0700 (PDT) Received: by 10.86.249.30 with SMTP id w30mr714212fgh.35.1254368924704; Wed, 30 Sep 2009 20:48:44 -0700 (PDT) Received: from xpjpn (pool-71-111-147-240.ptldor.dsl-w.verizon.net [71.111.147.240]) by mx.google.com with ESMTPS id d6sm530320fga.11.2009.09.30.20.48.39 (version=SSLv3 cipher=RC4-MD5); Wed, 30 Sep 2009 20:48:42 -0700 (PDT) From: Caz Yokoyama To: "'Joel Brobecker'" , "'Eli Zaretskii'" Cc: , References: <535d47e30909260627n662135a1hf6d1a0bb33368b3a@mail.gmail.com> <20090929015830.GJ9003@adacore.com> <1724490614004CEB9EE1A091A151E05B@xpjpn> <20090929042226.GK9003@adacore.com> <2C14068798BA41219F3603CDD24C8BC0@xpjpn> <20090929051929.GL9003@adacore.com> <7063C3E99BE344B2B98EDC0318ED852A@xpjpn> <20090929163910.GO9003@adacore.com> <93F096FEF7ED4579B52B23D69DA91195@xpjpn> <8363b0qm0n.fsf@gnu.org> <20090930201204.GH10338@adacore.com> Subject: RE: symbolic debug of loadable modules with kgdb light Date: Thu, 01 Oct 2009 03:48:00 -0000 Message-ID: <5650DA603A804427AA3B3F8F91164548@xpjpn> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0052_01CA420F.64AA8580" In-Reply-To: <20090930201204.GH10338@adacore.com> 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: 2009-10/txt/msg00001.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0052_01CA420F.64AA8580 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 972 Hello Joel and Eli, Here is the patch which integrates your inputs. Even though I carefully look through your inputs, there may be missing. Let me know if you find. Notes: - Use Ctrl-C, BREAK and SysRq-g according to Eli's suggestion. - "make info" in gdb/doc has no complain. - I always test the connection with Linux kernel. - I did manual test like "help remote interrupt-sequence" and see its output. - I ran "make check". Let me know if you want its output. -caz -----Original Message----- From: Joel Brobecker [mailto:brobecker@adacore.com] Sent: Wednesday, September 30, 2009 1:12 PM To: Eli Zaretskii Cc: Caz Yokoyama; pedro@codesourcery.com; gdb-patches@sourceware.org Subject: Re: symbolic debug of loadable modules with kgdb light > > +@item set interrupt-sequence > > +@cindex interrupt remote programs > > +@cindex select control-c, break or sysrq-g BTW: It should be "set remote interrupt-sequence". Same for "show remote interrupt-sequence". -- Joel ------=_NextPart_000_0052_01CA420F.64AA8580 Content-Type: application/octet-stream; name="remotebreak.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="remotebreak.patch" Content-length: 15561 Index: gdb/ChangeLog=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/ChangeLog,v=0A= retrieving revision 1.10923=0A= diff -u -r1.10923 ChangeLog=0A= --- gdb/ChangeLog 29 Sep 2009 16:27:05 -0000 1.10923=0A= +++ gdb/ChangeLog 1 Oct 2009 03:32:17 -0000=0A= @@ -1,3 +1,17 @@=0A= +2009-09-30 Kazuyoshi Caz Yokoyama =0A= +=0A= + * remote.c (interrupt_sequence_control_c)=0A= + (interrupt_sequence_break, interrupt_sequence_sysrq_g)=0A= + (interrupt_sequence_modes): New constants.=0A= + (interrupt_sequence_mode, interrupt_on_connect): New variable.=0A= + (show_interrupt_sequence): New function.=0A= + (set_remotebreak, show_remotebreak): New function.=0A= + (send_interrupt_sequence: New function.=0A= + (remote_start_remote): Call send_interrupt_sequence if interrupt_on_conne= ct.=0A= + (remote_stop_as): Call send_interrupt_sequence.=0A= + (_initialize_remote): Add interrupt-sequence and interrupt-on-connect,=0A= + modify remotebreak to call set_remotebreak and show_remotebreak.=0A= +=0A= 2009-09-29 Jan Kratochvil =0A= =20=0A= * ia64-tdep.c (ia64_convert_from_func_ptr_addr): New variable buf.=0A= Index: gdb/NEWS=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/NEWS,v=0A= retrieving revision 1.331=0A= diff -u -r1.331 NEWS=0A= --- gdb/NEWS 15 Sep 2009 03:30:04 -0000 1.331=0A= +++ gdb/NEWS 1 Oct 2009 03:32:18 -0000=0A= @@ -3,6 +3,9 @@=0A= =20=0A= *** Changes since GDB 6.8=0A= =20=0A= +* "set/show remotebreak" command is deprecated. Use "set/show remote=0A= +interrupt-sequence" instead.=0A= +=0A= * GDB now has an interface for JIT compilation. Applications that=0A= dynamically generate code can create symbol files in memory and register= =0A= them with GDB. For users, the feature should work transparently, and=0A= @@ -234,6 +237,20 @@=0A= =20=0A= * New commands (for set/show, see "New options" below)=0A= =20=0A= +set remote interrupt-sequence [Ctrl-C | BREAK | SysRq-g]=0A= +show remote interrupt-sequence=0A= + Allow the user to select one of ^C, a break or Magic SysRq g as the=0A= + sequence to the remote target in order to interrupt the execution.=0A= + Ctrl-C is a default. Some system prefers BREAK which is high level of= =0A= + serial line for some certain time. Linux kernel prefers SysRq-g, a.k.a= =0A= + Magic SysRq. It is BREAK signal and character 'g'.=0A= +=0A= +set remote interrupt-on-connect [on | off]=0A= +show remote interrupt-on-connect=0A= + When interrupt-on-connect is ON, gdb sends interrupt-sequence to=0A= + remote target when gdb connects to it. This is needed when you debug=0A= + Linux kernel.=0A= +=0A= catch syscall [NAME(S) | NUMBER(S)]=0A= Catch system calls. Arguments, which should be names of system=0A= calls or their numbers, mean catch only those syscalls. Without=0A= Index: gdb/remote.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/remote.c,v=0A= retrieving revision 1.372=0A= diff -u -r1.372 remote.c=0A= --- gdb/remote.c 10 Sep 2009 22:47:56 -0000 1.372=0A= +++ gdb/remote.c 1 Oct 2009 03:32:21 -0000=0A= @@ -546,14 +546,76 @@=0A= this can go away. */=0A= static int wait_forever_enabled_p =3D 1;=0A= =20=0A= +/* Allow the user to specify what sequence to send to the remote=0A= + when he requests a program interruption: Although ^C is usually=0A= + what remote systems expect (this is the default, here), it is=0A= + sometimes preferable to send a break. On other systems such=0A= + as the Linux kernel, a break followed by g, which is Magic SysRq g=0A= + is required in order to interrupt the execution. */=0A= +const char interrupt_sequence_control_c[] =3D "Ctrl-C";=0A= +const char interrupt_sequence_break[] =3D "BREAK";=0A= +const char interrupt_sequence_sysrq_g[] =3D "SysRq-g";=0A= +static const char *interrupt_sequence_modes[] =3D=0A= + {=0A= + interrupt_sequence_control_c,=0A= + interrupt_sequence_break,=0A= + interrupt_sequence_sysrq_g,=0A= + NULL=0A= + };=0A= +static const char *interrupt_sequence_mode =3D interrupt_sequence_control_= c;=0A= =20=0A= -/* This variable chooses whether to send a ^C or a break when the user=0A= - requests program interruption. Although ^C is usually what remote=0A= - systems expect, and that is the default here, sometimes a break is=0A= - preferable instead. */=0A= +static void=0A= +show_interrupt_sequence (struct ui_file *file, int from_tty,=0A= + struct cmd_list_element *c,=0A= + const char *value)=0A= +{=0A= + if (interrupt_sequence_mode =3D=3D interrupt_sequence_control_c)=0A= + fprintf_filtered (file,=0A= + _("Send the ASCII ETX character (Ctrl-c) "=0A= + "to the remote target to interrupt the "=0A= + "execution of the program.\n"));=0A= + else if (interrupt_sequence_mode =3D=3D interrupt_sequence_break)=0A= + fprintf_filtered (file,=0A= + _("send a break signal to the remote target "=0A= + "to interrupt the execution of the program.\n"));=0A= + else if (interrupt_sequence_mode =3D=3D interrupt_sequence_sysrq_g)=0A= + fprintf_filtered (file,=0A= + _("Send a break signal and 'g' a.k.a. SysRq-g and Magic SysRq to "= =0A= + "the remote target to interrupt the execution "=0A= + "of Linux kernel.\n"));=0A= + else=0A= + internal_error (__FILE__, __LINE__,=0A= + _("Invalid value for interrupt_sequence_mode: %s."),=0A= + interrupt_sequence_mode);=0A= +}=0A= =20=0A= +/* This boolean variable specifies whether interrupt_sequence is sent=0A= + to remote target when gdb starts. This is mostly needed when you debug= =0A= + Linux kernel. Linux kernel expects BREAK g which is Magic SysRq for=0A= + connecting gdb. */=0A= +static int interrupt_on_connect =3D 0;=0A= +=0A= +/* This variable is used to implement the "set/show remotebreak" commands.= =0A= + Since these commands are now deprecated in favor of "set/show remote=0A= + interrupt-sequence", it no longer has any effect on the code. */=0A= static int remote_break;=0A= =20=0A= +static void=0A= +set_remotebreak (char *args, int from_tty, struct cmd_list_element *c)=0A= +{=0A= + if (remote_break)=0A= + interrupt_sequence_mode =3D interrupt_sequence_break;=0A= + else=0A= + interrupt_sequence_mode =3D interrupt_sequence_control_c;=0A= +}=0A= +=0A= +static void=0A= +show_remotebreak (struct ui_file *file, int from_tty,=0A= + struct cmd_list_element *c,=0A= + const char *value)=0A= +{=0A= +}=0A= +=0A= /* Descriptor for I/O to remote machine. Initialize it to NULL so that=0A= remote_open knows that we don't have a file open when the program=0A= starts. */=0A= @@ -2585,6 +2647,25 @@=0A= int extended_p;=0A= };=0A= =20=0A= +/* Send interrupt_sequence to remote target. */=0A= +static void=0A= +send_interrupt_sequence ()=0A= +{=0A= + if (interrupt_sequence_mode =3D=3D interrupt_sequence_control_c)=0A= + serial_write (remote_desc, "\x03", 1);=0A= + else if (interrupt_sequence_mode =3D=3D interrupt_sequence_break)=0A= + serial_send_break (remote_desc);=0A= + else if (interrupt_sequence_mode =3D=3D interrupt_sequence_sysrq_g)=0A= + {=0A= + serial_send_break (remote_desc);=0A= + serial_write (remote_desc, "g", 1);=0A= + }=0A= + else=0A= + internal_error (__FILE__, __LINE__,=0A= + _("Invalid value for interrupt_sequence_mode: %s."),=0A= + interrupt_sequence_mode);=0A= +}=0A= +=0A= static void=0A= remote_start_remote (struct ui_out *uiout, void *opaque)=0A= {=0A= @@ -2598,6 +2679,9 @@=0A= /* Ack any packet which the remote side has already sent. */=0A= serial_write (remote_desc, "+", 1);=0A= =20=0A= + if (interrupt_on_connect)=0A= + send_interrupt_sequence ();=0A= +=0A= /* The first packet we send to the target is the optional "supported=0A= packets" request. If the target can answer this, it will tell us=0A= which later probes to skip. */=0A= @@ -4021,12 +4105,8 @@=0A= if (rs->cached_wait_status)=0A= return;=0A= =20=0A= - /* Send a break or a ^C, depending on user preference. */=0A= -=0A= - if (remote_break)=0A= - serial_send_break (remote_desc);=0A= - else=0A= - serial_write (remote_desc, "\003", 1);=0A= + /* Send interrupt_sequence to remote target. */=0A= + send_interrupt_sequence ();=0A= }=0A= =20=0A= /* This is the generic stop called via the target vector. When a target=0A= @@ -8993,6 +9073,10 @@=0A= _initialize_remote (void)=0A= {=0A= struct remote_state *rs;=0A= + struct cmd_list_element *cmd;=0A= + /* I can't use the same string for lookup_cmd(). Cause segment fault. *= /=0A= + static char *_set_remotebreak_ =3D "remotebreak";=0A= + static char *_show_remotebreak_ =3D "remotebreak";=0A= =20=0A= /* architecture specific data */=0A= remote_gdbarch_data_handle =3D=0A= @@ -9056,12 +9140,33 @@=0A= terminating `#' character and checksum."),=0A= &maintenancelist);=0A= =20=0A= - add_setshow_boolean_cmd ("remotebreak", no_class, &remote_break, _("\=0A= -Set whether to send break if interrupted."), _("\=0A= -Show whether to send break if interrupted."), _("\=0A= + add_setshow_boolean_cmd ("remotebreak", class_obscure, &remote_break, _(= "\=0A= +Deprecated. Use \"set remote interrupt-sequence [control-c|break]\" instea= d."), _("\=0A= +Deprecated. Use \"show remote interrupt-sequence\" instead."), _("\=0A= If set, a break, instead of a cntrl-c, is sent to the remote target."),=0A= - NULL, NULL, /* FIXME: i18n: Whether to send break if interrupted is = %s. */=0A= + set_remotebreak, show_remotebreak,=0A= &setlist, &showlist);=0A= + cmd =3D lookup_cmd (&_set_remotebreak_, setlist, "", -1, 1);=0A= + deprecate_cmd (cmd, "set remote interrupt-sequence");=0A= + cmd =3D lookup_cmd (&_show_remotebreak_, showlist, "", -1, 1);=0A= + deprecate_cmd (cmd, "show remote interrupt-sequence");=0A= +=0A= + add_setshow_enum_cmd ("interrupt-sequence", class_support,=0A= + interrupt_sequence_modes, &interrupt_sequence_mode, _("\=0A= +Set interrupt sequence to remote target."), _("\=0A= +Show interrupt sequence to remote target."), _("\=0A= +Valid value is \"Ctrl-C\", \"BREAK\" or \"SysRq-g\". The default is \"Ctrl= -C\"."),=0A= + NULL, show_interrupt_sequence,=0A= + &remote_set_cmdlist,=0A= + &remote_show_cmdlist);=0A= +=0A= + add_setshow_boolean_cmd ("interrupt-on-connect", class_support,=0A= + &interrupt_on_connect, _("\=0A= +Set whether interrupt-sequence is sent to remote target when gdb connects = to."), _(" \=0A= +Show whether interrupt-sequence is sent to remote target when gdb connects= to."), _(" \=0A= +If set, interrupt sequence is sent to remote target."),=0A= + NULL, NULL,=0A= + &remote_set_cmdlist, &remote_show_cmdlist);=0A= =20=0A= /* Install commands for configuring memory read/write packets. */=0A= =20=0A= Index: gdb/doc/ChangeLog=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/doc/ChangeLog,v=0A= retrieving revision 1.958=0A= diff -u -r1.958 ChangeLog=0A= --- gdb/doc/ChangeLog 26 Sep 2009 16:47:13 -0000 1.958=0A= +++ gdb/doc/ChangeLog 1 Oct 2009 03:32:23 -0000=0A= @@ -1,3 +1,8 @@=0A= +2009-09-30 Kazuyoshi Caz Yokoyama =0A= +=0A= + * gdb.texinfo (Remote Configuration): Add "set/show remote interrupt-sequ= ence" and=0A= + "set/show remote interrupt-on-connect" command.=0A= +=0A= 2009-09-26 Pierre Muller =0A= =20=0A= * gdb.texinfo (Cygwin Native): Mention support for Ctrl-BREAK.=0A= Index: gdb/doc/gdb.texinfo=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v=0A= retrieving revision 1.629=0A= diff -u -r1.629 gdb.texinfo=0A= --- gdb/doc/gdb.texinfo 26 Sep 2009 16:47:13 -0000 1.629=0A= +++ gdb/doc/gdb.texinfo 1 Oct 2009 03:32:36 -0000=0A= @@ -15011,6 +15011,33 @@=0A= target system. If it is not set, the target will use a default=0A= filename (e.g.@: the last program run).=0A= =20=0A= +@item set remote interrupt-sequence=0A= +@cindex interrupt remote programs=0A= +@cindex select Ctrl-C, BREAK or SysRq-g=0A= +Allow the user to specify what sequence @value{GDBN} sends to the remote t= arget=0A= +when you type @samp{Ctrl-c} to interrupt the program running=0A= +on the remote target. Although @samp{Ctrl-C} is usually=0A= +what remote systems expect (this is the default, here), it is=0A= +sometimes preferable to send a @code{BREAK}. When debugging the Linux ker= nel,=0A= +a @code{BREAK} followed by @code{g}, which is=0A= +Magic SysRq g is required in order to interrupt the execution.=0A= +=0A= +@item show interrupt-sequence=0A= +Show which of @samp{Ctrl-C}, @code{BREAK} or @code{BREAK} followed by @cod= e{g}=0A= +is sent by @value{GDBN} to interrupt the remote program.=0A= +@code{BREAK} followed by @code{g} is also known as Magic SysRq.=0A= +=0A= +@item set remote interrupt-on-connect=0A= +@cindex send interrupt-sequence on start=0A= +Specify whether interrupt_sequence is sent=0A= +to remote target when @value{GDBN} connects to it. This is mostly needed = when you debug=0A= +Linux kernel. Linux kernel expects @code{BREAK} followed by @code{g} whic= h is Magic SysRq=0A= +in order to connect @value{GDBN}.=0A= +=0A= +@item show interrupt-on-connect=0A= +Show whether interrupt-sequence is sent=0A= +to remote target when @value{GDBN} connects to it.=0A= +=0A= @kindex set tcp=0A= @kindex show tcp=0A= @item set tcp auto-retry on=0A= @@ -29817,9 +29844,9 @@=0A= @cindex interrupts (remote protocol)=0A= =20=0A= When a program on the remote target is running, @value{GDBN} may=0A= -attempt to interrupt it by sending a @samp{Ctrl-C} or a @code{BREAK},=0A= -control of which is specified via @value{GDBN}'s @samp{remotebreak}=0A= -setting (@pxref{set remotebreak}).=0A= +attempt to interrupt it by sending a @samp{Ctrl-C}, @code{BREAK} or=0A= +a @code{BREAK} followed by @code{g},=0A= +control of which is specified via @value{GDBN}'s @samp{interrupt-sequence}= .=0A= =20=0A= The precise meaning of @code{BREAK} is defined by the transport=0A= mechanism and may, in fact, be undefined. @value{GDBN} does not=0A= @@ -29836,6 +29863,11 @@=0A= (@pxref{X packet}), used for binary downloads, may include an unescaped=0A= @code{0x03} as part of its packet.=0A= =20=0A= +@code{BREAK} followed by @code{g} is also known as Magic SysRq and is=0A= +@code{BREAK} and @code{g}.=0A= +When Linux kernel receives this sequence from serial port,=0A= +it stops execution and connects to gdb.=0A= +=0A= Stubs are not required to recognize these interrupt mechanisms and the=0A= precise meaning associated with receipt of the interrupt is=0A= implementation defined. If the target supports debugging of multiple=0A= ------=_NextPart_000_0052_01CA420F.64AA8580--