Commit 03ce134d authored by Alexandre Julliard's avatar Alexandre Julliard

dbghelp: Use nameless union/structs.

parent febb06ce
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <assert.h> #include <assert.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "dbghelp_private.h" #include "dbghelp_private.h"
...@@ -39,9 +37,9 @@ static BOOL arm64_get_addr(HANDLE hThread, const CONTEXT* ctx, ...@@ -39,9 +37,9 @@ static BOOL arm64_get_addr(HANDLE hThread, const CONTEXT* ctx,
switch (ca) switch (ca)
{ {
#ifdef __aarch64__ #ifdef __aarch64__
case cpu_addr_pc: addr->Offset = ctx->Pc; return TRUE; case cpu_addr_pc: addr->Offset = ctx->Pc; return TRUE;
case cpu_addr_stack: addr->Offset = ctx->Sp; return TRUE; case cpu_addr_stack: addr->Offset = ctx->Sp; return TRUE;
case cpu_addr_frame: addr->Offset = ctx->u.s.Fp; return TRUE; case cpu_addr_frame: addr->Offset = ctx->Fp; return TRUE;
#endif #endif
default: addr->Mode = -1; default: addr->Mode = -1;
return FALSE; return FALSE;
...@@ -70,7 +68,7 @@ static BOOL fetch_next_frame(struct cpu_stack_walk* csw, union ctx *pcontext, ...@@ -70,7 +68,7 @@ static BOOL fetch_next_frame(struct cpu_stack_walk* csw, union ctx *pcontext,
{ {
DWORD64 xframe; DWORD64 xframe;
CONTEXT *context = &pcontext->ctx; CONTEXT *context = &pcontext->ctx;
DWORD_PTR oldReturn = context->u.s.Lr; DWORD_PTR oldReturn = context->Lr;
if (dwarf2_virtual_unwind(csw, curr_pc, pcontext, &xframe)) if (dwarf2_virtual_unwind(csw, curr_pc, pcontext, &xframe))
{ {
...@@ -79,7 +77,7 @@ static BOOL fetch_next_frame(struct cpu_stack_walk* csw, union ctx *pcontext, ...@@ -79,7 +77,7 @@ static BOOL fetch_next_frame(struct cpu_stack_walk* csw, union ctx *pcontext,
return TRUE; return TRUE;
} }
if (context->Pc == context->u.s.Lr) return FALSE; if (context->Pc == context->Lr) return FALSE;
context->Pc = oldReturn; context->Pc = oldReturn;
return TRUE; return TRUE;
...@@ -125,8 +123,8 @@ static BOOL arm64_stack_walk(struct cpu_stack_walk *csw, STACKFRAME64 *frame, ...@@ -125,8 +123,8 @@ static BOOL arm64_stack_walk(struct cpu_stack_walk *csw, STACKFRAME64 *frame,
/* set frame information */ /* set frame information */
frame->AddrStack.Offset = context->ctx.Sp; frame->AddrStack.Offset = context->ctx.Sp;
frame->AddrReturn.Offset = context->ctx.u.s.Lr; frame->AddrReturn.Offset = context->ctx.Lr;
frame->AddrFrame.Offset = context->ctx.u.s.Fp; frame->AddrFrame.Offset = context->ctx.Fp;
frame->AddrPC.Offset = context->ctx.Pc; frame->AddrPC.Offset = context->ctx.Pc;
frame->Far = TRUE; frame->Far = TRUE;
...@@ -202,12 +200,12 @@ static void *arm64_fetch_context_reg(union ctx *pctx, unsigned regno, unsigned * ...@@ -202,12 +200,12 @@ static void *arm64_fetch_context_reg(union ctx *pctx, unsigned regno, unsigned *
case CV_ARM64_X0 + 25: case CV_ARM64_X0 + 25:
case CV_ARM64_X0 + 26: case CV_ARM64_X0 + 26:
case CV_ARM64_X0 + 27: case CV_ARM64_X0 + 27:
case CV_ARM64_X0 + 28: *size = sizeof(ctx->u.X[0]); return &ctx->u.X[regno - CV_ARM64_X0]; case CV_ARM64_X0 + 28: *size = sizeof(ctx->X[0]); return &ctx->X[regno - CV_ARM64_X0];
case CV_ARM64_PSTATE: *size = sizeof(ctx->Cpsr); return &ctx->Cpsr; case CV_ARM64_PSTATE: *size = sizeof(ctx->Cpsr); return &ctx->Cpsr;
case CV_ARM64_FP: *size = sizeof(ctx->u.s.Fp); return &ctx->u.s.Fp; case CV_ARM64_FP: *size = sizeof(ctx->Fp); return &ctx->Fp;
case CV_ARM64_LR: *size = sizeof(ctx->u.s.Lr); return &ctx->u.s.Lr; case CV_ARM64_LR: *size = sizeof(ctx->Lr); return &ctx->Lr;
case CV_ARM64_SP: *size = sizeof(ctx->Sp); return &ctx->Sp; case CV_ARM64_SP: *size = sizeof(ctx->Sp); return &ctx->Sp;
case CV_ARM64_PC: *size = sizeof(ctx->Pc); return &ctx->Pc; case CV_ARM64_PC: *size = sizeof(ctx->Pc); return &ctx->Pc;
} }
#endif #endif
FIXME("Unknown register %x\n", regno); FIXME("Unknown register %x\n", regno);
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include <assert.h> #include <assert.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "dbghelp_private.h" #include "dbghelp_private.h"
...@@ -270,7 +268,7 @@ static void set_int_reg(CONTEXT *context, int reg, ULONG64 val) ...@@ -270,7 +268,7 @@ static void set_int_reg(CONTEXT *context, int reg, ULONG64 val)
static void set_float_reg(CONTEXT *context, int reg, M128A val) static void set_float_reg(CONTEXT *context, int reg, M128A val)
{ {
*(&context->u.s.Xmm0 + reg) = val; *(&context->Xmm0 + reg) = val;
} }
static int get_opcode_size(UNWIND_CODE op) static int get_opcode_size(UNWIND_CODE op)
...@@ -836,31 +834,31 @@ static void *x86_64_fetch_context_reg(union ctx *pctx, unsigned regno, unsigned ...@@ -836,31 +834,31 @@ static void *x86_64_fetch_context_reg(union ctx *pctx, unsigned regno, unsigned
case CV_AMD64_R15: *size = sizeof(ctx->R15); return &ctx->R15; case CV_AMD64_R15: *size = sizeof(ctx->R15); return &ctx->R15;
case CV_AMD64_RIP: *size = sizeof(ctx->Rip); return &ctx->Rip; case CV_AMD64_RIP: *size = sizeof(ctx->Rip); return &ctx->Rip;
case CV_AMD64_XMM0 + 0: *size = sizeof(ctx->u.s.Xmm0 ); return &ctx->u.s.Xmm0; case CV_AMD64_XMM0 + 0: *size = sizeof(ctx->Xmm0 ); return &ctx->Xmm0;
case CV_AMD64_XMM0 + 1: *size = sizeof(ctx->u.s.Xmm1 ); return &ctx->u.s.Xmm1; case CV_AMD64_XMM0 + 1: *size = sizeof(ctx->Xmm1 ); return &ctx->Xmm1;
case CV_AMD64_XMM0 + 2: *size = sizeof(ctx->u.s.Xmm2 ); return &ctx->u.s.Xmm2; case CV_AMD64_XMM0 + 2: *size = sizeof(ctx->Xmm2 ); return &ctx->Xmm2;
case CV_AMD64_XMM0 + 3: *size = sizeof(ctx->u.s.Xmm3 ); return &ctx->u.s.Xmm3; case CV_AMD64_XMM0 + 3: *size = sizeof(ctx->Xmm3 ); return &ctx->Xmm3;
case CV_AMD64_XMM0 + 4: *size = sizeof(ctx->u.s.Xmm4 ); return &ctx->u.s.Xmm4; case CV_AMD64_XMM0 + 4: *size = sizeof(ctx->Xmm4 ); return &ctx->Xmm4;
case CV_AMD64_XMM0 + 5: *size = sizeof(ctx->u.s.Xmm5 ); return &ctx->u.s.Xmm5; case CV_AMD64_XMM0 + 5: *size = sizeof(ctx->Xmm5 ); return &ctx->Xmm5;
case CV_AMD64_XMM0 + 6: *size = sizeof(ctx->u.s.Xmm6 ); return &ctx->u.s.Xmm6; case CV_AMD64_XMM0 + 6: *size = sizeof(ctx->Xmm6 ); return &ctx->Xmm6;
case CV_AMD64_XMM0 + 7: *size = sizeof(ctx->u.s.Xmm7 ); return &ctx->u.s.Xmm7; case CV_AMD64_XMM0 + 7: *size = sizeof(ctx->Xmm7 ); return &ctx->Xmm7;
case CV_AMD64_XMM8 + 0: *size = sizeof(ctx->u.s.Xmm8 ); return &ctx->u.s.Xmm8; case CV_AMD64_XMM8 + 0: *size = sizeof(ctx->Xmm8 ); return &ctx->Xmm8;
case CV_AMD64_XMM8 + 1: *size = sizeof(ctx->u.s.Xmm9 ); return &ctx->u.s.Xmm9; case CV_AMD64_XMM8 + 1: *size = sizeof(ctx->Xmm9 ); return &ctx->Xmm9;
case CV_AMD64_XMM8 + 2: *size = sizeof(ctx->u.s.Xmm10); return &ctx->u.s.Xmm10; case CV_AMD64_XMM8 + 2: *size = sizeof(ctx->Xmm10); return &ctx->Xmm10;
case CV_AMD64_XMM8 + 3: *size = sizeof(ctx->u.s.Xmm11); return &ctx->u.s.Xmm11; case CV_AMD64_XMM8 + 3: *size = sizeof(ctx->Xmm11); return &ctx->Xmm11;
case CV_AMD64_XMM8 + 4: *size = sizeof(ctx->u.s.Xmm12); return &ctx->u.s.Xmm12; case CV_AMD64_XMM8 + 4: *size = sizeof(ctx->Xmm12); return &ctx->Xmm12;
case CV_AMD64_XMM8 + 5: *size = sizeof(ctx->u.s.Xmm13); return &ctx->u.s.Xmm13; case CV_AMD64_XMM8 + 5: *size = sizeof(ctx->Xmm13); return &ctx->Xmm13;
case CV_AMD64_XMM8 + 6: *size = sizeof(ctx->u.s.Xmm14); return &ctx->u.s.Xmm14; case CV_AMD64_XMM8 + 6: *size = sizeof(ctx->Xmm14); return &ctx->Xmm14;
case CV_AMD64_XMM8 + 7: *size = sizeof(ctx->u.s.Xmm15); return &ctx->u.s.Xmm15; case CV_AMD64_XMM8 + 7: *size = sizeof(ctx->Xmm15); return &ctx->Xmm15;
case CV_AMD64_ST0 + 0: *size = sizeof(ctx->u.s.Legacy[0]); return &ctx->u.s.Legacy[0]; case CV_AMD64_ST0 + 0: *size = sizeof(ctx->Legacy[0]); return &ctx->Legacy[0];
case CV_AMD64_ST0 + 1: *size = sizeof(ctx->u.s.Legacy[1]); return &ctx->u.s.Legacy[1]; case CV_AMD64_ST0 + 1: *size = sizeof(ctx->Legacy[1]); return &ctx->Legacy[1];
case CV_AMD64_ST0 + 2: *size = sizeof(ctx->u.s.Legacy[2]); return &ctx->u.s.Legacy[2]; case CV_AMD64_ST0 + 2: *size = sizeof(ctx->Legacy[2]); return &ctx->Legacy[2];
case CV_AMD64_ST0 + 3: *size = sizeof(ctx->u.s.Legacy[3]); return &ctx->u.s.Legacy[3]; case CV_AMD64_ST0 + 3: *size = sizeof(ctx->Legacy[3]); return &ctx->Legacy[3];
case CV_AMD64_ST0 + 4: *size = sizeof(ctx->u.s.Legacy[4]); return &ctx->u.s.Legacy[4]; case CV_AMD64_ST0 + 4: *size = sizeof(ctx->Legacy[4]); return &ctx->Legacy[4];
case CV_AMD64_ST0 + 5: *size = sizeof(ctx->u.s.Legacy[5]); return &ctx->u.s.Legacy[5]; case CV_AMD64_ST0 + 5: *size = sizeof(ctx->Legacy[5]); return &ctx->Legacy[5];
case CV_AMD64_ST0 + 6: *size = sizeof(ctx->u.s.Legacy[6]); return &ctx->u.s.Legacy[6]; case CV_AMD64_ST0 + 6: *size = sizeof(ctx->Legacy[6]); return &ctx->Legacy[6];
case CV_AMD64_ST0 + 7: *size = sizeof(ctx->u.s.Legacy[7]); return &ctx->u.s.Legacy[7]; case CV_AMD64_ST0 + 7: *size = sizeof(ctx->Legacy[7]); return &ctx->Legacy[7];
case CV_AMD64_EFLAGS: *size = sizeof(ctx->EFlags); return &ctx->EFlags; case CV_AMD64_EFLAGS: *size = sizeof(ctx->EFlags); return &ctx->EFlags;
case CV_AMD64_ES: *size = sizeof(ctx->SegEs); return &ctx->SegEs; case CV_AMD64_ES: *size = sizeof(ctx->SegEs); return &ctx->SegEs;
......
...@@ -20,9 +20,6 @@ ...@@ -20,9 +20,6 @@
#include <time.h> #include <time.h>
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "ntstatus.h" #include "ntstatus.h"
#define WIN32_NO_STATUS #define WIN32_NO_STATUS
#include "dbghelp_private.h" #include "dbghelp_private.h"
...@@ -507,21 +504,21 @@ static unsigned dump_modules(struct dump_context* dc, BOOL dump_elf) ...@@ -507,21 +504,21 @@ static unsigned dump_modules(struct dump_context* dc, BOOL dump_elf)
cbin.ProcessHandle = dc->process->handle; cbin.ProcessHandle = dc->process->handle;
cbin.CallbackType = ModuleCallback; cbin.CallbackType = ModuleCallback;
cbin.u.Module.FullPath = ms->Buffer; cbin.Module.FullPath = ms->Buffer;
cbin.u.Module.BaseOfImage = dc->modules[i].base; cbin.Module.BaseOfImage = dc->modules[i].base;
cbin.u.Module.SizeOfImage = dc->modules[i].size; cbin.Module.SizeOfImage = dc->modules[i].size;
cbin.u.Module.CheckSum = dc->modules[i].checksum; cbin.Module.CheckSum = dc->modules[i].checksum;
cbin.u.Module.TimeDateStamp = dc->modules[i].timestamp; cbin.Module.TimeDateStamp = dc->modules[i].timestamp;
memset(&cbin.u.Module.VersionInfo, 0, sizeof(cbin.u.Module.VersionInfo)); memset(&cbin.Module.VersionInfo, 0, sizeof(cbin.Module.VersionInfo));
cbin.u.Module.CvRecord = NULL; cbin.Module.CvRecord = NULL;
cbin.u.Module.SizeOfCvRecord = 0; cbin.Module.SizeOfCvRecord = 0;
cbin.u.Module.MiscRecord = NULL; cbin.Module.MiscRecord = NULL;
cbin.u.Module.SizeOfMiscRecord = 0; cbin.Module.SizeOfMiscRecord = 0;
cbout.u.ModuleWriteFlags = flags_out; cbout.ModuleWriteFlags = flags_out;
if (!dc->cb->CallbackRoutine(dc->cb->CallbackParam, &cbin, &cbout)) if (!dc->cb->CallbackRoutine(dc->cb->CallbackParam, &cbin, &cbout))
continue; continue;
flags_out &= cbout.u.ModuleWriteFlags; flags_out &= cbout.ModuleWriteFlags;
} }
if (flags_out & ModuleWriteModule) if (flags_out & ModuleWriteModule)
{ {
...@@ -629,19 +626,19 @@ static unsigned dump_system_info(struct dump_context* dc) ...@@ -629,19 +626,19 @@ static unsigned dump_system_info(struct dump_context* dc)
wine_extra += strlen(build_id) + 1 + strlen(sys_name) + 1 + strlen(release_name) + 1; wine_extra += strlen(build_id) + 1 + strlen(sys_name) + 1 + strlen(release_name) + 1;
} }
mdSysInfo.ProcessorArchitecture = sysInfo.u.s.wProcessorArchitecture; mdSysInfo.ProcessorArchitecture = sysInfo.wProcessorArchitecture;
mdSysInfo.ProcessorLevel = sysInfo.wProcessorLevel; mdSysInfo.ProcessorLevel = sysInfo.wProcessorLevel;
mdSysInfo.ProcessorRevision = sysInfo.wProcessorRevision; mdSysInfo.ProcessorRevision = sysInfo.wProcessorRevision;
mdSysInfo.u.s.NumberOfProcessors = sysInfo.dwNumberOfProcessors; mdSysInfo.NumberOfProcessors = sysInfo.dwNumberOfProcessors;
mdSysInfo.u.s.ProductType = VER_NT_WORKSTATION; /* FIXME */ mdSysInfo.ProductType = VER_NT_WORKSTATION; /* FIXME */
mdSysInfo.MajorVersion = osInfo.dwMajorVersion; mdSysInfo.MajorVersion = osInfo.dwMajorVersion;
mdSysInfo.MinorVersion = osInfo.dwMinorVersion; mdSysInfo.MinorVersion = osInfo.dwMinorVersion;
mdSysInfo.BuildNumber = osInfo.dwBuildNumber; mdSysInfo.BuildNumber = osInfo.dwBuildNumber;
mdSysInfo.PlatformId = osInfo.dwPlatformId; mdSysInfo.PlatformId = osInfo.dwPlatformId;
mdSysInfo.CSDVersionRva = dc->rva + sizeof(mdSysInfo) + wine_extra; mdSysInfo.CSDVersionRva = dc->rva + sizeof(mdSysInfo) + wine_extra;
mdSysInfo.u1.Reserved1 = 0; mdSysInfo.Reserved1 = 0;
mdSysInfo.u1.s.SuiteMask = VER_SUITE_TERMINAL; mdSysInfo.SuiteMask = VER_SUITE_TERMINAL;
if (have_x86cpuid()) if (have_x86cpuid())
{ {
...@@ -752,18 +749,18 @@ static unsigned dump_threads(struct dump_context* dc, ...@@ -752,18 +749,18 @@ static unsigned dump_threads(struct dump_context* dc,
cbin.ProcessId = dc->pid; cbin.ProcessId = dc->pid;
cbin.ProcessHandle = dc->process->handle; cbin.ProcessHandle = dc->process->handle;
cbin.CallbackType = ThreadCallback; cbin.CallbackType = ThreadCallback;
cbin.u.Thread.ThreadId = dc->threads[i].tid; cbin.Thread.ThreadId = dc->threads[i].tid;
cbin.u.Thread.ThreadHandle = 0; /* FIXME */ cbin.Thread.ThreadHandle = 0; /* FIXME */
cbin.u.Thread.Context = ctx; cbin.Thread.Context = ctx;
cbin.u.Thread.SizeOfContext = sizeof(CONTEXT); cbin.Thread.SizeOfContext = sizeof(CONTEXT);
cbin.u.Thread.StackBase = mdThd.Stack.StartOfMemoryRange; cbin.Thread.StackBase = mdThd.Stack.StartOfMemoryRange;
cbin.u.Thread.StackEnd = mdThd.Stack.StartOfMemoryRange + cbin.Thread.StackEnd = mdThd.Stack.StartOfMemoryRange +
mdThd.Stack.Memory.DataSize; mdThd.Stack.Memory.DataSize;
cbout.u.ThreadWriteFlags = flags_out; cbout.ThreadWriteFlags = flags_out;
if (!dc->cb->CallbackRoutine(dc->cb->CallbackParam, &cbin, &cbout)) if (!dc->cb->CallbackRoutine(dc->cb->CallbackParam, &cbin, &cbout))
continue; continue;
flags_out &= cbout.u.ThreadWriteFlags; flags_out &= cbout.ThreadWriteFlags;
} }
if (flags_out & ThreadWriteThread) if (flags_out & ThreadWriteThread)
{ {
...@@ -978,7 +975,7 @@ BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess, DWORD pid, HANDLE hFile, ...@@ -978,7 +975,7 @@ BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess, DWORD pid, HANDLE hFile,
mdHead.NumberOfStreams = nStreams; mdHead.NumberOfStreams = nStreams;
mdHead.CheckSum = 0; /* native sets a 0 checksum in its files */ mdHead.CheckSum = 0; /* native sets a 0 checksum in its files */
mdHead.StreamDirectoryRva = sizeof(mdHead); mdHead.StreamDirectoryRva = sizeof(mdHead);
mdHead.u.TimeDateStamp = time(NULL); mdHead.TimeDateStamp = time(NULL);
mdHead.Flags = DumpType; mdHead.Flags = DumpType;
append(&dc, &mdHead, sizeof(mdHead)); append(&dc, &mdHead, sizeof(mdHead));
......
...@@ -32,8 +32,6 @@ ...@@ -32,8 +32,6 @@
* Add symbol size to internal symbol table. * Add symbol size to internal symbol table.
*/ */
#define NONAMELESSUNION
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define NONAMELESSUNION
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
* upon which full support for datatype handling will eventually be built. * upon which full support for datatype handling will eventually be built.
*/ */
#define NONAMELESSUNION
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <assert.h> #include <assert.h>
......
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