Commit 5f911944 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Use nameless union/structs.

parent e68d6c16
......@@ -52,7 +52,7 @@ typedef union _UNWIND_CODE
BYTE CodeOffset;
BYTE UnwindOp : 4;
BYTE OpInfo : 4;
} u;
};
USHORT FrameOffset;
} UNWIND_CODE, *PUNWIND_CODE;
......@@ -157,14 +157,14 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F
for (i = 0; i < info->CountOfCodes; i++)
{
TRACE(" 0x%x: ", info->UnwindCode[i].u.CodeOffset);
switch (info->UnwindCode[i].u.UnwindOp)
TRACE(" 0x%x: ", info->UnwindCode[i].CodeOffset);
switch (info->UnwindCode[i].UnwindOp)
{
case UWOP_PUSH_NONVOL:
TRACE("pushq %%%s\n", reg_names[info->UnwindCode[i].u.OpInfo]);
TRACE("pushq %%%s\n", reg_names[info->UnwindCode[i].OpInfo]);
break;
case UWOP_ALLOC_LARGE:
if (info->UnwindCode[i].u.OpInfo)
if (info->UnwindCode[i].OpInfo)
{
count = *(DWORD*)&info->UnwindCode[i+1];
i += 2;
......@@ -177,7 +177,7 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F
TRACE("subq $0x%x,%%rsp\n", count);
break;
case UWOP_ALLOC_SMALL:
count = (info->UnwindCode[i].u.OpInfo + 1) * 8;
count = (info->UnwindCode[i].OpInfo + 1) * 8;
TRACE("subq $0x%x,%%rsp\n", count);
break;
case UWOP_SET_FPREG:
......@@ -186,42 +186,42 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F
break;
case UWOP_SAVE_NONVOL:
count = *(USHORT*)&info->UnwindCode[i+1] * 8;
TRACE("movq %%%s,0x%x(%%rsp)\n", reg_names[info->UnwindCode[i].u.OpInfo], count);
TRACE("movq %%%s,0x%x(%%rsp)\n", reg_names[info->UnwindCode[i].OpInfo], count);
i++;
break;
case UWOP_SAVE_NONVOL_FAR:
count = *(DWORD*)&info->UnwindCode[i+1];
TRACE("movq %%%s,0x%x(%%rsp)\n", reg_names[info->UnwindCode[i].u.OpInfo], count);
TRACE("movq %%%s,0x%x(%%rsp)\n", reg_names[info->UnwindCode[i].OpInfo], count);
i += 2;
break;
case UWOP_SAVE_XMM128:
count = *(USHORT*)&info->UnwindCode[i+1] * 16;
TRACE("movaps %%xmm%u,0x%x(%%rsp)\n", info->UnwindCode[i].u.OpInfo, count);
TRACE("movaps %%xmm%u,0x%x(%%rsp)\n", info->UnwindCode[i].OpInfo, count);
i++;
break;
case UWOP_SAVE_XMM128_FAR:
count = *(DWORD*)&info->UnwindCode[i+1];
TRACE("movaps %%xmm%u,0x%x(%%rsp)\n", info->UnwindCode[i].u.OpInfo, count);
TRACE("movaps %%xmm%u,0x%x(%%rsp)\n", info->UnwindCode[i].OpInfo, count);
i += 2;
break;
case UWOP_PUSH_MACHFRAME:
TRACE("PUSH_MACHFRAME %u\n", info->UnwindCode[i].u.OpInfo);
TRACE("PUSH_MACHFRAME %u\n", info->UnwindCode[i].OpInfo);
break;
case UWOP_EPILOG:
if (info->Version == 2)
{
unsigned int offset;
if (info->UnwindCode[i].u.OpInfo)
offset = info->UnwindCode[i].u.CodeOffset;
if (info->UnwindCode[i].OpInfo)
offset = info->UnwindCode[i].CodeOffset;
else
offset = (info->UnwindCode[i+1].u.OpInfo << 8) + info->UnwindCode[i+1].u.CodeOffset;
TRACE("UWOP_EPILOG %u offset %u\n", info->UnwindCode[i].u.OpInfo, offset);
offset = (info->UnwindCode[i+1].OpInfo << 8) + info->UnwindCode[i+1].CodeOffset;
TRACE("UWOP_EPILOG %u offset %u\n", info->UnwindCode[i].OpInfo, offset);
i += 1;
break;
}
/* Fall through */
default:
FIXME("unknown code %u\n", info->UnwindCode[i].u.UnwindOp);
FIXME("unknown code %u\n", info->UnwindCode[i].UnwindOp);
break;
}
}
......@@ -273,10 +273,10 @@ static void set_float_reg(CONTEXT *context, int reg, M128A val)
static int get_opcode_size(UNWIND_CODE op)
{
switch (op.u.UnwindOp)
switch (op.UnwindOp)
{
case UWOP_ALLOC_LARGE:
return 2 + (op.u.OpInfo != 0);
return 2 + (op.OpInfo != 0);
case UWOP_SAVE_NONVOL:
case UWOP_SAVE_XMM128:
return 2;
......@@ -528,21 +528,21 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw,
for (i = 0; i < info->CountOfCodes; i += get_opcode_size(info->UnwindCode[i]))
{
if (prolog_offset < info->UnwindCode[i].u.CodeOffset) continue; /* skip it */
if (prolog_offset < info->UnwindCode[i].CodeOffset) continue; /* skip it */
switch (info->UnwindCode[i].u.UnwindOp)
switch (info->UnwindCode[i].UnwindOp)
{
case UWOP_PUSH_NONVOL: /* pushq %reg */
if (!sw_read_mem(csw, context->Rsp, &value, sizeof(DWORD64))) return FALSE;
set_int_reg(context, info->UnwindCode[i].u.OpInfo, value);
set_int_reg(context, info->UnwindCode[i].OpInfo, value);
context->Rsp += sizeof(ULONG64);
break;
case UWOP_ALLOC_LARGE: /* subq $nn,%rsp */
if (info->UnwindCode[i].u.OpInfo) context->Rsp += *(DWORD*)&info->UnwindCode[i+1];
if (info->UnwindCode[i].OpInfo) context->Rsp += *(DWORD*)&info->UnwindCode[i+1];
else context->Rsp += *(USHORT*)&info->UnwindCode[i+1] * 8;
break;
case UWOP_ALLOC_SMALL: /* subq $n,%rsp */
context->Rsp += (info->UnwindCode[i].u.OpInfo + 1) * 8;
context->Rsp += (info->UnwindCode[i].OpInfo + 1) * 8;
break;
case UWOP_SET_FPREG: /* leaq nn(%rsp),%framereg */
context->Rsp = newframe;
......@@ -550,22 +550,22 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw,
case UWOP_SAVE_NONVOL: /* movq %reg,n(%rsp) */
off = newframe + *(USHORT*)&info->UnwindCode[i+1] * 8;
if (!sw_read_mem(csw, off, &value, sizeof(DWORD64))) return FALSE;
set_int_reg(context, info->UnwindCode[i].u.OpInfo, value);
set_int_reg(context, info->UnwindCode[i].OpInfo, value);
break;
case UWOP_SAVE_NONVOL_FAR: /* movq %reg,nn(%rsp) */
off = newframe + *(DWORD*)&info->UnwindCode[i+1];
if (!sw_read_mem(csw, off, &value, sizeof(DWORD64))) return FALSE;
set_int_reg(context, info->UnwindCode[i].u.OpInfo, value);
set_int_reg(context, info->UnwindCode[i].OpInfo, value);
break;
case UWOP_SAVE_XMM128: /* movaps %xmmreg,n(%rsp) */
off = newframe + *(USHORT*)&info->UnwindCode[i+1] * 16;
if (!sw_read_mem(csw, off, &floatvalue, sizeof(M128A))) return FALSE;
set_float_reg(context, info->UnwindCode[i].u.OpInfo, floatvalue);
set_float_reg(context, info->UnwindCode[i].OpInfo, floatvalue);
break;
case UWOP_SAVE_XMM128_FAR: /* movaps %xmmreg,nn(%rsp) */
off = newframe + *(DWORD*)&info->UnwindCode[i+1];
if (!sw_read_mem(csw, off, &floatvalue, sizeof(M128A))) return FALSE;
set_float_reg(context, info->UnwindCode[i].u.OpInfo, floatvalue);
set_float_reg(context, info->UnwindCode[i].OpInfo, floatvalue);
break;
case UWOP_PUSH_MACHFRAME:
if (info->Flags & UNW_FLAG_CHAININFO)
......@@ -579,7 +579,7 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw,
break;
}
if (info->UnwindCode[i].u.OpInfo)
if (info->UnwindCode[i].OpInfo)
context->Rsp += 0x8;
if (!sw_read_mem(csw, context->Rsp, &context->Rip, sizeof(DWORD64))) return FALSE;
......@@ -587,7 +587,7 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw,
mach_frame = TRUE;
break;
default:
FIXME("unknown code %u\n", info->UnwindCode[i].u.UnwindOp);
FIXME("unknown code %u\n", info->UnwindCode[i].UnwindOp);
break;
}
}
......
......@@ -20,8 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define NONAMELESSUNION
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
......@@ -1600,10 +1598,10 @@ static struct symt* dwarf2_parse_array_type(dwarf2_debug_info_t* di)
if (pc && symt_check_tag(*pc, SymTagData))
{
struct symt_data* elt = (struct symt_data*)(*pc);
if (elt->u.value.n1.n2.n3.lVal < min.u.uvalue)
min.u.uvalue = elt->u.value.n1.n2.n3.lVal;
if (elt->u.value.n1.n2.n3.lVal > max.u.uvalue)
max.u.uvalue = elt->u.value.n1.n2.n3.lVal;
if (elt->u.value.lVal < min.u.uvalue)
min.u.uvalue = elt->u.value.lVal;
if (elt->u.value.lVal > max.u.uvalue)
max.u.uvalue = elt->u.value.lVal;
}
}
}
......
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