diff options
author | Zhizhou Yang <zhizhouy@google.com> | 2019-02-05 13:30:23 -0800 |
---|---|---|
committer | Zhizhou Yang <zhizhouy@google.com> | 2019-02-05 13:30:23 -0800 |
commit | 2a615abee9fb7c56458ce2ee58390c39ba9ccec4 (patch) | |
tree | 240a2858824202336bdd621ed5987162a26bd5a6 | |
parent | 321dd24967841c5380c6d2f07c37b869538d2f7b (diff) | |
download | gdb-2a615abee9fb7c56458ce2ee58390c39ba9ccec4.tar.gz |
Cherry-pick 7.11 changes to 8.2
Cherry-picked commits:
c64829b: Fallback to open if multifs_open fails.
2177073: Fix gdbserver process interruption.
b711aa8: Add Unix domain socket support to gdbserver 7.9.1.
35ee683: Remove gdb hack.
78af0f6: Handle cross compile for locale configuration
a7e49fd: bfd: add experimental support for SHT_RELR sections.
689b53d: Fix debugging of stripped PIE executables with padded PT_TLS
Fixed transport_is_reliable variable in b711aa8 so that it is consistent
with 8.2 changes.
Bug:62547070
Change-Id: I14a6b819cc0590dc11853dbce91111adfe2cb489
-rw-r--r-- | gdb-8.2/bfd/elf-bfd.h | 2 | ||||
-rw-r--r-- | gdb-8.2/bfd/elf.c | 27 | ||||
-rw-r--r-- | gdb-8.2/bfd/elf32-arm.c | 1 | ||||
-rw-r--r-- | gdb-8.2/bfd/elfcode.h | 2 | ||||
-rw-r--r-- | gdb-8.2/bfd/elfnn-aarch64.c | 1 | ||||
-rwxr-xr-x | gdb-8.2/gdb/gdbserver/configure | 18 | ||||
-rw-r--r-- | gdb-8.2/gdb/gdbserver/hostio.c | 8 | ||||
-rw-r--r-- | gdb-8.2/gdb/gdbserver/linux-low.c | 4 | ||||
-rw-r--r-- | gdb-8.2/gdb/gdbserver/remote-utils.c | 53 | ||||
-rw-r--r-- | gdb-8.2/gdb/gnulib/configure | 8 | ||||
-rw-r--r-- | gdb-8.2/gdb/remote.c | 22 | ||||
-rw-r--r-- | gdb-8.2/gdb/solib-svr4.c | 8 | ||||
-rw-r--r-- | gdb-8.2/gdb/testsuite/gdb.base/gcore-tls-pie.c | 48 | ||||
-rw-r--r-- | gdb-8.2/gdb/testsuite/gdb.base/gcore-tls-pie.exp | 62 | ||||
-rw-r--r-- | gdb-8.2/include/elf/common.h | 11 | ||||
-rw-r--r-- | gdb-8.2/include/elf/external.h | 8 |
16 files changed, 243 insertions, 40 deletions
diff --git a/gdb-8.2/bfd/elf-bfd.h b/gdb-8.2/bfd/elf-bfd.h index 3ed16de89..437e8c94f 100644 --- a/gdb-8.2/bfd/elf-bfd.h +++ b/gdb-8.2/bfd/elf-bfd.h @@ -689,7 +689,7 @@ struct sym_cache struct elf_size_info { unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr; - unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note; + unsigned char sizeof_rel, sizeof_rela, sizeof_relr, sizeof_sym, sizeof_dyn, sizeof_note; /* The size of entries in the .hash section. */ unsigned char sizeof_hash_entry; diff --git a/gdb-8.2/bfd/elf.c b/gdb-8.2/bfd/elf.c index 0f7537512..8b9ee273f 100644 --- a/gdb-8.2/bfd/elf.c +++ b/gdb-8.2/bfd/elf.c @@ -1716,6 +1716,9 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) case DT_RELA: name = "RELA"; break; case DT_RELASZ: name = "RELASZ"; break; case DT_RELAENT: name = "RELAENT"; break; + case DT_RELR: name = "RELR"; break; + case DT_RELRSZ: name = "RELRSZ"; break; + case DT_RELRENT: name = "RELRENT"; break; case DT_STRSZ: name = "STRSZ"; break; case DT_SYMENT: name = "SYMENT"; break; case DT_INIT: name = "INIT"; break; @@ -1753,6 +1756,7 @@ _bfd_elf_print_private_bfd_data (bfd *abfd, void *farg) case DT_PLTPAD: name = "PLTPAD"; break; case DT_MOVETAB: name = "MOVETAB"; break; case DT_SYMINFO: name = "SYMINFO"; break; + case DT_RELRCOUNT: name = "RELRCOUNT"; break; case DT_RELACOUNT: name = "RELACOUNT"; break; case DT_RELCOUNT: name = "RELCOUNT"; break; case DT_FLAGS_1: name = "FLAGS_1"; break; @@ -2320,16 +2324,30 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) case SHT_REL: case SHT_RELA: + case SHT_RELR: /* *These* do a lot of work -- but build no sections! */ { asection *target_sect; Elf_Internal_Shdr *hdr2, **p_hdr; unsigned int num_sec = elf_numsections (abfd); struct bfd_elf_section_data *esdt; + bfd_size_type size; - if (hdr->sh_entsize - != (bfd_size_type) (hdr->sh_type == SHT_REL - ? bed->s->sizeof_rel : bed->s->sizeof_rela)) + switch (hdr->sh_type) + { + case SHT_REL: + size = bed->s->sizeof_rel; + break; + case SHT_RELA: + size = bed->s->sizeof_rela; + break; + case SHT_RELR: + size = bed->s->sizeof_relr; + break; + default: + goto fail; + } + if (hdr->sh_entsize != size) goto fail; /* Check for a bogus link to avoid crashing. */ @@ -2396,7 +2414,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex) || hdr->sh_info == SHN_UNDEF || hdr->sh_info >= num_sec || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_REL - || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA) + || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELA + || elf_elfsections (abfd)[hdr->sh_info]->sh_type == SHT_RELR) { ret = _bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex); diff --git a/gdb-8.2/bfd/elf32-arm.c b/gdb-8.2/bfd/elf32-arm.c index b21901c0f..31b32578b 100644 --- a/gdb-8.2/bfd/elf32-arm.c +++ b/gdb-8.2/bfd/elf32-arm.c @@ -19813,6 +19813,7 @@ const struct elf_size_info elf32_arm_size_info = sizeof (Elf32_External_Shdr), sizeof (Elf32_External_Rel), sizeof (Elf32_External_Rela), + sizeof (Elf32_External_Relr), sizeof (Elf32_External_Sym), sizeof (Elf32_External_Dyn), sizeof (Elf_External_Note), diff --git a/gdb-8.2/bfd/elfcode.h b/gdb-8.2/bfd/elfcode.h index fb02e255f..9d5b0c817 100644 --- a/gdb-8.2/bfd/elfcode.h +++ b/gdb-8.2/bfd/elfcode.h @@ -80,6 +80,7 @@ #define Elf_External_Phdr NAME(Elf,External_Phdr) #define Elf_External_Rel NAME(Elf,External_Rel) #define Elf_External_Rela NAME(Elf,External_Rela) +#define Elf_External_Relr NAME(Elf,External_Relr) #define Elf_External_Dyn NAME(Elf,External_Dyn) #define elf_core_file_failing_command NAME(bfd_elf,core_file_failing_command) @@ -1899,6 +1900,7 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = { sizeof (Elf_External_Shdr), sizeof (Elf_External_Rel), sizeof (Elf_External_Rela), + sizeof (Elf_External_Relr), sizeof (Elf_External_Sym), sizeof (Elf_External_Dyn), sizeof (Elf_External_Note), diff --git a/gdb-8.2/bfd/elfnn-aarch64.c b/gdb-8.2/bfd/elfnn-aarch64.c index cf321f32c..66fe0c94a 100644 --- a/gdb-8.2/bfd/elfnn-aarch64.c +++ b/gdb-8.2/bfd/elfnn-aarch64.c @@ -9561,6 +9561,7 @@ const struct elf_size_info elfNN_aarch64_size_info = sizeof (ElfNN_External_Shdr), sizeof (ElfNN_External_Rel), sizeof (ElfNN_External_Rela), + sizeof (ElfNN_External_Relr), sizeof (ElfNN_External_Sym), sizeof (ElfNN_External_Dyn), sizeof (Elf_External_Note), diff --git a/gdb-8.2/gdb/gdbserver/configure b/gdb-8.2/gdb/gdbserver/configure index 6064a1eb1..3316147bc 100755 --- a/gdb-8.2/gdb/gdbserver/configure +++ b/gdb-8.2/gdb/gdbserver/configure @@ -7644,20 +7644,7 @@ _ACEOF fi -case "${target}" in - *-android*) - # Starting with NDK version 9, <elf.h> actually includes definitions - # of Elf32_auxv_t and Elf64_auxv_t. But sadly, <elf.h> includes - # <sys/exec_elf.h> which defines some of the ELF types incorrectly, - # leading to conflicts with the defintions from <linux/elf.h>. - # This makes it impossible for us to include both <elf.h> and - # <linux/elf.h>, which means that, in practice, we do not have - # access to Elf32_auxv_t and Elf64_auxv_t on this platform. - # Therefore, do not try to auto-detect availability, as it would - # get it wrong on this platform. - ;; - *) - ac_fn_c_check_type "$LINENO" "Elf32_auxv_t" "ac_cv_type_Elf32_auxv_t" "#include <elf.h> +ac_fn_c_check_type "$LINENO" "Elf32_auxv_t" "ac_cv_type_Elf32_auxv_t" "#include <elf.h> " if test "x$ac_cv_type_Elf32_auxv_t" = xyes; then : @@ -7680,9 +7667,6 @@ _ACEOF fi -esac - - # Check whether --with-pkgversion was given. if test "${with_pkgversion+set}" = set; then : diff --git a/gdb-8.2/gdb/gdbserver/hostio.c b/gdb-8.2/gdb/gdbserver/hostio.c index c621edfef..c5daee5c0 100644 --- a/gdb-8.2/gdb/gdbserver/hostio.c +++ b/gdb-8.2/gdb/gdbserver/hostio.c @@ -302,7 +302,7 @@ handle_open (char *own_buf) { char filename[HOSTIO_PATH_MAX]; char *p; - int fileio_flags, fileio_mode, flags, fd; + int fileio_flags, fileio_mode, flags, fd = -1; mode_t mode; struct fd_list *new_fd; @@ -326,7 +326,11 @@ handle_open (char *own_buf) if (hostio_fs_pid != 0 && the_target->multifs_open != NULL) fd = the_target->multifs_open (hostio_fs_pid, filename, flags, mode); - else + + /* HACK: multifs_open will fail for android applications, because run-as does + not switch to the same mount namespace as the running application. Retry + with regular open if this happens. */ + if (fd == -1) fd = open (filename, flags, mode); if (fd == -1) diff --git a/gdb-8.2/gdb/gdbserver/linux-low.c b/gdb-8.2/gdb/gdbserver/linux-low.c index 7c396ae36..b7c82d21a 100644 --- a/gdb-8.2/gdb/gdbserver/linux-low.c +++ b/gdb-8.2/gdb/gdbserver/linux-low.c @@ -5940,9 +5940,7 @@ linux_look_up_symbols (void) static void linux_request_interrupt (void) { - /* Send a SIGINT to the process group. This acts just like the user - typed a ^C on the controlling terminal. */ - kill (-signal_pid, SIGINT); + kill (signal_pid, SIGINT); } /* Copy LEN bytes from inferior's auxiliary vector starting at OFFSET diff --git a/gdb-8.2/gdb/gdbserver/remote-utils.c b/gdb-8.2/gdb/gdbserver/remote-utils.c index 45d5c8d45..848e1e9a2 100644 --- a/gdb-8.2/gdb/gdbserver/remote-utils.c +++ b/gdb-8.2/gdb/gdbserver/remote-utils.c @@ -282,11 +282,64 @@ remote_prepare (const char *name) /* Open a connection to a remote debugger. NAME is the filename used for communication. */ +// ANDROID BEGIN. +#ifndef USE_WIN32API +#include <sys/un.h> +#endif +// ANDROID END. + void remote_open (const char *name) { + client_state &cs = get_client_state (); const char *port_str; + // ANDROID BEGIN. + // The Android NDK uses Unix domain sockets because applications + // aren't allowed to bind to localhost TCP sockets, and developers + // debugging on production devices can't get root. + // Typical ndk-gdb usage is "gdbserver +debug-socket --attach 123". + if (name[0] == '+') + { +#ifdef USE_WIN32API + error ("Only <host>:<port> is supported on this platform."); +#else + struct sockaddr_un sockaddr; + socklen_t sockaddrlen; + + listen_desc = socket (AF_UNIX, SOCK_STREAM, 0); + if (listen_desc == -1) + perror_with_name ("Can't create Unix domain socket"); + + /* Skip the initial '+'. */ + name++; + + memset (&sockaddr, 0, sizeof sockaddr); + sockaddr.sun_family = AF_UNIX; + strlcpy (sockaddr.sun_path, name, sizeof (sockaddr.sun_path)); + sockaddrlen = sizeof (sockaddr.sun_family) + + strlen (sockaddr.sun_path) + 1; + + unlink (sockaddr.sun_path); + + if (bind (listen_desc, (struct sockaddr *) &sockaddr, sockaddrlen) + || listen (listen_desc, 1)) + perror_with_name ("Can't bind Unix domain socket"); + + fprintf (stderr, "Listening on Unix domain socket '%s'\n", + sockaddr.sun_path); + fflush (stderr); + + /* Register the event loop handler. */ + add_file_handler (listen_desc, handle_accept_event, NULL); + + cs.transport_is_reliable = 1; +#endif + + return; + } + // ANDROID END. + port_str = strchr (name, ':'); #ifdef USE_WIN32API if (port_str == NULL) diff --git a/gdb-8.2/gdb/gnulib/configure b/gdb-8.2/gdb/gnulib/configure index a152abcb7..7148a16f7 100644 --- a/gdb-8.2/gdb/gnulib/configure +++ b/gdb-8.2/gdb/gnulib/configure @@ -11467,6 +11467,8 @@ _ACEOF $as_echo_n "checking for a traditional japanese locale... " >&6; } if ${gt_cv_locale_ja+:} false; then : $as_echo_n "(cached) " >&6 +elif test "$cross_compiling" = yes; then : + gt_cv_locale_ja=none else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11606,6 +11608,8 @@ $as_echo "$gt_cv_locale_ja" >&6; } $as_echo_n "checking for a transitional chinese locale... " >&6; } if ${gt_cv_locale_zh_CN+:} false; then : $as_echo_n "(cached) " >&6 +elif test "$cross_compiling" = yes; then : + gt_cv_locale_zh_CN=none else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11738,6 +11742,8 @@ $as_echo "$gt_cv_locale_zh_CN" >&6; } $as_echo_n "checking for a french Unicode locale... " >&6; } if ${gt_cv_locale_fr_utf8+:} false; then : $as_echo_n "(cached) " >&6 +elif test "$cross_compiling" = yes; then : + gt_cv_locale_fr_utf8=none else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -11867,6 +11873,8 @@ $as_echo "$gt_cv_locale_fr_utf8" >&6; } $as_echo_n "checking for a traditional french locale... " >&6; } if ${gt_cv_locale_fr+:} false; then : $as_echo_n "(cached) " >&6 +elif test "$cross_compiling" = yes; then : + gt_cv_locale_fr=none else cat confdefs.h - <<_ACEOF >conftest.$ac_ext diff --git a/gdb-8.2/gdb/remote.c b/gdb-8.2/gdb/remote.c index 9a5286da3..d4808ff45 100644 --- a/gdb-8.2/gdb/remote.c +++ b/gdb-8.2/gdb/remote.c @@ -4232,14 +4232,14 @@ stop_reply_extract_thread (char *stop_reply) { const char *p1; - p1 = strchr (p, ':'); + p1 = strchrnul (p, ':'); if (p1 == NULL) return null_ptid; if (strncmp (p, "thread", p1 - p) == 0) return read_ptid (++p1, &p); - p1 = strchr (p, ';'); + p1 = strchrnul (p, ';'); if (p1 == NULL) return null_ptid; p1++; @@ -5300,7 +5300,7 @@ remote_target::remote_query_supported () there's another item after this, we overwrite the separator (terminated strings are much easier to work with). */ p = next; - end = strchr (p, ';'); + end = strchrnul (p, ';'); if (end == NULL) { end = p + strlen (p); @@ -5318,7 +5318,7 @@ remote_target::remote_query_supported () } } - name_end = strchr (p, '='); + name_end = strchrnul (p, '='); if (name_end) { /* This is a name=value entry. */ @@ -5967,7 +5967,7 @@ remote_target::remote_vcont_probe () else if (*p == 'r' && (*(p + 1) == ';' || *(p + 1) == 0)) rs->supports_vCont.r = 1; - p = strchr (p, ';'); + p = strchrnul (p, ';'); } /* If c, and C are not all supported, we can't use vCont. Clearing @@ -7227,7 +7227,7 @@ remote_target::remote_parse_stop_reply (char *buf, stop_reply *event) const char *p1; int fieldsize; - p1 = strchr (p, ':'); + p1 = strchrnul (p, ':'); if (p1 == NULL) error (_("Malformed packet(a) (missing colon): %s\n\ Packet: '%s'\n"), @@ -10339,7 +10339,7 @@ remote_target::insert_watchpoint (CORE_ADDR addr, int len, set_general_process (); xsnprintf (rs->buf, endbuf - rs->buf, "Z%x,", packet); - p = strchr (rs->buf, '\0'); + p = strchrnul (rs->buf, '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); xsnprintf (p, endbuf - p, ",%x", len); @@ -10388,7 +10388,7 @@ remote_target::remove_watchpoint (CORE_ADDR addr, int len, set_general_process (); xsnprintf (rs->buf, endbuf - rs->buf, "z%x,", packet); - p = strchr (rs->buf, '\0'); + p = strchrnul (rs->buf, '\0'); addr = remote_address_masked (addr); p += hexnumstr (p, (ULONGEST) addr); xsnprintf (p, endbuf - p, ",%x", len); @@ -10563,7 +10563,7 @@ remote_target::insert_hw_breakpoint (struct gdbarch *gdbarch, case PACKET_ERROR: if (rs->buf[1] == '.') { - message = strchr (rs->buf + 2, '.'); + message = strchrnul (rs->buf + 2, '.'); if (message) error (_("Remote failure reply: %s"), message + 1); } @@ -11194,7 +11194,7 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf) /* The query prefix. */ strcpy (rs->buf, "qRcmd,"); - p = strchr (rs->buf, '\0'); + p = strchrnul (rs->buf, '\0'); if ((strlen (rs->buf) + strlen (command) * 2 + 8/*misc*/) > get_remote_packet_size ()) @@ -13238,7 +13238,7 @@ remote_target::trace_find (enum trace_find_type type, int num, p = rs->buf; strcpy (p, "QTFrame:"); - p = strchr (p, '\0'); + p = strchrnul (p, '\0'); switch (type) { case tfind_number: diff --git a/gdb-8.2/gdb/solib-svr4.c b/gdb-8.2/gdb/solib-svr4.c index 6f48c6863..84589509e 100644 --- a/gdb-8.2/gdb/solib-svr4.c +++ b/gdb-8.2/gdb/solib-svr4.c @@ -2709,8 +2709,10 @@ svr4_exec_displacement (CORE_ADDR *displacementp) /* Strip modifies the flags and alignment of PT_GNU_RELRO. CentOS-5 has problems with filesz, memsz as well. + Strip also modifies memsz of PT_TLS. See PR 11786. */ - if (phdr2[i].p_type == PT_GNU_RELRO) + if (phdr2[i].p_type == PT_GNU_RELRO || + phdr2[i].p_type == PT_TLS) { Elf32_External_Phdr tmp_phdr = *phdrp; Elf32_External_Phdr tmp_phdr2 = *phdr2p; @@ -2840,8 +2842,10 @@ svr4_exec_displacement (CORE_ADDR *displacementp) /* Strip modifies the flags and alignment of PT_GNU_RELRO. CentOS-5 has problems with filesz, memsz as well. + Strip also modifies memsz of PT_TLS. See PR 11786. */ - if (phdr2[i].p_type == PT_GNU_RELRO) + if (phdr2[i].p_type == PT_GNU_RELRO || + phdr2[i].p_type == PT_TLS) { Elf64_External_Phdr tmp_phdr = *phdrp; Elf64_External_Phdr tmp_phdr2 = *phdr2p; diff --git a/gdb-8.2/gdb/testsuite/gdb.base/gcore-tls-pie.c b/gdb-8.2/gdb/testsuite/gdb.base/gcore-tls-pie.c new file mode 100644 index 000000000..aaba20fcc --- /dev/null +++ b/gdb-8.2/gdb/testsuite/gdb.base/gcore-tls-pie.c @@ -0,0 +1,48 @@ +/* Copyright 2013-2018 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +/* The size of these variables is chosen so that gold will add some padding + to the TLS program header (total size of 16 bytes on x86_64) which strip + will remove (bringing it down to 9 bytes). */ + +__thread long j; +__thread char i; + +void +break_here (void) +{ + *(int *) 0 = 0; +} + +void +foo (void) +{ + break_here (); +} + +void +bar (void) +{ + foo (); +} + +int +main (void) +{ + bar (); + return 0; +} diff --git a/gdb-8.2/gdb/testsuite/gdb.base/gcore-tls-pie.exp b/gdb-8.2/gdb/testsuite/gdb.base/gcore-tls-pie.exp new file mode 100644 index 000000000..1f7381e1b --- /dev/null +++ b/gdb-8.2/gdb/testsuite/gdb.base/gcore-tls-pie.exp @@ -0,0 +1,62 @@ +# Copyright 2013-2018 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# PR 11786 (Gold and strip differ on memsz field of PT_TLS). +# Generate a core file from the stripped version of the program, +# and then try to debug the core with the unstripped version. + +standard_testfile + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug additional_flags=-fpie "ldflags=-pie -fuse-ld=gold"}]} { + return -1 +} + +set stripped_binfile ${binfile}.stripped +set gcorefile ${binfile}.gcore + +set strip_program [transform strip] +remote_file host delete ${stripped_binfile} +if [run_on_host "strip" "$strip_program" "-g -o ${stripped_binfile} $binfile"] { + return -1 +} + +# Workaround PR binutils/10802: +# Preserve the 'x' bit also for PIEs (Position Independent Executables). +set perm [file attributes ${binfile} -permissions] +file attributes ${stripped_binfile} -permissions $perm + +clean_restart ${stripped_binfile} + +# The binary is stripped of debug info, but not minsyms. +if ![runto break_here] { + fail "can't run to break_here" + return -1 +} + +if {![gdb_gcore_cmd $gcorefile "save a corefile"]} { + return -1 +} + +# Now restart gdb with the unstripped binary and load the corefile. + +clean_restart ${binfile} + +gdb_test "core ${gcorefile}" \ + "Core was generated by .*" "re-load generated corefile" + +# Put $pc in gdb.log for debug purposes for comparison with stripped case. +gdb_test "x/i \$pc" "break_here.*" + +gdb_test "frame" "#0 \[^\r\n\]* break_here .*" "unstripped + core ok" diff --git a/gdb-8.2/include/elf/common.h b/gdb-8.2/include/elf/common.h index 773f378fd..d61c244e2 100644 --- a/gdb-8.2/include/elf/common.h +++ b/gdb-8.2/include/elf/common.h @@ -519,6 +519,10 @@ #define SHT_GNU_verneed SHT_SUNW_verneed #define SHT_GNU_versym SHT_SUNW_versym +/* Experimental support for SHT_RELR sections. For details, see proposal + at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg */ +#define SHT_RELR 0x6fffff00 /* Relative relocations, only offsets */ + #define SHT_LOPROC 0x70000000 /* Processor-specific semantics, lo */ #define SHT_HIPROC 0x7FFFFFFF /* Processor-specific semantics, hi */ #define SHT_LOUSER 0x80000000 /* Application-specific semantics */ @@ -957,6 +961,13 @@ /* This tag is a GNU extension to the Solaris version scheme. */ #define DT_VERSYM 0x6ffffff0 +/* Experimental support for SHT_RELR sections. For details, see proposal + at https://groups.google.com/forum/#!topic/generic-abi/bX460iggiKg */ +#define DT_RELR 0x6fffe000 +#define DT_RELRSZ 0x6fffe001 +#define DT_RELRENT 0x6fffe003 +#define DT_RELRCOUNT 0x6fffe005 + #define DT_LOPROC 0x70000000 #define DT_HIPROC 0x7fffffff diff --git a/gdb-8.2/include/elf/external.h b/gdb-8.2/include/elf/external.h index 7aece984b..03a98275d 100644 --- a/gdb-8.2/include/elf/external.h +++ b/gdb-8.2/include/elf/external.h @@ -212,6 +212,10 @@ typedef struct { } Elf32_External_Rela; typedef struct { + unsigned char r_data[4]; /* jump and bitmap for relative relocations */ +} Elf32_External_Relr; + +typedef struct { unsigned char r_offset[8]; /* Location at which to apply the action */ unsigned char r_info[8]; /* index and type of relocation */ } Elf64_External_Rel; @@ -222,6 +226,10 @@ typedef struct { unsigned char r_addend[8]; /* Constant addend used to compute value */ } Elf64_External_Rela; +typedef struct { + unsigned char r_data[8]; /* jump and bitmap for relative relocations */ +} Elf64_External_Relr; + /* dynamic section structure */ typedef struct { |