[lldb-dev] [PATCH] 32-bit linux use hard-coded DR0 offset not offsetof against a structure
tfiala at google.com
Tue Mar 4 14:06:55 PST 2014
This is now in as part of r202887.
On Tue, Mar 4, 2014 at 2:22 AM, Matthew Gardiner <mg11 at csr.com> wrote:
> Hi folks
> I'm posting this to dev not commits as it's slightly contentious, but when
> combined with an earlier posting of mine:
> [Lldb-commits] [PATCH] 32-bit linux Remove WriteRegOperation's explicit
> GetAsUInt32() call
> this proposal fixes the 32-bit linux debug experience.
> This patch proposes to calculate the offset of an i386 debug offset using a
> simple base + multiple sum, instead using offsetof against a structure.
> We all know that there are lots of ways to solve this problem. I'm posting
> one as it is compact and fits with the existing "#define
> Index: source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp
> --- source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp (revision
> +++ source/Plugins/Process/POSIX/RegisterContextLinux_i386.cpp (working
> @@ -83,8 +83,9 @@
> #define DR_SIZE sizeof(UserArea::u_debugreg)
> +#define DR_0_OFFSET 0xFC
> #define DR_OFFSET(reg_index) \
> - (LLVM_EXTENSION offsetof(UserArea, u_debugreg[reg_index]))
> + (DR_0_OFFSET + (reg_index * 4))
> #define FPR_SIZE(reg) sizeof(((FPR_i386*)NULL)->reg)
> Using the offsetof(struct, element) mantra can be problematic, if the
> structure is changed, and has no benefits IMO if the structure is not also
> as a structure.
> Could someone apply this or a similar patch?
> 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
> 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
Todd Fiala | Software Engineer | tfiala at google.com | 650-943-3180
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-dev