This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
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:
remotebreak.patch
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |