From: Caz Yokoyama <cazyokoyama@gmail.com>
To: "'Michael Snyder'" <msnyder@vmware.com>
Cc: "'Daniel Jacobowitz'" <drow@false.org>,
"'Pedro Alves'" <pedro@codesourcery.com>,
<gdb-patches@sourceware.org>, <tromey@redhat.com>,
"'Joel Brobecker'" <brobecker@adacore.com>
Subject: RE: symbolic debug of loadable modules with kgdb light
Date: Fri, 07 Aug 2009 07:17:00 -0000 [thread overview]
Message-ID: <D4F6E14FCE904FF5813F6BD1615A3934@xpjpn> (raw)
In-Reply-To:
[-- Attachment #1: Type: text/plain, Size: 6137 bytes --]
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.
>
[-- Attachment #2: remotebreak.patch --]
[-- Type: application/octet-stream, Size: 4407 bytes --]
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. */
next prev parent reply other threads:[~2009-08-07 4:06 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-09 15:51 Caz Yokoyama
2009-04-24 15:33 ` Tom Tromey
2009-04-24 16:49 ` Caz Yokoyama
2009-04-26 0:39 ` Caz Yokoyama
2009-05-15 21:14 ` Caz Yokoyama
2009-05-15 21:23 ` Pedro Alves
2009-05-15 21:34 ` Caz Yokoyama
2009-05-15 21:34 ` Daniel Jacobowitz
2009-05-15 21:41 ` Caz Yokoyama
2009-05-15 22:13 ` Michael Snyder
2009-05-15 22:25 ` Caz Yokoyama
2009-08-07 7:17 ` Caz Yokoyama [this message]
2009-08-07 9:22 ` Eli Zaretskii
2009-08-07 20:42 ` Caz Yokoyama
2009-09-23 0:48 ` Joel Brobecker
2009-09-23 1:39 ` Daniel Jacobowitz
2009-09-23 4:16 ` Caz Yokoyama
2009-09-23 11:36 ` Caz Yokoyama
2009-09-24 16:40 ` Caz Yokoyama
2009-09-24 22:42 ` Caz Yokoyama
2009-09-25 16:06 ` Joel Brobecker
2009-09-26 3:43 ` Caz Yokoyama
[not found] ` <535d47e30909260627n662135a1hf6d1a0bb33368b3a@mail.gmail.com>
2009-09-29 1:58 ` Joel Brobecker
2009-09-29 3:23 ` Caz Yokoyama
2009-09-29 4:22 ` Joel Brobecker
2009-09-29 4:58 ` Caz Yokoyama
2009-09-29 5:19 ` Joel Brobecker
2009-09-29 16:12 ` Caz Yokoyama
2009-09-29 16:39 ` Joel Brobecker
2009-09-30 4:45 ` Caz Yokoyama
2009-09-30 17:28 ` Joel Brobecker
2009-09-30 19:16 ` Eli Zaretskii
2009-09-30 20:12 ` Joel Brobecker
2009-10-01 3:48 ` Caz Yokoyama
2009-10-01 4:08 ` Eli Zaretskii
2009-10-01 4:51 ` Caz Yokoyama
2009-10-01 20:04 ` Eli Zaretskii
2009-10-01 16:33 ` Joel Brobecker
2009-10-01 17:18 ` Caz Yokoyama
2009-10-01 19:37 ` Joel Brobecker
2009-10-01 19:53 ` Caz Yokoyama
2009-10-01 20:25 ` Eli Zaretskii
2009-10-01 20:19 ` Eli Zaretskii
2009-10-01 20:29 ` Caz Yokoyama
2009-10-01 20:46 ` Joel Brobecker
2009-10-01 21:10 ` Daniel Jacobowitz
2009-10-01 21:58 ` Caz Yokoyama
2009-10-01 22:13 ` Pedro Alves
2009-10-01 23:04 ` Caz Yokoyama
2009-10-01 23:32 ` Joel Brobecker
2009-10-02 1:18 ` Caz Yokoyama
2009-10-02 22:14 ` Joel Brobecker
2009-10-02 8:55 ` Eli Zaretskii
2009-10-28 15:05 ` Joel Brobecker
2009-10-01 20:13 ` Caz Yokoyama
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D4F6E14FCE904FF5813F6BD1615A3934@xpjpn \
--to=cazyokoyama@gmail.com \
--cc=brobecker@adacore.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
--cc=pedro@codesourcery.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox