| 1487 | */ |
| 1488 | |
| 1489 | void _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 | /* |
nothing calls this directly
no test coverage detected