Commit 4cc0bf28 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Fixed bitfield extraction.

parent e577a2a3
......@@ -150,18 +150,21 @@ static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
types_get_info(type, TI_GET_TYPE, &lvalue->type.id);
lvalue->type.module = type->module;
types_get_info(type, TI_GET_OFFSET, &offset);
if (!types_get_info(type, TI_GET_OFFSET, &offset)) return FALSE;
lvalue->addr.Offset += offset;
if (types_get_info(type, TI_GET_BITPOSITION, &bitoffset))
{
if (!types_get_info(type, TI_GET_LENGTH, &length) ||
length > sizeof(*tmpbuf))
return FALSE;
types_get_info(type, TI_GET_LENGTH, &length);
/* FIXME: this test isn't sufficient, depending on start of bitfield
* (ie a 32 bit field can spread across 5 bytes)
*/
if (length > 8 * sizeof(*tmpbuf)) return FALSE;
lvalue->addr.Offset += bitoffset >> 3;
/*
* Bitfield operation. We have to extract the field and store
* it in a temporary buffer so that we get it all right.
*/
lvalue->addr.Offset += offset;
if (!memory_read_value(lvalue, sizeof(*tmpbuf), tmpbuf)) return FALSE;
mask = 0xffffffff << length;
*tmpbuf >>= bitoffset & 7;
......@@ -180,14 +183,13 @@ static BOOL types_get_udt_element_lvalue(struct dbg_lvalue* lvalue,
{
*tmpbuf |= mask;
}
return TRUE;
}
if (types_get_info(type, TI_GET_OFFSET, &offset))
else
{
lvalue->addr.Offset += offset;
return TRUE;
if (!memory_read_value(lvalue, sizeof(*tmpbuf), tmpbuf)) return FALSE;
}
return FALSE;
return TRUE;
}
/******************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment