24#define NONAMELESSUNION
25#define NONAMELESSSTRUCT
27#define WIN32_NO_STATUS
90 default:
addr->Mode = -1;
100#define __CurrentMode 0
101#define __CurrentCount 1
104#define curr_mode (frame->Reserved[__CurrentMode])
105#define curr_count (frame->Reserved[__CurrentCount])
116 static const char *
const reg_names[16] =
117 {
"rax",
"rcx",
"rdx",
"rbx",
"rsp",
"rbp",
"rsi",
"rdi",
118 "r8",
"r9",
"r10",
"r11",
"r12",
"r13",
"r14",
"r15" };
120 union handler_data handler_data;
127 TRACE(
"**** func %x-%x\n", function->BeginAddress, function->EndAddress);
130 if (function->UnwindData & 1)
132 if (!
sw_read_mem(csw,
base + function->UnwindData, &snext,
sizeof(snext)))
134 TRACE(
"Couldn't unwind RUNTIME_INFO at %lx\n",
base + function->UnwindData);
137 TRACE(
"unwind info for function %p-%p chained to function %p-%p\n",
138 (
char*)
base + function->BeginAddress, (
char*)
base + function->EndAddress,
139 (
char*)
base + snext.BeginAddress, (
char*)
base + snext.EndAddress);
148 FIXME(
"couldn't read memory for UNWIND_INFO at %lx\n",
addr);
151 TRACE(
"unwind info at %p flags %x prolog 0x%x bytes function %p-%p\n",
153 (
char*)
base + function->BeginAddress, (
char*)
base + function->EndAddress);
155 if (
info->FrameRegister)
156 TRACE(
" frame register %s offset 0x%x(%%rsp)\n",
157 reg_names[
info->FrameRegister],
info->FrameOffset * 16);
159 for (
i = 0;
i <
info->CountOfCodes;
i++)
161 TRACE(
" 0x%x: ",
info->UnwindCode[
i].u.CodeOffset);
162 switch (
info->UnwindCode[
i].u.UnwindOp)
165 TRACE(
"pushq %%%s\n", reg_names[
info->UnwindCode[
i].u.OpInfo]);
168 if (
info->UnwindCode[
i].u.OpInfo)
181 count = (
info->UnwindCode[
i].u.OpInfo + 1) * 8;
185 TRACE(
"leaq 0x%x(%%rsp),%s\n",
186 info->FrameOffset * 16, reg_names[
info->FrameRegister]);
190 TRACE(
"movq %%%s,0x%x(%%rsp)\n", reg_names[
info->UnwindCode[
i].u.OpInfo],
count);
195 TRACE(
"movq %%%s,0x%x(%%rsp)\n", reg_names[
info->UnwindCode[
i].u.OpInfo],
count);
200 TRACE(
"movaps %%xmm%u,0x%x(%%rsp)\n",
info->UnwindCode[
i].u.OpInfo,
count);
205 TRACE(
"movaps %%xmm%u,0x%x(%%rsp)\n",
info->UnwindCode[
i].u.OpInfo,
count);
209 TRACE(
"PUSH_MACHFRAME %u\n",
info->UnwindCode[
i].u.OpInfo);
212 FIXME(
"unknown code %u\n",
info->UnwindCode[
i].u.UnwindOp);
221 if (!
sw_read_mem(csw,
addr, &handler_data,
sizeof(handler_data.chain)))
223 FIXME(
"couldn't read memory for handler_data.chain\n");
226 TRACE(
" chained to function %p-%p\n",
227 (
char*)
base + handler_data.chain.BeginAddress,
228 (
char*)
base + handler_data.chain.EndAddress);
229 function = &handler_data.chain;
234 if (!
sw_read_mem(csw,
addr, &handler_data,
sizeof(handler_data.handler)))
236 FIXME(
"couldn't read memory for handler_data.handler\n");
239 TRACE(
" handler %p data at %p\n",
240 (
char*)
base + handler_data.handler, (
char*)
addr +
sizeof(handler_data.handler));
264 switch (
op.u.UnwindOp)
267 return 2 + (
op.u.OpInfo != 0);
288 if ((op0 & 0xf8) == 0x48)
295 if (op0 == 0x48 && op2 == 0xc4)
302 if (op0 == 0x48 && op2 == 0xc4)
309 if (op0 & 0x06)
return FALSE;
310 if (((op2 >> 3) & 7) != 4)
return FALSE;
311 if ((op2 & 7) == 4)
return FALSE;
330 if ((op0 & 0xf0) == 0x40)
353 if (pc -
base >= function->BeginAddress && pc - base < function->EndAddress)
358 pc += 2 + (
signed char)op1;
359 if (pc -
base >= function->BeginAddress && pc - base < function->EndAddress)
382 if ((insn & 0xf0) == 0x40)
399 set_int_reg(
context, insn - 0x58 + (
rex & 1) * 8, val64);
406 pc += 2 +
sizeof(
LONG);
415 if ((insn >> 6) == 1)
425 pc += 2 +
sizeof(
LONG);
446 pc += 2 + (
signed char)val8;
449 FIXME(
"unsupported insn %x\n", insn);
473 union handler_data handler_data;
485 WARN(
"Couldn't read unwind_code at %lx\n",
base + function->UnwindData);
489 if (
info->Version != 1)
491 WARN(
"unknown unwind info version %u at %lx\n",
info->Version,
base + function->UnwindData);
495 if (
info->FrameRegister)
496 newframe = get_int_reg(
context,
info->FrameRegister) -
info->FrameOffset * 16;
499 if (
context->Rip >=
base + function->BeginAddress &&
502 prolog_offset =
context->Rip -
base - function->BeginAddress;
507 if (is_inside_epilog(csw,
context->Rip,
base, function))
514 for (
i = 0;
i <
info->CountOfCodes;
i += get_opcode_size(
info->UnwindCode[
i]))
516 if (prolog_offset < info->UnwindCode[
i].
u.CodeOffset)
continue;
518 switch (
info->UnwindCode[
i].u.UnwindOp)
536 off = newframe + *(
USHORT*)&
info->UnwindCode[
i+1] * 8;
541 off = newframe + *(
DWORD*)&
info->UnwindCode[
i+1];
546 off = newframe + *(
USHORT*)&
info->UnwindCode[
i+1] * 16;
548 set_float_reg(
context,
info->UnwindCode[
i].u.OpInfo, floatvalue);
551 off = newframe + *(
DWORD*)&
info->UnwindCode[
i+1];
553 set_float_reg(
context,
info->UnwindCode[
i].u.OpInfo, floatvalue);
556 FIXME(
"PUSH_MACHFRAME %u\n",
info->UnwindCode[
i].u.OpInfo);
559 FIXME(
"unknown code %u\n",
info->UnwindCode[
i].u.UnwindOp);
566 &handler_data,
sizeof(handler_data)))
return FALSE;
567 function = &handler_data.chain;
569 return default_unwind(csw,
context);
587 if (prtf) *prtf = rtf;
590 return interpret_function_table_entry(csw,
context, rtf,
base);
596 TRACE(
" rax=%016lx rbx=%016lx rcx=%016lx rdx=%016lx\n",
598 TRACE(
" rsi=%016lx rdi=%016lx rbp=%016lx rsp=%016lx\n",
600 TRACE(
" r8=%016lx r9=%016lx r10=%016lx r11=%016lx\n",
602 TRACE(
" r12=%016lx r13=%016lx r14=%016lx r15=%016lx\n",
607 return default_unwind(csw,
context);
619 TRACE(
"Enter: PC=%s Frame=%s Return=%s Stack=%s Mode=%s Count=%s\n",
632 WARN(
"Bad AddrPC.Mode / AddrFrame.Mode combination\n");
675 TRACE(
"Leave: PC=%s Frame=%s Return=%s Stack=%s Mode=%s Count=%s FuncTable=%p\n",
708 if (addr < module->
module.BaseOfImage + rtf[
pos].BeginAddress)
max =
pos - 1;
713 while (rtf->UnwindData & 1)
715 FIXME(
"RunTime_Function outside IMAGE_DIRECTORY_ENTRY_EXCEPTION unimplemented yet!\n");
731 if (regno >= 17 && regno <= 24)
733 else if (regno >= 25 && regno <= 32)
735 else if (regno >= 33 && regno <= 40)
775 FIXME(
"Don't know how to map register %d\n", regno);
842 FIXME(
"Unknown register %x\n", regno);
902 FIXME(
"Unknown register %x\n", regno);
941 while (rtf + 1 <
end)
943 while (rtf->UnwindData & 1)
945 FIXME(
"RunTime_Function outside IMAGE_DIRECTORY_ENTRY_EXCEPTION unimplemented yet!\n");
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static BOOL x86_64_stack_walk(struct cpu_stack_walk *csw, STACKFRAME64 *frame, union ctx *ctx)
enum _UNWIND_OP_CODES UNWIND_CODE_OPS
static BOOL x86_64_fetch_minidump_module(struct dump_context *dc, unsigned index, unsigned flags)
union _UNWIND_CODE UNWIND_CODE
struct _UNWIND_INFO * PUNWIND_INFO
static BOOL x86_64_get_addr(HANDLE hThread, const CONTEXT *ctx, enum cpu_addr ca, ADDRESS64 *addr)
struct _UNWIND_INFO UNWIND_INFO
static void * x86_64_find_runtime_function(struct module *module, DWORD64 addr)
union _UNWIND_CODE * PUNWIND_CODE
static const char * x86_64_fetch_regname(unsigned regno)
DECLSPEC_HIDDEN struct cpu cpu_x86_64
static BOOL x86_64_fetch_minidump_thread(struct dump_context *dc, unsigned index, unsigned flags, const CONTEXT *ctx)
static void * x86_64_fetch_context_reg(union ctx *pctx, unsigned regno, unsigned *size)
static unsigned x86_64_map_dwarf_register(unsigned regno, const struct module *module, BOOL eh_frame)
void * sw_table_access(struct cpu_stack_walk *csw, DWORD64 addr) DECLSPEC_HIDDEN
const char * pe_map_directory(struct module *module, int dirno, DWORD *size) DECLSPEC_HIDDEN
static BOOL read_process_memory(const struct process *process, UINT64 addr, void *buf, size_t size)
BOOL dwarf2_virtual_unwind(struct cpu_stack_walk *csw, DWORD_PTR ip, union ctx *ctx, DWORD64 *cfa) DECLSPEC_HIDDEN
DWORD64 sw_module_base(struct cpu_stack_walk *csw, DWORD64 addr) DECLSPEC_HIDDEN
void minidump_add_memory_block(struct dump_context *dc, ULONG64 base, ULONG size, ULONG rva) DECLSPEC_HIDDEN
BOOL sw_read_mem(struct cpu_stack_walk *csw, DWORD64 addr, void *ptr, DWORD sz) DECLSPEC_HIDDEN
struct module * module_find_by_addr(const struct process *pcs, DWORD64 addr, enum module_type type) DECLSPEC_HIDDEN
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
@ ThreadWriteInstructionWindow
const char * wine_dbgstr_addr(const ADDRESS64 *addr)
struct process * process_find_by_handle(HANDLE hProcess)
UINT(* handler)(MSIPACKAGE *)
GLuint GLuint GLsizei count
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
#define IMAGE_FILE_MACHINE_AMD64
#define IMAGE_DIRECTORY_ENTRY_EXCEPTION
UNWIND_CODE UnwindCode[1]
IMAGEHLP_MODULEW64 module
#define FIELD_OFFSET(t, f)
struct _UNWIND_CODE::@369 u