[sr-dev] git:master:4349c4f9: kamctl: updates to trap command to work with pretty printed jsonrpc

Daniel-Constantin Mierla miconda at gmail.com
Wed Feb 20 12:15:48 CET 2019


Module: kamailio
Branch: master
Commit: 4349c4f9bdd82ae099aadb5b626366deb7ef1109
URL: https://github.com/kamailio/kamailio/commit/4349c4f9bdd82ae099aadb5b626366deb7ef1109

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-02-20T12:14:13+01:00

kamctl: updates to trap command to work with pretty printed jsonrpc

---

Modified: utils/kamctl/kamctl

---

Diff:  https://github.com/kamailio/kamailio/commit/4349c4f9bdd82ae099aadb5b626366deb7ef1109.diff
Patch: https://github.com/kamailio/kamailio/commit/4349c4f9bdd82ae099aadb5b626366deb7ef1109.patch

---

diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 9993d56f0f..d9d70a538e 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -2835,16 +2835,16 @@ kamailio_trap() {
 	DATE=`/bin/date +%Y%m%d_%H%M%S`
 	LOG_FILE=/tmp/gdb_kamailio_$DATE
 	minfo "Trap file: $LOG_FILE"
-	$SERCTLCMD ps > $LOG_FILE
+	ctl_cmd_run core.psx > $LOG_FILE
 	echo -n "Trapping Kamailio with gdb: "
-	PID_TIMESTAMP_VECTOR=`sed -e 's/\([0-9]*\).*/\1/' $LOG_FILE`
+	PID_TIMESTAMP_VECTOR=`$EGREP 'PID' $LOG_FILE | $EGREP -Eo '[0-9]+'`
 	for pid in $PID_TIMESTAMP_VECTOR
 	do
 		echo -n "."
 		PID=`echo $pid | cut -d '-' -f 1`
 		echo "" >> $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 2>&1
 		echo "---end $PID -------------------------------------------------------" >> $LOG_FILE
 	done
 	echo "."




More information about the sr-dev mailing list