[lldb-dev] Patch to add two new classes - RegisterContextLinux_x86_64 and RegisterContextFreeBSD_x86_64

Thirumurthi, Ashok ashok.thirumurthi at intel.com
Tue May 7 13:55:11 PDT 2013


> m_register_infos is allocated only once per platform.

Well, a single instance of RegisterContext will allocate a single copy of g_register_infos.  However, we have one instance of RegisterContext per POSIXThread.  This is required to have a register set per thread, but not to have static metadata like g_register_infos,

- Ashok

-----Original Message-----
From: Samuel Jacob [mailto:samueldotj at gmail.com] 
Sent: Tuesday, May 07, 2013 3:55 PM
To: Thirumurthi, Ashok
Cc: lldb-dev
Subject: Re: [lldb-dev] Patch to add two new classes - RegisterContextLinux_x86_64 and RegisterContextFreeBSD_x86_64

On Tue, May 7, 2013 at 12:36 PM, Thirumurthi, Ashok <ashok.thirumurthi at intel.com> wrote:
> I see.  Note that there are a few downsides to the current implementation.  First, there is a need for about 6Kb of data for m_register_infos that is currently allocated per thread.  Secondly, it's not possible to have static methods that use m_register_infos, and we have a regression in logging because of static methods that use the stale m_register_infos like GetRegisterIndexFromOffset().  Third, the base class is brittle because it has stale m_register_infos.
>
Agree with the downsides. Slight correction m_register_infos is allocated only once per platform.

> One possibility is for POSIXThread to maintain a new static class instance that wraps m_register_infos for each platform (let's call this RegisterLayout).  This would allow the plugins to be recoded without static methods while keeping the leaf classes lightweight.  Currently, we couple the register set with the layout in RegisterContext, whereas we need one register set per thread and one register layout per platform.

Good idea it will make RegisterContext classes neat.

Thanks
Samuel




More information about the lldb-dev mailing list