From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16415 invoked by alias); 7 Aug 2009 04:06:17 -0000 Received: (qmail 16407 invoked by uid 22791); 7 Aug 2009 04:06:16 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,MIME_QP_LONG_LINE,SPF_PASS X-Spam-Check-By: sourceware.org Received: from rv-out-0708.google.com (HELO rv-out-0708.google.com) (209.85.198.240) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 07 Aug 2009 04:06:02 +0000 Received: by rv-out-0708.google.com with SMTP id b17so326286rvf.48 for ; Thu, 06 Aug 2009 21:06:00 -0700 (PDT) Received: by 10.140.161.3 with SMTP id j3mr303852rve.27.1249617960590; Thu, 06 Aug 2009 21:06:00 -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 f42sm3501004rvb.5.2009.08.06.21.05.57 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 06 Aug 2009 21:05:58 -0700 (PDT) From: Caz Yokoyama To: "'Michael Snyder'" Cc: "'Daniel Jacobowitz'" , "'Pedro Alves'" , , , "'Joel Brobecker'" References: <409D09C1E1964C5EAFF5EFBAD6E936ED@xpjpn> <200905152223.58241.pedro@codesourcery.com> <20090515213410.GA10064@caradoc.them.org> <8AA4B846934A4A9081F778449B96F416@xpjpn> <4A0DE914.1050800@vmware.com> Subject: RE: symbolic debug of loadable modules with kgdb light Date: Fri, 07 Aug 2009 07:17:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0153_01CA16D9.52FD80A0" In-Reply-To: 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-08/txt/msg00101.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0153_01CA16D9.52FD80A0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Content-length: 6137 This patch generalizes remotebreak. It becomes an enum string from a Boolean. It may be "Ctrl-C", "BREAK" or "BREAK-g". When it is "BREAK-g", gdb also sends BREAK g to connect to Linux kernel when it starts. Index: gdb/remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.366 diff -c -r1.366 remote.c *** gdb/remote.c 31 Jul 2009 22:15:15 -0000 1.366 --- gdb/remote.c 7 Aug 2009 03:50:30 -0000 *************** *** 546,558 **** this can go away. */ static int wait_forever_enabled_p = 1; ! /* This variable chooses whether to send a ^C or a break when the user ! requests program interruption. Although ^C is usually what remote ! systems expect, and that is the default here, sometimes a break is ! preferable instead. */ ! ! static int remote_break; /* Descriptor for I/O to remote machine. Initialize it to NULL so that remote_open knows that we don't have a file open when the program --- 546,575 ---- this can go away. */ static int wait_forever_enabled_p = 1; + /* This variable chooses whether to send a ^C, a break or a break g + when the user requests program interruption. + Although ^C is usually what remote systems expect, + and that is the default here, sometimes a break is + preferable instead. For interrupting Linux kernel, a break and g is + expected which is Magic SysReq g. */ + const char bs_Crtl_C[] = "Ctrl-C"; + const char bs_BREAK[] = "BREAK"; + const char bs_BREAK_g[] = "BREAK-g"; + static const char *remotebreak_enum[] = { + bs_Crtl_C, + bs_BREAK, + bs_BREAK_g, + NULL + }; + const char *remotebreak_string = bs_Crtl_C; ! static void show_remotebreak(struct ui_file *file, int from_tty, ! struct cmd_list_element *c, ! const char *value) ! { ! fprintf_unfiltered (file, "remote systems expect %s to be interrupted\n", ! remotebreak_string); ! } /* Descriptor for I/O to remote machine. Initialize it to NULL so that remote_open knows that we don't have a file open when the program *************** *** 2601,2606 **** --- 2618,2629 ---- /* Ack any packet which the remote side has already sent. */ serial_write (remote_desc, "+", 1); + /* send break sequence on debugging Linux kernel */ + if (remotebreak_string == bs_BREAK_g) { + serial_send_break (remote_desc); + serial_write (remote_desc, "g", 1); + } + /* The first packet we send to the target is the optional "supported packets" request. If the target can answer this, it will tell us which later probes to skip. */ *************** *** 4011,4022 **** if (rs->cached_wait_status) return; ! /* Send a break or a ^C, depending on user preference. */ ! ! if (remote_break) serial_send_break (remote_desc); ! else ! serial_write (remote_desc, "\003", 1); } /* This is the generic stop called via the target vector. When a target --- 4034,4048 ---- if (rs->cached_wait_status) return; ! /* Send ^C, a break or a break g, depending on user preference. */ ! if (remotebreak_string == bs_Crtl_C) { ! serial_write (remote_desc, "\003", 1); ! } else if (remotebreak_string == bs_BREAK) { ! serial_send_break (remote_desc); ! } else if (remotebreak_string == bs_BREAK_g) { serial_send_break (remote_desc); ! serial_write (remote_desc, "g", 1); ! } } /* This is the generic stop called via the target vector. When a target *************** *** 9051,9062 **** terminating `#' character and checksum."), &maintenancelist); ! add_setshow_boolean_cmd ("remotebreak", no_class, &remote_break, _("\ ! Set whether to send break if interrupted."), _("\ ! Show whether to send break if interrupted."), _("\ ! If set, a break, instead of a cntrl-c, is sent to the remote target."), ! NULL, NULL, /* FIXME: i18n: Whether to send break if interrupted is %s. */ ! &setlist, &showlist); /* Install commands for configuring memory read/write packets. */ --- 9077,9088 ---- terminating `#' character and checksum."), &maintenancelist); ! add_setshow_enum_cmd ("remotebreak", class_support, ! remotebreak_enum, &remotebreak_string, _("\ ! Set remote break sequence."), _("\ ! Show remote break sequence."), NULL, ! NULL, show_remotebreak, ! &setlist, &showlist); /* Install commands for configuring memory read/write packets. */ -caz -----Original Message----- From: Caz Yokoyama [mailto:caz@caztech.com] Sent: Friday, May 15, 2009 3:26 PM To: 'Michael Snyder' Cc: 'Daniel Jacobowitz'; 'Pedro Alves'; 'gdb-patches@sourceware.org'; 'tromey@redhat.com'; 'Joel Brobecker' Subject: RE: symbolic debug of loadable modules with kgdb light I have no objection regarding generic way of sending a BREAK. However, I had two reasons to introduce linux-kgdb. 1) Someone suggested me the same several months ago. Nobody implemented. 2) I need some way to specify debugging linux kernel by using kgdb for symbolic debug of loadable modules. -caz -----Original Message----- From: Michael Snyder [mailto:msnyder@vmware.com] Sent: Friday, May 15, 2009 3:14 PM To: Caz Yokoyama Cc: 'Daniel Jacobowitz'; 'Pedro Alves'; gdb-patches@sourceware.org; tromey@redhat.com; 'Joel Brobecker' Subject: Re: symbolic debug of loadable modules with kgdb light I think we need a generic way to send a BREAK (whatever that may mean) to the target from the command line. Like maybe a "BREAK" command. Caz Yokoyama wrote: > Yes, that is correct. > -caz > -----Original Message----- > From: Daniel Jacobowitz [mailto:drow@false.org] > Sent: Friday, May 15, 2009 2:34 PM > To: Pedro Alves > Cc: gdb-patches@sourceware.org; Caz Yokoyama; tromey@redhat.com; 'Joel > Brobecker' > Subject: Re: symbolic debug of loadable modules with kgdb light > > On Fri, May 15, 2009 at 10:23:57PM +0100, Pedro Alves wrote: >> Sounds like you need to fix kgdb instead. Why would it need >> a 'g' on connection? > > BREAK on a serial (or network maybe?) console is magic sysrq; this is > sysrq-g, probably for debuG. > ------=_NextPart_000_0153_01CA16D9.52FD80A0 Content-Type: application/octet-stream; name="remotebreak.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="remotebreak.patch" Content-length: 5040 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.366=0A= diff -c -r1.366 remote.c=0A= *** gdb/remote.c 31 Jul 2009 22:15:15 -0000 1.366=0A= --- gdb/remote.c 7 Aug 2009 03:50:30 -0000=0A= ***************=0A= *** 546,558 ****=0A= this can go away. */=0A= static int wait_forever_enabled_p =3D 1;=0A= =20=20=0A= =20=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= !=20=0A= ! static int remote_break;=0A= =20=20=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= --- 546,575 ----=0A= this can go away. */=0A= static int wait_forever_enabled_p =3D 1;=0A= =20=20=0A= + /* This variable chooses whether to send a ^C, a break or a break g=0A= + when the user requests program interruption.=0A= + Although ^C is usually what remote systems expect,=0A= + and that is the default here, sometimes a break is=0A= + preferable instead. For interrupting Linux kernel, a break and g is=0A= + expected which is Magic SysReq g. */=0A= + const char bs_Crtl_C[] =3D "Ctrl-C";=0A= + const char bs_BREAK[] =3D "BREAK";=0A= + const char bs_BREAK_g[] =3D "BREAK-g";=0A= + static const char *remotebreak_enum[] =3D {=0A= + bs_Crtl_C,=0A= + bs_BREAK,=0A= + bs_BREAK_g,=0A= + NULL=0A= + };=0A= + const char *remotebreak_string =3D bs_Crtl_C;=0A= =20=20=0A= ! static void show_remotebreak(struct ui_file *file, int from_tty,=0A= ! struct cmd_list_element *c,=0A= ! const char *value)=0A= ! {=0A= ! fprintf_unfiltered (file, "remote systems expect %s to be interrupted\n= ",=0A= ! remotebreak_string);=0A= ! }=0A= =20=20=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= ***************=0A= *** 2601,2606 ****=0A= --- 2618,2629 ----=0A= /* Ack any packet which the remote side has already sent. */=0A= serial_write (remote_desc, "+", 1);=0A= =20=20=0A= + /* send break sequence on debugging Linux kernel */=0A= + if (remotebreak_string =3D=3D bs_BREAK_g) {=0A= + serial_send_break (remote_desc);=0A= + serial_write (remote_desc, "g", 1);=0A= + }=0A= +=20=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= ***************=0A= *** 4011,4022 ****=0A= if (rs->cached_wait_status)=0A= return;=0A= =20=20=0A= ! /* Send a break or a ^C, depending on user preference. */=0A= !=20=0A= ! if (remote_break)=0A= serial_send_break (remote_desc);=0A= ! else=0A= ! serial_write (remote_desc, "\003", 1);=0A= }=0A= =20=20=0A= /* This is the generic stop called via the target vector. When a target= =0A= --- 4034,4048 ----=0A= if (rs->cached_wait_status)=0A= return;=0A= =20=20=0A= ! /* Send ^C, a break or a break g, depending on user preference. */=0A= ! if (remotebreak_string =3D=3D bs_Crtl_C) {=0A= ! serial_write (remote_desc, "\003", 1);=0A= ! } else if (remotebreak_string =3D=3D bs_BREAK) {=0A= ! serial_send_break (remote_desc);=0A= ! } else if (remotebreak_string =3D=3D bs_BREAK_g) {=0A= serial_send_break (remote_desc);=0A= ! serial_write (remote_desc, "g", 1);=0A= ! }=0A= }=0A= =20=20=0A= /* This is the generic stop called via the target vector. When a target= =0A= ***************=0A= *** 9051,9062 ****=0A= terminating `#' character and checksum."),=0A= &maintenancelist);=0A= =20=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= ! 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= ! &setlist, &showlist);=0A= =20=20=0A= /* Install commands for configuring memory read/write packets. */=0A= =20=20=0A= --- 9077,9088 ----=0A= terminating `#' character and checksum."),=0A= &maintenancelist);=0A= =20=20=0A= ! add_setshow_enum_cmd ("remotebreak", class_support,=0A= ! remotebreak_enum, &remotebreak_string, _("\=0A= ! Set remote break sequence."), _("\=0A= ! Show remote break sequence."), NULL,=0A= ! NULL, show_remotebreak,=0A= ! &setlist, &showlist);=0A= =20=20=0A= /* Install commands for configuring memory read/write packets. */=0A= =20=20=0A= ------=_NextPart_000_0153_01CA16D9.52FD80A0--