https://git.reactos.org/?p=reactos.git;a=commitdiff;h=36388062cde2534651dbd…
commit 36388062cde2534651dbdc259678dd7208bb4c40
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Fri Sep 11 18:52:52 2020 +0200
Commit: Jérôme Gardou <jerome.gardou(a)reactos.org>
CommitDate: Wed Sep 16 10:35:51 2020 +0200
[WINESYNC] dbghelp: Pass stab size to stabs_parse.
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 9c2cedabc7c7b48c4f9042d444c45a3036cfd4be by Jacek Caban
<jacek(a)codeweavers.com>
---
dll/win32/dbghelp/dbghelp_private.h | 2 +-
dll/win32/dbghelp/elf_module.c | 2 +-
dll/win32/dbghelp/macho_module.c | 2 +-
dll/win32/dbghelp/pe_module.c | 2 +-
dll/win32/dbghelp/stabs.c | 15 ++-------------
sdk/tools/winesync/dbghelp.cfg | 2 +-
6 files changed, 7 insertions(+), 18 deletions(-)
diff --git a/dll/win32/dbghelp/dbghelp_private.h b/dll/win32/dbghelp/dbghelp_private.h
index 521f64881ad..b43eec1a2ed 100644
--- a/dll/win32/dbghelp/dbghelp_private.h
+++ b/dll/win32/dbghelp/dbghelp_private.h
@@ -723,7 +723,7 @@ typedef void (*stabs_def_cb)(struct module* module, ULONG_PTR
load_offset,
BOOL is_public, BOOL is_global, unsigned char other,
struct symt_compiland* compiland, void* user);
extern BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
- const char* stabs, int stablen,
+ const char* stabs, size_t nstab, size_t stabsize,
const char* strs, int strtablen,
stabs_def_cb callback, void* user) DECLSPEC_HIDDEN;
diff --git a/dll/win32/dbghelp/elf_module.c b/dll/win32/dbghelp/elf_module.c
index 01759cd18ee..50f19bc79a3 100644
--- a/dll/win32/dbghelp/elf_module.c
+++ b/dll/win32/dbghelp/elf_module.c
@@ -1007,7 +1007,7 @@ static BOOL elf_load_debug_info_from_map(struct module* module,
{
/* OK, now just parse all of the stabs. */
lret = stabs_parse(module,
module->format_info[DFI_ELF]->u.elf_info->elf_addr,
- stab, image_get_map_size(&stab_sect),
+ stab, image_get_map_size(&stab_sect) /
sizeof(struct stab_nlist), sizeof(struct stab_nlist),
stabstr, image_get_map_size(&stabstr_sect),
NULL, NULL);
if (lret)
diff --git a/dll/win32/dbghelp/macho_module.c b/dll/win32/dbghelp/macho_module.c
index ab88d271081..1e01d84c192 100644
--- a/dll/win32/dbghelp/macho_module.c
+++ b/dll/win32/dbghelp/macho_module.c
@@ -944,7 +944,7 @@ static int macho_parse_symtab(struct image_file_map* ifm,
if (!stabs_parse(mdi->module,
mdi->module->format_info[DFI_MACHO]->u.macho_info->load_addr -
fmap->segs_start,
- stab, sc->nsyms * stabsize,
+ stab, sc->nsyms, stabsize,
stabstr, sc->strsize, macho_stabs_def_cb, mdi))
ret = -1;
diff --git a/dll/win32/dbghelp/pe_module.c b/dll/win32/dbghelp/pe_module.c
index b915911d6ce..230c4d01d78 100644
--- a/dll/win32/dbghelp/pe_module.c
+++ b/dll/win32/dbghelp/pe_module.c
@@ -502,7 +502,7 @@ static BOOL pe_load_stabs(const struct process* pcs, struct module*
module)
{
ret = stabs_parse(module,
module->module.BaseOfImage -
fmap->u.pe.ntheader.OptionalHeader.ImageBase,
- stab, image_get_map_size(§_stabs),
+ stab, image_get_map_size(§_stabs) / sizeof(struct
stab_nlist), sizeof(struct stab_nlist),
stabstr, image_get_map_size(§_stabstr),
NULL, NULL);
}
diff --git a/dll/win32/dbghelp/stabs.c b/dll/win32/dbghelp/stabs.c
index 9190997cdf8..0d28ae1415a 100644
--- a/dll/win32/dbghelp/stabs.c
+++ b/dll/win32/dbghelp/stabs.c
@@ -1255,7 +1255,7 @@ static inline void stabbuf_append(char **buf, unsigned *buf_size,
const char *st
}
BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
- const char* pv_stab_ptr, int stablen,
+ const char* pv_stab_ptr, size_t nstab, size_t stabsize,
const char* strs, int strtablen,
stabs_def_cb callback, void* user)
{
@@ -1264,7 +1264,6 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
struct symt_compiland* compiland = NULL;
char* srcpath = NULL;
int i;
- int nstab;
const char* ptr;
char* stabbuff;
unsigned int stabbufflen;
@@ -1280,14 +1279,8 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
BOOL ret = TRUE;
struct location loc;
unsigned char type;
- size_t stabsize = sizeof(struct stab_nlist);
uint64_t n_value;
-#ifdef __APPLE__
- if (module->process->is_64bit)
- stabsize = sizeof(struct macho64_nlist);
-#endif
- nstab = stablen / stabsize;
strs_end = strs + strtablen;
memset(stabs_basic, 0, sizeof(stabs_basic));
@@ -1306,11 +1299,7 @@ BOOL stabs_parse(struct module* module, ULONG_PTR load_offset,
for (i = 0; i < nstab; i++)
{
stab_ptr = (struct stab_nlist *)(pv_stab_ptr + i * stabsize);
- n_value = stab_ptr->n_value;
-#ifdef __APPLE__
- if (module->process->is_64bit)
- n_value = ((struct macho64_nlist *)stab_ptr)->n_value;
-#endif
+ n_value = stabsize == sizeof(struct macho64_nlist) ? ((struct macho64_nlist
*)stab_ptr)->n_value : stab_ptr->n_value;
ptr = strs + stab_ptr->n_strx;
if ((ptr > strs_end) || (ptr + strlen(ptr) > strs_end))
{
diff --git a/sdk/tools/winesync/dbghelp.cfg b/sdk/tools/winesync/dbghelp.cfg
index e3835e05f57..0c82a58e2d3 100644
--- a/sdk/tools/winesync/dbghelp.cfg
+++ b/sdk/tools/winesync/dbghelp.cfg
@@ -4,4 +4,4 @@ files:
include/dbghelp.h: sdk/include/psdk/dbghelp.h
include/wine/mscvpdb.h: sdk/include/reactos/wine/mscvpdb.h
tags:
- wine: f48f8cc39980f2d93015ecd56f28e3e9f52843fe
+ wine: 9c2cedabc7c7b48c4f9042d444c45a3036cfd4be