History

kgdb: core changes to support kdb

These are the minimum changes to the kgdb core in order to enable an API to connect a new front end (kdb) to the debug core. This patch introduces the dbg_kdb_mode variable controls where the user level I/O is routed. It will be routed to the gdbstub (kgdb) or to the kdb front end which is a simple shell available over the kgdboc connection. You can switch back and forth between kdb or the gdb stub mode of operation dynamically. From gdb stub mode you can blindly type "$3#33", or from the kdb mode you can enter "kgdb" to switch to the gdb stub. The logic in the debug core depends on kdb to look for the typical gdb connection sequences and return immediately with KGDB_PASS_EVENT if a gdb serial command sequence is detected. That should allow a reasonably seamless transition between kdb -> gdb without leaving the kernel exception state. The two gdb serial queries that kdb is responsible for detecting are the "?" and "qSupported" packets.

Jason Wessel committed 16 years ago

Commit dcc78711 parent 67fc4e09 files · +186 −20Browse files

Showing the changes to kernel/debug/debug_core.h (1 of 9 files). Show all

Unified · Split

kernel/debug/debug_core.h+24−0
@@ -38,6 +38,8 @@ struct debuggerinfo_struct { · 37 unmodified lines
3838 void *debuggerinfo;
3939 struct task_struct *task;
4040 int exception_state;
41+ int ret_state;
42+ int irq_depth;
4143 };
4244
4345 extern struct debuggerinfo_struct kgdb_info[];
@@ -47,9 +49,31 @@ extern int dbg_remove_all_break(void); · 3 unmodified lines
4749 extern int dbg_set_sw_break(unsigned long addr);
4850 extern int dbg_remove_sw_break(unsigned long addr);
4951 extern int dbg_activate_sw_breakpoints(void);
52+extern int dbg_deactivate_sw_breakpoints(void);
53+
54+/* polled character access to i/o module */
55+extern int dbg_io_get_char(void);
56+
57+/* stub return value for switching between the gdbstub and kdb */
58+#define DBG_PASS_EVENT -12345
59+/* Switch from one cpu to another */
60+#define DBG_SWITCH_CPU_EVENT -123456
61+extern int dbg_switch_cpu;
5062
5163 /* gdbstub interface functions */
5264 extern int gdb_serial_stub(struct kgdb_state *ks);
5365 extern void gdbstub_msg_write(const char *s, int len);
5466
67+/* gdbstub functions used for kdb <-> gdbstub transition */
68+extern int gdbstub_state(struct kgdb_state *ks, char *cmd);
69+
70+#ifdef CONFIG_KGDB_KDB
71+extern int kdb_stub(struct kgdb_state *ks);
72+#else /* ! CONFIG_KGDB_KDB */
73+static inline int kdb_stub(struct kgdb_state *ks)
74+{
75+ return DBG_PASS_EVENT;
76+}
77+#endif /* CONFIG_KGDB_KDB */
78+
5579 #endif /* _DEBUG_CORE_H_ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t