Added kernel_debugger command for entering the kernel debugger.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31966 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
213d2d8f9d
commit
567c7b1055
@ -7,6 +7,12 @@ UsePrivateSystemHeaders ;
|
||||
|
||||
StaticLibrary <bin>debug_utils.a : debug_utils.cpp ;
|
||||
|
||||
BinCommand kernel_debugger : kernel_debugger.cpp
|
||||
:
|
||||
$(TARGET_LIBSUPC++)
|
||||
;
|
||||
|
||||
|
||||
HaikuSubInclude ltrace ;
|
||||
HaikuSubInclude profile ;
|
||||
HaikuSubInclude scheduling_recorder ;
|
||||
|
43
src/bin/debug/kernel_debugger.cpp
Normal file
43
src/bin/debug/kernel_debugger.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include <syscalls.h>
|
||||
|
||||
|
||||
extern const char* __progname;
|
||||
|
||||
static const char* const kUsage =
|
||||
"Usage: %s [ <message> ]\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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user