Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/4] [gdb/symtab] Fix htab_find_slot call in read_call_site_scope
Date: Mon, 4 Oct 2021 18:14:52 +0200	[thread overview]
Message-ID: <6fbc3a03-fc42-8b14-4590-d60657e70446@suse.de> (raw)
In-Reply-To: <fd79e232-a7bf-7875-f45a-1f51a06ae16a@polymtl.ca>

On 10/4/21 5:41 PM, Simon Marchi wrote:
> On 2021-10-04 08:46, Tom de Vries wrote:
>> On 10/4/21 2:05 PM, Simon Marchi wrote:
>>>>> Ah, I had not seen this comment.  So it was on purpose.  Still, I think
>>>>> that it makes it more confusing than anything.  The patch LGTM.
>>>>
>>>> And, this follow-up commit reverts everything except the comment.
>>>>
>>>> Any comments?
>>>>
>>>> Thanks,
>>>> - Tom
>>>>
>>>
>>> Is there a problem with having the lookups done with just the pc? 
>>
>> Well, there's the problem that I describe in the commit message.  I
>> don't known of any other problem.
>>
>>> If we
>>> were to replace this with some C++ hash table, say std::unordered_map, it
>>> would be std::unordered_map<CORE_ADDR /* pc */, call_site>. 
>>
>> Right, because there's a separation between key and element.
>>
>>> So doing
>>> the lookups using just the pc in the htab makes sense to me.
>>
>> I'm sorry, I don't really understand what you're trying to say here.
>>
>> Do you agree with the patch?  Do you disagree with the patch.  Are you
>> suggesting an alternative solution?
> 
> My thinking was: why not keep core_addr_eq and core_addr_hash, and pass
> a pointer to a CORE_ADDR when calling htab_find_slot.  And drop the
> requirement for call_site::pc to be the first member of call_site.  But
> I now realize that this may not be a correct use of htab: htab_find
> passes entries to the eq func.  So if we have core_addr_eq as the eq
> func and htab passes a call_site* entry to core_addr_eq, it won't work.
> Now, we don't actually use htab_find, so it would still work for us.
> But that would be like setting up a trap for whoever tries to use
> htab_find in the future.
> 

All find variants (with the explicit exception of
find_empty_slot_for_expand) call eq_f on both an element argument and a
hash table element.  Consequently, if we break first-field-type
compatibility between the two, the element argument must be of the same
type as the hash table element, and the eq function must use hash table
element type.

This is not a future problem, this is an actual problem I ran into when
I tried it out moving the pc to the second field position, and the
problem is described in the commit log.

> So, the patche LGTM.

Ack, thanks for the review, I'll commit.

Thanks,
- Tom

  reply	other threads:[~2021-10-04 16:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01 12:33 Tom de Vries via Gdb-patches
2021-10-01 12:33 ` [PATCH 2/4] [gdb/symtab] Remove COMPUNIT_CALL_SITE_HTAB Tom de Vries via Gdb-patches
2021-10-01 13:13   ` Simon Marchi via Gdb-patches
2021-10-01 12:33 ` [PATCH 3/4] [gdb/symtab] Add call_site::pc () Tom de Vries via Gdb-patches
2021-10-01 18:10   ` Simon Marchi
2021-10-04 16:45     ` Tom de Vries via Gdb-patches
2021-10-01 12:33 ` [PATCH 4/4] [gdb/symtab] Use unrelocated addresses in call_site Tom de Vries via Gdb-patches
2021-10-01 20:56   ` Simon Marchi via Gdb-patches
2021-10-04 16:47     ` Tom de Vries via Gdb-patches
2021-10-01 13:09 ` [PATCH 1/4] [gdb/symtab] Fix htab_find_slot call in read_call_site_scope Simon Marchi via Gdb-patches
2021-10-03 19:34   ` Tom de Vries via Gdb-patches
2021-10-04 12:05     ` Simon Marchi via Gdb-patches
2021-10-04 12:46       ` Tom de Vries via Gdb-patches
2021-10-04 15:41         ` Simon Marchi via Gdb-patches
2021-10-04 16:14           ` Tom de Vries via Gdb-patches [this message]
2021-10-04 16:34             ` Simon Marchi via Gdb-patches

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=6fbc3a03-fc42-8b14-4590-d60657e70446@suse.de \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tdevries@suse.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