1/*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5
6
7#include <stdio.h>
8#include <string.h>
9
10
11#include <syscalls.h>
12
13
14extern const char* __progname;
15
16static const char* const kUsage =
17	"Usage: %s [ <message> ]\n"
18	"Enters the kernel debugger with the optional message.\n";
19
20
21int
22main(int argc, const char* const* argv)
23{
24	const char* message = "User command requested kernel debugger.";
25
26	if (argc > 1) {
27		if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
28			printf(kUsage, __progname);
29			return 0;
30		}
31
32		message = argv[1];
33	}
34
35	status_t error = _kern_kernel_debugger(message);
36	if (error != B_OK) {
37		fprintf(stderr, "Error: Entering the kernel debugger failed: %s\n",
38			strerror(error));
39		return 1;
40	}
41
42	return 0;
43}
44