diff --git a/src/bin/debug/Jamfile b/src/bin/debug/Jamfile index 4a6e20f0a5..75d9f044f8 100644 --- a/src/bin/debug/Jamfile +++ b/src/bin/debug/Jamfile @@ -7,6 +7,12 @@ UsePrivateSystemHeaders ; StaticLibrary debug_utils.a : debug_utils.cpp ; +BinCommand kernel_debugger : kernel_debugger.cpp + : + $(TARGET_LIBSUPC++) +; + + HaikuSubInclude ltrace ; HaikuSubInclude profile ; HaikuSubInclude scheduling_recorder ; diff --git a/src/bin/debug/kernel_debugger.cpp b/src/bin/debug/kernel_debugger.cpp new file mode 100644 index 0000000000..ad3b801232 --- /dev/null +++ b/src/bin/debug/kernel_debugger.cpp @@ -0,0 +1,43 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Distributed under the terms of the MIT License. + */ + + +#include +#include + + +#include + + +extern const char* __progname; + +static const char* const kUsage = + "Usage: %s [ ]\n" + "Enters the kernel debugger with the optional message.\n"; + + +int +main(int argc, const char* const* argv) +{ + const char* message = "User command requested kernel debugger."; + + if (argc > 1) { + if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) { + printf(kUsage, __progname); + return 0; + } + + message = argv[1]; + } + + status_t error = _kern_kernel_debugger(message); + if (error != B_OK) { + fprintf(stderr, "Error: Entering the kernel debugger failed: %s\n", + strerror(error)); + return 1; + } + + return 0; +}