diff --git a/gdb/gdbinit b/gdb/gdbinit index 57b4abb4d3f..40b4b074460 100644 --- a/gdb/gdbinit +++ b/gdb/gdbinit @@ -1,6 +1,15 @@ python import sys -sys.path.insert(0, sys.path[0] + '/../../%GCC_NAME%/python') +import os +from os import path +dir_of_gcc = list(filter(lambda x: x.startswith('gcc'), os.listdir('/usr/share'))) +if len(dir_of_gcc) > 0: + dir_of_gcc = path.join('/usr/share', dir_of_gcc[0], 'python') + if not path.exists(dir_of_gcc): + dir_of_gcc = sys.path[0] +else: + dir_of_gcc = sys.path[0] +sys.path.insert(0, dir_of_gcc) from libstdcxx.v6.printers import register_libstdcxx_printers register_libstdcxx_printers (None) -end \ No newline at end of file +end