mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
edc30b12ea
Or for blackbox tests --gdb1=<subdaemon> / --gdb2=<subdaemon>. This makes the subdaemon wait as soon as it's execed, so we can attach the debugger. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
22 lines
428 B
C
22 lines
428 B
C
#include <ccan/str/str.h>
|
|
#include <lightningd/debug.h>
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
void subdaemon_debug(int argc, char *argv[])
|
|
{
|
|
int i;
|
|
bool printed = false;
|
|
|
|
/* From debugger, tell gdb "return". */
|
|
for (i = 1; i < argc; i++) {
|
|
while (streq(argv[i], "--debugger")) {
|
|
if (!printed)
|
|
fprintf(stderr, "gdb -ex 'attach %u' %s\n",
|
|
getpid(), argv[0]);
|
|
printed = true;
|
|
}
|
|
}
|
|
}
|