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

- implemented support for function debug start/stop and labels (msc.c

and stabs.c) - started implementing typedef support - functions now have a real function signature (only in stabs.c, still to be done in msc.c) - small enhancements to TI_GET_TYPE for functions - added support for functions' block and local variables in registers (msc.c) - fixed some bugs in StackWalk - constants are now stored as variants (instead of unsigned ints) - fixed regular expression management (dbghelp's RE are not the same as POSIX ones)
parent 9509912e
......@@ -29,22 +29,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp);
/* TODO
* - support for symbols' types is still partly missing
* + debug start/stop in functions
* + parameters in function prototype...
* + C++ support
* + funcargtype:s are (partly) wrong: they should be a specific struct (like
* typedef) pointing to the actual type (and not a direct access)
* + we should store the underlying type for an enum in the symt_enum struct
* - most options (dbghelp_options) are not used (loading lines, decoration,
* deferring reading of module symbols, public symbols...)
* - (un)decoration is not handled (should make winedump's code a (.a) library
* and link it to winedump, and potentially to msvcrt and dbghelp (check best
* way not to duplicate code in msvcrt & dbghelp)
* - msc:
* + handle the debug_start & debug_end information block
* + we should add parameters' types to the function's signature
* while processing a function's parameters
* + get rid of MSC reading FIXME:s (lots of types are not defined)
* + C++ management
* - stabs:
* + we should add parameters' types to the function's signature
* while processing a function's parameters
* + should generate the func debug_{start,end} statements (black magic ?)
* + should identify the relay code in Wine and mark it as thunk type
* + C++ management
* - implement the callback notification mechanism
......
......@@ -26,6 +26,7 @@
#include "winbase.h"
#include "winver.h"
#include "dbghelp.h"
#include "oaidl.h"
#include "cvconst.h"
......@@ -142,11 +143,7 @@ struct symt_data
unsigned position;
unsigned length;
} bitfield; /* used by BitField */
#if 1
unsigned value; /* LocIsConstant */
#else
VARIANT value; /* LocIsConstant */
#endif
} u;
};
......@@ -159,7 +156,15 @@ struct symt_function
struct symt* type; /* points to function_signature */
unsigned long size;
struct vector vlines;
struct vector vchildren; /* locals, params, blocks */
struct vector vchildren; /* locals, params, blocks, start/end, labels */
};
struct symt_function_point
{
struct symt symt; /* either SymTagFunctionDebugStart, SymTagFunctionDebugEnd, SymTagLabel */
struct symt_function* parent;
unsigned long offset;
const char* name; /* for labels */
};
struct symt_public
......@@ -201,6 +206,7 @@ struct symt_function_signature
{
struct symt symt;
struct symt* rettype;
struct vector vchildren;
};
struct symt_pointer
......@@ -367,11 +373,21 @@ extern struct symt_data*
extern struct symt_block*
symt_open_func_block(struct module* module,
struct symt_function* func,
struct symt_block* block, unsigned pc);
struct symt_block* block,
unsigned pc, unsigned len);
extern struct symt_block*
symt_close_func_block(struct module* module,
struct symt_function* func,
struct symt_block* block, unsigned pc);
extern struct symt_function_point*
symt_add_function_point(struct module* module,
struct symt_function* func,
enum SymTagEnum point,
unsigned offset, const char* name);
extern BOOL symt_fill_func_line_info(struct module* module,
struct symt_function* func,
DWORD addr, IMAGEHLP_LINE* line);
extern BOOL symt_get_func_line_next(struct module* module, PIMAGEHLP_LINE line);
/* type.c */
extern void symt_init_basic(struct module* module);
......@@ -394,13 +410,19 @@ extern struct symt_enum*
symt_new_enum(struct module* module, const char* typename);
extern BOOL symt_add_enum_element(struct module* module,
struct symt_enum* enum_type,
const char* name, unsigned value);
const char* name, int value);
extern struct symt_array*
symt_new_array(struct module* module, int min, int max,
struct symt* base);
extern struct symt_function_signature*
symt_new_function_signature(struct module* module,
struct symt* ret_type);
extern BOOL symt_add_function_signature_parameter(struct module* module,
struct symt_function_signature* sig,
struct symt* param);
extern struct symt_pointer*
symt_new_pointer(struct module* module,
struct symt* ref_type);
extern struct symt_typedef*
symt_new_typedef(struct module* module, struct symt* ref,
const char* name);
......@@ -1112,6 +1112,30 @@ struct symt_public* lookup_public(const struct module* module,
return found;
}
/******************************************************************
* stabs_finalize_function
*
* Ends function creation: mainly:
* - cleans up line number information
* - tries to set up a debug-start tag (FIXME: heuristic to be enhanced)
*/
static void stabs_finalize_function(struct module* module, struct symt_function* func)
{
IMAGEHLP_LINE il;
if (!func) return;
symt_normalize_function(module, func);
/* To define the debug-start of the function, we use the second line number.
* Not 100% bullet proof, but better than nothing
*/
if (symt_fill_func_line_info(module, func, func->addr, &il) &&
symt_get_func_line_next(module, &il))
{
symt_add_function_point(module, func, SymTagFuncDebugStart,
il.Address - func->addr, NULL);
}
}
SYM_TYPE stabs_parse(struct module* module, const char* addr,
unsigned long load_offset, unsigned int staboff, int stablen,
unsigned int strtaboff, int strtablen)
......@@ -1267,7 +1291,7 @@ SYM_TYPE stabs_parse(struct module* module, const char* addr,
break;
case N_LBRAC:
block = symt_open_func_block(module, curr_func, block,
stab_ptr->n_value);
stab_ptr->n_value, 0);
for (j = 0; j < num_pending_vars; j++)
{
symt_add_func_local(module, curr_func, pending_vars[j].regno,
......@@ -1284,9 +1308,13 @@ SYM_TYPE stabs_parse(struct module* module, const char* addr,
/* These are function parameters. */
if (curr_func != NULL)
{
struct symt* param_type = stabs_parse_type(ptr);
stab_strcpy(symname, sizeof(symname), ptr);
symt_add_func_local(module, curr_func, 0, stab_ptr->n_value,
NULL, stabs_parse_type(ptr), symname);
NULL, param_type, symname);
symt_add_function_signature_parameter(module,
(struct symt_function_signature*)curr_func->type,
param_type);
}
break;
case N_RSYM:
......@@ -1385,7 +1413,7 @@ SYM_TYPE stabs_parse(struct module* module, const char* addr,
break;
case N_FUN:
/* First, clean up the previous function we were working on. */
symt_normalize_function(module, curr_func);
stabs_finalize_function(module, curr_func);
/*
* For now, just declare the various functions. Later
......@@ -1409,11 +1437,11 @@ SYM_TYPE stabs_parse(struct module* module, const char* addr,
if ((public = lookup_public(module, compiland, symname)))
curr_func = symt_new_function(module, compiland, symname,
public->address, public->size,
stabs_parse_type(ptr));
&func_type->symt);
#else
curr_func = symt_new_function(module, compiland, symname,
load_offset + stab_ptr->n_value, 0,
stabs_parse_type(ptr));
&func_type->symt);
#endif
}
else
......@@ -1431,7 +1459,7 @@ SYM_TYPE stabs_parse(struct module* module, const char* addr,
{
/* Nuke old path. */
currpath[0] = '\0';
symt_normalize_function(module, curr_func);
stabs_finalize_function(module, curr_func);
curr_func = NULL;
source_idx = -1;
incl_stk = -1;
......@@ -1456,7 +1484,7 @@ SYM_TYPE stabs_parse(struct module* module, const char* addr,
case N_UNDF:
strs += strtabinc;
strtabinc = stab_ptr->n_value;
symt_normalize_function(module, curr_func);
stabs_finalize_function(module, curr_func);
curr_func = NULL;
break;
case N_OPT:
......
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