mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
common: move some files out of lightningd/
Basically all files shared by different daemons. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
8375857116
commit
a37c165cb9
30
common/debug.c
Normal file
30
common/debug.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <ccan/str/str.h>
|
||||
#include <common/debug.h>
|
||||
#include <common/dev_disconnect.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void subdaemon_debug(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
bool printed = false;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strstarts(argv[i], "--dev-disconnect=")) {
|
||||
dev_disconnect_init(atoi(argv[i]
|
||||
+ strlen("--dev-disconnect=")));
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user