From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 61601 invoked by alias); 6 Mar 2020 17:06:51 -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 61593 invoked by uid 89); 6 Mar 2020 17:06:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.5 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=mez, folgendes, MEZ, geschrieben X-HELO: sonic313-21.consmr.mail.ir2.yahoo.com Received: from sonic313-21.consmr.mail.ir2.yahoo.com (HELO sonic313-21.consmr.mail.ir2.yahoo.com) (77.238.179.188) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Mar 2020 17:06:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s2048; t=1583514407; bh=jdfzVJyxSPulBxs26nO2JZODhg9IMNdiYKowTkyOoPc=; h=Date:From:To:In-Reply-To:References:Subject:From:Subject; b=I/zp0iERIzhoDscaK66yaJncI1uxOTQCVt/gqbI0m9AhsHO2LRm7Tkh5X/5UA538ySEufka/MiuD8XZl7KcFfIRw3ga/InW5Ie+tz30YRCT1NXpuOV3tfqWtPV/pcyjO1l7VYeyU0To92bg/yiM011WVPaEoQKn8kVYKMiwsK/IUcEjRQ7Dwy5TvwdSDQ5Bd7jmbJr2Is6/GH/9/OMtRIsTJTgw6Zzrs16q6kH474kuRKIh38d/U996lS+Rms5+4OgM1nYnSSveJVeoOcA7Fj77PrkXZ5twgKjRFLdcCnvmaJdfK59vhwMKN7VKBjztUJ33IAArdRmBvgt5a6N0fow== Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Fri, 6 Mar 2020 17:06:47 +0000 Date: Fri, 06 Mar 2020 17:06:00 -0000 From: "Hannes Domani via gdb-patches" Reply-To: Hannes Domani To: Gdb-patches Message-ID: <1282895660.8715665.1583514403483@mail.yahoo.com> In-Reply-To: <01f93db0-846f-8a9b-0642-498be38e75ff@simark.ca> References: <20200306165000.3073-1-ssbssa.ref@yahoo.de> <20200306165000.3073-1-ssbssa@yahoo.de> <01f93db0-846f-8a9b-0642-498be38e75ff@simark.ca> Subject: Re: [PATCH] Don't try to get the TIB address without an inferior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2020-03/txt/msg00148.txt Am Freitag, 6. M=C3=A4rz 2020, 17:57:30 MEZ hat Simon Marchi Folgendes geschrieben: > 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 w= ithout > > an inferior anyways. > > > > gdb/ChangeLog: > > > > 2020-03-06=C2=A0 Hannes Domani=C2=A0 > > > >=C2=A0=C2=A0=C2=A0=C2=A0 * windows-tdep.c (windows_solib_create_inferior= _hook): > >=C2=A0=C2=A0=C2=A0=C2=A0 Check inferior_ptid. > > --- > >=C2=A0 gdb/windows-tdep.c | 3 ++- > >=C2=A0 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) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 } > >=C2=A0=C2=A0=C2=A0 CORE_ADDR tlb; > >=C2=A0=C2=A0=C2=A0 gdb_byte buf[8]; > > -=C2=A0 if (target_get_tib_address (inferior_ptid, &tlb) > > +=C2=A0 if (inferior_ptid !=3D null_ptid > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 && target_get_tib_address (inferior_pti= d, &tlb) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 && !target_read_memory (tlb += peb_offset, buf, ptr_bytes)) > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 { > >=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 CORE_ADDR peb =3D extract_uns= igned_integer (buf, ptr_bytes, byte_order); > > > It won't really make much of a difference in practice, but I think it wou= ld be > appropriate to use "target_has_memory" for this condition. I just tried it, but exec_target::has_memory() returns true, although no program is running: (gdb) l 1153=C2=A0=C2=A0=C2=A0 bool 1154=C2=A0=C2=A0=C2=A0 exec_target::has_memory () 1155=C2=A0=C2=A0=C2=A0 { 1156=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* We can provide memory if we have any = file/target sections to read 1157=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 from.=C2=A0 */ 1158=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return (current_target_sections->sections 1159=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 !=3D current_target_sections->sections_end); 1160=C2=A0=C2=A0=C2=A0 } 1161 1162=C2=A0=C2=A0=C2=A0 char * (gdb) p current_program_space->target_sections $4 =3D { =C2=A0 sections =3D 0x11f70630, =C2=A0 sections_end =3D 0x11f70710 }