diff options
author | unknown <monty@hundin.mysql.fi> | 2002-06-03 12:59:31 +0300 |
---|---|---|
committer | unknown <monty@hundin.mysql.fi> | 2002-06-03 12:59:31 +0300 |
commit | f0409fa920c7908f2f9ef03919583a32bf84eaad (patch) | |
tree | be04186411dc657ef6bbcbe01267d30f2675c914 /extra/resolve_stack_dump.c | |
parent | ebbcb0f391d7df364e0ccc6bca706456e9aadbf7 (diff) | |
parent | 7cb2e2d1dce2c7466388f4a6ade0614564be82fc (diff) | |
download | mariadb-git-f0409fa920c7908f2f9ef03919583a32bf84eaad.tar.gz |
merge with 4.0
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
BUILD/SETUP.sh:
Auto merged
BUILD/compile-pentium-debug:
Auto merged
BitKeeper/triggers/post-commit:
Auto merged
configure.in:
Auto merged
Docs/manual.texi:
Auto merged
client/mysql.cc:
Auto merged
client/mysqldump.c:
Auto merged
client/mysqltest.c:
Auto merged
extra/mysql_install.c:
Auto merged
extra/resolve_stack_dump.c:
Auto merged
extra/resolveip.c:
Auto merged
include/my_sys.h:
Auto merged
include/mysqld_error.h:
Auto merged
isam/pack_isam.c:
Auto merged
libmysql/Makefile.shared:
Auto merged
libmysql/libmysql.c:
Auto merged
myisam/ft_dump.c:
Auto merged
myisam/ft_test1.c:
Auto merged
myisam/ftdefs.h:
Auto merged
myisam/mi_check.c:
Auto merged
myisam/mi_test1.c:
Auto merged
myisam/mi_write.c:
Auto merged
myisam/myisamchk.c:
Auto merged
myisam/myisampack.c:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysql-test/r/select_found.result:
Auto merged
mysql-test/t/select_found.test:
Auto merged
mysys/charset.c:
Auto merged
mysys/default.c:
Auto merged
mysys/hash.c:
Auto merged
sql/field.cc:
Auto merged
sql/gen_lex_hash.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/hostname.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_timefunc.h:
Auto merged
sql/lex.h:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/repl_failsafe.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_string.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_union.cc:
Auto merged
sql/share/czech/errmsg.txt:
Auto merged
sql/share/danish/errmsg.txt:
Auto merged
sql/share/dutch/errmsg.txt:
Auto merged
sql/share/english/errmsg.txt:
Auto merged
sql/share/estonian/errmsg.txt:
Auto merged
sql/share/german/errmsg.txt:
Auto merged
sql/share/greek/errmsg.txt:
Auto merged
sql/share/hungarian/errmsg.txt:
Auto merged
sql/share/italian/errmsg.txt:
Auto merged
sql/share/japanese/errmsg.txt:
Auto merged
sql/share/korean/errmsg.txt:
Auto merged
sql/share/norwegian-ny/errmsg.txt:
Auto merged
sql/share/norwegian/errmsg.txt:
Auto merged
sql/sql_update.cc:
Auto merged
sql/structs.h:
Auto merged
sql/share/polish/errmsg.txt:
Auto merged
sql/share/portuguese/errmsg.txt:
Auto merged
sql/share/romanian/errmsg.txt:
Auto merged
sql/share/russian/errmsg.txt:
Auto merged
sql/share/slovak/errmsg.txt:
Auto merged
sql/share/spanish/errmsg.txt:
Auto merged
sql/share/swedish/errmsg.txt:
Auto merged
sql/share/ukrainian/errmsg.txt:
Auto merged
strings/Makefile.am:
Auto merged
strings/ctype-ujis.c:
Auto merged
tools/mysqlmanager.c:
Auto merged
Diffstat (limited to 'extra/resolve_stack_dump.c')
-rw-r--r-- | extra/resolve_stack_dump.c | 80 |
1 files changed, 38 insertions, 42 deletions
diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index 7d1d125ec7e..e606f38d179 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -25,12 +25,12 @@ #include <m_string.h> #include <mysql_version.h> #include <errno.h> -#include <getopt.h> +#include <my_getopt.h> #define INIT_SYM_TABLE 4096 #define INC_SYM_TABLE 4096 #define MAX_SYM_SIZE 128 -#define DUMP_VERSION "1.2" +#define DUMP_VERSION "1.4" #define HEX_INVALID (uchar)255 typedef ulong my_long_addr_t ; /* at some point, we need to fix configure @@ -48,15 +48,21 @@ static char* dump_fname = 0, *sym_fname = 0; static DYNAMIC_ARRAY sym_table; /* how do you like this , static DYNAMIC ? */ static FILE* fp_dump, *fp_sym = 0, *fp_out; -struct option long_options[] = +static struct my_option my_long_options[] = { - {"help", no_argument, 0, 'h'}, - {"version", no_argument, 0, 'V'}, - {"symbols-file", required_argument, 0, 's'}, - {"numeric-dump-file", required_argument, 0, 'n'}, - {0, 0,0,0} + {"help", 'h', "Display this help and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Output version information and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"symbols-file", 's', "Use specified symbols file.", (gptr*) &sym_fname, + (gptr*) &sym_fname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"numeric-dump-file", 'n', "Read the dump from specified file.", + (gptr*) &dump_fname, (gptr*) &dump_fname, 0, GET_STR, REQUIRED_ARG, + 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; + static void verify_sort(); static void print_version(void) @@ -72,11 +78,8 @@ static void usage() printf("This software comes with ABSOLUTELY NO WARRANTY\n\n"); printf("Resolve numeric stack strace dump into symbols.\n\n"); printf("Usage: %s [OPTIONS] symbols-file [numeric-dump-file]\n", my_progname); - printf("\n\ - -?, --help Display this help and exit.\n\ - -s, --symbols-file=... Use specified symbols file.\n\ - -n, --numeric-dump-file=... Read the dump from specified file.\n\ - -V, --version Output version information and exit.\n"); + my_print_help(my_long_options); + my_print_variables(my_long_options); printf("\n\ The symbols-file should include the output from: 'nm --numeric-sort mysqld'.\n\ The numeric-dump-file should contain a numeric stack trace from mysqld.\n\ @@ -97,40 +100,33 @@ static void die(const char* fmt, ...) } -static int parse_args(int argc, char **argv) +static my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument __attribute__((unused))) { - int c, option_index = 0; + switch(optid) { + case 'V': + print_version(); + exit(0); + case '?': + usage(); + exit(0); + } + return 0; +} - while((c = getopt_long(argc, argv, "?Vn:s:", - long_options, &option_index)) != EOF) - { - switch(c) - { - case 'n': - dump_fname = optarg; - break; - case 's': - sym_fname = optarg; - break; - case 'V': - print_version(); - exit(0); - case '?': - usage(); - exit(0); - default: - usage(); - exit(1); - } - } - argc-=optind; - argv+=optind; +static int parse_args(int argc, char **argv) +{ + int ho_error; + + if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) + exit(ho_error); /* The following code is to make the command compatible with the old version that required one to use the -n and -s options - */ + */ if (argc == 2) { @@ -230,9 +226,9 @@ static int init_sym_entry(SYM_ENTRY* se, char* buf) static void init_sym_table() { char buf[512]; - if(init_dynamic_array(&sym_table, sizeof(SYM_ENTRY), INIT_SYM_TABLE, + if(my_init_dynamic_array(&sym_table, sizeof(SYM_ENTRY), INIT_SYM_TABLE, INC_SYM_TABLE)) - die("Failed in init_dynamic_array() -- looks like out of memory problem"); + die("Failed in my_init_dynamic_array() -- looks like out of memory problem"); while(fgets(buf, sizeof(buf), fp_sym)) { |