~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/resolve_stack_dump.c

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include <mystrings/m_ctype.h>
22
22
#include <mysys/my_sys.h>
23
23
#include <mystrings/m_string.h>
 
24
#include <drizzled/version.h>
24
25
#include <errno.h>
25
26
#include <mysys/my_getopt.h>
26
 
#include <stdio.h>
27
27
 
28
28
#define INIT_SYM_TABLE  4096
29
29
#define INC_SYM_TABLE  4096
41
41
 
42
42
static char* dump_fname = 0, *sym_fname = 0;
43
43
static DYNAMIC_ARRAY sym_table; /* how do you like this , static DYNAMIC ? */
44
 
static FILE* fp_dump, *fp_sym = 0, *fp_out;
 
44
static FILE* fp_dump, *fp_sym = 0, *fp_out; 
45
45
 
46
46
static struct my_option my_long_options[] =
47
47
{
63
63
static void print_version(void)
64
64
{
65
65
  printf("%s  Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION,
66
 
         VERSION,SYSTEM_TYPE,MACHINE_TYPE);
 
66
         DRIZZLE_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
67
67
}
68
68
 
69
69
 
95
95
}
96
96
 
97
97
 
98
 
extern "C"
99
 
bool get_one_option(int optid, const struct my_option *, char *)
 
98
static bool
 
99
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
 
100
               char *argument __attribute__((unused)))
100
101
{
101
102
  switch(optid) {
102
103
  case 'V':
153
154
  fp_out = stdout;
154
155
  fp_dump = stdin;
155
156
 
156
 
  if (dump_fname && !(fp_dump= fopen(dump_fname, "r")))
 
157
  if (dump_fname && !(fp_dump = my_fopen(dump_fname, O_RDONLY, MYF(MY_WME))))
157
158
      die("Could not open %s", dump_fname);
158
159
  /* if name not given, assume stdin*/
159
160
 
160
161
  if (!sym_fname)
161
162
    die("Please run nm --numeric-sort on drizzled binary that produced stack \
162
163
trace dump and specify the path to it with -s or --symbols-file");
163
 
  if (!(fp_sym= fopen(sym_fname, "r")))
 
164
  if (!(fp_sym = my_fopen(sym_fname, O_RDONLY, MYF(MY_WME))))
164
165
    die("Could not open %s", sym_fname);
165
166
 
166
167
}
172
173
    return c - '0';
173
174
  l = my_tolower(&my_charset_utf8_general_ci,c);
174
175
  if (l < 'a' || l > 'f')
175
 
    return HEX_INVALID;
 
176
    return HEX_INVALID; 
176
177
  return (unsigned char)10 + ((unsigned char)c - (unsigned char)'a');
177
178
}
178
179
 
185
186
  while((c = hex_val(*p++)) != HEX_INVALID)
186
187
      addr = (addr << 4) + c;
187
188
 
188
 
  *buf = p;
 
189
  *buf = p; 
189
190
  return addr;
190
191
}
191
192