[PATCH 01/10] dbghelp{dwarf}: Allow tweaking from env variable which DWARF version is to be loaded.

Eric Pouech eric.pouech at gmail.com
Wed Sep 8 01:33:49 CDT 2021


This is a temporary feature while implementing the required bits for Dwarf3
and Dwarf4 format.

Signed-off-by: Eric Pouech <eric.pouech at gmail.com>

---
 dlls/dbghelp/dwarf.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index af84fb660b8..7133d489c28 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -2344,6 +2344,8 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
     unsigned short cu_version;
     ULONG_PTR cu_abbrev_offset;
     BOOL ret = FALSE;
+    /* FIXME this is a temporary configuration while adding support for dwarf3&4 bits */
+    static LONG max_supported_dwarf_version = 0;
 
     cu_length = dwarf2_parse_u4(mod_ctx);
     cu_ctx.data = mod_ctx->data;
@@ -2360,10 +2362,21 @@ static BOOL dwarf2_parse_compilation_unit(const dwarf2_section_t* sections,
     TRACE("- abbrev_offset: %lu\n", cu_abbrev_offset);
     TRACE("- word_size:     %u\n",  cu_ctx.word_size);
 
-    if (cu_version != 2)
+    if (max_supported_dwarf_version == 0)
     {
-        WARN("%u DWARF version unsupported. Wine dbghelp only support DWARF 2.\n",
-             cu_version);
+        char* env = getenv("DBGHELP_DWARF_VERSION");
+        LONG v = env ? atol(env) : 2;
+        max_supported_dwarf_version = (v >= 2 && v <= 4) ? v : 2;
+    }
+
+    if (cu_version < 2 || cu_version > max_supported_dwarf_version)
+    {
+        if (max_supported_dwarf_version > 2)
+            WARN("%u DWARF version unsupported. Wine dbghelp only support DWARF 2 up to %u.\n",
+                 cu_version, max_supported_dwarf_version);
+        else
+            WARN("%u DWARF version unsupported. Wine dbghelp only support DWARF 2.\n",
+                 cu_version);
         return FALSE;
     }
 




More information about the wine-devel mailing list