Commit 11f98554 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

dbghelp: Fix compilation on systems that don't support nameless unions.

parent fbc59357
...@@ -53,7 +53,7 @@ typedef union _UNWIND_CODE ...@@ -53,7 +53,7 @@ typedef union _UNWIND_CODE
BYTE CodeOffset; BYTE CodeOffset;
BYTE UnwindOp : 4; BYTE UnwindOp : 4;
BYTE OpInfo : 4; BYTE OpInfo : 4;
}; } u;
USHORT FrameOffset; USHORT FrameOffset;
} UNWIND_CODE, *PUNWIND_CODE; } UNWIND_CODE, *PUNWIND_CODE;
...@@ -158,14 +158,14 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F ...@@ -158,14 +158,14 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F
for (i = 0; i < info->CountOfCodes; i++) for (i = 0; i < info->CountOfCodes; i++)
{ {
TRACE(" 0x%x: ", info->UnwindCode[i].CodeOffset); TRACE(" 0x%x: ", info->UnwindCode[i].u.CodeOffset);
switch (info->UnwindCode[i].UnwindOp) switch (info->UnwindCode[i].u.UnwindOp)
{ {
case UWOP_PUSH_NONVOL: case UWOP_PUSH_NONVOL:
TRACE("pushq %%%s\n", reg_names[info->UnwindCode[i].OpInfo]); TRACE("pushq %%%s\n", reg_names[info->UnwindCode[i].u.OpInfo]);
break; break;
case UWOP_ALLOC_LARGE: case UWOP_ALLOC_LARGE:
if (info->UnwindCode[i].OpInfo) if (info->UnwindCode[i].u.OpInfo)
{ {
count = *(DWORD*)&info->UnwindCode[i+1]; count = *(DWORD*)&info->UnwindCode[i+1];
i += 2; i += 2;
...@@ -178,7 +178,7 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F ...@@ -178,7 +178,7 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F
TRACE("subq $0x%x,%%rsp\n", count); TRACE("subq $0x%x,%%rsp\n", count);
break; break;
case UWOP_ALLOC_SMALL: case UWOP_ALLOC_SMALL:
count = (info->UnwindCode[i].OpInfo + 1) * 8; count = (info->UnwindCode[i].u.OpInfo + 1) * 8;
TRACE("subq $0x%x,%%rsp\n", count); TRACE("subq $0x%x,%%rsp\n", count);
break; break;
case UWOP_SET_FPREG: case UWOP_SET_FPREG:
...@@ -187,29 +187,29 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F ...@@ -187,29 +187,29 @@ static void dump_unwind_info(struct cpu_stack_walk* csw, ULONG64 base, RUNTIME_F
break; break;
case UWOP_SAVE_NONVOL: case UWOP_SAVE_NONVOL:
count = *(USHORT*)&info->UnwindCode[i+1] * 8; count = *(USHORT*)&info->UnwindCode[i+1] * 8;
TRACE("movq %%%s,0x%x(%%rsp)\n", reg_names[info->UnwindCode[i].OpInfo], count); TRACE("movq %%%s,0x%x(%%rsp)\n", reg_names[info->UnwindCode[i].u.OpInfo], count);
i++; i++;
break; break;
case UWOP_SAVE_NONVOL_FAR: case UWOP_SAVE_NONVOL_FAR:
count = *(DWORD*)&info->UnwindCode[i+1]; count = *(DWORD*)&info->UnwindCode[i+1];
TRACE("movq %%%s,0x%x(%%rsp)\n", reg_names[info->UnwindCode[i].OpInfo], count); TRACE("movq %%%s,0x%x(%%rsp)\n", reg_names[info->UnwindCode[i].u.OpInfo], count);
i += 2; i += 2;
break; break;
case UWOP_SAVE_XMM128: case UWOP_SAVE_XMM128:
count = *(USHORT*)&info->UnwindCode[i+1] * 16; count = *(USHORT*)&info->UnwindCode[i+1] * 16;
TRACE("movaps %%xmm%u,0x%x(%%rsp)\n", info->UnwindCode[i].OpInfo, count); TRACE("movaps %%xmm%u,0x%x(%%rsp)\n", info->UnwindCode[i].u.OpInfo, count);
i++; i++;
break; break;
case UWOP_SAVE_XMM128_FAR: case UWOP_SAVE_XMM128_FAR:
count = *(DWORD*)&info->UnwindCode[i+1]; count = *(DWORD*)&info->UnwindCode[i+1];
TRACE("movaps %%xmm%u,0x%x(%%rsp)\n", info->UnwindCode[i].OpInfo, count); TRACE("movaps %%xmm%u,0x%x(%%rsp)\n", info->UnwindCode[i].u.OpInfo, count);
i += 2; i += 2;
break; break;
case UWOP_PUSH_MACHFRAME: case UWOP_PUSH_MACHFRAME:
TRACE("PUSH_MACHFRAME %u\n", info->UnwindCode[i].OpInfo); TRACE("PUSH_MACHFRAME %u\n", info->UnwindCode[i].u.OpInfo);
break; break;
default: default:
FIXME("unknown code %u\n", info->UnwindCode[i].UnwindOp); FIXME("unknown code %u\n", info->UnwindCode[i].u.UnwindOp);
break; break;
} }
} }
...@@ -261,10 +261,10 @@ static void set_float_reg(CONTEXT *context, int reg, M128A val) ...@@ -261,10 +261,10 @@ static void set_float_reg(CONTEXT *context, int reg, M128A val)
static int get_opcode_size(UNWIND_CODE op) static int get_opcode_size(UNWIND_CODE op)
{ {
switch (op.UnwindOp) switch (op.u.UnwindOp)
{ {
case UWOP_ALLOC_LARGE: case UWOP_ALLOC_LARGE:
return 2 + (op.OpInfo != 0); return 2 + (op.u.OpInfo != 0);
case UWOP_SAVE_NONVOL: case UWOP_SAVE_NONVOL:
case UWOP_SAVE_XMM128: case UWOP_SAVE_XMM128:
return 2; return 2;
...@@ -515,21 +515,21 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw, ...@@ -515,21 +515,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])) for (i = 0; i < info->CountOfCodes; i += get_opcode_size(info->UnwindCode[i]))
{ {
if (prolog_offset < info->UnwindCode[i].CodeOffset) continue; /* skip it */ if (prolog_offset < info->UnwindCode[i].u.CodeOffset) continue; /* skip it */
switch (info->UnwindCode[i].UnwindOp) switch (info->UnwindCode[i].u.UnwindOp)
{ {
case UWOP_PUSH_NONVOL: /* pushq %reg */ case UWOP_PUSH_NONVOL: /* pushq %reg */
if (!sw_read_mem(csw, context->Rsp, &value, sizeof(DWORD64))) return FALSE; if (!sw_read_mem(csw, context->Rsp, &value, sizeof(DWORD64))) return FALSE;
set_int_reg(context, info->UnwindCode[i].OpInfo, value); set_int_reg(context, info->UnwindCode[i].u.OpInfo, value);
context->Rsp += sizeof(ULONG64); context->Rsp += sizeof(ULONG64);
break; break;
case UWOP_ALLOC_LARGE: /* subq $nn,%rsp */ case UWOP_ALLOC_LARGE: /* subq $nn,%rsp */
if (info->UnwindCode[i].OpInfo) context->Rsp += *(DWORD*)&info->UnwindCode[i+1]; if (info->UnwindCode[i].u.OpInfo) context->Rsp += *(DWORD*)&info->UnwindCode[i+1];
else context->Rsp += *(USHORT*)&info->UnwindCode[i+1] * 8; else context->Rsp += *(USHORT*)&info->UnwindCode[i+1] * 8;
break; break;
case UWOP_ALLOC_SMALL: /* subq $n,%rsp */ case UWOP_ALLOC_SMALL: /* subq $n,%rsp */
context->Rsp += (info->UnwindCode[i].OpInfo + 1) * 8; context->Rsp += (info->UnwindCode[i].u.OpInfo + 1) * 8;
break; break;
case UWOP_SET_FPREG: /* leaq nn(%rsp),%framereg */ case UWOP_SET_FPREG: /* leaq nn(%rsp),%framereg */
context->Rsp = newframe; context->Rsp = newframe;
...@@ -537,28 +537,28 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw, ...@@ -537,28 +537,28 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw,
case UWOP_SAVE_NONVOL: /* movq %reg,n(%rsp) */ case UWOP_SAVE_NONVOL: /* movq %reg,n(%rsp) */
off = newframe + *(USHORT*)&info->UnwindCode[i+1] * 8; off = newframe + *(USHORT*)&info->UnwindCode[i+1] * 8;
if (!sw_read_mem(csw, off, &value, sizeof(DWORD64))) return FALSE; if (!sw_read_mem(csw, off, &value, sizeof(DWORD64))) return FALSE;
set_int_reg(context, info->UnwindCode[i].OpInfo, value); set_int_reg(context, info->UnwindCode[i].u.OpInfo, value);
break; break;
case UWOP_SAVE_NONVOL_FAR: /* movq %reg,nn(%rsp) */ case UWOP_SAVE_NONVOL_FAR: /* movq %reg,nn(%rsp) */
off = newframe + *(DWORD*)&info->UnwindCode[i+1]; off = newframe + *(DWORD*)&info->UnwindCode[i+1];
if (!sw_read_mem(csw, off, &value, sizeof(DWORD64))) return FALSE; if (!sw_read_mem(csw, off, &value, sizeof(DWORD64))) return FALSE;
set_int_reg(context, info->UnwindCode[i].OpInfo, value); set_int_reg(context, info->UnwindCode[i].u.OpInfo, value);
break; break;
case UWOP_SAVE_XMM128: /* movaps %xmmreg,n(%rsp) */ case UWOP_SAVE_XMM128: /* movaps %xmmreg,n(%rsp) */
off = newframe + *(USHORT*)&info->UnwindCode[i+1] * 16; off = newframe + *(USHORT*)&info->UnwindCode[i+1] * 16;
if (!sw_read_mem(csw, off, &floatvalue, sizeof(M128A))) return FALSE; if (!sw_read_mem(csw, off, &floatvalue, sizeof(M128A))) return FALSE;
set_float_reg(context, info->UnwindCode[i].OpInfo, floatvalue); set_float_reg(context, info->UnwindCode[i].u.OpInfo, floatvalue);
break; break;
case UWOP_SAVE_XMM128_FAR: /* movaps %xmmreg,nn(%rsp) */ case UWOP_SAVE_XMM128_FAR: /* movaps %xmmreg,nn(%rsp) */
off = newframe + *(DWORD*)&info->UnwindCode[i+1]; off = newframe + *(DWORD*)&info->UnwindCode[i+1];
if (!sw_read_mem(csw, off, &floatvalue, sizeof(M128A))) return FALSE; if (!sw_read_mem(csw, off, &floatvalue, sizeof(M128A))) return FALSE;
set_float_reg(context, info->UnwindCode[i].OpInfo, floatvalue); set_float_reg(context, info->UnwindCode[i].u.OpInfo, floatvalue);
break; break;
case UWOP_PUSH_MACHFRAME: case UWOP_PUSH_MACHFRAME:
FIXME("PUSH_MACHFRAME %u\n", info->UnwindCode[i].OpInfo); FIXME("PUSH_MACHFRAME %u\n", info->UnwindCode[i].u.OpInfo);
break; break;
default: default:
FIXME("unknown code %u\n", info->UnwindCode[i].UnwindOp); FIXME("unknown code %u\n", info->UnwindCode[i].u.UnwindOp);
break; break;
} }
} }
......
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