5 #---------------------------------------------------------------------
6 # This quick and dirty script assists in updating the C++ demangler
7 # machinery in coregrind/m_demangle.
8 # The script will check out
9 # - old and new revisions of the C++ demangler related files from GCC's trunk
10 # - m_demangle from valgrind's trunk.
12 # - a patch file with local changes that were applied to the C++
13 # demangler to make it work within valgrind
14 # - a directory new_m_demangle whose contents should be copied to
15 # m_demangle in valgrind trunk
16 # The patch will *not* be applied automatically.
17 #---------------------------------------------------------------------
19 # You need to modify these revision numbers for your update.
20 old_gcc_revision
=r240068
# the revision of the previous update
21 new_gcc_revision
=r246502
# the revision for this update
23 # Unless the organization of demangler related files has changed, no
24 # changes below this line should be necessary.
26 # Setup a temp directory
34 echo "Updating the demangler in $DIR"
36 # 1) Check out files from old GCC revision
37 echo "Checking out GCC files @ $old_gcc_revision"
39 mkdir gcc-
$old_gcc_revision
40 cd gcc-
$old_gcc_revision
41 svn co
-$old_gcc_revision svn
://gcc.gnu.org
/svn
/gcc
/trunk
/libiberty libiberty
> /dev
/null
42 svn co
-$old_gcc_revision svn
://gcc.gnu.org
/svn
/gcc
/trunk
/include include
> /dev
/null
47 # 2) Assemble the ones we need in $DIR/$old_gcc_revision
48 mkdir
$old_gcc_revision
50 cp ..
/gcc-
$old_gcc_revision/include
/ansidecl.h .
51 cp ..
/gcc-
$old_gcc_revision/include
/demangle.h .
52 cp ..
/gcc-
$old_gcc_revision/include
/dyn-string.h .
53 cp ..
/gcc-
$old_gcc_revision/include
/safe-ctype.h .
54 cp ..
/gcc-
$old_gcc_revision/libiberty
/cp-demangle.c .
55 cp ..
/gcc-
$old_gcc_revision/libiberty
/cp-demangle.h .
56 cp ..
/gcc-
$old_gcc_revision/libiberty
/cplus-dem.c .
57 cp ..
/gcc-
$old_gcc_revision/libiberty
/dyn-string.c .
58 cp ..
/gcc-
$old_gcc_revision/libiberty
/d-demangle.c .
59 cp ..
/gcc-
$old_gcc_revision/libiberty
/rust-demangle.c .
60 cp ..
/gcc-
$old_gcc_revision/libiberty
/safe-ctype.c .
63 # 3) Check out files from new GCC revision
65 echo "Checking out GCC files @ $new_gcc_revision"
66 mkdir gcc-
$new_gcc_revision
67 cd gcc-
$new_gcc_revision
68 svn co
-$new_gcc_revision svn
://gcc.gnu.org
/svn
/gcc
/trunk
/libiberty libiberty
> /dev
/null
69 svn co
-$new_gcc_revision svn
://gcc.gnu.org
/svn
/gcc
/trunk
/include include
> /dev
/null
74 # 4) Assemble the ones we need in $DIR/$new_gcc_revision
76 mkdir
$new_gcc_revision
78 cp ..
/gcc-
$new_gcc_revision/include
/ansidecl.h .
79 cp ..
/gcc-
$new_gcc_revision/include
/demangle.h .
80 cp ..
/gcc-
$new_gcc_revision/include
/dyn-string.h .
81 cp ..
/gcc-
$new_gcc_revision/include
/safe-ctype.h .
82 cp ..
/gcc-
$new_gcc_revision/libiberty
/cp-demangle.c .
83 cp ..
/gcc-
$new_gcc_revision/libiberty
/cp-demangle.h .
84 cp ..
/gcc-
$new_gcc_revision/libiberty
/cplus-dem.c .
85 cp ..
/gcc-
$new_gcc_revision/libiberty
/dyn-string.c .
86 cp ..
/gcc-
$new_gcc_revision/libiberty
/d-demangle.c .
87 cp ..
/gcc-
$new_gcc_revision/libiberty
/rust-demangle.c .
88 cp ..
/gcc-
$new_gcc_revision/libiberty
/safe-ctype.c .
91 # 5) Check out valgrind coregrind/m_demangle into old_m_demangle
92 echo "Checking out coregrind/m_demangle"
93 svn co svn
://svn.valgrind.org
/valgrind
/trunk
/coregrind
/m_demangle old_m_demangle
> /dev
/null
94 rm -rf old_m_demangle
/.svn
96 # 6) Create new_m_demangle
97 cp -rp old_m_demangle new_m_demangle
98 cp -rp $new_gcc_revision/*.
[ch
] new_m_demangle
100 # 7) Compare files from previous GCC revision against old_m_demangle
101 # (This gets us the changes we made to the demangler).
102 echo "Creating patch"
104 diff -r -u $old_gcc_revision old_m_demangle
> our-changes
105 echo "Patch file 'our-changes' created"
107 # 7) See how the patch would apply
108 echo "Attempting to apply the patch (but not actualy doing it)."
110 patch --dry -p1 < ..
/our-changes