MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / DbugParse

Function DbugParse

dbug/dbug.c:499–772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497 */
498
499int DbugParse(CODE_STATE *cs, const char *control)
500{
501 const char *end;
502 int rel, f_used=0;
503 struct settings *stack;
504
505 /*
506 Make sure we are not changing settings while inside a
507 DBUG_LOCK_FILE
508 DBUG_UNLOCK_FILE
509 section, that is a mis use, that would cause changing
510 DBUG_FILE while the caller prints to it.
511 */
512 assert(! cs->locked);
513
514 stack= cs->stack;
515
516 /*
517 When parsing the global init_settings itself,
518 make sure to block every other thread using dbug functions.
519 */
520 assert(cs->m_read_lock_count == 0);
521 if (stack == &init_settings)
522 rw_wrlock(&THR_LOCK_init_settings);
523
524 if (control[0] == '-' && control[1] == '#')
525 control+=2;
526
527 rel= control[0] == '+' || control[0] == '-';
528 if ((!rel || (!stack->out_file && !stack->next)))
529 {
530 /* Free memory associated with the state before resetting its members */
531 FreeState(cs, stack, 0);
532 stack->flags= 0;
533 stack->delay= 0;
534 stack->maxdepth= 0;
535 stack->sub_level= 0;
536 stack->out_file= stderr;
537 stack->prof_file= NULL;
538 stack->functions= NULL;
539 stack->p_functions= NULL;
540 stack->keywords= NULL;
541 stack->processes= NULL;
542 }
543 else if (!stack->out_file)
544 {
545 stack->flags= stack->next->flags;
546 stack->delay= stack->next->delay;
547 stack->maxdepth= stack->next->maxdepth;
548 stack->sub_level= stack->next->sub_level;
549 strcpy(stack->name, stack->next->name);
550 stack->prof_file= stack->next->prof_file;
551 if (stack->next == &init_settings)
552 {
553 assert(stack != &init_settings);
554 rw_rdlock(&THR_LOCK_init_settings);
555
556 /*

Callers 3

_db_set_Function · 0.85
_db_push_Function · 0.85
_db_set_init_Function · 0.85

Calls 7

FreeStateFunction · 0.85
ListCopyFunction · 0.85
DbugStrTokFunction · 0.85
FreeListFunction · 0.85
atoiFunction · 0.85
DBUGCloseFileFunction · 0.85
DBUGOpenFileFunction · 0.85

Tested by

no test coverage detected