File: 1426

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (87 lines) | stat: -rwxr-xr-x 2,260 bytes parent folder | download
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
#!/bin/sh
# PCP QA Test No. 1426
# __pmDumpStack()
#
# Copyright (c) 2022 Ken McDonell.  All Rights Reserved.
#

if [ $# -eq 0 ]
then
    seq=`basename $0`
    echo "QA output created by $seq"
else
    # use $seq from caller, unless not set
    [ -n "$seq" ] || seq=`basename $0`
    echo "QA output created by `basename $0` $*"
fi

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

[ "$PCP_PLATFORM" = solaris ] && _notrun "No arguments in backtrace on Solaris"

_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

status=0	# success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

# awk fluff is because the callstack from exec begin down to
# main() is non-deterministic ... also the OpenBSD reporting
# style is:
#	0x16a15bc9 <bar+0x19> at src/dumpstack
#	0x88d6c13 <__pmDumpStack+0x83> at /usr/lib/libpcp.so.3
# and the FreeBSD reporting style is:
#       0x400d0a <bar+0x9> at /usr/home/kenj/src/pcp/qa/src/dumpstack (0xd0a)
#       0x8225c45f9 <__pmDumpStack+0x79> at /usr/lib/libpcp.so.3 (0x8221c45f9)
# compared to the Linux style:
#	src/dumpstack(bar+0xd)[0x556c0dbbc226] (0x1226)
#	/lib/libpcp.so.3(__pmDumpStack+0x8e)[0x7fae47dd5fee] (0x2a423a21afee)
#
_filter()
{
    tee -a $seq_full \
    | sed \
	-e '/executable text segment/d' \
	-e 's/  *0x[0-9a-f]* </(/' \
	-e 's/ *\[0x[0-9a-f]*]//' \
	-e 's/ *(0x[0-9a-f]*)//' \
	-e 's/> at/) at/' \
	-e 's@\(.*\) at src/dumpstack@dumpstack\1@' \
	-e 's@\(.*\) at .*/src/dumpstack@dumpstack\1@' \
	-e 's@\(.*\) at .*libpcp\.so.*@libpcp\1@' \
	-e 's@src/dumpstack(@dumpstack(@' \
	-e 's/^[ 	]*//' \
	-e 's@^[/a-z0-9]*libpcp@libpcp@' \
	-e 's/libpcp\.so\.[0-9]*/libpcp/' \
	-e 's/+0x.*)/...)/' \
    | $PCP_AWK_PROG '
$1 == "Procedure"	{ skip = 0
			  if (NR > 1 && seen_main == 0) print "dumpstack(main...)"
			  seen_main = 0
			}
skip == 1		{ next }
			{ print }
/dumpstack[(]main/	{ skip = 1; seen_main = 1 }
END			{ if (seen_main == 0) print "dumpstack(main...)" }'
}

# real QA test starts here
src/dumpstack >$tmp.out 2>&1

if grep 'returns 0, nothing to report' $tmp.out >/dev/null
then
    # for vm33 (OpenBSD 7.0) et al
    #
    _notrun "backtrace() not functional here"
else
    _filter <$tmp.out
fi

# success, all done
exit