From patchwork Fri Mar 6 16:50:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Terekhov, Mikhail via Gdb-patches" X-Patchwork-Id: 38450 Received: (qmail 46248 invoked by alias); 6 Mar 2020 16:50:33 -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 46235 invoked by uid 89); 6 Mar 2020 16:50:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.4 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=inferior_ptid, HContent-Transfer-Encoding:8bit X-HELO: sonic304-22.consmr.mail.ir2.yahoo.com Received: from sonic304-22.consmr.mail.ir2.yahoo.com (HELO sonic304-22.consmr.mail.ir2.yahoo.com) (77.238.179.147) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Mar 2020 16:50:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1583513428; bh=tW6cymS3h0FLdNlJQQMqI5hHX5sxvLYZ53gya4pfZro=; h=From:To:Subject:Date:References:From:Subject; b=QvnD8vdiHOG8o9JD/+5jQ/T32WIPL44ZKkFSNOvChK3OaWUVfwuifR+4nDWwtmYmlBzDwflBNFdX+niBdJgKiraJ54jasj5dW1a4REmncP7qFrvc9FG6+qjoIHd7aqRLKyrJuA2ClMUGQQWEpFtATzh2JF5qxMfDmJXGtpCrDCXAItXKdGBi40HMrjbPVBGRrxqLSPQsc5aIqO1dIvE0XUw7eifuRoRD6ZWzZHefdzxP7oR+MVDtQrTNXFweuVloLvPKPTVUnvpLPL19sJbSgIIfHRP0ZVWNzdKm4o2MafoV5ByWa6AmdMe5WR1rg3zXs0COkHf0m8R5z6FjoVEiLg== Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ir2.yahoo.com with HTTP; Fri, 6 Mar 2020 16:50:28 +0000 Received: by smtp404.mail.ir2.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID d05c46fdda0a87725c4233f137369917; Fri, 06 Mar 2020 16:50:23 +0000 (UTC) X-Patchwork-Original-From: "Hannes Domani via gdb-patches" From: "Terekhov, Mikhail via Gdb-patches" Reply-To: Hannes Domani To: gdb-patches@sourceware.org Subject: [PATCH] Don't try to get the TIB address without an inferior Date: Fri, 6 Mar 2020 17:50:00 +0100 Message-Id: <20200306165000.3073-1-ssbssa@yahoo.de> MIME-Version: 1.0 References: <20200306165000.3073-1-ssbssa.ref@yahoo.de> Content-Length: 1119 X-IsSubscribed: yes The target_get_tib_address call always fails in this case, and there is an error when changing the program with the file command: (gdb) file allocer64.exe Reading symbols from allocer64.exe... You can't do that when your target is `exec' Now it will skip this part, there is no need to rebase the executable without an inferior anyways. gdb/ChangeLog: 2020-03-06 Hannes Domani * windows-tdep.c (windows_solib_create_inferior_hook): Check inferior_ptid. --- gdb/windows-tdep.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 4e5d8303ca..a3bacc2211 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -843,7 +843,8 @@ windows_solib_create_inferior_hook (int from_tty) } CORE_ADDR tlb; gdb_byte buf[8]; - if (target_get_tib_address (inferior_ptid, &tlb) + if (inferior_ptid != null_ptid + && target_get_tib_address (inferior_ptid, &tlb) && !target_read_memory (tlb + peb_offset, buf, ptr_bytes)) { CORE_ADDR peb = extract_unsigned_integer (buf, ptr_bytes, byte_order);