[Lldb-commits] [lldb] r186207 - Introduces core file support for Linux x86-64 using 'lldb a.out -c core'.
gclayton at apple.com
Thu Jul 25 11:49:08 PDT 2013
On Jul 25, 2013, at 11:41 AM, Ed Maste <emaste at freebsd.org> wrote:
> On 16 July 2013 17:43, Greg Clayton <gclayton at apple.com> wrote:
>> I spent some time modifying the patch to correctly abstract the register contexts so we don't have this incorrect RegisterContext base class that uses ProcessMonitor... I wasn't able to finish it, but I did get it close. I have attached the patch for you guys to check out and hopefully fix it up and get it working for normal linux/freebsd, and for ELF core files for both linux and freebsd.
>> The basics are, the following classes contain the register context data, but don't do any of the reading/writing registers (they have pure virtual functions for that):
> Is there any reason these shouldn't be just RegisterContext_i386 and
> RegisterContext_x86_64, and used for all platforms (i.e., shared with
> the Darwin ones)?
Yes, different systems expose different registers. When you match your local register context to the exact structures that are used by the current system, you can easily read registers and blast them into a buffer with no remapping required. Darwin, for x86_64, has:
Not that many of the segment registers are missing as they are not backed up with each thread. LLDB also requires that all registers be numbered started at zero and increment up with no gaps in between for the register IDs so that lookups are always just a direct access into an array instead of a large switch statement which works arounds the gaps.
The register contexts are easy to subclass and tailor to how your system reads registers (entire register sets at a time, or individual registers). I would like to avoid showing registers that can't be read/written to on a platform (like the segment registers in our case).
More information about the lldb-commits