rust/cargo-c: update to 0.10.7+cargo-0.84.0
[oi-userland.git] / components / developer / gdb / Solaris / gen_syscall_table.sh
blob9d179e84be9ecd67c16c1735f45041f6b233f0b3
1 #!/usr/bin/bash
2 # Generate illumos data files describing system calls and structures
3 # found in core files.
4 CW=/opt/onbld/bin/i386/cw
5 GENOFFSETS=/opt/onbld/bin/genoffsets
6 TMPDIR=${COMPONENT_DIR}/tmp
7 CTFSTABS=/opt/onbld/bin/i386/ctfstabs
8 CTFCONVERT=/opt/onbld/bin/i386/ctfconvert
9 GENOFFSETS_CFLAGS="-gdwarf-2 -_gcc=-fno-eliminate-unused-debug-symbols -_gcc=-fno-eliminate-unused-debug-types"
10 EGREP=/usr/gnu/bin/egrep
11 GCC=/usr/gcc/${GCC_VERSION}/bin/gcc
12 CFLAGS32=-m32
13 CFLAGS64=-m64
14 OOCEBIN=/usr/bin
16 function generate {
18 # System call table
20 cat << EOM
21 <?xml version="1.0"?>
22 <!DOCTYPE feature SYSTEM "gdb-syscalls.dtd">
23 <syscalls_info>
24 EOM
25 $EGREP $'^#define\tSYS_.*[0-9]$' /usr/include/sys/syscall.h \
26 | while read _ call num; do
27 printf ' <syscall name="%s" number="%d"/>\n' \
28 ${call#SYS_} $num
29 done
31 echo "</syscalls_info>"
32 } > $TMPDIR/syscalls.xml
33 echo $TMPDIR/syscalls.xml
34 for arch in i386 amd64; do
35 cp ${TMPDIR}/syscalls.xml \
36 ${SOURCE_DIR}/gdb/syscalls/$arch-illumos.xml \
37 || echo "Could not install $arch system call table"
38 done
40 for bits in 32 64; do
41 flags=CFLAGS$bits
42 $GENOFFSETS -s $CTFSTABS -r $CTFCONVERT \
43 $CW --primary gcc,${GCC},gnu --noecho -- \
44 $GENOFFSETS_CFLAGS ${!flags} \
45 < ${COMPONENT_DIR}/Solaris/offsets.in > $TMPDIR/offsets$bits.h
46 done
48 sed < $TMPDIR/offsets32.h 's/\t0x/_32&/'
49 sed < $TMPDIR/offsets64.h 's/\t0x/_64&/'
50 $EGREP $'define\tPR(FN|ARG)SZ' /usr/include/sys/old_procfs.h
51 } | tee illumos-offsets.h > ${SOURCE_DIR}/bfd/illumos-offsets.h
55 [ ! -d ${TMPDIR} ] && mkdir ${TMPDIR}
56 generate