mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[WINESYNC] dbghelp: Use local stab_nlist declaration in macho_module.c.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 061146c2ab530a54f8323331e88c5771dd7bba49 by Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
parent
2d57c6b88f
commit
43384a1d3c
4 changed files with 39 additions and 38 deletions
|
@ -136,6 +136,15 @@ struct image_section_map
|
||||||
LONG_PTR sidx;
|
LONG_PTR sidx;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct stab_nlist
|
||||||
|
{
|
||||||
|
unsigned n_strx;
|
||||||
|
unsigned char n_type;
|
||||||
|
char n_other;
|
||||||
|
short n_desc;
|
||||||
|
unsigned n_value;
|
||||||
|
};
|
||||||
|
|
||||||
BOOL image_check_alternate(struct image_file_map* fmap, const struct module* module) DECLSPEC_HIDDEN;
|
BOOL image_check_alternate(struct image_file_map* fmap, const struct module* module) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
BOOL elf_map_handle(HANDLE handle, struct image_file_map* fmap) DECLSPEC_HIDDEN;
|
BOOL elf_map_handle(HANDLE handle, struct image_file_map* fmap) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -932,7 +932,7 @@ static int macho_parse_symtab(struct image_file_map* ifm,
|
||||||
struct macho_debug_info* mdi = user;
|
struct macho_debug_info* mdi = user;
|
||||||
const char* stabstr;
|
const char* stabstr;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
size_t stabsize = (ifm->addr_size == 32) ? sizeof(struct nlist) : sizeof(struct nlist_64);
|
size_t stabsize = (ifm->addr_size == 32) ? sizeof(struct stab_nlist) : sizeof(struct nlist_64);
|
||||||
const char *stab;
|
const char *stab;
|
||||||
|
|
||||||
TRACE("(%p/%p, %p, %p) %u syms at 0x%08x, strings 0x%08x - 0x%08x\n", fmap, fmap->handle, lc,
|
TRACE("(%p/%p, %p, %p) %u syms at 0x%08x, strings 0x%08x - 0x%08x\n", fmap, fmap->handle, lc,
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "dbghelp_private.h"
|
#include "dbghelp_private.h"
|
||||||
|
#include "image_private.h"
|
||||||
|
|
||||||
#ifndef DBGHELP_STATIC_LIB
|
#ifndef DBGHELP_STATIC_LIB
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
|
@ -120,15 +121,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dbghelp_stabs);
|
||||||
#define N_EXCL 0xc2
|
#define N_EXCL 0xc2
|
||||||
#define N_RBRAC 0xe0
|
#define N_RBRAC 0xe0
|
||||||
|
|
||||||
struct stab_nlist
|
|
||||||
{
|
|
||||||
unsigned n_strx;
|
|
||||||
unsigned char n_type;
|
|
||||||
char n_other;
|
|
||||||
short n_desc;
|
|
||||||
unsigned n_value;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void stab_strcpy(char* dest, int sz, const char* source)
|
static void stab_strcpy(char* dest, int sz, const char* source)
|
||||||
{
|
{
|
||||||
char* ptr = dest;
|
char* ptr = dest;
|
||||||
|
@ -339,7 +331,7 @@ struct ParseTypedefData
|
||||||
int idx;
|
int idx;
|
||||||
struct module* module;
|
struct module* module;
|
||||||
#ifdef PTS_DEBUG
|
#ifdef PTS_DEBUG
|
||||||
struct PTS_Error
|
struct PTS_Error
|
||||||
{
|
{
|
||||||
const char* ptr;
|
const char* ptr;
|
||||||
unsigned line;
|
unsigned line;
|
||||||
|
@ -396,12 +388,12 @@ static int stabs_get_basic(struct ParseTypedefData* ptd, unsigned basic, struct
|
||||||
case 35: stabs_basic[basic] = symt_new_basic(ptd->module, btComplex, "long double complex", 24); break;
|
case 35: stabs_basic[basic] = symt_new_basic(ptd->module, btComplex, "long double complex", 24); break;
|
||||||
default: PTS_ABORTIF(ptd, 1);
|
default: PTS_ABORTIF(ptd, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*symt = &stabs_basic[basic]->symt;
|
*symt = &stabs_basic[basic]->symt;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stabs_pts_read_type_def(struct ParseTypedefData* ptd,
|
static int stabs_pts_read_type_def(struct ParseTypedefData* ptd,
|
||||||
const char* typename, struct symt** dt);
|
const char* typename, struct symt** dt);
|
||||||
|
|
||||||
static int stabs_pts_read_id(struct ParseTypedefData* ptd)
|
static int stabs_pts_read_id(struct ParseTypedefData* ptd)
|
||||||
|
@ -480,7 +472,7 @@ static int stabs_pts_read_range_value(struct ParseTypedefData* ptd, struct pts_r
|
||||||
{
|
{
|
||||||
switch (ptd->ptr[1])
|
switch (ptd->ptr[1])
|
||||||
{
|
{
|
||||||
case '0':
|
case '0':
|
||||||
PTS_ABORTIF(ptd, ptd->ptr[0] != '1');
|
PTS_ABORTIF(ptd, ptd->ptr[0] != '1');
|
||||||
prv->sign = -1;
|
prv->sign = -1;
|
||||||
prv->val = 0;
|
prv->val = 0;
|
||||||
|
@ -501,7 +493,7 @@ static int stabs_pts_read_range_value(struct ParseTypedefData* ptd, struct pts_r
|
||||||
ptd->ptr = last;
|
ptd->ptr = last;
|
||||||
break;
|
break;
|
||||||
case '+':
|
case '+':
|
||||||
default:
|
default:
|
||||||
prv->sign = 1;
|
prv->sign = 1;
|
||||||
prv->val = strtoull(ptd->ptr, &last, 10);
|
prv->val = strtoull(ptd->ptr, &last, 10);
|
||||||
ptd->ptr = last;
|
ptd->ptr = last;
|
||||||
|
@ -631,7 +623,7 @@ static inline int stabs_pts_read_method_info(struct ParseTypedefData* ptd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
|
static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
|
||||||
struct symt_udt* sdt)
|
struct symt_udt* sdt)
|
||||||
{
|
{
|
||||||
LONG_PTR sz, ofs;
|
LONG_PTR sz, ofs;
|
||||||
|
@ -677,7 +669,7 @@ static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
|
||||||
}
|
}
|
||||||
PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
|
PTS_ABORTIF(ptd, *ptd->ptr++ != ';');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* if the structure has already been filled, just redo the parsing
|
/* if the structure has already been filled, just redo the parsing
|
||||||
* but don't store results into the struct
|
* but don't store results into the struct
|
||||||
|
@ -685,7 +677,7 @@ static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Now parse the individual elements of the structure/union. */
|
/* Now parse the individual elements of the structure/union. */
|
||||||
while (*ptd->ptr != ';')
|
while (*ptd->ptr != ';')
|
||||||
{
|
{
|
||||||
/* agg_name : type ',' <int:offset> ',' <int:size> */
|
/* agg_name : type ',' <int:offset> ',' <int:size> */
|
||||||
idx = ptd->idx;
|
idx = ptd->idx;
|
||||||
|
@ -727,7 +719,7 @@ static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
|
||||||
*/
|
*/
|
||||||
if (*ptd->ptr == ':')
|
if (*ptd->ptr == ':')
|
||||||
{
|
{
|
||||||
ptd->ptr++;
|
ptd->ptr++;
|
||||||
stabs_pts_read_method_info(ptd);
|
stabs_pts_read_method_info(ptd);
|
||||||
ptd->idx = idx;
|
ptd->idx = idx;
|
||||||
continue;
|
continue;
|
||||||
|
@ -773,7 +765,7 @@ static inline int stabs_pts_read_aggregate(struct ParseTypedefData* ptd,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int stabs_pts_read_enum(struct ParseTypedefData* ptd,
|
static inline int stabs_pts_read_enum(struct ParseTypedefData* ptd,
|
||||||
struct symt_enum* edt)
|
struct symt_enum* edt)
|
||||||
{
|
{
|
||||||
LONG_PTR value;
|
LONG_PTR value;
|
||||||
|
@ -837,7 +829,7 @@ static int stabs_pts_read_type_def(struct ParseTypedefData* ptd, const char* typ
|
||||||
PTS_ABORTIF(ptd, new_dt != NULL);
|
PTS_ABORTIF(ptd, new_dt != NULL);
|
||||||
|
|
||||||
/* first handle attribute if any */
|
/* first handle attribute if any */
|
||||||
switch (*ptd->ptr)
|
switch (*ptd->ptr)
|
||||||
{
|
{
|
||||||
case '@':
|
case '@':
|
||||||
if (*++ptd->ptr == 's')
|
if (*++ptd->ptr == 's')
|
||||||
|
@ -915,7 +907,7 @@ static int stabs_pts_read_type_def(struct ParseTypedefData* ptd, const char* typ
|
||||||
* classes names. Therefore, we could be here with either:
|
* classes names. Therefore, we could be here with either:
|
||||||
* - typename and udt->hash_elt.name being the same string
|
* - typename and udt->hash_elt.name being the same string
|
||||||
* (non embedded case)
|
* (non embedded case)
|
||||||
* - typename being foo::bar while udt->hash_elt.name being
|
* - typename being foo::bar while udt->hash_elt.name being
|
||||||
* just bar
|
* just bar
|
||||||
* So, we twist the comparison to test both occurrences. When
|
* So, we twist the comparison to test both occurrences. When
|
||||||
* we have proper C++ types in this file, this twist has to be
|
* we have proper C++ types in this file, this twist has to be
|
||||||
|
@ -986,7 +978,7 @@ static int stabs_pts_read_type_def(struct ParseTypedefData* ptd, const char* typ
|
||||||
{
|
{
|
||||||
LONG_PTR type, len, unk;
|
LONG_PTR type, len, unk;
|
||||||
int basic;
|
int basic;
|
||||||
|
|
||||||
PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &type) == -1);
|
PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &type) == -1);
|
||||||
PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
|
PTS_ABORTIF(ptd, *ptd->ptr++ != ';'); /* ';' */
|
||||||
PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &len) == -1);
|
PTS_ABORTIF(ptd, stabs_pts_read_number(ptd, &len) == -1);
|
||||||
|
@ -1025,7 +1017,7 @@ static int stabs_pts_read_type_def(struct ParseTypedefData* ptd, const char* typ
|
||||||
new_dt = &symt_new_basic(ptd->module, btVoid, typename, 0)->symt;
|
new_dt = &symt_new_basic(ptd->module, btVoid, typename, 0)->symt;
|
||||||
PTS_ABORTIF(ptd, strcmp(typename, "void"));
|
PTS_ABORTIF(ptd, strcmp(typename, "void"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*stabs_find_ref(filenr1, subnr1) = *ret_dt = new_dt;
|
*stabs_find_ref(filenr1, subnr1) = *ret_dt = new_dt;
|
||||||
|
|
||||||
|
@ -1034,7 +1026,7 @@ static int stabs_pts_read_type_def(struct ParseTypedefData* ptd, const char* typ
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stabs_parse_typedef(struct module* module, const char* ptr,
|
static int stabs_parse_typedef(struct module* module, const char* ptr,
|
||||||
const char* typename)
|
const char* typename)
|
||||||
{
|
{
|
||||||
struct ParseTypedefData ptd;
|
struct ParseTypedefData ptd;
|
||||||
|
@ -1062,7 +1054,7 @@ static int stabs_parse_typedef(struct module* module, const char* ptr,
|
||||||
ret = stabs_pts_read_type_def(&ptd, typename, &dt);
|
ret = stabs_pts_read_type_def(&ptd, typename, &dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == -1 || *ptd.ptr)
|
if (ret == -1 || *ptd.ptr)
|
||||||
{
|
{
|
||||||
#ifdef PTS_DEBUG
|
#ifdef PTS_DEBUG
|
||||||
int i;
|
int i;
|
||||||
|
@ -1071,13 +1063,13 @@ static int stabs_parse_typedef(struct module* module, const char* ptr,
|
||||||
{
|
{
|
||||||
for (i = 0; i < ptd.err_idx; i++)
|
for (i = 0; i < ptd.err_idx; i++)
|
||||||
{
|
{
|
||||||
TRACE("[%d]: line %d => %s\n",
|
TRACE("[%d]: line %d => %s\n",
|
||||||
i, ptd.errors[i].line, debugstr_a(ptd.errors[i].ptr));
|
i, ptd.errors[i].line, debugstr_a(ptd.errors[i].ptr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
TRACE("[0]: => %s\n", debugstr_a(ptd.ptr));
|
TRACE("[0]: => %s\n", debugstr_a(ptd.ptr));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
ERR("Failure on %s at %s\n", debugstr_a(ptr), debugstr_a(ptd.ptr));
|
ERR("Failure on %s at %s\n", debugstr_a(ptr), debugstr_a(ptd.ptr));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1254,7 +1246,7 @@ static void stabs_finalize_function(struct module* module, struct symt_function*
|
||||||
{
|
{
|
||||||
loc.kind = loc_absolute;
|
loc.kind = loc_absolute;
|
||||||
loc.offset = il.Address - func->address;
|
loc.offset = il.Address - func->address;
|
||||||
symt_add_function_point(module, func, SymTagFuncDebugStart,
|
symt_add_function_point(module, func, SymTagFuncDebugStart,
|
||||||
&loc, NULL);
|
&loc, NULL);
|
||||||
}
|
}
|
||||||
if (size) func->size = size;
|
if (size) func->size = size;
|
||||||
|
@ -1447,8 +1439,8 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
symt_add_func_local(module, curr_func,
|
symt_add_func_local(module, curr_func,
|
||||||
(int)n_value >= 0 ? DataIsParam : DataIsLocal,
|
(int)n_value >= 0 ? DataIsParam : DataIsLocal,
|
||||||
&loc, NULL, param_type, symname);
|
&loc, NULL, param_type, symname);
|
||||||
symt_add_function_signature_parameter(module,
|
symt_add_function_signature_parameter(module,
|
||||||
(struct symt_function_signature*)curr_func->type,
|
(struct symt_function_signature*)curr_func->type,
|
||||||
param_type);
|
param_type);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1506,8 +1498,8 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
stab_strcpy(symname, sizeof(symname), ptr);
|
stab_strcpy(symname, sizeof(symname), ptr);
|
||||||
symt_add_func_local(module, curr_func, DataIsParam, &loc,
|
symt_add_func_local(module, curr_func, DataIsParam, &loc,
|
||||||
NULL, param_type, symname);
|
NULL, param_type, symname);
|
||||||
symt_add_function_signature_parameter(module,
|
symt_add_function_signature_parameter(module,
|
||||||
(struct symt_function_signature*)curr_func->type,
|
(struct symt_function_signature*)curr_func->type,
|
||||||
param_type);
|
param_type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1532,7 +1524,7 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
ULONG_PTR offset = n_value;
|
ULONG_PTR offset = n_value;
|
||||||
if (module->type == DMT_MACHO)
|
if (module->type == DMT_MACHO)
|
||||||
offset -= curr_func->address - load_offset;
|
offset -= curr_func->address - load_offset;
|
||||||
symt_add_func_line(module, curr_func, source_idx,
|
symt_add_func_line(module, curr_func, source_idx,
|
||||||
stab_ptr->n_desc, offset);
|
stab_ptr->n_desc, offset);
|
||||||
}
|
}
|
||||||
else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc,
|
else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc,
|
||||||
|
@ -1562,13 +1554,13 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
|
||||||
* Assume size of the func is the delta between current offset
|
* Assume size of the func is the delta between current offset
|
||||||
* and offset of last function
|
* and offset of last function
|
||||||
*/
|
*/
|
||||||
stabs_finalize_function(module, curr_func,
|
stabs_finalize_function(module, curr_func,
|
||||||
n_value ?
|
n_value ?
|
||||||
(load_offset + n_value - curr_func->address) : 0);
|
(load_offset + n_value - curr_func->address) : 0);
|
||||||
}
|
}
|
||||||
func_type = symt_new_function_signature(module,
|
func_type = symt_new_function_signature(module,
|
||||||
stabs_parse_type(ptr), -1);
|
stabs_parse_type(ptr), -1);
|
||||||
curr_func = symt_new_function(module, compiland, symname,
|
curr_func = symt_new_function(module, compiland, symname,
|
||||||
load_offset + n_value, 0,
|
load_offset + n_value, 0,
|
||||||
&func_type->symt);
|
&func_type->symt);
|
||||||
pending_flush(&pending_func, module, curr_func, NULL);
|
pending_flush(&pending_func, module, curr_func, NULL);
|
||||||
|
|
|
@ -4,4 +4,4 @@ files:
|
||||||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||||
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
|
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
|
||||||
tags:
|
tags:
|
||||||
wine: 47f1c5a993ed34e5f1e4783360019613d0f9682a
|
wine: 061146c2ab530a54f8323331e88c5771dd7bba49
|
||||||
|
|
Loading…
Reference in a new issue