Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could you please upgrade the gdb version to the newest? #182

Open
speedan0 opened this issue Jul 2, 2024 · 3 comments
Open

Could you please upgrade the gdb version to the newest? #182

speedan0 opened this issue Jul 2, 2024 · 3 comments

Comments

@speedan0
Copy link

speedan0 commented Jul 2, 2024

I tried to load the dump and vmlinux with crash 8.0.5 tools, and it reported the error as below. From the tests, I found that gdb 10.2 was the problem, whereas gdb 13.1 was able to load the vmlinux with no issues.
I tried to compile crash 8.0.5 with gdb 13.1; however, it compiled with some errors.
Could you please upgrade the gdb version to the newest?
Thanks.

  1. crash 8.0.5 loads the dump and vmlinux with below errors.
    $crash ./symbols/symbols/kernel/vmlinux SYS_COREDUMP
    crash 8.0.5
    Copyright (C) 2002-2024 Red Hat, Inc.
    Copyright (C) 2004, 2005, 2006, 2010 IBM Corporation
    Copyright (C) 1999-2006 Hewlett-Packard Co
    Copyright (C) 2005, 2006, 2011, 2012 Fujitsu Limited
    Copyright (C) 2006, 2007 VA Linux Systems Japan K.K.
    Copyright (C) 2005, 2011, 2020-2024 NEC Corporation
    Copyright (C) 1999, 2002, 2007 Silicon Graphics, Inc.
    Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
    Copyright (C) 2015, 2021 VMware, Inc.
    This program is free software, covered by the GNU General Public License,
    and you are welcome to change it and/or distribute copies of it under
    certain conditions. Enter "help copying" to see the conditions.
    This program has absolutely no warranty. Enter "help warranty" for details.

    BFD: ./symbols/symbols/kernel/vmlinux: unknown type [0x13] section .relr.dyn' <=== ERROR!!! BFD: ./symbols/symbols/kernel/vmlinux: unknown type [0x13] section .relr.dyn' <=== ERROR!!!
    GNU gdb (GDB) 10.2
    Copyright (C) 2021 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "--host=x86_64-pc-linux-gnu --target=aarch64-elf-linux".
    Type "show configuration" for configuration details.
    Find the GDB manual and other documentation resources online at:
    http://www.gnu.org/software/gdb/documentation/.

    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    BFD: ./symbols/symbols/kernel/vmlinux: unknown type [0x13] section `.relr.dyn'
    BFD: ./symbols/symbols/kernel/vmlinux: unable to initialize decompress status for section .debug_aranges
    "0x7fff3da6eaf0s": not in executable format: file format not recognized

    crash: ./symbols/symbols/kernel/vmlinux: no debugging data available

  2. gdb 10.2 loads the vmlinux with below errors.
    $gdb ./symbols/symbols/kernel/vmlinux
    GNU gdb (GDB) 10.2
    Copyright (C) 2021 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "--host=x86_64-pc-linux-gnu --target=aarch64-elf-linux".Type "show configuration" for configuration details.
    Find the GDB manual and other documentation resources online at:
    http://www.gnu.org/software/gdb/documentation/.

    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    BFD: ./symbols/symbols/kernel/vmlinux: unknown type [0x13] section `.relr.dyn'
    BFD: ./symbols/symbols/kernel/vmlinux: unable to initialize decompress status for section .debug_aranges
    "./symbols/symbols/kernel/vmlinux": not in executable format: file format not recognized
    (gdb) q

  3. gdb 13.1 loads the vmlinux with no problem.
    $~/bin/crash_git/gdb-13.1/gdb/gdb ./symbols/symbols/kernel/vmlinux
    GNU gdb (GDB) 13.1
    Copyright (C) 2023 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "x86_64-pc-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    https://www.gnu.org/software/gdb/bugs/.
    Find the GDB manual and other documentation resources online at:
    http://www.gnu.org/software/gdb/documentation/.

    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from ./symbols/symbols/kernel/vmlinux...
    (gdb) q

  4. I tried to compile crash 8.0.5 with gdb 13.1; however, it compiled with some errors.

    1. Below is my patch upgrading the gdb version from 10.2 to 13.1. Please correct me if I have make mistake.
      diff --git a/Makefile b/Makefile
      index 60dad1870a92..725979077090 100644
      --- a/Makefile
      +++ b/Makefile
      @@ -24,8 +24,8 @@ PROGRAM=crash

      Supported targets: X86 ALPHA PPC IA64 PPC64 SPARC64

      TARGET and GDB_CONF_FLAGS will be configured automatically by configure

      -TARGET=
      -GDB_CONF_FLAGS=
      +TARGET=ARM64
      +GDB_CONF_FLAGS=--target=aarch64-elf-linux

      ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
      ifeq (${ARCH}, ppc64)
      @@ -35,10 +35,10 @@ endif

      GDB, GDB_FILES, GDB_OFILES and GDB_PATCH_FILES will be configured automatically by configure

      -GDB=
      -GDB_FILES=
      -GDB_OFILES=
      -GDB_PATCH_FILES=
      +GDB=gdb-13.1
      +GDB_FILES=${GDB_13.1_FILES}
      +GDB_OFILES=${GDB_13.1_OFILES}
      +GDB_PATCH_FILES=gdb-13.1.patch

      Default installation directory

      @@ -188,13 +188,13 @@ GDB_7.3.1_OFILES=${GDB}/gdb/symtab.o
      GDB_7.6_FILES=
      GDB_7.6_OFILES=${GDB}/gdb/symtab.o

      -GDB_10.2_FILES=
      -GDB_10.2_OFILES=${GDB}/gdb/symtab.o crash_target.o
      +GDB_13.1_FILES=
      +GDB_13.1_OFILES=${GDB}/gdb/symtab.o crash_target.o

      GDB_FLAGS is passed up from the gdb Makefile.

      -GDB_FLAGS=
      +GDB_FLAGS=-DGDB_13_1

      WARNING_OPTIONS and WARNING_ERROR are both applied on a per-file basis.

      @@ -211,7 +211,7 @@ TARGET_CFLAGS=

      CRASH_CFLAGS=-g -D${TARGET} ${TARGET_CFLAGS} ${GDB_FLAGS} ${CFLAGS}

      -GPL_FILES=
      +GPL_FILES=COPYING3
      TAR_FILES=${SOURCE_FILES} Makefile ${GPL_FILES} README .rh_rpm_package crash.8
      ${EXTENSION_SOURCE_FILES} ${MEMORY_DRIVER_FILES}
      CSCOPE_FILES=${SOURCE_FILES}
      diff --git a/configure.c b/configure.c
      index 4668c9a4e20b..c7fbe585138c 100644
      --- a/configure.c
      +++ b/configure.c
      @@ -194,10 +194,10 @@ void add_extra_lib(char *);
      #define GDB_7_0 (3)
      #define GDB_7_3_1 (4)
      #define GDB_7_6 (5)
      -#define GDB_10_2 (6)
      -#define SUPPORTED_GDB_VERSIONS (GDB_10_2 + 1)
      +#define GDB_13_1 (6)
      +#define SUPPORTED_GDB_VERSIONS (GDB_13_1 + 1)

      -int default_gdb = GDB_10_2;
      +int default_gdb = GDB_13_1;

      struct supported_gdb_version {
      char *GDB;
      @@ -263,12 +263,12 @@ struct supported_gdb_version {
      "GPLv3"
      },
      {

      •        "GDB=gdb-10.2",
        
      •        "10.2",
        
      •        "GDB_FILES=${GDB_10.2_FILES}",
        
      •        "GDB_OFILES=${GDB_10.2_OFILES}",
        
      •        "GDB_PATCH_FILES=gdb-10.2.patch",
        
      •        "GDB_FLAGS=-DGDB_10_2",
        
      •        "GDB=gdb-13.1",
        
      •        "13.1",
        
      •        "GDB_FILES=${GDB_13.1_FILES}",
        
      •        "GDB_OFILES=${GDB_13.1_OFILES}",
        
      •        "GDB_PATCH_FILES=gdb-13.1.patch",
        
      •        "GDB_FLAGS=-DGDB_13_1",
               "GPLv3"
           },
        

      };
      @@ -1592,9 +1592,9 @@ setup_gdb_defaults(void)
      fprintf(stderr, ".gdb configuration: %s\n", sp->GDB_VERSION_IN);
      return store_gdb_defaults(sp);
      }

      •            if (strcmp(buf, "10.2") == 0) {
        
      •            if (strcmp(buf, "13.1") == 0) {
                           fclose(fp);
        
      •                    sp = &supported_gdb_versions[GDB_10_2];
        
      •                    sp = &supported_gdb_versions[GDB_13_1];
                           fprintf(stderr, ".gdb configuration: %s\n", sp->GDB_VERSION_IN);
                           return store_gdb_defaults(sp);
                   }
        
    2. Below is the error log.
      CXX varobj.o
      GEN stamp-version
      CXX version.o
      GEN xml-builtin.c
      CXX xml-builtin.o
      CXX xml-support.o
      CXX xml-syscall.o
      CXX xml-tdesc.o
      GEN init.c
      CXX init.o
      CXXLD gdb
      (test "ln -s" = "ln -s" &&
      ln -s ./all-cfg.texi gdb-cfg.texi) ||
      ln ./all-cfg.texi gdb-cfg.texi ||
      cp ./all-cfg.texi gdb-cfg.texi
      date=sed -n -e 's/^.* BFD_VERSION_DATE \(.*\)$/\1/p' ./../../bfd/version.h;
      sed -e "s/DATE/$date/" < ./../version.in > version.subst
      echo "@set GDBVN sed q version.subst" > ./GDBvn.new
      if [ -n "(GDB) " ]; then
      echo "@set VERSION_PACKAGE (GDB) " >> ./GDBvn.new;
      fi
      echo "@set BUGURL " >> ./GDBvn.new
      if [ "" = "@uref{http://www.gnu.org/software/gdb/bugs/}" ]; then
      echo "@set BUGURL_DEFAULT" >> ./GDBvn.new;
      fi
      if test -z "-I ./../../readline/readline/doc"; then
      echo "@set SYSTEM_READLINE" >> ./GDBvn.new;
      fi
      if [ -n "" ]; then
      echo "@set SYSTEM_GDBINIT " >> ./GDBvn.new;
      fi
      if [ -n "" ]; then
      echo "@set SYSTEM_GDBINIT_DIR " >> ./GDBvn.new;
      fi
      mv GDBvn.new GDBvn.texi
      makeinfo --split-size=5000000 --split-size=5000000 -DHAVE_MAKEINFO_CLICK
      -I ./../../readline/readline/doc -I ./../mi -I .
      -o gdb.info ./gdb.texinfo
      makeinfo --split-size=5000000 --split-size=5000000 -DHAVE_MAKEINFO_CLICK
      -I . -o stabs.info ./stabs.texinfo
      makeinfo --split-size=5000000 --split-size=5000000 -DHAVE_MAKEINFO_CLICK
      -I . -o annotate.info ./annotate.texinfo
      rm -rf ./syscalls
      mkdir ./syscalls
      files='gdb-syscalls.dtd freebsd.xml netbsd.xml aarch64-linux.xml
      amd64-linux.xml arm-linux.xml i386-linux.xml mips-n32-linux.xml
      mips-n64-linux.xml mips-o32-linux.xml ppc-linux.xml ppc64-linux.xml
      s390-linux.xml s390x-linux.xml sparc-linux.xml sparc64-linux.xml' ;
      for file in $files ; do
      f=./../syscalls/$file ;
      if test -f $f ; then
      /usr/bin/install -c -m 644 $f ./syscalls ;
      fi ;
      done
      touch stamp-syscalls
      rm -rf ./python
      files='' ;
      if test "x$files" != x ; then
      for file in $files ; do
      dir=echo "$file" | sed 's,/[^/]*$,,' ;
      /bin/bash ./../../mkinstalldirs ./python/$dir ;
      /usr/bin/install -c -m 644 ./../python/lib/$file ./python/$dir ;
      done ;
      fi
      touch stamp-python
      rm -rf ./guile
      if test "x" != x ; then
      files='./gdb.scm gdb/boot.scm gdb/experimental.scm gdb/init.scm
      gdb/iterator.scm gdb/printing.scm gdb/support.scm gdb/types.scm' ;
      for file in $files ; do
      dir=echo "$file" | sed 's,/[^/]*$,,' ;
      /bin/bash ./../../mkinstalldirs ./guile/$dir ;
      /usr/bin/install -c -m 644 ./../guile/lib/$file ./guile/$dir ;
      done ;
      files='./gdb.go gdb/experimental.go gdb/iterator.go gdb/printing.go
      gdb/support.go gdb/types.go' ;
      cd ./guile ;
      for go in $files ; do
      source="echo $go | sed 's/\.go$/.scm/'" ;
      echo compile -Warity-mismatch -Wformat -Wunused-toplevel -L . -o
      "$go" "$source" ;
      compile -Warity-mismatch -Wformat -Wunused-toplevel -L . -o "$go"
      "$source" || exit 1 ;
      done ;
      fi
      touch stamp-guile
      rm -rf ./system-gdbinit
      mkdir ./system-gdbinit
      files='elinos.py wrs-linux.py' ;
      for file in $files ; do
      f=./../system-gdbinit/$file ;
      if test -f $f ; then
      /usr/bin/install -c -m 644 $f ./system-gdbinit ;
      fi ;
      done
      touch stamp-system-gdbinit
      make[3]: Nothing to be done for 'all-target'.

    crash build failed

    make[1]: *** [Makefile:267: gdb_merge] Error 1
    make: *** [Makefile:258: all] Error 2

Thank you very much.

@KangHoupeng
Copy link

Have you solved it yet? I also encountered a similar problem and need to upgrade to GDB.

@snow-skylee
Copy link

you need porting the patch for gdb. could refer the file gdb-10.2.patch

@atuxli
Copy link

atuxli commented Nov 25, 2024

Have you solved it yet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants