Removed debugging statements.

This commit is contained in:
Heiko Reese
2021-08-20 01:04:19 +02:00
parent 4ff77be04a
commit d8b209ba33
3 changed files with 34 additions and 25 deletions

26
src/debug_helpers.c Normal file
View File

@ -0,0 +1,26 @@
/*
* Convert a string to its hexadecimal representation.
*
* Use like this:
* log_write(0, LOG_MAIN, "DEBUG: %s", string2hex(var, var_len));
*/
char * string2hex(unsigned char * input, size_t length) {
const int growth = 3;
char * outstring = store_get(growth*length+1);
memset(outstring, 0, 3*length+1);
for (int i =0; i<length; i++) {
sprintf(outstring+i*growth, "%02x ", input[i]);
}
return outstring;
}
/*
* How to debug this library:
*
* 1. Add this code to the first “breakpoint”:
* log_write(0, LOG_MAIN, "pid: %d", getpid()); int busywait = 0; while (busywait == 0) {}
* 2. Compile.
* 3. Run “exim -be […]” to call the lib; see simple_exim_test.sh for details.
* 4. Read exim pid from log output. Attach to the looping exim process with “gdb -p PID”
* 5. Prepare breakpoints, watches, etc. Set busywait to 1 and continue.
*/