[Asterisk-cvs] zaptel checkstack,NONE,1.1 .cvsignore,1.3,1.4 Makefile,1.49,1.50

markster at lists.digium.com markster at lists.digium.com
Sat Jul 24 10:27:24 CDT 2004


Update of /usr/cvsroot/zaptel
In directory localhost.localdomain:/tmp/cvs-serv12203

Modified Files:
	.cvsignore Makefile 
Added Files:
	checkstack 
Log Message:
Add "checkstack" for checking stack sizes


--- NEW FILE: checkstack ---
#!/bin/bash
#
# Written by Keith Owens, modified by Arjan van de Ven to output in deciman
#
# Usage :  check-stack.sh vmlinux $(/sbin/modprobe -l)
#
#	Run a compiled ix86 kernel and print large local stack usage.
#
#	/>:/{s/[<>:]*//g; h; }   On lines that contain '>:' (headings like
#	c0100000 <_stext>:), remove <, > and : and hold the line.  Identifies
#	the procedure and its start address.
#
#	/subl\?.*\$0x[^,][^,][^,].*,%esp/{    Select lines containing
#	subl\?...0x...,%esp but only if there are at least 3 digits between 0x and
#	,%esp.  These are local stacks of at least 0x100 bytes.
#
#	s/.*$0x\([^,]*\).*/\1/;   Extract just the stack adjustment
#	/^[89a-f].......$/d;   Ignore line with 8 digit offsets that are
#	negative.  Some compilers adjust the stack on exit, seems to be related
#	to goto statements
#	G;   Append the held line (procedure and start address).
#	s/\(.*\)\n.* \(.*\)/\1 \2/;  Remove the newline and procedure start
#	address.  Leaves just stack size and procedure name.
#	p; };   Print stack size and procedure name.
#
#	/subl\?.*%.*,%esp/{   Selects adjustment of %esp by register, dynamic
#	arrays on stack.
#	G;   Append the held line (procedure and start address).
#	s/\(.*\)\n\(.*\)/Dynamic \2 \1/;   Reformat to "Dynamic", procedure
#	start address, procedure name and the instruction that adjusts the
#	stack, including its offset within the proc.
#	p; };   Print the dynamic line.
#
#
#	Leading spaces in the sed string are required.
#
# first check if it's x86, since only that arch works for now
uname -m  | grep -q 86$ > /dev/null || exit
#
objdump --disassemble "$@" | \
sed -ne '/>:/{s/[<>:]*//g; h; }
 /subl\?.*\$0x[^,][^,][^,].*,%esp/{
 s/.*\$0x\([^,]*\).*/\1/; /^[89a-f].......$/d; G; s/\(.*\)\n.* \(.*\)/\1 \2/; p; };
 /subl\?.*%.*,%esp/{ G; s/\(.*\)\n\(.*\)/Dynamic \2 \1/; p; }; ' | \
 sort | \
perl -e 'while (<>) { if (/^([0-9a-f]+)(.*)/) { $decn = hex("0x" . $1); if ($decn > 400) { print "$decn $2\n";} } }'

Index: .cvsignore
===================================================================
RCS file: /usr/cvsroot/zaptel/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- .cvsignore	9 Apr 2004 00:39:13 -0000	1.3
+++ .cvsignore	24 Jul 2004 14:13:23 -0000	1.4
@@ -11,6 +11,7 @@
 libtonezone.so.1.0
 gendigits
 fxstest
+zttest
 *.ko
 *.mod.c
 .*.cmd

Index: Makefile
===================================================================
RCS file: /usr/cvsroot/zaptel/Makefile,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- Makefile	16 Jul 2004 22:09:07 -0000	1.49
+++ Makefile	24 Jul 2004 14:13:23 -0000	1.50
@@ -217,6 +217,9 @@
 fxsdump: fxsdump.o
 	$(CC) -o fxsdump fxsdump.o -lm
 
+stackcheck: checkstack $(BUILDVER)
+	./checkstack *.o
+
 devices:
 ifeq ($(DYNFS),)
 	mkdir -p $(INSTALL_PREFIX)/dev/zap




More information about the svn-commits mailing list