Skip to content

Commit

Permalink
executor: move debug_dump_data() into common_linux.h
Browse files Browse the repository at this point in the history
Compiling the executor on OpenBSD currently fails:

  executor/executor.cc:1316:6: error: unused function 'debug_dump_data'
  • Loading branch information
mptre authored and dvyukov committed Sep 20, 2018
1 parent 25ff1e1 commit 5f78ab4
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
12 changes: 12 additions & 0 deletions executor/common_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ struct cover_t;
static void cover_reset(cover_t* cov);
#endif

static void debug_dump_data(const char* data, int length)
{
if (!flag_debug)
return;
for (int i = 0; i < length; i++) {
debug("%02x ", data[i] & 0xff);
if (i % 16 == 15)
debug("\n");
}
debug("\n");
}

#if SYZ_EXECUTOR || SYZ_THREADED
#include <linux/futex.h>
#include <pthread.h>
Expand Down
13 changes: 0 additions & 13 deletions executor/executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ static NORETURN PRINTF void error(const char* msg, ...);
static NORETURN PRINTF void exitf(const char* msg, ...);
// Print debug output, does not add \n at the end of msg as opposed to the previous functions.
static PRINTF void debug(const char* msg, ...);
static void debug_dump_data(const char* data, int length);
static NORETURN void doexit(int status);

static void receive_execute();
Expand Down Expand Up @@ -1312,15 +1311,3 @@ void debug(const char* msg, ...)
va_end(args);
fflush(stderr);
}

void debug_dump_data(const char* data, int length)
{
if (!flag_debug)
return;
for (int i = 0; i < length; i++) {
debug("%02x ", data[i] & 0xff);
if (i % 16 == 15)
debug("\n");
}
debug("\n");
}
12 changes: 12 additions & 0 deletions pkg/csource/generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,18 @@ struct cover_t;
static void cover_reset(cover_t* cov);
#endif
static void debug_dump_data(const char* data, int length)
{
if (!flag_debug)
return;
for (int i = 0; i < length; i++) {
debug("%02x ", data[i] & 0xff);
if (i % 16 == 15)
debug("\n");
}
debug("\n");
}
#if SYZ_EXECUTOR || SYZ_THREADED
#include <linux/futex.h>
#include <pthread.h>
Expand Down

0 comments on commit 5f78ab4

Please sign in to comment.