From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50482 invoked by alias); 6 Mar 2020 16:57:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 50471 invoked by uid 89); 6 Mar 2020 16:57:32 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1401 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Mar 2020 16:57:30 +0000 Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 387CE1E581; Fri, 6 Mar 2020 11:57:28 -0500 (EST) Subject: Re: [PATCH] Don't try to get the TIB address without an inferior To: Hannes Domani , gdb-patches@sourceware.org References: <20200306165000.3073-1-ssbssa.ref@yahoo.de> <20200306165000.3073-1-ssbssa@yahoo.de> From: Simon Marchi Message-ID: <01f93db0-846f-8a9b-0642-498be38e75ff@simark.ca> Date: Fri, 06 Mar 2020 16:57:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200306165000.3073-1-ssbssa@yahoo.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2020-03/txt/msg00145.txt On 2020-03-06 11:50 a.m., Hannes Domani via gdb-patches wrote: > 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); It won't really make much of a difference in practice, but I think it would be appropriate to use "target_has_memory" for this condition. Simon