~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to dbug/dbug.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
455
455
  rel= control[0] == '+' || control[0] == '-';
456
456
  if ((!rel || (!stack->out_file && !stack->next)))
457
457
  {
458
 
    /*
459
 
      We need to free what's already in init_settings, because unlike
460
 
      the thread related stack frames there's a chance that something
461
 
      is in these variables already.
462
 
    */
463
 
    if (stack == &init_settings)
464
 
      FreeState(cs, stack, 0);
 
458
    /* Free memory associated with the state before resetting its members */
 
459
    FreeState(cs, stack, 0);
465
460
    stack->flags= 0;
466
461
    stack->delay= 0;
467
462
    stack->maxdepth= 0;
749
744
  CODE_STATE tmp_cs;
750
745
  bzero((uchar*) &tmp_cs, sizeof(tmp_cs));
751
746
  tmp_cs.stack= &init_settings;
 
747
  tmp_cs.process= db_process ? db_process : "dbug";
752
748
  DbugParse(&tmp_cs, control);
753
749
}
754
750
 
1447
1443
  struct settings *new_malloc;
1448
1444
 
1449
1445
  new_malloc= (struct settings *) DbugMalloc(sizeof(struct settings));
 
1446
  bzero(new_malloc, sizeof(struct settings));
1450
1447
  new_malloc->next= cs->stack;
1451
 
  new_malloc->out_file= NULL;
1452
1448
  cs->stack= new_malloc;
1453
1449
}
1454
1450
 
1957
1953
 
1958
1954
static void DBUGCloseFile(CODE_STATE *cs, FILE *fp)
1959
1955
{
1960
 
  if (fp != stderr && fp != stdout && fclose(fp) == EOF)
 
1956
  if (fp != NULL && fp != stderr && fp != stdout && fclose(fp) == EOF)
1961
1957
  {
1962
1958
    pthread_mutex_lock(&THR_LOCK_dbug);
1963
1959
    (void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process);
2272
2268
} /* dbug_flush */
2273
2269
 
2274
2270
 
 
2271
void _db_flush_()
 
2272
{
 
2273
  CODE_STATE *cs= NULL;
 
2274
  get_code_state_or_return;
 
2275
  (void) fflush(cs->stack->out_file);
 
2276
}
 
2277
 
 
2278
 
 
2279
#ifndef __WIN__
 
2280
void _db_suicide_()
 
2281
{
 
2282
  int retval;
 
2283
  sigset_t new_mask;
 
2284
  sigfillset(&new_mask);
 
2285
 
 
2286
  fprintf(stderr, "SIGKILL myself\n");
 
2287
  fflush(stderr);
 
2288
 
 
2289
  retval= kill(getpid(), SIGKILL);
 
2290
  assert(retval == 0);
 
2291
  retval= sigsuspend(&new_mask);
 
2292
  fprintf(stderr, "sigsuspend returned %d errno %d \n", retval, errno);
 
2293
  assert(FALSE); /* With full signal mask, we should never return here. */
 
2294
}
 
2295
#endif  /* ! __WIN__ */
 
2296
 
 
2297
 
2275
2298
void _db_lock_file_()
2276
2299
{
2277
2300
  CODE_STATE *cs=0;