mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
plugins: allow --dev-debugger=<pluginname>.
This currently just invokes GDB, but we could generalize it (though pdb doesn't allow attaching to a running process, other python debuggers seem to). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -37,19 +37,10 @@ void subdaemon_setup(int argc, char *argv[])
|
||||
logging_io = true;
|
||||
}
|
||||
|
||||
daemon_maybe_debug(argc, argv);
|
||||
|
||||
#if DEVELOPER
|
||||
/* From debugger, set debugger_spin to 0. */
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (streq(argv[i], "--debugger")) {
|
||||
char *cmd = tal_fmt(NULL, "${DEBUG_TERM:-gnome-terminal --} gdb -ex 'attach %u' %s &", getpid(), argv[0]);
|
||||
fprintf(stderr, "Running %s\n", cmd);
|
||||
/* warn_unused_result is fascist bullshit.
|
||||
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 */
|
||||
if (system(cmd))
|
||||
;
|
||||
/* Continue in the debugger. */
|
||||
kill(getpid(), SIGSTOP);
|
||||
}
|
||||
if (strstarts(argv[i], "--dev-disconnect=")) {
|
||||
dev_disconnect_init(atoi(argv[i]
|
||||
+ strlen("--dev-disconnect=")));
|
||||
|
||||
Reference in New Issue
Block a user