OpenBSD-4.6/usr.bin/pmdb/pmdb.1

Compare this file to the similar file:
Show the results in this format:

.\"	$OpenBSD: pmdb.1,v 1.17 2007/08/06 19:16:05 sobrado Exp $
.\"
.\" Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. The name of the author may not be used to endorse or promote products
.\"    derived from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
.\" EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: August 6 2007 $
.Dt PMDB 1
.Os
.Sh NAME
.Nm pmdb
.Nd debugger
.Sh SYNOPSIS
.Nm pmdb
.Op Fl c Ar core
.Op Fl p Ar pid
.Ar program ...
.Sh DESCRIPTION
The
.Nm
utility can be used to see what is happening inside a running process or
to catch program crashes and examine the state at the time of the crash.
The only way to start
.Nm
at this moment is to specify the name of the program to be debugged and all
its arguments on the command line.
Optionally,
.Fl c
can be used to specify a core file to examine.
It is also possible to debug a process that is already running by specifying
the process's PID to the
.Fl p
flag.
This causes the process to be put in STOPPED state until execution
is resumed either by an explicit command to pmdb or by exiting pmdb.
The program is controlled from a command line which usually gives the
prompt "pmdb>".
.Sh PROCESS STATES
A loaded program can be in one of three possible states:
.Bl -tag -width RUNNING
.It LOADED
This is the initial state.
The program is not running, it can't be examined (because it doesn't have
any state).
The only thing that can be done to the process is to start it with the
.Ic run
command.
.It RUNNING
When a process is
.Ic RUNNING ,
the only way to affect it is through signals sent to it.
Unless a signal is ignored with the
.Ic signal ignore
command, it will be caught by
.Nm
and the process will go into the
.Ic STOPPED
state.
.It STOPPED
A stopped process can be examined, changed and restarted with the
.Ic continue
command.
.El
.Sh COMMANDS
.Bl -tag -width continueXXXX
.It examine Ar symbol|address
Fetch and display in hex a word at
.Ar address
or
.Ar symbol .
.It regs
Show the contents of the processor registers at the moment the process was
.Ic STOPPED .
.It trace
Show the function call trace of the currently
.Ic STOPPED
process.
.It run
Start running a
.Ic LOADED
process.
.It continue
Continue a
.Ic STOPPED
process.
.It kill
Unconditionally kills the debugged process and puts it in the
.Ic LOADED
state.
.It signal Ar ignore|stop Ar signum|signame
Sets the signal state for the specified signal to either ignore it and
pass it to the process or to stop the process.
.It sigstate
Shows which signals are currently ignored.
.It setenv Ar var Ar val
Sets the environment variable
.Ar var
to the value
.Ar val .
.It break Ar symname|addr
Sets a breakpoint at the symbol
.Ar symname
or the numerical address
.Ar addr .
.It step
Resumes execution just like
.Ic continue ,
but stops it again as soon as possible after executing at least
one instruction.
.It sym_load Ar fname Ar offs
Loads a symbol table from the file
.Ar fname
at the offset
.Ar offs .
.It help
Shows a short help.
.It quit
Kills the process (if necessary) and exits.
.It exit
Alias for
.Ic quit .
.El
.Sh SEE ALSO
.Xr core 5
.Sh HISTORY
The
.Nm
debugger was written because the author believed that
.Xr gdb 1
was too bloated and hairy to run on OpenBSD/sparc64.
.Sh BUGS
The command syntax is really poor and ad hoc at this moment. Most of the
command names and arguments will change as soon as the command line interface
is replaced.