MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / debug_sprintf_do

Function debug_sprintf_do

src/debug.cpp:9548–9654  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9546}
9547
9548static void debug_sprintf_do(uae_u32 s)
9549{
9550 int cnt = 0;
9551 char format[MAX_DPATH];
9552 char out[MAX_DPATH];
9553 read_string(format, MAX_DPATH - 1, s);
9554 char *p = format;
9555 char *d = out;
9556 bool gotm = false;
9557 bool l = false;
9558 uaecptr ptr = debugsprintf_va;
9559 struct dsprintfstack *stack = debugsprintf_stack;
9560 char fstr[100], *fstrp;
9561 int buffersize = MAX_DPATH - 1;
9562 fstrp = fstr;
9563 *d = 0;
9564 for (;;) {
9565 char c = *p++;
9566 if (c == 0)
9567 break;
9568 if (gotm) {
9569 bool got = false;
9570 buffersize = MAX_DPATH - uaestrlen(out);
9571 if (buffersize <= 1)
9572 break;
9573 if (c == '%') {
9574 *d++ = '%';
9575 gotm = false;
9576 } else if (c == 'l') {
9577 l = true;
9578 } else if (c == 'c') {
9579 uae_u32 size;
9580 uae_u32 val = get_value(&stack, &size, &ptr, l ? sz_long : sz_word);
9581 *fstrp++ = c;
9582 *fstrp = 0;
9583 snprintf(d, buffersize, fstr, val);
9584 got = true;
9585 } else if (c == 'b') {
9586 uae_u32 size;
9587 uae_u32 val = get_value(&stack, &size, &ptr, sz_long);
9588 char tmp[MAX_DPATH];
9589 read_bstring(tmp, MAX_DPATH - 1, val);
9590 *fstrp++ = 's';
9591 *fstrp = 0;
9592 snprintf(d, buffersize, fstr, tmp);
9593 got = true;
9594 } else if (c == 's') {
9595 uae_u32 size;
9596 uae_u32 val = get_value(&stack, &size, &ptr, sz_long);
9597 char tmp[MAX_DPATH];
9598 read_string(tmp, MAX_DPATH - 1, val);
9599 *fstrp++ = c;
9600 *fstrp = 0;
9601 snprintf(d, buffersize, fstr, tmp);
9602 got = true;
9603 } else if (c == 'p') {
9604 uae_u32 size;
9605 uae_u32 val = get_value(&stack, &size, &ptr, sz_long);

Callers 1

debug_sprintfFunction · 0.85

Calls 6

read_stringFunction · 0.85
get_valueFunction · 0.85
snprintfFunction · 0.85
read_bstringFunction · 0.85
parse_customFunction · 0.85
write_logFunction · 0.70

Tested by

no test coverage detected