summaryrefslogtreecommitdiff
path: root/microkernel
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@schwinge.name>2011-08-30 12:03:36 +0200
committerThomas Schwinge <thomas@schwinge.name>2011-08-30 12:03:36 +0200
commit016433b123ce4b60eee550dbdb7812ba623d16e7 (patch)
tree5b0c66777ca1dae1ac112d1eee8c05ba2c840d4b /microkernel
parentedd7d582fce7a52565efd3e404bb0419f7e34474 (diff)
Minor tweaks.
Diffstat (limited to 'microkernel')
-rw-r--r--microkernel/mach/gnumach/building.mdwn11
-rw-r--r--microkernel/mach/gnumach/debugging.mdwn34
-rw-r--r--microkernel/mach/mig/gnu_mig/building.mdwn11
-rw-r--r--microkernel/mach/mig/gnu_mig/building/discussion.mdwn16
-rw-r--r--microkernel/mach/mig/gnu_mig/discussion.mdwn6
5 files changed, 60 insertions, 18 deletions
diff --git a/microkernel/mach/gnumach/building.mdwn b/microkernel/mach/gnumach/building.mdwn
index 24a73608..afcfac74 100644
--- a/microkernel/mach/gnumach/building.mdwn
+++ b/microkernel/mach/gnumach/building.mdwn
@@ -1,3 +1,14 @@
+[[!meta copyright="Copyright © 2006, 2007, 2008, 2011 Free Software Foundation,
+Inc."]]
+
+[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
+id="license" text="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]]."]]"""]]
+
# Building [[GNU_Mach|gnumach]] from Source
If you want to build the [[GNU_Mach|gnumach]] kernel yourself instead of just using a
diff --git a/microkernel/mach/gnumach/debugging.mdwn b/microkernel/mach/gnumach/debugging.mdwn
index 596e4da0..f657e7cc 100644
--- a/microkernel/mach/gnumach/debugging.mdwn
+++ b/microkernel/mach/gnumach/debugging.mdwn
@@ -9,7 +9,12 @@ 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]]."]]"""]]
-Here are some hints to debug with GNU Mach
+Here are some hints to debug with GNU Mach.
+
+[[!toc levels=2]]
+
+
+# Kernel Debugger
Mach has a built-in kernel debugger.
[Manual](http://www.gnu.org/software/hurd/gnumach-doc/Kernel-Debugger.html).
@@ -20,27 +25,25 @@ Then, reproduce the issue again. If something like a kernel trap happens, you wi
If you are running in kvm or qemu, it is convenient to use the curses frontend to be able to copy/paste.
-The debugger has an extensive documentation on http://www.gnu.org/software/hurd/gnumach-doc/Kernel-Debugger.html , but a quick start is the following.
-
To get the register values, type
-show registers
+ show registers
To get a backtrace, type trace, which will print both function return addresses and function parameters, such as
-0x107cf1(8088488,5e,40000008,2aa008,0)
-0x1071bc(0,0,0,0,0)
-0x106831(24fe00,2000,b,800,0)
+ 0x107cf1(8088488,5e,40000008,2aa008,0)
+ 0x1071bc(0,0,0,0,0)
+ 0x106831(24fe00,2000,b,800,0)
Run the addr2line tool on the return addresses:
-addr2line -i -f -e /boot/gnumach 0x107cf1 0x1071bc 0x106831
+ $ addr2line -i -f -e /boot/gnumach 0x107cf1 0x1071bc 0x106831
This will print the source code lines of the backtrace.
To examine the backtrace of some given thread, use
-show all thread/u
+ show all thread/u
to get the whole listing of all tasks and threads. You can then use trace/t to trace a specific thread.
@@ -48,25 +51,28 @@ Unfortunately, userland and kernelland use the same range of addresses, so one c
To examine a variable, use nm /boot/gnumach to get the address of the variable (e.g. 0x123400), and use
-x 0x123400
+ x 0x123400
to read it. One can also write to it by using
-w 0x123400
+ w 0x123400
Another interesting feature is watching a variable, by using
-watch 0x123400
+ watch 0x123400
and then type continue, to let Mach continue execution. The debugger will be entered again on any change in that variable. The watch is implemented in hardware, so it does not disturb or slow down execution at all.
+# GDB in QEMU
When you're [[running_a_system_in_QEMU|hurd/running/qemu]] you can directly
[use GDB on the running
kernel](http://www.nongnu.org/qemu/qemu-doc.html#SEC48).
+# Code Inside the Kernel
+
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.
@@ -105,6 +111,8 @@ This is especially useful if you need to manually trigger some stuff inside the
running kernel, as with the *D1* example.
+## Writing to the Screen Buffer
+
If you're doing real low level debugging, you might want to put variations of
the following snipped into the code, this code will write a `#` character at
line `[LINE]`, column `[COLUMN]` on the screen:
@@ -118,6 +126,8 @@ some place when running the kernel inside QEMU, as QEMU somehow decides not to
update its display buffer anymore under certain conditions.
+# Halting the CPU and Examining Registers
+
IRC, freenode, #hurd, 2011-07-14:
<braunr> one ugly trick i use when printf isn't available is to halt the
diff --git a/microkernel/mach/mig/gnu_mig/building.mdwn b/microkernel/mach/mig/gnu_mig/building.mdwn
index 759c1a84..cd588341 100644
--- a/microkernel/mach/mig/gnu_mig/building.mdwn
+++ b/microkernel/mach/mig/gnu_mig/building.mdwn
@@ -1,3 +1,14 @@
+[[!meta copyright="Copyright © 2006, 2007, 2008, 2011 Free Software Foundation,
+Inc."]]
+
+[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
+id="license" text="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]]."]]"""]]
+
# <a name="Building_the_Mach_Interface_Gene"> Building the Mach Interface Generator from Source </a>
If you want to build the Mach Interface Generator yourself instead of just
diff --git a/microkernel/mach/mig/gnu_mig/building/discussion.mdwn b/microkernel/mach/mig/gnu_mig/building/discussion.mdwn
new file mode 100644
index 00000000..d7636158
--- /dev/null
+++ b/microkernel/mach/mig/gnu_mig/building/discussion.mdwn
@@ -0,0 +1,16 @@
+[[!meta copyright="Copyright © 2011 Free Software Foundation, Inc."]]
+
+[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
+id="license" text="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]]."]]"""]]
+
+# Non-cross-compiling
+
+[[!tag open_issue_mig]]
+
+[[samuelthibault]] mentioned that I should make clear what compiler options, etc. are only needed if compiling on a 64 bit computer. However, I don't know if the --host=i686... option is needed, here and when making gnumach, in case there may be some other default on 32 bit computers? --[[sudoman]]
+
diff --git a/microkernel/mach/mig/gnu_mig/discussion.mdwn b/microkernel/mach/mig/gnu_mig/discussion.mdwn
deleted file mode 100644
index e5a4dea3..00000000
--- a/microkernel/mach/mig/gnu_mig/discussion.mdwn
+++ /dev/null
@@ -1,6 +0,0 @@
-# Builing MIG
-
-## Non-cross-compiling
-
-[[samuelthibault]] mentioned that I should make clear what compiler options, etc. are only needed if compiling on a 64 bit computer. However, I don't know if the --host=i686... option is needed, here and when making gnumach, in case there may be some other default on 32 bit computers? --[[sudoman]]
-