From patchwork Sat Feb 9 00:40:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 31376 Received: (qmail 27504 invoked by alias); 9 Feb 2019 00:42:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 27455 invoked by uid 89); 9 Feb 2019 00:42:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=sk:svr4_fe, jhb@FreeBSD.org, D*FreeBSD.org, jhbFreeBSDorg X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Feb 2019 00:42:38 +0000 Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 0B0A810B4CE for ; Fri, 8 Feb 2019 19:42:35 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH v2 03/11] Handle an edge case for minisym TLS variable lookups. Date: Fri, 8 Feb 2019 16:40:06 -0800 Message-Id: <864920bfe86e53c8050916713ab672e74db4c137.1549672588.git.jhb@FreeBSD.org> In-Reply-To: References: MIME-Version: 1.0 X-IsSubscribed: yes If a TLS variable is provided by a minisym from a separate debug file, the separate debug file is passed to gdbarch_fetch_tls_load_module_address. However, the object files stored in the shared object list are the original object files, not the separate debug object files. In this case, svr4_fetch_objfile_link_map was failing to find the link map entry since the debug object file is not in its internal list, only the original object file. gdb/ChangeLog: * solib-svr4.c (svr4_fetch_objfile_link_map): Look for objfile->separate_debug_objfile_backlink if not NULL. --- gdb/ChangeLog | 5 +++++ gdb/solib-svr4.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9751118c0e..7f4e912ad3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-02-08 John Baldwin + + * solib-svr4.c (svr4_fetch_objfile_link_map): Look for + objfile->separate_debug_objfile_backlink if not NULL. + 2019-02-08 John Baldwin * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Use diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 787b98ba26..d7a792580d 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -1548,6 +1548,11 @@ svr4_fetch_objfile_link_map (struct objfile *objfile) if (objfile == symfile_objfile) return info->main_lm_addr; + /* If OBJFILE is a separate debug object file, look for the + original object file. */ + if (objfile->separate_debug_objfile_backlink != NULL) + objfile = objfile->separate_debug_objfile_backlink; + /* The other link map addresses may be found by examining the list of shared libraries. */ for (so = master_so_list (); so; so = so->next)