File: update-demangler

package info (click to toggle)
valgrind 1%3A3.14.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 156,980 kB
  • sloc: ansic: 728,128; exp: 26,134; xml: 22,268; cpp: 7,638; asm: 7,312; makefile: 6,102; perl: 5,910; sh: 5,717
file content (118 lines) | stat: -rwxr-xr-x 4,279 bytes parent folder | download | duplicates (2)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh

set -e

#---------------------------------------------------------------------
# This quick and dirty script assists in updating the C++ demangler
# machinery in coregrind/m_demangle.
# The script will check out 
# - old and new revisions of the C++ demangler related files from GCC's trunk
# - m_demangle from valgrind's trunk.
# It will assemble
# - a patch file with local changes that were applied to the C++
#   demangler to make it work within valgrind
# - a directory new_m_demangle whose contents should be copied to
#   m_demangle in valgrind trunk
# The patch will *not* be applied automatically.
#---------------------------------------------------------------------

# You need to modify these revision numbers for your update.
old_gcc_revision=r240068  # the revision of the previous update
new_gcc_revision=r246502  # the revision for this update

# Unless the organization of demangler related files has changed, no
# changes below this line should be necessary.

# Setup a temp directory
DIR=/tmp/demangle

rm -rf $DIR
mkdir -p $DIR

cd $DIR

echo "Updating the demangler in $DIR"

# 1) Check out files from old GCC revision
echo "Checking out GCC files @ $old_gcc_revision"

mkdir gcc-$old_gcc_revision
cd    gcc-$old_gcc_revision
svn co -$old_gcc_revision svn://gcc.gnu.org/svn/gcc/trunk/libiberty libiberty > /dev/null
svn co -$old_gcc_revision svn://gcc.gnu.org/svn/gcc/trunk/include   include   > /dev/null
rm -rf libiberty/.svn
rm -rf include/.svn
cd ..

# 2) Assemble the ones we need in $DIR/$old_gcc_revision
mkdir $old_gcc_revision
cd    $old_gcc_revision
cp    ../gcc-$old_gcc_revision/include/ansidecl.h .
cp    ../gcc-$old_gcc_revision/include/demangle.h .
cp    ../gcc-$old_gcc_revision/include/dyn-string.h .
cp    ../gcc-$old_gcc_revision/include/safe-ctype.h .
cp    ../gcc-$old_gcc_revision/libiberty/cp-demangle.c .
cp    ../gcc-$old_gcc_revision/libiberty/cp-demangle.h .
cp    ../gcc-$old_gcc_revision/libiberty/cplus-dem.c .
cp    ../gcc-$old_gcc_revision/libiberty/dyn-string.c .
cp    ../gcc-$old_gcc_revision/libiberty/d-demangle.c .
cp    ../gcc-$old_gcc_revision/libiberty/rust-demangle.c .
cp    ../gcc-$old_gcc_revision/libiberty/safe-ctype.c .
cd ..

# 3) Check out files from new GCC revision

echo "Checking out GCC files @ $new_gcc_revision"
mkdir gcc-$new_gcc_revision
cd    gcc-$new_gcc_revision
svn co -$new_gcc_revision svn://gcc.gnu.org/svn/gcc/trunk/libiberty libiberty > /dev/null
svn co -$new_gcc_revision svn://gcc.gnu.org/svn/gcc/trunk/include   include   > /dev/null
rm -rf libiberty/.svn
rm -rf include/.svn
cd ..

# 4) Assemble the ones we need in $DIR/$new_gcc_revision

mkdir $new_gcc_revision
cd    $new_gcc_revision
cp    ../gcc-$new_gcc_revision/include/ansidecl.h .
cp    ../gcc-$new_gcc_revision/include/demangle.h .
cp    ../gcc-$new_gcc_revision/include/dyn-string.h .
cp    ../gcc-$new_gcc_revision/include/safe-ctype.h .
cp    ../gcc-$new_gcc_revision/libiberty/cp-demangle.c .
cp    ../gcc-$new_gcc_revision/libiberty/cp-demangle.h .
cp    ../gcc-$new_gcc_revision/libiberty/cplus-dem.c .
cp    ../gcc-$new_gcc_revision/libiberty/dyn-string.c .
cp    ../gcc-$new_gcc_revision/libiberty/d-demangle.c .
cp    ../gcc-$new_gcc_revision/libiberty/rust-demangle.c .
cp    ../gcc-$new_gcc_revision/libiberty/safe-ctype.c .
cd ..

# 5) Sparse check out valgrind coregrind/m_demangle into old_m_demangle
echo "Checking out coregrind/m_demangle"
mkdir valgrind-sparse-clone
cd valgrind-sparse-clone
git init
git remote add origin -f git://sourceware.org/git/valgrind.git/
git config core.sparsecheckout true
echo "coregrind/m_demangle/*" > .git/info/sparse-checkout
git pull origin master
cd ..
mv valgrind-sparse-clone/coregrind/m_demangle old_m_demangle
rm -rf valgrind-sparse-clone

# 6) Create new_m_demangle
cp -rp old_m_demangle new_m_demangle
cp -rp $new_gcc_revision/*.[ch] new_m_demangle

# 7) Compare files from previous GCC revision against old_m_demangle
#    (This gets us the changes we made to the demangler).
echo "Creating patch"
set +e
diff -r -u $old_gcc_revision old_m_demangle > our-changes
echo "Patch file 'our-changes' created"

# 7) See how the patch would apply
echo "Attempting to apply the patch (but not actualy doing it)."
cd new_m_demangle
patch --dry -p1 < ../our-changes