MCPcopy Create free account
hub / github.com/ElementsProject/lightning / daemon_maybe_debug

Function daemon_maybe_debug

common/daemon.c:165–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void daemon_maybe_debug(char *argv[])
166{
167#if DEVELOPER
168 for (int i = 1; argv[i]; i++) {
169 if (!streq(argv[i], "--debugger"))
170 continue;
171
172 /* Don't let this mess up stdout, so redir to /dev/null */
173 char *cmd = tal_fmt(NULL, "${DEBUG_TERM:-gnome-terminal --} gdb -ex 'attach %u' %s >/dev/null &", getpid(), argv[0]);
174 fprintf(stderr, "Running %s\n", cmd);
175 /* warn_unused_result is fascist bullshit.
176 * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 */
177 if (system(cmd))
178 ;
179 tal_free(cmd);
180 /* Continue in the debugger. */
181 kill(getpid(), SIGSTOP);
182 }
183#endif /* DEVELOPER */
184}

Callers 1

subdaemon_setupFunction · 0.70

Calls 1

tal_freeFunction · 0.85

Tested by

no test coverage detected