2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
4 * This file is part of Portals, http://www.sf.net/projects/lustre/
6 * Portals is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
10 * Portals is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Portals; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 * Some day I'll split all of this functionality into a cfs_debug module
20 * of its own. That day is not today.
25 #include <lnet/lnetctl.h>
26 #include <libcfs/libcfsutil.h>
30 {"debug_kernel", jt_dbg_debug_kernel, 0, "usage: debug_kernel [file] [raw], get debug buffer and print it [to a file]"},
31 {"debug_daemon", jt_dbg_debug_daemon, 0, "usage: debug_daemon [start file|stop], control debug daemon to dump debug buffer to a file"},
32 {"debug_file", jt_dbg_debug_file, 0, "usage: debug_file <input> [output] [raw], read debug buffer from input and print it [to output]"},
33 {"clear", jt_dbg_clear_debug_buf, 0, "clear kernel debug buffer"},
34 {"mark", jt_dbg_mark_debug_buf, 0, "insert a marker into the kernel debug buffer (args: [marker text])"},
35 {"filter", jt_dbg_filter, 0, "filter certain messages (args: subsystem/debug ID)\n"},
36 {"show", jt_dbg_show, 0, "enable certain messages (args: subsystem/debug ID)\n"},
37 {"list", jt_dbg_list, 0, "list subsystem and debug types (args: subs or types)\n"},
38 {"modules", jt_dbg_modules, 0, "provide gdb-friendly module info (arg: <path>)"},
39 {"panic", jt_dbg_panic, 0, "cause the kernel to panic"},
40 {"dump", jt_ioc_dump, 0, "usage: dump file, save ioctl buffer to file"},
41 {"help", Parser_help, 0, "help"},
42 {"exit", Parser_quit, 0, "quit"},
43 {"quit", Parser_quit, 0, "quit"},
47 int main(int argc, char **argv)
51 rc = libcfs_arch_init();
55 rc = dbg_initialize(argc, argv);
59 register_ioc_dev(LNET_DEV_ID, LNET_DEV_PATH,
60 LNET_DEV_MAJOR, LNET_DEV_MINOR);
62 Parser_init("debugctl > ", list);
64 rc = Parser_execarg(argc - 1, &argv[1], list);
65 unregister_ioc_dev(LNET_DEV_ID);
71 unregister_ioc_dev(LNET_DEV_ID);
74 libcfs_arch_cleanup();