public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Hannes Domani <ssbssa@yahoo.de>,
	Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Don't try to get the TIB address without an inferior
Date: Fri, 06 Mar 2020 17:13:00 -0000	[thread overview]
Message-ID: <74b2a6ee-7411-0d5f-298d-c84f25603eca@simark.ca> (raw)
In-Reply-To: <1282895660.8715665.1583514403483@mail.yahoo.com>

On 2020-03-06 12:06 p.m., Hannes Domani via gdb-patches wrote:
>  Am Freitag, 6. März 2020, 17:57:30 MEZ hat Simon Marchi <simark@simark.ca> 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 without
>>> an inferior anyways.
>>>
>>> gdb/ChangeLog:
>>>
>>> 2020-03-06  Hannes Domani  <ssbssa@yahoo.de>
>>>
>>>      * 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.
> 
> I just tried it, but exec_target::has_memory() returns true, although no
> program is running:
> 
> (gdb) l
> 1153    bool
> 1154    exec_target::has_memory ()
> 1155    {
> 1156      /* We can provide memory if we have any file/target sections to read
> 1157         from.  */
> 1158      return (current_target_sections->sections
> 1159              != current_target_sections->sections_end);
> 1160    }
> 1161
> 1162    char *
> (gdb) p current_program_space->target_sections
> $4 = {
>   sections = 0x11f70630,
>   sections_end = 0x11f70710
> }
> 

Oh, right, perhaps target_has_execution then?

      reply	other threads:[~2020-03-06 17:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200306165000.3073-1-ssbssa.ref@yahoo.de>
2020-03-06 16:50 ` Hannes Domani via gdb-patches
2020-03-06 16:57   ` Simon Marchi
2020-03-06 17:05     ` Simon Marchi
2020-03-06 17:12       ` Hannes Domani via gdb-patches
2020-03-06 17:21         ` Simon Marchi
2020-03-06 17:42           ` Hannes Domani via gdb-patches
2020-03-06 17:06     ` Hannes Domani via gdb-patches
2020-03-06 17:13       ` Simon Marchi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74b2a6ee-7411-0d5f-298d-c84f25603eca@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=ssbssa@yahoo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).