summaryrefslogtreecommitdiff
path: root/usr.bin/pmdb/pmdb.1
blob: fff40a3afab6491b9db1789f46379b583163d516 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
.\"	$OpenBSD: pmdb.1,v 1.12 2003/03/22 08:07:12 david 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 February 20, 2002
.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 Op Ar ...
.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 continue
.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
.Nm .
.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.