Menu

[69de4e]: / command / kill.sh  Maximize  Restore  History

Download this file

97 lines (78 with data), 2.9 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# -*- shell-script -*-
# gdb-like "kill" debugger command
#
# Copyright (C) 2002-2006, 2008, 2009, 2010-2011, 2016, 2019
# Rocky Bernstein <rocky@gnu.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; see the file COPYING. If not, write to
# the Free Software Foundation, 59 Temple Place, Suite 330, Boston,
# MA 02111 USA.
_Dbg_help_add kill \
"**kill** [*signal-number*]
**kill!** [*signal-number*]
Send this process a POSIX signal ('9' for 'SIGKILL' or 'kill -SIGKILL')
9 is a non-maskable interrupt that terminates the program. If program is threaded it may
be expedient to use this command to terminate the program.
However other signals, such as those that allow for the debugged to handle them can be
sent.
Giving a negative number is the same as using its positive value.
When the ! suffix appears, no confirmation is neeeded.
Examples:
---------
kill # non-interuptable, nonmaskable kill
kill 9 # same as above
kill -9 # same as above
kill 15 # nicer, maskable TERM signal
kill! 15 # same as above, but no confirmation
kill -SIGINT # same as above
kill -WINCH # send \"window change\" signal
kill -USR1 # send \"user 1\" signal
See also:
---------
**quit** for less a forceful termination command.
**run** is a way to restart the debugged program.
Also similar is the **signal** command."
_Dbg_do_kill() {
if (($# > 1)); then
_Dbg_errmsg "Got $# parameters, but need 0 or 1."
return 1
fi
typeset _Dbg_response='n'
if [[ ${_Dbg_orig_cmd:${#_Dbg_orig_cmd}-1:1} == '!' ]]; then
_Dbg_response='y'
fi
typeset _Dbg_prompt_output=${_Dbg_tty:-/dev/null}
typeset signal='-9'
(($# == 1)) && signal="$1"
if [[ ${signal:0:1} != '-' ]] ; then
_Dbg_errmsg "Kill signal ($signal) should start with a '-'"
return 2
fi
if [[ $_Dbg_response == n ]] ; then
_Dbg_confirm "Send kill signal ${signal} which may terminate the debugger? (y/N): " 'n'
fi
if [[ $_Dbg_response == [yY] ]] ; then
case $signal in
-9 | -SEGV )
_Dbg_cleanup2
;;
esac
kill $signal $$
else
_Dbg_errmsg "Kill not done - not confirmed."
return 3
fi
return 0
}
_Dbg_alias_add 'kill!' 'kill'
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.