用sprintf 函数输出字符1,字符2 分两次输出简单方法记录:
如下示范代码:
static void xxxxxxxxxx(log_t* log, pid_t tid, uintptr_t addr, bool at_fault) {
char code_buffer[64]; /* actual 8+1+((8+1)*4) + 1 == 45 /
。。。。。。。。。。。
while (p < end) {
char asc_out = ascii_buffer;
**sprintf(code_buffer, "%08x ", p);**
int i;
for (i = 0; i < 4; i++) {
/*
* If we see (data == -1 && errno != 0), we know that the ptrace
* call failed, probably because we're dumping memory in an
* unmapped or inaccessible page. I don't know if there's
* value in making that explicit in the output -- it likely
* just complicates parsing and clarifies nothing for the
* enlightened reader.
*/
long data = ptrace(PTRACE_PEEKTEXT, tid, (void*)p, NULL);
**sprintf(code_buffer + strlen(code_buffer), "%08lx ", data);**
。。。。。。。