-.\" $OpenBSD: btrace.8,v 1.2 2020/09/11 08:16:15 mpi Exp $
+.\" $OpenBSD: btrace.8,v 1.3 2021/03/21 01:24:35 jmatthew Exp $
.\"
.\" Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: September 11 2020 $
+.Dd $Mdocdate: March 21 2021 $
.Dt BTRACE 8
.Os
.Sh NAME
.Ar program .
.It Fl l
List all available probes.
+.It Fl n
+No action.
+Parse the program and then exit.
.It Fl p Ar pid
Enable tracing on the indicated process ID (only one
.Fl p
-/* $OpenBSD: btrace.c,v 1.29 2021/02/08 09:46:45 mpi Exp $ */
+/* $OpenBSD: btrace.c,v 1.30 2021/03/21 01:24:35 jmatthew Exp $ */
/*
* Copyright (c) 2019 - 2020 Martin Pieuchot <mpi@openbsd.org>
int fd = -1, ch, error = 0;
const char *filename = NULL, *btscript = NULL;
const char *errstr;
- int showprobes = 0, tracepid = -1;
+ int showprobes = 0, tracepid = -1, noaction = 0;
setlocale(LC_ALL, "");
err(1, "pledge");
#endif
- while ((ch = getopt(argc, argv, "e:lp:v")) != -1) {
+ while ((ch = getopt(argc, argv, "e:lnp:v")) != -1) {
switch (ch) {
case 'e':
btscript = optarg;
case 'l':
showprobes = 1;
break;
+ case 'n':
+ noaction = 1;
+ break;
case 'p':
if (tracepid != -1)
usage();
return error;
}
+ if (noaction)
+ return error;
+
if (showprobes || g_nprobes > 0) {
fd = open(__PATH_DEVDT, O_RDONLY);
if (fd == -1)
__dead void
usage(void)
{
- fprintf(stderr, "usage: %s [-lv] [-p pid] [-e program|file]\n",
+ fprintf(stderr, "usage: %s [-lnv] [-p pid] [-e program | file]\n",
getprogname());
exit(1);
}