diff options
author | Stan Shebs <shebs@codesourcery.com> | 2012-03-06 22:48:53 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 2012-03-06 22:48:53 +0000 |
commit | 2b03b41d6ac4781c8aac2baa37e9ec282dd0d2b0 (patch) | |
tree | 132fc8ce2c9fd9b998bc772902d0368cd81d8193 /gdb/mi/mi-cmds.c | |
parent | 3ce231f8e2a12502728fbebf0ddfaa690e986154 (diff) | |
download | gdb-2b03b41d6ac4781c8aac2baa37e9ec282dd0d2b0.zip gdb-2b03b41d6ac4781c8aac2baa37e9ec282dd0d2b0.tar.gz gdb-2b03b41d6ac4781c8aac2baa37e9ec282dd0d2b0.tar.bz2 |
* mi/mi-cmd-break.c: Enforce coding standards, fix comments.
* mi/mi-cmd-disas.c: Ditto.
* mi/mi-cmd-env.c: Ditto.
* mi/mi-cmd-file.c: Ditto.
* mi/mi-cmd-stack.c: Ditto.
* mi/mi-cmd-target.c: Ditto.
* mi/mi-cmd-var.c: Ditto.
* mi/mi-cmds.c: Ditto.
* mi/mi-cmds.h: Ditto.
* mi/mi-console.c: Ditto.
* mi/mi-getopt.c: Ditto.
* mi/mi-getopt.h: Ditto.
* mi/mi-interp.c: Ditto.
* mi/mi-main.c: Ditto.
* mi/mi-out.c: Ditto.
* mi/mi-parse.c: Ditto.
* mi/mi-parse.h: Ditto.
* mi/mi-symbol-cmds.c: Ditto.
* mi/mi-getopt.h: Move mi_opt struct up.
* mi/mi-main.c (captured_mi_execute_command): Remove redundant
return.
* mi/mi-out.c (_initialize_mi_out): Remove empty initialize.
Diffstat (limited to 'gdb/mi/mi-cmds.c')
-rw-r--r-- | gdb/mi/mi-cmds.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c index 81648a7..9152489 100644 --- a/gdb/mi/mi-cmds.c +++ b/gdb/mi/mi-cmds.c @@ -1,5 +1,4 @@ /* MI Command Set for GDB, the GNU debugger. - Copyright (C) 2000-2001, 2003, 2007-2012 Free Software Foundation, Inc. @@ -26,11 +25,11 @@ #include "gdb_string.h" extern void _initialize_mi_cmds (void); + struct mi_cmd; static struct mi_cmd **lookup_table (const char *command); static void build_table (struct mi_cmd *commands); - struct mi_cmd mi_cmds[] = { { "ada-task-info", { NULL, 0 }, mi_cmd_ada_task_info }, @@ -140,24 +139,25 @@ struct mi_cmd mi_cmds[] = { NULL, } }; -/* Pointer to the mi command table (built at run time) */ +/* Pointer to the mi command table (built at run time). */ static struct mi_cmd **mi_table; -/* A prime large enough to accomodate the entire command table */ +/* A prime large enough to accomodate the entire command table. */ enum { MI_TABLE_SIZE = 227 }; -/* Exported function used to obtain info from the table */ +/* Exported function used to obtain info from the table. */ struct mi_cmd * mi_lookup (const char *command) { return *lookup_table (command); } -/* stat collecting */ +/* Used for collecting hash hit/miss statistics. */ + struct mi_cmd_stats { int hit; @@ -166,20 +166,21 @@ struct mi_cmd_stats }; struct mi_cmd_stats stats; -/* our lookup function */ +/* Look up a command. */ + static struct mi_cmd ** lookup_table (const char *command) { const char *chp; unsigned int index = 0; - /* compute our hash */ + /* Compute our hash. */ for (chp = command; *chp; chp++) { - /* some what arbitrary */ + /* We use a somewhat arbitrary formula. */ index = ((index << 6) + (unsigned int) *chp) % MI_TABLE_SIZE; } - /* look it up */ + while (1) { struct mi_cmd **entry = &mi_table[index]; @@ -218,6 +219,7 @@ build_table (struct mi_cmd *commands) _("command `%s' appears to be duplicated"), command->name); *entry = command; + /* FIXME lose these prints */ if (0) { fprintf_unfiltered (gdb_stdlog, "%-30s %2d\n", |