mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-09-03 05:33:44 +02:00
build.py: Really run in GDB when using --debug.
The usage (--help) says: "Build with debug support; run in GDB", but GDB was only used when using the D-Bus daemon. Run a libwrap built Jami with GDB as well. * build.py (run_run): Disable SIGINT when using GDB, and invoke the Jami client with GDB. Disable output redirection to logs when using GDB. Change-Id: Icf3415a3d1fbb87f193d0ede07cb1e1fbb179ce2
This commit is contained in:
parent
9f2840884f
commit
80c81ed2b0
1 changed files with 24 additions and 5 deletions
29
build.py
29
build.py
|
@ -23,6 +23,7 @@ import multiprocessing
|
|||
import os
|
||||
import platform
|
||||
import shlex
|
||||
import signal
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
@ -458,6 +459,13 @@ def run_clean():
|
|||
|
||||
def run_run(args):
|
||||
run_env = os.environ
|
||||
|
||||
if args.debug:
|
||||
# Ignore the interruption signal when using GDB, as it's
|
||||
# common to use C-c when debugging and we do not want the
|
||||
# Python script to abort the debugging session.
|
||||
signal.signal(signal.SIGINT, signal.SIG_IGN)
|
||||
|
||||
try:
|
||||
if args.no_libwrap:
|
||||
jamid_log = open("daemon.log", 'a')
|
||||
|
@ -474,10 +482,18 @@ def run_run(args):
|
|||
client_log = open('jami.log', 'a')
|
||||
client_log.write('=== Starting client (%s) ===' %
|
||||
time.strftime("%d/%m/%Y %H:%M:%S"))
|
||||
client_process = subprocess.Popen(["./install/bin/jami", "-d"],
|
||||
stdout=client_log,
|
||||
stderr=client_log,
|
||||
env=run_env)
|
||||
jami_cmdline = ['install/bin/jami', '-d']
|
||||
if args.debug:
|
||||
jami_cmdline = ['gdb', '-ex', 'run', '--args'] + jami_cmdline
|
||||
|
||||
print('Invoking jami with: {}'.format(str.join(' ', jami_cmdline)))
|
||||
if args.debug:
|
||||
print('Debugging with GDB; NOT redirecting output to log file')
|
||||
client_process = subprocess.Popen(
|
||||
jami_cmdline,
|
||||
stdout=False if args.debug else client_log,
|
||||
stderr=False if args.debug else client_log,
|
||||
env=run_env)
|
||||
|
||||
with open('jami.pid', 'w') as f:
|
||||
f.write(str(client_process.pid)+'\n')
|
||||
|
@ -494,7 +510,10 @@ def run_run(args):
|
|||
print("\nCaught KeyboardInterrupt...")
|
||||
|
||||
finally:
|
||||
if args.background == False:
|
||||
if args.debug:
|
||||
# Restore the default signal handler for SIGINT.
|
||||
signal.signal(signal.SIGINT, signal.SIG_DFL)
|
||||
if not args.background:
|
||||
try:
|
||||
# Only kill the processes if they are running, as they
|
||||
# could have been closed by the user.
|
||||
|
|
Loading…
Add table
Reference in a new issue