[sr-dev] git:5.2:69ec6f22: kamctl: updates to trap command to work with pretty printed jsonrpc

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


Module: kamailio
Branch: 5.2
Commit: 69ec6f2248dfda10c1c38df3a8a1c3c432b7d0d5
URL: https://github.com/kamailio/kamailio/commit/69ec6f2248dfda10c1c38df3a8a1c3c432b7d0d5

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

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

(cherry picked from commit 4349c4f9bdd82ae099aadb5b626366deb7ef1109)

---

Modified: utils/kamctl/kamctl

---

Diff:  https://github.com/kamailio/kamailio/commit/69ec6f2248dfda10c1c38df3a8a1c3c432b7d0d5.diff
Patch: https://github.com/kamailio/kamailio/commit/69ec6f2248dfda10c1c38df3a8a1c3c432b7d0d5.patch

---

diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index acc0d1f741..62bb0a148e 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