[lldb-dev] [PATCH] Incorrect register map for Linux 32-bit - Correction supplied

Todd Fiala tfiala at google.com
Fri Feb 14 08:59:19 PST 2014


I'll have a look at it.

This is essentially what I was driving towards last night, which was that
our duplicated version of the truth in sys/user.h was incorrect.

I'll give this a run now on my end.  If it works, I will probably also
check it in with some other minor changes I made to logging, and an assert
I put in for ensuring our custom structure size matches the sys/user.h
structure size.

Later I'd suggest we go back and rewrite that code in terms of the official
structures for a given platform.


On Fri, Feb 14, 2014 at 3:39 AM, Matthew Gardiner <mg11 at csr.com> wrote:

> Hi,
>
> The register map in RegisterContextLinux_i386.cpp is in disagreement with
> that seen in /usr/include/sys/user.h. The result is that offset
> calculations for the dr0-dr7 are incorrect. I've had a look at the source
> and determined that this can't be fixed portably (i.e. for 32/64-bit) with:
>
> FXSAVE i387;
>
> since FXSAVE deploys a union and thus the size of the struct would be the
> same in either architecture, which would be undesirable. I have fixed this
> on my system with:
>
> Index: source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp
> ===================================================================
> --- source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp  (revision
> 201399)
> +++ source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp  (working
> copy)
> @@ -34,11 +34,23 @@
>      uint32_t ss;
>  };
>
> +struct FPR_i386
> +{
> +  long int cwd;
> +  long int swd;
> +  long int twd;
> +  long int fip;
> +  long int fcs;
> +  long int foo;
> +  long int fos;
> +  long int st_space [20];
> +};
> +
>  struct UserArea
>  {
>      GPR      regs;          // General purpose registers.
>      int32_t  fpvalid;       // True if FPU is being used.
> -    FXSAVE   i387;          // FPU registers.
> +    FPR_i386   i387;        // FPU registers.
>      uint32_t tsize;         // Text segment size.
>      uint32_t dsize;         // Data segment size.
>      uint32_t ssize;         // Stack segment size.
>
> That is, by repetition of the linux FPR area within the lldb codebase. (I
> could not use the more obvious FPR as my struct name, as it collided with a
> previous use of the name).
>
> Would someone be able to view/consider/submit my patch?
>
> thanks
> Matt
>
>
>
> Member of the CSR plc group of companies. CSR plc registered in England
> and Wales, registered number 4187346, registered office Churchill House,
> Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Keep up to date with CSR on
> our technical blog, www.csr.com/blog, CSR people blog, www.csr.com/people,
> YouTube, www.youtube.com/user/CSRplc, Facebook,
> www.facebook.com/pages/CSR/191038434253534, or follow us on Twitter at
> www.twitter.com/CSR_plc.
> New for 2014, you can now access the wide range of products powered by
> aptX at www.aptx.com.
>
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
>
>


-- 
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140214/8c9c2bff/attachment.html>


More information about the lldb-dev mailing list