*BSD News Article 1666


Return to BSD News archive

Path: sserve!manuel!munnari.oz.au!uunet!mcsun!Germany.EU.net!unido!adagio!grog
From: grog@adagio.UUCP (Greg Lehey)
Newsgroups: comp.unix.bsd
Subject: Re: kdb kgdb and dump
Keywords: kdb kgdb dump kernel debugger
Message-ID: <1793@adagio.UUCP>
Date: 24 Jun 92 08:49:10 GMT
References: <cproto.709305090@marsh>
Organization: LEMIS, Schellnhausen 2, W-6324 Feldatal, Germany
Lines: 86

In article <cproto.709305090@marsh> cproto@marsh.cs.curtin.edu.au (Computer Protocol) writes:
>
>Has anybody got some sort of a kernel debugger working for 386bsd ???

I have a low-level debugger for BSD/386, which is *almost* complete. I
would imagine that it also would work on 386BSD. It is more or less
independent of the kernel, and thus can be used (or will be able to
when I've finished it) to debug just about any part of the kernel. The
down side of this is that it is not source-oriented, though it does
handle symbols.

Here a command summary:

  Commands:
 
  b: set breakpoint
 
  b - lists all breakpoints
  b <addr> [<type>] [<length>]
 
    set a breakpoint at addr.
    type is i (instruction breakpoint, default),
            w (memory write breakpoint),
            m (memory read/write breakpoint)
    length is the number of bytes to be monitored (1, 2 or 4, default 4)
  c	     continue execution. Traps will be handled by Lowbug.
  d	     delete all breakpoints (requires confirmation)
  d <num>:  delete breakpoint number <num> (numbers listed by b command).
  e [+|- <trap number> ...]
            enable (+) or disable (-) catching trap <trap number>.
            By default, the traps defined in the variable catch_trap are
            caught. In any case, list currently caught traps
  k         connect to kgdb
  kp        call panic ("Lowbug")
  l <n>     show local stack frame <n> from esp to ebp inclusive
  m [<addr>] [<value>]
            modify memory (prompts for inputs, or one can be specified on the command line).
            <addr> defaults to last address displayed + 4
  n         single step one instruction (only if entry via breakpoint)
  p [<addr>] [<length>]:        print data at <addr> for <length> bytes.
            <addr> defaults to last address + 4 referred to by m or p commands.
            <length> defaults to 128 initially, does not change implicitly
  r         display general registers
  r <reg> [<value>]
            display register contents, prompt for new value if none specified
  R         display all registers (including cr0-3, gdtr, ldtr, idtr)
  s[<seg>]  display segment information. Default: current TSS.
  si[<seg>] display IDT information. Default: 0
  t <num>   stack trace from <num>th frame (default 0, maximum 4095)
  t <addr>  stack trace from <addr> (min 4096)
  x         exit from trap. A `c' will return to the caller - in the case of a trap, `x' will
            return to the trap handler and `c' will return to the stored eip value, normally
            invoker of the trap.
  :<expr>   set ``base'' to <expr>. This is intended to make life easier with 8-digit
            addresses: instead of %fe234123, you can do :%fe234000 and then refer to addresses
            as :123. Default value is 0xfe000000.
  = <expr>  evaluate expression and print in hex, decimal and character form
  @ <expr> <symbol>  Intern <symbol> with value <expr> into symbol list
  ^D:       resume execution
  ^M (cr)   execute last instruction *without operands*
 
  Expressions:
 
  <num>       long value (decimal)
  0x<num>     long value (hex)
  %<hexnum>   long value (hex)
  %<regname>  contents of register <regname>
  "char"      long value (characters)
  (<expr>)    value of <expr>
  *<expr>     contents of memory location *<expr>
  :<hexnum>   ``base'' + <hexnum>
  <expr> + <expr>  sum
  <expr> - <expr>  difference
  <expr> * <expr>  product
  <expr> / <expr>  quotient (long integer)
  <id>        value of id

If anybody's interested, please contact me at
grog%lemis@germany.eu.net (don't reply to this message, unido does
something horrible to my mail headers).

-- 
-------------------------------------------------------------------------------
Greg Lehey                       | Tel: +49-6637-1488              
LEMIS                            | Fax: +49-6637-1489
*** NOTE ***: Headers are mangled - reply to grog%lemis@Germany.EU.net