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

Function _db_dump_

dbug/dbug.c:1489–1537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1487 */
1488
1489void _db_dump_(uint _line_, const char *keyword,
1490 const unsigned char *memory, size_t length)
1491{
1492 int pos;
1493 CODE_STATE *cs;
1494 get_code_state_or_return;
1495
1496 /* Dirty read, for DBUG_DUMP() performance. */
1497 if (! DEBUGGING)
1498 return;
1499
1500 read_lock_stack(cs);
1501
1502 if (_db_keyword_(cs, keyword, 0))
1503 {
1504 if (!cs->locked)
1505 pthread_mutex_lock(&THR_LOCK_dbug);
1506 DoPrefix(cs, _line_);
1507 if (TRACING)
1508 {
1509 Indent(cs, cs->level + 1);
1510 pos= MY_MIN(MY_MAX(cs->level-cs->stack->sub_level,0)*INDENT,80);
1511 }
1512 else
1513 {
1514 fprintf(cs->stack->out_file, "%s: ", cs->func);
1515 }
1516 (void) fprintf(cs->stack->out_file, "%s: Memory: 0x%lx Bytes: (%ld)\n",
1517 keyword, (ulong) memory, (long) length);
1518
1519 pos=0;
1520 while (length-- > 0)
1521 {
1522 uint tmp= *((unsigned char*) memory++);
1523 if ((pos+=3) >= 80)
1524 {
1525 fputc('\n',cs->stack->out_file);
1526 pos=3;
1527 }
1528 fputc(_dig_vec_upper[((tmp >> 4) & 15)], cs->stack->out_file);
1529 fputc(_dig_vec_upper[tmp & 15], cs->stack->out_file);
1530 fputc(' ',cs->stack->out_file);
1531 }
1532 (void) fputc('\n',cs->stack->out_file);
1533 DbugFlush(cs);
1534 }
1535
1536 unlock_stack(cs);
1537}
1538
1539
1540/*

Callers

nothing calls this directly

Calls 6

read_lock_stackFunction · 0.85
_db_keyword_Function · 0.85
DoPrefixFunction · 0.85
IndentFunction · 0.85
DbugFlushFunction · 0.85
unlock_stackFunction · 0.85

Tested by

no test coverage detected