~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/resolve_stack_dump.cc

  • Committer: Monty Taylor
  • Date: 2009-05-09 22:13:47 UTC
  • mto: This revision was merged to the branch mainline in revision 1009.
  • Revision ID: mordred@inaugust.com-20090509221347-l712szviusbobro0
Re-added bitset<> as a replacement for Bitmap<>

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>
25
24
#include <errno.h>
26
25
#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
 
         DRIZZLE_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
 
66
         VERSION,SYSTEM_TYPE,MACHINE_TYPE);
67
67
}
68
68
 
69
69
 
95
95
}
96
96
 
97
97
 
98
 
static bool
99
 
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
100
 
               char *argument __attribute__((unused)))
 
98
extern "C"
 
99
bool get_one_option(int optid, const struct my_option *, char *)
101
100
{
102
101
  switch(optid) {
103
102
  case 'V':
154
153
  fp_out = stdout;
155
154
  fp_dump = stdin;
156
155
 
157
 
  if (dump_fname && !(fp_dump = my_fopen(dump_fname, O_RDONLY, MYF(MY_WME))))
 
156
  if (dump_fname && !(fp_dump= fopen(dump_fname, "r")))
158
157
      die("Could not open %s", dump_fname);
159
158
  /* if name not given, assume stdin*/
160
159
 
161
160
  if (!sym_fname)
162
161
    die("Please run nm --numeric-sort on drizzled binary that produced stack \
163
162
trace dump and specify the path to it with -s or --symbols-file");
164
 
  if (!(fp_sym = my_fopen(sym_fname, O_RDONLY, MYF(MY_WME))))
 
163
  if (!(fp_sym= fopen(sym_fname, "r")))
165
164
    die("Could not open %s", sym_fname);
166
165
 
167
166
}
173
172
    return c - '0';
174
173
  l = my_tolower(&my_charset_utf8_general_ci,c);
175
174
  if (l < 'a' || l > 'f')
176
 
    return HEX_INVALID; 
 
175
    return HEX_INVALID;
177
176
  return (unsigned char)10 + ((unsigned char)c - (unsigned char)'a');
178
177
}
179
178
 
186
185
  while((c = hex_val(*p++)) != HEX_INVALID)
187
186
      addr = (addr << 4) + c;
188
187
 
189
 
  *buf = p; 
 
188
  *buf = p;
190
189
  return addr;
191
190
}
192
191