Index: test/lldbutil.py =================================================================== --- test/lldbutil.py +++ test/lldbutil.py @@ -922,3 +922,31 @@ def append_to_remote_wd(*paths): return join_remote_paths(lldb.remote_platform.GetWorkingDirectory(), *paths) + +# ================================================== +# Utility functions to get the correct signal number +# ================================================== + +import signal + +def get_signal_number(signal_name): + platform = lldb.remote_platform + if platform: + if platform.GetName() == 'remote-linux': + command = lldb.SBPlatformShellCommand('kill -l %d' % signal_name) + platform.Run(command) + if command.GetStatus() == 0: + try: + return int(command.GetOutput()) + except ValueError: + pass + elif platform.GetName() == 'remote-android': + for signal_number in range(1, 65): + command = lldb.SBPlatformShellCommand('kill -l %d' % signal_number) + platform.Run(command) + output = command.GetOutput().strip().upper() + if not output.startswith('SIG'): + output = 'SIG' + output + if output == signal_name: + return signal_number + return getattr(signal, signal_name)