[okl4-developer] Would you teach the method of debug pistachio/iguana/wombat

Hal Ashburner hala at ok-labs.com
Fri May 25 15:20:51 EST 2007


Tomohiro Kitamura wrote:
> Hello Kenge-users
>
>
> I would like to build the image with debug symbol in okl4_release_1.4.1.1.
> Although I research how I build the image for debug, I can't find it.
> Could you teach the method to build the image with symbol information?
>
> If it is impossible to do it,  would you have a other method for debug
> about pistachio, iguana and wombat ?
> I want to know about wombat debug in particular.
> Wombat hang up in our hardware in the middle of boot process.
> I want to investigate about cause of hangup.
> When I added printk() to linux souorce for debug, many errors occur.
> Therefore I can't debug the wombat.
>
> I already know about kdb.
> but I don't know about detail of how to use it.
> Is there more detail documentation about kdb other than OKL4 Microkernel 
> Programing Manual?
>
>   
Hello Tomohiro,

Firstly the boring admin stuff.  Kenge-users is no-longer used. We have
all moved to developer at okl4.org. So I'm following up there.


Debugging hangs is lots of fun. Some of the tricks we use are:


Entering kdb. On ia32 you do this by typing ctrl+k at the serial terminal.

the '?' will then provides the help.
 BS - back up to previous menu
  ?  - this help message
 ESC - back to previous menu
  a  - architecture specifics
  S  - execute until next taken branch
  c  - KDB configuration
  B  - generic bootinfo
 SPC - show current exception frame
  K  - dump kernel interface page
  p  - dump page table
  g  - continue execution
  S  - list all address spaces
  d  - dump memory
  P  - dump physical memory
  D  - dump memory in other space
  6  - Reset system
  q  - show scheduling queue
  t  - show thread control block
  T  - shows thread control block (extended)
  s  - Single step
  #  - statistics
  r  - enable/disable/list tracepoints


to view the sub menus type (for example) a, to enter the architecture
specific submenu
then
?
to get the help for that
/arch> help
  BS - back up to previous menu
  ?  - this help message
 ESC - back to previous menu
  I  - dump interrupt controller
  b  - set breakpoints
  C  - dump CPU features
  m  - dump model specific registers
  V  - dump VGA screen contents
  g  - dump the GDT
  i  - dump the IDT
  n  - control nmi handling
  p  - IO port access
  c  - show IA32 control registers

running objdump -d vmlinux.reloc > vmlinux.objdump (outside of the
debugger) will enable you to match the instruction pointer to a specific
assembly language instruction.
I quite like objdump -S as this gives you the C/C++ source in that file as
well as the assembly.

You can obviously run objdump on any of the iguana binaries or L4 itself as well.

If you wish to break into the debugger before wombat is up on x86 the
best way is to add an instruction somewhere early in the boot procedure.

L4_KDB_Enter("I want to breakin here!");
which will give you access to the debugger to set breakpoints etc.

Once you're done setting up, pressing 'g' at the top level menu will
start things running again.

Another good source of debugging info is to run qemu with the
-d in_asm
switch, which will put a trace of the assembly instructions qemu
executes in /tmp/qemu.log
These can also be matched to the objdump file.

If you suspect that the hang is happening before wombat is booting, try
enabling the debugging output by uncommenting the relevant lines near the top of iguana/server/src/ig_util.h


Which architecture are you using? Ia32? arm? Which board?

I hope this is useful to you. Happy debugging!

-- 
Kind regards,
Hal Ashburner




More information about the Developer mailing list