GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / toolchains / hndtools-arm-linux-2.6.36-uclibc-4.5.3 / arm-brcm-linux-uclibcgnueabi / sysroot / usr / lib / libstdc++.so.6.0.14-gdb.py
blobb296ddc5ff31ea105723095aa2c82dfa6ed44bf5
1 # -*- python -*-
2 # Copyright (C) 2009 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 import sys
18 import gdb
19 import os
20 import os.path
22 pythondir = '/projects/hnd/tools/linux/hndtools-arm-linux-2.6.36-uclibc-4.5.3/share/gcc-4.5.3/python'
23 libdir = '/projects/hnd/tools/linux/hndtools-arm-linux-2.6.36-uclibc-4.5.3/arm-brcm-linux-uclibcgnueabi/lib'
25 # This file might be loaded when there is no current objfile. This
26 # can happen if the user loads it manually. In this case we don't
27 # update sys.path; instead we just hope the user managed to do that
28 # beforehand.
29 if gdb.current_objfile () is not None:
30 # Update module path. We want to find the relative path from libdir
31 # to pythondir, and then we want to apply that relative path to the
32 # directory holding the objfile with which this file is associated.
33 # This preserves relocatability of the gcc tree.
35 # Do a simple normalization that removes duplicate separators.
36 pythondir = os.path.normpath (pythondir)
37 libdir = os.path.normpath (libdir)
39 prefix = os.path.commonprefix ([libdir, pythondir])
40 # In some bizarre configuration we might have found a match in the
41 # middle of a directory name.
42 if prefix[-1] != '/':
43 prefix = os.path.dirname (prefix) + '/'
45 # Strip off the prefix.
46 pythondir = pythondir[len (prefix):]
47 libdir = libdir[len (prefix):]
49 # Compute the ".."s needed to get from libdir to the prefix.
50 dotdots = ('..' + os.sep) * len (libdir.split (os.sep))
52 objfile = gdb.current_objfile ().filename
53 dir = os.path.join (os.path.dirname (objfile), dotdots, pythondir)
55 if not dir in sys.path:
56 sys.path.insert(0, dir)
58 # Load the pretty-printers.
59 from libstdcxx.v6.printers import register_libstdcxx_printers
60 register_libstdcxx_printers (gdb.current_objfile ())