From 47e0ddbf78de952850634de217fa079e63dd9524 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Wed, 17 Oct 2007 17:02:33 +0200 Subject: Some hints about debugging GNU Mach stuff. --- microkernel/mach/gnumach.mdwn | 7 +++-- microkernel/mach/gnumach/debugging.mdwn | 53 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 microkernel/mach/gnumach/debugging.mdwn (limited to 'microkernel') diff --git a/microkernel/mach/gnumach.mdwn b/microkernel/mach/gnumach.mdwn index cfdb1a99..16ed602a 100644 --- a/microkernel/mach/gnumach.mdwn +++ b/microkernel/mach/gnumach.mdwn @@ -10,15 +10,16 @@ GNU Mach is currently used by the GNU [[Hurd]]. GNU Mach remains compatible with Mach 3.0. -The majority of GNU Mach's device drivers are from Linux 2.0. They were -added using glue code, i.e., a Linux emulation layer in Mach. +The majority of GNU Mach's [[device_driver]]s are from Linux 2.0. They were +added using glue code, i.e., a Linux [[emulation]] layer in Mach. GNU Mach runs on x86 machines. See the [[hardware_compatibility_list|hardwarecompatibilitylist]] and information about [[ports]] to other architectures. -# Related Links +# Development * [[Building]] +* [[Debugging]] * [[RevivalProject]] - GNU Mach Projects diff --git a/microkernel/mach/gnumach/debugging.mdwn b/microkernel/mach/gnumach/debugging.mdwn new file mode 100644 index 00000000..7f4fc6ad --- /dev/null +++ b/microkernel/mach/gnumach/debugging.mdwn @@ -0,0 +1,53 @@ +[[meta copyright="Copyright © 2007 Free Software Foundation, Inc."]] +[[meta license="Permission is granted to copy, distribute and/or modify this +document under the terms of the GNU Free Documentation License, Version 1.2 or +any later version published by the Free Software Foundation; with no Invariant +Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license +is included in the section entitled +[[GNU_Free_Documentation_License|/fdl.txt]]."]] + +Mach has a built-in kernel debugger. +[Manual](http://www.gnu.org/software/hurd/gnumach-doc/Kernel-Debugger.html). + + +When you're [[running_a_system_in_QEMU|hurd/running/qemu]] you can directly +[use GDB on the running +kernel](http://fabrice.bellard.free.fr/qemu/qemu-doc.html#SEC36). + + +Alternatively you can use an approach like this one: add the following code +snippet to `device/ds_routines.c`'s `ds_device_open` function, right at the top +of the function, and modify the code as needed. + + void D (char *s) + { + switch (s[0] - '0') + { + case 0: + printf ("Hello from %s!\n", __FUNCTION__); + break; + case 1: + printf ("%s: Invoking task_collect_scan.\n", __FUNCTION__); + extern void task_collect_scan (void); + task_collect_scan (); + break; + default: + printf ("No idea what you want me to do.\n"); + break; + } + } + + if (name && name[0] == 'D') + D (name + 1); + +Then boot your system and do something like this: + + # devprobe D0 + Hello from D! + # devprobe D1 + D: Invoking task_collect_scan. + # devprobe D2 + No idea what you want me to do. + +This is especially useful if you need to manually trigger some stuff inside the +running kernel, as with the *D1* example. -- cgit v1.2.3