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.  */
  
