Commit c5e0a696 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

- fixed some bugs in StackWalk (claimed for but forgotten in last

patch) - removed location field in symt_data, and reworked the actual location of information based on the 'kind' field - shorten debug channel name - added support for bitfield in struct:s - cleaned up source line information support - now storing constants values as VARIANT
parent c5524e1e
......@@ -132,18 +132,16 @@ struct symt_data
enum DataKind kind;
struct symt* container;
struct symt* type;
enum LocationType location;
union /* depends on location */
union /* depends on kind */
{
unsigned long address; /* used by Static, Tls, ThisRel */
int offset; /* used by RegRel */
unsigned reg_id; /* used by Enregistered */
unsigned long address; /* DataIs{Global, FileStatic} */
struct
{
unsigned position;
unsigned length;
} bitfield; /* used by BitField */
VARIANT value; /* LocIsConstant */
long offset; /* DataIs{Member,Local,Param} in bits*/
unsigned long length; /* DataIs{Member} in bits */
unsigned long reg_id; /* DataIs{Local} (0 if frame relative) */
} s;
VARIANT value; /* DataIsConstant */
} u;
};
......
......@@ -70,14 +70,12 @@ static const char* wine_dbgstr_addr(const ADDRESS* addr)
* StackWalk (DBGHELP.@)
*/
BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
LPSTACKFRAME frame, LPVOID _ctx,
LPSTACKFRAME frame, LPVOID ctx,
PREAD_PROCESS_MEMORY_ROUTINE f_read_mem,
PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
PTRANSLATE_ADDRESS_ROUTINE f_xlat_adr)
{
#ifdef __i386__
CONTEXT* ctx = (CONTEXT*)_ctx;
STACK32FRAME frame32;
STACK16FRAME frame16;
char ch;
......@@ -87,7 +85,7 @@ BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
BOOL do_switch;
TRACE("(%ld, %p, %p, %p, %p, %p, %p, %p, %p)\n",
MachineType, hProcess, hThread, frame, _ctx,
MachineType, hProcess, hThread, frame, ctx,
f_read_mem, FunctionTableAccessRoutine,
GetModuleBaseRoutine, f_xlat_adr);
......@@ -119,13 +117,6 @@ BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
curr_mode = (frame->AddrPC.Mode == AddrModeFlat) ?
stm_32bit : stm_16bit;
/* Get the current ESP (don't know if this is valid) */
if (ctx)
{
frame->AddrStack.Segment = 0;
frame->AddrStack.Offset = ctx->Esp;
frame->AddrStack.Mode = AddrModeFlat;
}
/* cur_switch holds address of curr_stack's field in TEB in debuggee
* address space
*/
......@@ -155,11 +146,6 @@ BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
&ch, sizeof(ch), NULL))
curr_switch = 0xFFFFFFFF;
frame->AddrReturn.Mode = frame->AddrStack.Mode = AddrMode1616;
/* "pop up" previous BP value */
if (!f_read_mem(hProcess, (void*)frame->AddrFrame.Offset,
&val, sizeof(WORD), NULL))
goto done_err;
frame->AddrFrame.Offset = val;
}
else
{
......@@ -177,11 +163,10 @@ BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
if (!f_read_mem(hProcess, (void*)curr_switch, &ch, sizeof(ch), NULL))
curr_switch = 0xFFFFFFFF;
frame->AddrReturn.Mode = frame->AddrStack.Mode = AddrModeFlat;
/* "pop up" previous EBP value */
if (!f_read_mem(hProcess, (void*)frame->AddrFrame.Offset,
&frame->AddrFrame.Offset, sizeof(DWORD), NULL))
goto done_err;
}
/* don't set up AddrStack on first call. Either the caller has set it up, or
* we will get it in the next frame
*/
}
else
{
......@@ -393,11 +378,4 @@ BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
done_err:
curr_mode = stm_done;
return FALSE;
#else /* __i386__ */
FIXME("(%ld, %p, %p, %p, %p, %p, %p, %p, %p): stub\n",
MachineType, hProcess, hThread, frame, _ctx,
f_read_mem, FunctionTableAccessRoutine,
GetModuleBaseRoutine, f_xlat_adr);
return FALSE;
#endif
}
......@@ -34,7 +34,7 @@
#include "dbghelp_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symtype);
WINE_DECLARE_DEBUG_CHANNEL(dbghelp_symt);
static const char* symt_get_tag_str(DWORD tag)
{
......@@ -154,7 +154,7 @@ struct symt_udt* symt_new_udt(struct module* module, const char* typename,
{
struct symt_udt* sym;
TRACE_(dbghelp_symtype)("Adding udt %s:%s\n", module->module.ModuleName, typename);
TRACE_(dbghelp_symt)("Adding udt %s:%s\n", module->module.ModuleName, typename);
if ((sym = pool_alloc(&module->pool, sizeof(*sym))))
{
sym->symt.tag = SymTagUDT;
......@@ -176,8 +176,8 @@ BOOL symt_set_udt_size(struct module* module, struct symt_udt* udt, unsigned siz
if (vector_length(&udt->vchildren) != 0)
{
if (udt->size != size)
FIXME_(dbghelp_symtype)("Changing size for %s from %u to %u\n",
udt->hash_elt.name, udt->size, size);
FIXME_(dbghelp_symt)("Changing size for %s from %u to %u\n",
udt->hash_elt.name, udt->size, size);
return TRUE;
}
udt->size = size;
......@@ -201,7 +201,7 @@ BOOL symt_add_udt_element(struct module* module, struct symt_udt* udt_type,
assert(udt_type->symt.tag == SymTagUDT);
TRACE_(dbghelp_symtype)("Adding %s to UDT %s\n", name, udt_type->hash_elt.name);
TRACE_(dbghelp_symt)("Adding %s to UDT %s\n", name, udt_type->hash_elt.name);
p = NULL;
while ((p = vector_iter_up(&udt_type->vchildren, p)))
{
......@@ -221,18 +221,9 @@ BOOL symt_add_udt_element(struct module* module, struct symt_udt* udt_type,
m->kind = DataIsMember;
m->container = &udt_type->symt;
m->type = elt_type;
if (!(offset & 7) && !(size & 7))
{
m->location = LocIsThisRel;
m->u.offset = offset >> 3;
/* we could check that elt_type's size is actually size */
}
else
{
m->location = LocIsBitField;
m->u.bitfield.position = offset;
m->u.bitfield.length = size;
}
m->u.s.offset = offset;
m->u.s.length = ((offset & 7) || (size & 7)) ? size : 0;
m->u.s.reg_id = 0;
p = vector_add(&udt_type->vchildren, &module->pool);
*p = &m->symt;
......@@ -269,7 +260,6 @@ BOOL symt_add_enum_element(struct module* module, struct symt_enum* enum_type,
e->container = &enum_type->symt;
/* CV defines the underlying type for the enumeration */
e->type = &symt_new_basic(module, btInt, "int", 4)->symt;
e->location = LocIsConstant;
e->u.value.n1.n2.vt = VT_I4;
e->u.value.n1.n2.n3.lVal = value;
......@@ -491,9 +481,11 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
break;
case TI_GET_BITPOSITION:
if (type->tag != SymTagData || ((struct symt_data*)type)->location != LocIsBitField)
if (type->tag != SymTagData ||
((struct symt_data*)type)->kind != DataIsMember ||
((struct symt_data*)type)->u.s.length == 0)
return FALSE;
X(DWORD) = ((struct symt_data*)type)->u.bitfield.position;
X(DWORD) = ((struct symt_data*)type)->u.s.offset & 7;
break;
case TI_GET_CHILDRENCOUNT:
......@@ -560,10 +552,10 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
X(DWORD) = sizeof(int); /* FIXME: should be size of base-type of enum !!! */
break;
case SymTagData:
if (((struct symt_data*)type)->location == LocIsBitField)
X(DWORD) = ((struct symt_data*)type)->u.bitfield.length;
else
if (((struct symt_data*)type)->kind != DataIsMember ||
!((struct symt_data*)type)->u.s.length)
return FALSE;
X(DWORD) = ((struct symt_data*)type)->u.s.length;
break;
case SymTagArrayType:
if (!symt_get_info(((struct symt_array*)type)->basetype,
......@@ -622,10 +614,10 @@ BOOL symt_get_info(const struct symt* type, IMAGEHLP_SYMBOL_TYPE_INFO req,
case DataIsParam:
case DataIsLocal:
case DataIsMember:
X(ULONG) = ((struct symt_data*)type)->u.offset;
X(ULONG) = ((struct symt_data*)type)->u.s.offset >> 3;
break;
default:
FIXME("Unknown kind (%u) for get-offset\n",
FIXME("Unknown kind (%u) for get-offset\n",
((struct symt_data*)type)->kind);
return FALSE;
}
......
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