aboutsummaryrefslogtreecommitdiff
path: root/src/afl-showmap.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-06-28 22:50:18 +0200
committervan Hauser <vh@thc.org>2020-06-28 22:50:18 +0200
commit81974c4d5e63211744153f2ebcfb246046edbc5b (patch)
tree7bfd8f6fc9b9d63a1f54349e3e72a15861c0d1c5 /src/afl-showmap.c
parent5f3b7e6cdffe25f4d8e53115db3f47dcf8f8ab6e (diff)
downloadafl++-81974c4d5e63211744153f2ebcfb246046edbc5b.tar.gz
debug code
Diffstat (limited to 'src/afl-showmap.c')
-rw-r--r--src/afl-showmap.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/afl-showmap.c b/src/afl-showmap.c
index 24e83721..994d80eb 100644
--- a/src/afl-showmap.c
+++ b/src/afl-showmap.c
@@ -890,10 +890,13 @@ int main(int argc, char **argv_orig, char **envp) {
struct dirent *dir_ent;
int done = 0;
u8 infile[PATH_MAX], outfile[PATH_MAX];
+ u8 wait_for_gdb = 0;
#if !defined(DT_REG)
struct stat statbuf;
#endif
+ if (getenv("AFL_DEBUG_GDB")) wait_for_gdb = 1;
+
fsrv->dev_null_fd = open("/dev/null", O_RDWR);
if (fsrv->dev_null_fd < 0) { PFATAL("Unable to open /dev/null"); }
@@ -982,6 +985,12 @@ int main(int argc, char **argv_orig, char **envp) {
if (read_file(infile)) {
+ if (wait_for_gdb) {
+ fprintf(stderr, "exec: gdb -p %d\n", fsrv->child_pid);
+ fprintf(stderr, "exec: kill -CONT %d\n", getpid());
+ kill(0, SIGSTOP);
+ }
+
showmap_run_target_forkserver(fsrv, use_argv, in_data, in_len);
ck_free(in_data);
tcnt = write_results_to_file(fsrv, outfile);