int rt_puts(const char *s) { int res; res = rt_fputs(s, stdout); if (res < 0) return res; return print_to_buffer(stdout, 0, RT_PRINT_MODE_FWRITE, 1, "\n"); }
int rt_fputc(int c, FILE *stream) { unsigned char uc = c; int rc; rc = print_to_buffer(stream, 0, RT_PRINT_MODE_FWRITE, 1, (char *)&uc); if (rc < 0) return EOF; return (int)uc; }
/* os specific loader initialization epilogue after finalizing the load. */ void os_loader_init_epilogue(void) { #ifdef INTERNAL /* Print the add-symbol-file commands so they can be copy-pasted into gdb. * We have to do it in a single syslog so they can be copy pasted. Since * info syslogs are only in internal builds, we only do this work in an * internal build. To debug an external build, we rely on the gdb script to * find text_addr in opd. * FIXME i#531: Support attaching from the gdb script. */ privmod_t *mod; size_t sofar = 0; size_t bufsz = 4096; /* Should be enough, but too much for stack. */ char *buf; /* FIXME: Skip this work if we're not going to print or log. */ ASSERT(dynamo_heap_initialized); ASSERT(!printed_gdb_commands); buf = HEAP_ARRAY_ALLOC(GLOBAL_DCONTEXT, char, bufsz, ACCT_OTHER, PROTECTED); acquire_recursive_lock(&privload_lock); for (mod = privload_first_module(); mod != NULL; mod = privload_next_module(mod)) { os_privmod_data_t *opd = (os_privmod_data_t *) mod->os_privmod_data; /* GDB already finds externally loaded modules (e.g. DR). */ if (mod->externally_loaded) continue; print_to_buffer(buf, bufsz, &sofar, "add-symbol-file '%s' %p\n", mod->path, opd->text_addr); } printed_gdb_commands = true; release_recursive_lock(&privload_lock); if (sofar > 0) { SYSLOG_INTERNAL_INFO("Paste into GDB to debug DynamoRIO clients:\n" /* Need to turn off confirm for paste to work. */ "set confirm off\n" "%s", buf); } HEAP_ARRAY_FREE(GLOBAL_DCONTEXT, buf, char, bufsz, ACCT_OTHER, PROTECTED); #endif /* INTERNAL */ }
size_t rt_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream) { print_to_buffer(stream, 0, RT_PRINT_MODE_FWRITE, size * nmemb, ptr); return nmemb; }
int rt_fputs(const char *s, FILE *stream) { return print_to_buffer(stream, 0, RT_PRINT_MODE_FWRITE, strlen(s), s); }
void AccessFlags::p() const { char buff[1024]; print_to_buffer(buff, CMF); tty->print_cr(buff); }
int rt_puts(const char *s) { return print_to_buffer(stdout, 0, RT_PRINT_MODE_PUTS, s); }