MCPcopy Create free account
hub / github.com/GJDuck/e9patch / entry

Function entry

examples/print.c:24–51  ·  view source on GitHub ↗

* Entry point. */

Source from the content-addressed store, hash-verified

22 * Entry point.
23 */
24void entry(const void *addr, const uint8_t *instr, size_t size,
25 const char *_asm)
26{
27 static mutex_t mutex = MUTEX_INITIALIZER;
28 if (mutex_lock(&mutex) < 0)
29 return;
30
31 clearerr(stderr);
32 fprintf(stderr, RED "%.16lx" WHITE ": " YELLOW, addr);
33 int i;
34 for (i = 0; i < size; i++)
35 {
36 fprintf(stderr, "%.2x ", instr[i]);
37 if (i == 7 && size > 8)
38 fprintf(stderr, GREEN "%s" WHITE "\n "
39 YELLOW, _asm);
40 }
41 if (i <= 8)
42 {
43 for (; i < 8; i++)
44 fputs(" ", stderr);
45 fprintf(stderr, GREEN "%s", _asm);
46 }
47 fputs(WHITE "\n", stderr);
48 fflush(stderr);
49
50 mutex_unlock(&mutex);
51}
52
53/*
54 * Init.

Callers

nothing calls this directly

Calls 6

mutex_lockFunction · 0.85
clearerrFunction · 0.85
fputsFunction · 0.85
fflushFunction · 0.85
mutex_unlockFunction · 0.85
fprintfFunction · 0.70

Tested by

no test coverage detected