From 686237e043236f97759b26be1516c6f082761840 Mon Sep 17 00:00:00 2001
From: Eric Pouech <eric.pouech@wanadoo.fr>
Date: Sun, 18 Jun 2006 21:31:49 +0200
Subject: [PATCH] dbghelp: dwarf: Added support for function labels.

---
 dlls/dbghelp/dwarf.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index f0d4ea0a09d..4cffd0ac3a6 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -972,6 +972,22 @@ static void dwarf2_parse_subprogram_parameter(dwarf2_parse_context_t* ctx,
     if (di->abbrev->have_child) FIXME("Unsupported children\n");
 }
 
+static void dwarf2_parse_subprogram_label(dwarf2_parse_context_t* ctx,
+                                          struct symt_function* func,
+                                          dwarf2_debug_info_t* di)
+{
+    union attribute name;
+    union attribute low_pc;
+
+    TRACE("%s, for %s\n", dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
+
+    if (!dwarf2_find_attribute(di, DW_AT_low_pc, &low_pc)) low_pc.uvalue = 0;
+    dwarf2_find_name(ctx, di, &name, "label");
+
+    symt_add_function_point(ctx->module, func, SymTagLabel,
+                            ctx->module->module.BaseOfImage + low_pc.uvalue, name.string);
+}
+
 static void dwarf2_parse_subprogram_block(dwarf2_parse_context_t* ctx, 
 					  dwarf2_debug_info_t* di, 
 					  struct symt_function* func);
@@ -1015,6 +1031,11 @@ static void dwarf2_parse_inlined_subroutine(dwarf2_parse_context_t* ctx,
                 /* FIXME */
                 dwarf2_parse_inlined_subroutine(ctx, child);
                 break;
+            case DW_TAG_label:
+                /* FIXME
+                 * dwarf2_parse_subprogram_label(ctx, func, child);
+                 */
+                break;
             default:
                 FIXME("Unhandled Tag type 0x%lx at %s, for %s\n",
                       child->abbrev->tag, dwarf2_debug_ctx(ctx), dwarf2_debug_di(di));
@@ -1131,6 +1152,9 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx,
                  * skip it for now
                  */
                 break;
+            case DW_TAG_label:
+                dwarf2_parse_subprogram_label(ctx, func, child);
+                break;
             case DW_TAG_class_type:
             case DW_TAG_structure_type:
             case DW_TAG_union_type:
-- 
GitLab