Prechádzať zdrojové kódy

kamctl: don't force global exit if gdb is not found

- it is not a general requirement, only for trap command
Daniel-Constantin Mierla 11 rokov pred
rodič
commit
8b023bbab1
2 zmenil súbory, kde vykonal 10 pridanie a 4 odobranie
  1. 5 1
      utils/kamctl/kamctl
  2. 5 3
      utils/kamctl/kamctl.base

+ 5 - 1
utils/kamctl/kamctl

@@ -2649,6 +2649,10 @@ extcmd() {
 #
 #
 
 
 kamailio_trap() {
 kamailio_trap() {
+	if [ -z "$GDB" ] ; then
+		merr "'gdb' tool not found: set GDB variable to correct tool path"
+		exit
+	fi
 	DATE=`/bin/date +%Y%m%d_%H%M%S`
 	DATE=`/bin/date +%Y%m%d_%H%M%S`
 	LOG_FILE=/tmp/gdb_kamailio_$DATE
 	LOG_FILE=/tmp/gdb_kamailio_$DATE
 	minfo "Trap file: $LOG_FILE"
 	minfo "Trap file: $LOG_FILE"
@@ -2661,7 +2665,7 @@ kamailio_trap() {
 		PID=`echo $pid | cut -d '-' -f 1`
 		PID=`echo $pid | cut -d '-' -f 1`
 		echo "" >> $LOG_FILE
 		echo "" >> $LOG_FILE
 		echo "---start $PID -----------------------------------------------------" >> $LOG_FILE
 		echo "---start $PID -----------------------------------------------------" >> $LOG_FILE
-		$GDB kamailio $PID -batch --eval-command="bt full" &>> $LOG_FILE
+		$GDB kamailio $PID -batch --eval-command="bt full" & >> $LOG_FILE
 		echo "---end $PID -------------------------------------------------------" >> $LOG_FILE
 		echo "---end $PID -------------------------------------------------------" >> $LOG_FILE
 	done
 	done
 	echo "."
 	echo "."

+ 5 - 3
utils/kamctl/kamctl.base

@@ -57,10 +57,12 @@ if [ -z "$GDB" ] ; then
 	locate_tool gdb
 	locate_tool gdb
 	if [ -z "$TOOLPATH" ] ; then
 	if [ -z "$TOOLPATH" ] ; then
 		# now error, but we can look for alternative names if it is the case
 		# now error, but we can look for alternative names if it is the case
-		echo "error: 'gdb' tool not found: set GDB variable to correct tool path"
-		exit
+		GDB=""
+		# echo "error: 'gdb' tool not found: set GDB variable to correct tool path"
+		# exit
+	else
+		GDB="$TOOLPATH"
 	fi
 	fi
-	GDB="$TOOLPATH"
 fi
 fi
 if [ -z "$MD5" ]; then
 if [ -z "$MD5" ]; then
 	locate_tool md5sum md5
 	locate_tool md5sum md5