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

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

RegisterContextLinux_i386.cpp.diff (895 Bytes)

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.

There are some cases where we can't rely on system definitions, since
the code will be built on a different platform - for example, we can
debug Linux cores on FreeBSD and vice versa, so register layouts and
such need to be explicitly specified. Of course anything that is only
applicable to live local debugging doesn't have this constraint.

Yeah, that probably is the fly in the ointment that made it be what it is :slight_smile:

So - I’ve tried Matthew’s patch over on my end with the extra logging. I’m going to reduce audience so I’m not spamming the lldb-dev list.