Re: [RFC-v4] Fix .text section offset for windows DLL (was Calling __stdcall functions in the inferior)

Joel Brobecker
2012-11-26T20:58:39Z

> Here, 'entry' is used to look in the hash table, but it is not entered
> into the hash table itself. For that you have to go into the subsequent
> "*slot == NULL" code; and there it allocates a new entry on the
> objfile's obstack. There are two cases, but e.g.:
>
> *slot = obstack_alloc (&objfile->objfile_obstack,
> offsetof (struct demangled_name_entry,
> demangled)
> + demangled_len + 1);

Ah, I got tricked by the INSERT, but looking at the htab_find_slot
documentation, indeed, it clearly explains that the data still needs
to be set. I wasn't able to to determine from just reading the code
where we might be creating a dangling pointer.

> I think there's no need; this is what the 'copy_name=1' case is for.

Right. We just need to dig deeper to figure out what it's not working
for Pierre... I don't think we want to check in his patch where
the xmalloc'ed name does not have a corresponding xfree...

Thanks, Tom.
--
Joel