Changeset 875c629 in mainline for kernel/generic/src/console/cmd.c


Ignore:
Timestamp:
2011-01-27T17:19:49Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
577f042a, f579760
Parents:
bf75e3cb (diff), 5b7a107 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge 'btrace' kernel console command (a last resort debugging means for printing uspace stack traces from within kernel console)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    rbf75e3cb r875c629  
    7878static cmd_info_t help_info = {
    7979        .name = "help",
    80         .description = "List of supported commands.",
     80        .description = "List supported commands.",
    8181        .func = cmd_help,
    8282        .argc = 0
    8383};
    8484
     85/* Data and methods for 'reboot' command. */
    8586static int cmd_reboot(cmd_arg_t *argv);
    8687static cmd_info_t reboot_info = {
    8788        .name = "reboot",
    88         .description = "Reboot.",
     89        .description = "Reboot system.",
    8990        .func = cmd_reboot,
    9091        .argc = 0
    9192};
    9293
     94/* Data and methods for 'uptime' command. */
    9395static int cmd_uptime(cmd_arg_t *argv);
    9496static cmd_info_t uptime_info = {
    9597        .name = "uptime",
    96         .description = "Print uptime information.",
     98        .description = "Show system uptime.",
    9799        .func = cmd_uptime,
    98100        .argc = 0
    99101};
    100102
     103/* Data and methods for 'continue' command. */
    101104static int cmd_continue(cmd_arg_t *argv);
    102105static cmd_info_t continue_info = {
     
    108111
    109112#ifdef CONFIG_TEST
     113
     114/* Data and methods for 'test' command. */
    110115static char test_buf[MAX_CMDLINE + 1];
    111116static int cmd_test(cmd_arg_t *argv);
     
    119124static cmd_info_t test_info = {
    120125        .name = "test",
    121         .description = "Print list of kernel tests or run a test.",
     126        .description = "<test> List kernel tests or run a test.",
    122127        .func = cmd_test,
    123128        .argc = 1,
     
    125130};
    126131
     132/* Data and methods for 'bench' command. */
    127133static int cmd_bench(cmd_arg_t *argv);
    128134static cmd_arg_t bench_argv[] = {
     
    138144static cmd_info_t bench_info = {
    139145        .name = "bench",
    140         .description = "Run kernel test as benchmark.",
     146        .description = "<test> <count> Run kernel test as benchmark.",
    141147        .func = cmd_bench,
    142148        .argc = 2,
    143149        .argv = bench_argv
    144150};
    145 #endif
     151
     152#endif /* CONFIG_TEST */
    146153
    147154/* Data and methods for 'description' command. */
    148155static int cmd_desc(cmd_arg_t *argv);
    149156static void desc_help(void);
    150 static char desc_buf[MAX_CMDLINE+1];
     157static char desc_buf[MAX_CMDLINE + 1];
    151158static cmd_arg_t desc_argv = {
    152159        .type = ARG_TYPE_STRING,
     
    156163static cmd_info_t desc_info = {
    157164        .name = "describe",
    158         .description = "Describe specified command.",
     165        .description = "<command> Describe specified command.",
    159166        .help = desc_help,
    160167        .func = cmd_desc,
     
    165172/* Data and methods for 'symaddr' command. */
    166173static int cmd_symaddr(cmd_arg_t *argv);
    167 static char symaddr_buf[MAX_CMDLINE+1];
     174static char symaddr_buf[MAX_CMDLINE + 1];
    168175static cmd_arg_t symaddr_argv = {
    169176        .type = ARG_TYPE_STRING,
     
    173180static cmd_info_t symaddr_info = {
    174181        .name = "symaddr",
    175         .description = "Return symbol address.",
     182        .description = "<symbol> Return symbol address.",
    176183        .func = cmd_symaddr,
    177184        .argc = 1,
     
    179186};
    180187
    181 static char set_buf[MAX_CMDLINE+1];
     188/* Data and methods for 'set4' command. */
     189static char set_buf[MAX_CMDLINE + 1];
    182190static int cmd_set4(cmd_arg_t *argv);
    183191static cmd_arg_t set4_argv[] = {
     
    193201static cmd_info_t set4_info = {
    194202        .name = "set4",
    195         .description = "set <dest_addr> <value> - 4byte version",
     203        .description = "<addr> <value> Set 4B memory location to a value.",
    196204        .func = cmd_set4,
    197205        .argc = 2,
     
    213221static cmd_info_t call0_info = {
    214222        .name = "call0",
    215         .description = "call0 <function> -> call function().",
     223        .description = "<function> Call function().",
    216224        .func = cmd_call0,
    217225        .argc = 1,
     
    228236static cmd_info_t mcall0_info = {
    229237        .name = "mcall0",
    230         .description = "mcall0 <function> -> call function() on each CPU.",
     238        .description = "<function> Call function() on each CPU.",
    231239        .func = cmd_mcall0,
    232240        .argc = 1,
     
    250258static cmd_info_t call1_info = {
    251259        .name = "call1",
    252         .description = "call1 <function> <arg1> -> call function(arg1).",
     260        .description = "<function> <arg1> Call function(arg1).",
    253261        .func = cmd_call1,
    254262        .argc = 2,
     
    277285static cmd_info_t call2_info = {
    278286        .name = "call2",
    279         .description = "call2 <function> <arg1> <arg2> -> call function(arg1,arg2).",
     287        .description = "<function> <arg1> <arg2> Call function(arg1, arg2).",
    280288        .func = cmd_call2,
    281289        .argc = 3,
     
    310318static cmd_info_t call3_info = {
    311319        .name = "call3",
    312         .description = "call3 <function> <arg1> <arg2> <arg3> -> call function(arg1,arg2,arg3).",
     320        .description = "<function> <arg1> <arg2> <arg3> Call function(arg1, arg2, arg3).",
    313321        .func = cmd_call3,
    314322        .argc = 4,
     
    340348cmd_info_t tlb_info = {
    341349        .name = "tlb",
    342         .description = "Print TLB of current processor.",
     350        .description = "Print TLB of the current CPU.",
    343351        .help = NULL,
    344352        .func = cmd_tlb,
     
    377385};
    378386
     387#ifdef CONFIG_UDEBUG
     388
     389/* Data and methods for 'btrace' command */
     390static int cmd_btrace(cmd_arg_t *argv);
     391static cmd_arg_t btrace_argv = {
     392        .type = ARG_TYPE_INT,
     393};
     394static cmd_info_t btrace_info = {
     395        .name = "btrace",
     396        .description = "<threadid> Show thread stack trace.",
     397        .func = cmd_btrace,
     398        .argc = 1,
     399        .argv = &btrace_argv
     400};
     401
     402#endif /* CONFIG_UDEBUG */
    379403
    380404static int cmd_sched(cmd_arg_t *argv);
    381405static cmd_info_t sched_info = {
    382406        .name = "scheduler",
    383         .description = "List all scheduler information.",
     407        .description = "Show scheduler information.",
    384408        .func = cmd_sched,
    385409        .argc = 0
     
    406430static cmd_info_t zones_info = {
    407431        .name = "zones",
    408         .description = "List of memory zones.",
     432        .description = "List memory zones.",
    409433        .func = cmd_zones,
    410434        .argc = 0
     435};
     436
     437/* Data and methods for 'zone' command */
     438static int cmd_zone(cmd_arg_t *argv);
     439static cmd_arg_t zone_argv = {
     440        .type = ARG_TYPE_INT,
     441};
     442
     443static cmd_info_t zone_info = {
     444        .name = "zone",
     445        .description = "<zone> Show memory zone structure.",
     446        .func = cmd_zone,
     447        .argc = 1,
     448        .argv = &zone_argv
    411449};
    412450
     
    418456static cmd_info_t ipc_info = {
    419457        .name = "ipc",
    420         .description = "ipc <taskid> Show IPC information of given task.",
     458        .description = "<taskid> Show IPC information of a task.",
    421459        .func = cmd_ipc,
    422460        .argc = 1,
     
    431469static cmd_info_t kill_info = {
    432470        .name = "kill",
    433         .description = "kill <taskid> Kill a task.",
     471        .description = "<taskid> Kill a task.",
    434472        .func = cmd_kill,
    435473        .argc = 1,
    436474        .argv = &kill_argv
    437 };
    438 
    439 /* Data and methods for 'zone' command */
    440 static int cmd_zone(cmd_arg_t *argv);
    441 static cmd_arg_t zone_argv = {
    442         .type = ARG_TYPE_INT,
    443 };
    444 
    445 static cmd_info_t zone_info = {
    446         .name = "zone",
    447         .description = "Show memory zone structure.",
    448         .func = cmd_zone,
    449         .argc = 1,
    450         .argv = &zone_argv
    451475};
    452476
     
    482506        &cpus_info,
    483507        &desc_info,
    484         &reboot_info,
    485         &uptime_info,
    486508        &halt_info,
    487509        &help_info,
    488510        &ipc_info,
    489511        &kill_info,
     512        &physmem_info,
     513        &reboot_info,
     514        &sched_info,
    490515        &set4_info,
    491516        &slabs_info,
     517        &symaddr_info,
    492518        &sysinfo_info,
    493         &symaddr_info,
    494         &sched_info,
     519        &tasks_info,
    495520        &threads_info,
    496         &tasks_info,
    497         &physmem_info,
    498521        &tlb_info,
     522        &uptime_info,
    499523        &version_info,
    500524        &zones_info,
     
    504528        &bench_info,
    505529#endif
     530#ifdef CONFIG_UDEBUG
     531        &btrace_info,
     532#endif
    506533        NULL
    507534};
     
    530557        }
    531558}
    532 
    533559
    534560/** List supported commands.
     
    574600}
    575601
    576 
    577602/** Reboot the system.
    578603 *
     
    588613        return 1;
    589614}
    590 
    591615
    592616/** Print system uptime information.
     
    824848}
    825849
    826 
    827850/** Print detailed description of 'describe' command. */
    828851void desc_help(void)
     
    911934 * @return Always 1
    912935 */
    913 int cmd_slabs(cmd_arg_t * argv)
     936int cmd_slabs(cmd_arg_t *argv)
    914937{
    915938        slab_print_list();
     
    923946 * @return Always 1
    924947 */
    925 int cmd_sysinfo(cmd_arg_t * argv)
     948int cmd_sysinfo(cmd_arg_t *argv)
    926949{
    927950        sysinfo_dump(NULL);
     
    929952}
    930953
    931 
    932 /** Command for listings Thread information
     954/** Command for listing thread information
    933955 *
    934956 * @param argv Ignored
     
    948970}
    949971
    950 /** Command for listings Task information
     972/** Command for listing task information
    951973 *
    952974 * @param argv Ignored
     
    966988}
    967989
    968 /** Command for listings Thread information
     990#ifdef CONFIG_UDEBUG
     991
     992/** Command for printing thread stack trace
     993 *
     994 * @param argv Integer argument from cmdline expected
     995 *
     996 * return Always 1
     997 *
     998 */
     999int cmd_btrace(cmd_arg_t *argv)
     1000{
     1001        thread_stack_trace(argv[0].intval);
     1002        return 1;
     1003}
     1004
     1005#endif /* CONFIG_UDEBUG */
     1006
     1007/** Command for printing scheduler information
    9691008 *
    9701009 * @param argv Ignores
     
    9721011 * @return Always 1
    9731012 */
    974 int cmd_sched(cmd_arg_t * argv)
     1013int cmd_sched(cmd_arg_t *argv)
    9751014{
    9761015        sched_print_list();
     
    9841023 * return Always 1
    9851024 */
    986 int cmd_zones(cmd_arg_t * argv)
     1025int cmd_zones(cmd_arg_t *argv)
    9871026{
    9881027        zones_print_list();
     
    9961035 * return Always 1
    9971036 */
    998 int cmd_zone(cmd_arg_t * argv)
     1037int cmd_zone(cmd_arg_t *argv)
    9991038{
    10001039        zone_print_one(argv[0].intval);
     
    10021041}
    10031042
    1004 /** Command for printing task ipc details
     1043/** Command for printing task IPC details
    10051044 *
    10061045 * @param argv Integer argument from cmdline expected
     
    10081047 * return Always 1
    10091048 */
    1010 int cmd_ipc(cmd_arg_t * argv)
     1049int cmd_ipc(cmd_arg_t *argv)
    10111050{
    10121051        ipc_print_task(argv[0].intval);
     
    10201059 * return 0 on failure, 1 on success.
    10211060 */
    1022 int cmd_kill(cmd_arg_t * argv)
     1061int cmd_kill(cmd_arg_t *argv)
    10231062{
    10241063        if (task_kill(argv[0].intval) != EOK)
Note: See TracChangeset for help on using the changeset viewer.