From patchwork Tue Jan 22 18:42:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 31163 Received: (qmail 85469 invoked by alias); 22 Jan 2019 18:43:45 -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 85447 invoked by uid 89); 22 Jan 2019 18:43:45 -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=John, HContent-Transfer-Encoding:8bit 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; Tue, 22 Jan 2019 18:43:43 +0000 Received: from ralph.com (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id BC70210B4CE for ; Tue, 22 Jan 2019 13:43:41 -0500 (EST) From: John Baldwin To: gdb-patches@sourceware.org Subject: [PATCH 3/9] Handle TLS variable lookups when using separate debug object files. Date: Tue, 22 Jan 2019 10:42:56 -0800 Message-Id: <6f24b813adb0155b499d6e2265a6f15a2db4e6ca.1548180889.git.jhb@FreeBSD.org> In-Reply-To: References: MIME-Version: 1.0 X-IsSubscribed: yes The object files stored in the shared object list are the original object files, not the separate debug object files. However, when resolving a TLS variable, the variable is resolved against a separate debug object file if it exists. 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 056a60fa23..c02e534fe5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2019-01-22 John Baldwin + + * solib-svr4.c (svr4_fetch_objfile_link_map): Look for + objfile->separate_debug_objfile_backlink if not NULL. + 2019-01-22 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)