This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 11/25] Use VEC for target_desc.reg_defs


Pedro Alves <palves@redhat.com> writes:

> Can you say more about the choice of VEC?  It feels
> like new uses should come with a rationale for why it'd
> be preferred over std::vector.
>
> I'm guessing that it's because the gdb side uses VEC too?
> Or is it something else?  (I can guess other reasons, but
> the point is that we shouldn't have to guess.)

Yes, GDB target description uses VEC, so I chose VEC for GDBserver
target description too.

>
> [Note that the IPA avoids calling the inferior's malloc during
> normal operation, to avoid deadlocking the inferior.
> This is initialization code, so it's not covered by the exact
> same level of concern, even though one of the original goals was
> to also be able to inject the IPA into a running inferior (e.g., by
> calling dlopen via gdb).  That does work (or at least used to),
> but it's a little unsafe because the IPA initialization code
> already calls malloc and other non-async-signal-safe functions.

Such usage is documented, at least,
https://sourceware.org/gdb/onlinedocs/gdb/Server.html

> I guess std::vector would make it possible to use a custom
> allocator in the IPA that would allocate memory with mmap
> directly (or we'd make the IPA's xmalloc allocate with mmap,
> and then the allocator would use xmalloc).]

Do you suggest that we need to use std::vector plus a customized
allocator which uses mmap?

-- 
Yao (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]