bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Support invoking the debugger over the serial console


From: Justus Winter
Subject: [PATCH] Support invoking the debugger over the serial console
Date: Thu, 21 Aug 2014 12:14:50 +0200

* i386/i386at/com.c (comintr): Invoke the debugger if ctrl-alt-d is
pressed.
* i386/i386at/com.h (kdb_kintr): Add declaration.
---
 i386/i386at/com.c | 23 ++++++++++++++++++++++-
 i386/i386at/com.h |  4 ++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index 5e65ad8..8a81b76 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -518,9 +518,30 @@ comintr(int unit)
                case RECi:
                case CTIi:         /* Character timeout indication */
                        if (tp->t_state&TS_ISOPEN) {
+                               int escape = 0;
                                while ((line = inb(LINE_STAT(addr))) & iDR) {
                                        c = inb(TXRX(addr));
-                                       ttyinput(c, tp);
+
+                                       if (c == 0x1b) {
+                                               escape = 1;
+                                               continue;
+                                       }
+
+#if MACH_KDB
+                                       if (escape && c == 4)
+                                               /* ctrl-alt-d pressed,
+                                                  invoke debugger */
+                                               kdb_kintr();
+                                       else
+#endif /* MACH_KDB */
+                                       if (escape) {
+                                               ttyinput(0x1b, tp);
+                                               ttyinput(c, tp);
+                                       }
+                                       else
+                                               ttyinput(c, tp);
+
+                                       escape = 0;
                                }
                        } else
                                tt_open_wakeup(tp);
diff --git a/i386/i386at/com.h b/i386/i386at/com.h
index 95baa45..779cdba 100644
--- a/i386/i386at/com.h
+++ b/i386/i386at/com.h
@@ -71,6 +71,10 @@ comsetstat(
        int             *data,
        natural_t       count);
 
+#if MACH_KDB
+extern void kdb_kintr(void);
+#endif /* MACH_KDB */
+
 extern io_return_t comopen(dev_t dev, int flag, io_req_t ior);
 extern void comclose(dev_t dev, int flag);
 extern io_return_t comread(dev_t dev, io_req_t ior);
-- 
2.1.0.rc1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]