Eric Pouech : dbghelp/pdb: Handle a block in DEBUG_S_LINES subsection spreading across several symbols.

Alexandre Julliard julliard at winehq.org
Mon Nov 8 15:45:08 CST 2021


Module: wine
Branch: master
Commit: bfc0edb8cfa9d8434537bf0f002cdf9088b25026
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=bfc0edb8cfa9d8434537bf0f002cdf9088b25026

Author: Eric Pouech <eric.pouech at gmail.com>
Date:   Mon Nov  8 14:59:47 2021 +0100

dbghelp/pdb: Handle a block in DEBUG_S_LINES subsection spreading across several symbols.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dbghelp/msc.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index 4fba245d815..1be73b723f0 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -1480,7 +1480,6 @@ static void codeview_snarf_linetab(const struct msc_debug_info* msc_dbg, const B
 static void codeview_snarf_linetab2(const struct msc_debug_info* msc_dbg, const struct cv_module_snarf* cvmod)
 {
     unsigned    i;
-    DWORD_PTR       addr;
     const void* hdr_last = (const char*)cvmod->dbgsubsect + cvmod->dbgsubsect_size;
     const struct CV_DebugSSubsectionHeader_t*     hdr;
     const struct CV_DebugSSubsectionHeader_t*     hdr_next;
@@ -1512,6 +1511,7 @@ static void codeview_snarf_linetab2(const struct msc_debug_info* msc_dbg, const
         hdr_next = CV_RECORD_GAP(hdr, hdr->cbLen);
         if (!(hdr->type & DEBUG_S_IGNORE))
         {
+            ULONG_PTR lineblk_base;
             /* FIXME: should also check that whole lines_blk fits in linetab + size */
             switch (hdr->type)
             {
@@ -1520,7 +1520,6 @@ static void codeview_snarf_linetab2(const struct msc_debug_info* msc_dbg, const
                 files_hdr = CV_RECORD_AFTER(lines_hdr);
                 /* Skip blocks that are too small - Intel C Compiler generates these. */
                 if (!CV_IS_INSIDE(files_hdr, hdr_next)) break;
-                addr = codeview_get_address(msc_dbg, lines_hdr->segCon, lines_hdr->offCon);
                 TRACE("block from %04x:%08x #%x\n",
                       lines_hdr->segCon, lines_hdr->offCon, lines_hdr->cbCon);
                 chksms = CV_RECORD_GAP(hdr_files, files_hdr->offFile);
@@ -1531,20 +1530,20 @@ static void codeview_snarf_linetab2(const struct msc_debug_info* msc_dbg, const
                 }
                 source = source_new(msc_dbg->module, NULL,
                                     (chksms->strOffset < cvmod->strsize) ? cvmod->strimage + chksms->strOffset : "<<stroutofbounds>>");
-                func = (struct symt_function*)symt_find_nearest(msc_dbg->module, addr);
-                /* FIXME: at least labels support line numbers */
-                if (!symt_check_tag(&func->symt, SymTagFunction) && !symt_check_tag(&func->symt, SymTagInlineSite))
-                {
-                    WARN("--not a func at %04x:%08x %Ix tag=%d\n",
-                         lines_hdr->segCon, lines_hdr->offCon, addr, func ? func->symt.tag : -1);
-                    break;
-                }
+                lineblk_base = codeview_get_address(msc_dbg, lines_hdr->segCon, lines_hdr->offCon);
                 lines = CV_RECORD_AFTER(files_hdr);
                 for (i = 0; i < files_hdr->nLines; i++)
                 {
+                    func = (struct symt_function*)symt_find_nearest(msc_dbg->module, lineblk_base + lines[i].offset);
+                    /* FIXME: at least labels support line numbers */
+                    if (!symt_check_tag(&func->symt, SymTagFunction) && !symt_check_tag(&func->symt, SymTagInlineSite))
+                    {
+                        WARN("--not a func at %04x:%08x %Ix tag=%d\n",
+                             lines_hdr->segCon, lines_hdr->offCon + lines[i].offset, lineblk_base + lines[i].offset, func ? func->symt.tag : -1);
+                        continue;
+                    }
                     symt_add_func_line(msc_dbg->module, func, source,
-                                       lines[i].linenumStart,
-                                       func->address + lines[i].offset);
+                                       lines[i].linenumStart, lineblk_base + lines[i].offset);
                 }
                 break;
             case DEBUG_S_FILECHKSMS: /* skip */




More information about the wine-cvs mailing list