[lldb-dev] 32-bit linux IsWatchpointHit assertion failure due to WriteRegister

Matthew Gardiner mg11 at csr.com
Mon Mar 3 06:02:31 PST 2014


Yes, my latest pain in 32-bit linux occurs due to the offset calculations for dr6/7 being broken by the inclusion of the extended floating point registers structure in "struct UserArea". I'm not 
really sure what we are trying to model here, since, looking at sys/user.h, it's the regular FP registers (user_fpregs_struct) which comprise the user area not the extended ones (user_fpxregs_struct).

I did try to fix this issue by reinstating the previous definition for FPR_i386, i.e.

struct FPR_i386
{
     int32_t cwd;
     int32_t swd;
     int32_t twd;
     int32_t fip;
     int32_t fcs;
     int32_t foo;
     int32_t fos;
     int32_t st_space [20];
};

Unfortunately, this results in a world of pain, since the numerous "DEFINE_FPR" invocations in RegisterInfos_i386.h rely on the elements contained in user_fpxregs_struct.

So, I solved this issue in a different (and in my opinion simpler) way - by using the following macro to calculate the offset of a debug register in the user:

#define DR_OFFSET(reg_index) \
     (0xFC + (reg_index * 4))

Can't we just use this in our lldb code?

Why do we currently calculate the offsets with copied structures? Do we actually use the structures as structures as well? This is a source of bugs.

So I'll repeat what I hint to above...

Can we remove the copied user/register structures and replace the required offsets with integral constant definitions please?

thanks
Matthew Gardiner


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.



More information about the lldb-dev mailing list