dbghelp: [1/3] make dwarf2_parse_line_numbers handle missing line number section

Peter Oberndorfer kumbayo84 at arcor.de
Mon Nov 6 13:05:28 CST 2006


replaces my previous patch "dbghelp: do not read from array element -1"
explicitly handle a missing(not mapped) .debug_line section

Changelog:
dbghelp: make dwarf2_parse_line_numbers handle missing line number section
-------------- next part --------------
From 9c92267979e484c6b3e0dfacf4e53f53acb7e630 Mon Sep 17 00:00:00 2001
From: Peter Oberndorfer <kumbayo84 at arcor.de>
Date: Mon, 6 Nov 2006 19:44:44 +0100
Subject: [PATCH] dbghelp: make dwarf2_parse_line_numbers handle missing line number section
---
 dlls/dbghelp/dwarf.c      |    5 +++++
 dlls/dbghelp/elf_module.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 2f22d9e..47f05fe 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -150,6 +150,7 @@ typedef struct dwarf2_debug_info_s
     struct vector               children;
 } dwarf2_debug_info_t;
 
+#define NO_MAP                  ((const void*)0xffffffff)
 
 typedef struct dwarf2_section_s
 {
@@ -1594,6 +1595,10 @@ static void dwarf2_parse_line_numbers(co
     struct vector               files;
     const char**                p;
 
+    /* section with line numbers stripped */
+    if (sections[section_line].address == NO_MAP)
+        return;
+
     traverse.data = sections[section_line].address + offset;
     traverse.start_data = traverse.data;
     traverse.end_data = traverse.data + 4;
diff --git a/dlls/dbghelp/elf_module.c b/dlls/dbghelp/elf_module.c
index 0c83984..86b5c7a 100644
--- a/dlls/dbghelp/elf_module.c
+++ b/dlls/dbghelp/elf_module.c
@@ -901,7 +901,7 @@ static BOOL elf_load_debug_info_from_map
                                     dw2_debug, fmap->sect[debug_sect].shdr.sh_size,
                                     dw2_debug_abbrev, fmap->sect[debug_abbrev_sect].shdr.sh_size,
                                     dw2_debug_str, fmap->sect[debug_str_sect].shdr.sh_size,
-                                    dw2_debug_line, fmap->sect[debug_line_sect].shdr.sh_size);
+                                    dw2_debug_line, dw2_debug_line != NO_MAP ? fmap->sect[debug_line_sect].shdr.sh_size : 0);
                 if (!lret)
                     WARN("Couldn't correctly read stabs\n");
                 ret = ret || lret;
-- 
1.4.3.3



More information about the wine-patches mailing list