[PATCH 09/22] [DbgHelp]: function's point

Eric Pouech eric.pouech at wanadoo.fr
Fri Nov 24 15:17:54 CST 2006


- function points' location is now expressed as a
  struct location

A+
---

 dlls/dbghelp/dbghelp_private.h |    5 +++--
 dlls/dbghelp/dwarf.c           |    6 ++++--
 dlls/dbghelp/msc.c             |   31 +++++++++++++++++++++----------
 dlls/dbghelp/stabs.c           |    7 +++++--
 dlls/dbghelp/symbol.c          |    6 ++++--
 dlls/dbghelp/type.c            |    2 +-
 6 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h
index fbf9879..19864db 100644
--- a/dlls/dbghelp/dbghelp_private.h
+++ b/dlls/dbghelp/dbghelp_private.h
@@ -210,7 +210,7 @@ struct symt_function_point
 {
     struct symt                 symt;           /* either SymTagFunctionDebugStart, SymTagFunctionDebugEnd, SymTagLabel */
     struct symt_function*       parent;
-    unsigned long               offset;
+    struct location             loc;
     const char*                 name;           /* for labels */
 };
 
@@ -532,7 +532,8 @@ extern struct symt_function_point*
                     symt_add_function_point(struct module* module, 
                                             struct symt_function* func,
                                             enum SymTagEnum point, 
-                                            unsigned offset, const char* name);
+                                            const struct location* loc,
+                                            const char* name);
 extern BOOL         symt_fill_func_line_info(struct module* module,
                                              struct symt_function* func, 
                                              DWORD addr, IMAGEHLP_LINE* line);
diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
index 80d5272..5f2ba7d 100644
--- a/dlls/dbghelp/dwarf.c
+++ b/dlls/dbghelp/dwarf.c
@@ -1274,15 +1274,17 @@ static void dwarf2_parse_subprogram_labe
 {
     struct attribute    name;
     struct attribute    low_pc;
+    struct location     loc;
 
     TRACE("%s, for %s\n", dwarf2_debug_ctx(subpgm->ctx), dwarf2_debug_di(di));
 
     if (!dwarf2_find_attribute(subpgm->ctx, di, DW_AT_low_pc, &low_pc)) low_pc.u.uvalue = 0;
     dwarf2_find_name(subpgm->ctx, di, &name, "label");
 
+    loc.kind = loc_absolute;
+    loc.offset = subpgm->ctx->module->module.BaseOfImage + low_pc.u.uvalue,
     symt_add_function_point(subpgm->ctx->module, subpgm->func, SymTagLabel,
-                            subpgm->ctx->module->module.BaseOfImage + low_pc.u.uvalue,
-                            name.u.string);
+                            &loc, name.u.string);
 }
 
 static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm,
diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c
index bc59045..8ec270e 100644
--- a/dlls/dbghelp/msc.c
+++ b/dlls/dbghelp/msc.c
@@ -1344,8 +1344,11 @@ static int codeview_snarf(const struct m
                                           codeview_get_type(sym->proc_v1.proctype, FALSE));
             codeview_add_func_linenum(msc_dbg->module, curr_func, flt, 
                                       sym->proc_v1.offset, sym->proc_v1.proc_len);
-            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, sym->proc_v1.debug_start, NULL);
-            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, sym->proc_v1.debug_end, NULL);
+            loc.kind = loc_absolute;
+            loc.offset = sym->proc_v1.debug_start;
+            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
+            loc.offset = sym->proc_v1.debug_end;
+            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
 	    break;
 	case S_GPROC_V2:
 	case S_LPROC_V2:
@@ -1358,8 +1361,11 @@ static int codeview_snarf(const struct m
                                           codeview_get_type(sym->proc_v2.proctype, FALSE));
             codeview_add_func_linenum(msc_dbg->module, curr_func, flt, 
                                       sym->proc_v2.offset, sym->proc_v2.proc_len);
-            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, sym->proc_v2.debug_start, NULL);
-            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, sym->proc_v2.debug_end, NULL);
+            loc.kind = loc_absolute;
+            loc.offset = sym->proc_v2.debug_start;
+            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
+            loc.offset = sym->proc_v2.debug_end;
+            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
 	    break;
 	case S_GPROC_V3:
 	case S_LPROC_V3:
@@ -1372,8 +1378,11 @@ static int codeview_snarf(const struct m
                                           codeview_get_type(sym->proc_v3.proctype, FALSE));
             codeview_add_func_linenum(msc_dbg->module, curr_func, flt, 
                                       sym->proc_v3.offset, sym->proc_v3.proc_len);
-            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, sym->proc_v3.debug_start, NULL);
-            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, sym->proc_v3.debug_end, NULL);
+            loc.kind = loc_absolute;
+            loc.offset = sym->proc_v3.debug_start;
+            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugStart, &loc, NULL);
+            loc.offset = sym->proc_v3.debug_end;
+            symt_add_function_point(msc_dbg->module, curr_func, SymTagFuncDebugEnd, &loc, NULL);
 	    break;
         /*
          * Function parameters and stack variables.
@@ -1495,8 +1504,9 @@ static int codeview_snarf(const struct m
         case S_LABEL_V1:
             if (curr_func)
             {
-                symt_add_function_point(msc_dbg->module, curr_func, SymTagLabel, 
-                                        codeview_get_address(msc_dbg, sym->label_v1.segment, sym->label_v1.offset) - curr_func->address,
+                loc.kind = loc_absolute;
+                loc.offset = codeview_get_address(msc_dbg, sym->label_v1.segment, sym->label_v1.offset) - curr_func->address;
+                symt_add_function_point(msc_dbg->module, curr_func, SymTagLabel, &loc,
                                         terminate_string(&sym->label_v1.p_name));
             }
             else
@@ -1506,9 +1516,10 @@ static int codeview_snarf(const struct m
         case S_LABEL_V3:
             if (curr_func)
             {
+                loc.kind = loc_absolute;
+                loc.offset = codeview_get_address(msc_dbg, sym->label_v3.segment, sym->label_v3.offset) - curr_func->address;
                 symt_add_function_point(msc_dbg->module, curr_func, SymTagLabel, 
-                                        codeview_get_address(msc_dbg, sym->label_v3.segment, sym->label_v3.offset) - curr_func->address,
-                                        sym->label_v3.name);
+                                        &loc, sym->label_v3.name);
             }
             else
                 FIXME("No current function for label %s\n", sym->label_v3.name);
diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c
index 6f6c851..7693ff7 100644
--- a/dlls/dbghelp/stabs.c
+++ b/dlls/dbghelp/stabs.c
@@ -1153,7 +1153,8 @@ static void stabs_finalize_function(stru
                                     unsigned long size)
 {
     IMAGEHLP_LINE       il;
-   
+    struct location     loc;
+
     if (!func) return;
     symt_normalize_function(module, func);
     /* To define the debug-start of the function, we use the second line number.
@@ -1162,8 +1163,10 @@ static void stabs_finalize_function(stru
     if (symt_fill_func_line_info(module, func, func->address, &il) &&
         symt_get_func_line_next(module, &il))
     {
+        loc.kind = loc_absolute;
+        loc.offset = il.Address - func->address;
         symt_add_function_point(module, func, SymTagFuncDebugStart, 
-                                il.Address - func->address, NULL);
+                                &loc, NULL);
     }
     if (size) func->size = size;
 }
diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c
index 8e1cdf4..0f62889 100644
--- a/dlls/dbghelp/symbol.c
+++ b/dlls/dbghelp/symbol.c
@@ -376,7 +376,8 @@ struct symt_block* symt_close_func_block
 struct symt_function_point* symt_add_function_point(struct module* module, 
                                                     struct symt_function* func,
                                                     enum SymTagEnum point, 
-                                                    unsigned offset, const char* name)
+                                                    const struct location* loc,
+                                                    const char* name)
 {
     struct symt_function_point* sym;
     struct symt**               p;
@@ -385,7 +386,7 @@ struct symt_function_point* symt_add_fun
     {
         sym->symt.tag = point;
         sym->parent   = func;
-        sym->offset   = offset;
+        sym->loc      = *loc;
         sym->name     = name ? pool_strdup(&module->pool, name) : NULL;
         p = vector_add(&func->vchildren, &module->pool);
         *p = &sym->symt;
@@ -741,6 +742,7 @@ static BOOL symt_enum_locals_helper(stru
         case SymTagLabel:
         case SymTagFuncDebugStart:
         case SymTagFuncDebugEnd:
+        case SymTagCustom:
             break;
         default:
             FIXME("Unknown type: %u (%x)\n", lsym->tag, lsym->tag);
diff --git a/dlls/dbghelp/type.c b/dlls/dbghelp/type.c
index 83db9eb..e112ce9 100644
--- a/dlls/dbghelp/type.c
+++ b/dlls/dbghelp/type.c
@@ -484,7 +484,7 @@ #define X(_t) (*((_t*)pInfo))
         case SymTagFuncDebugEnd:
         case SymTagLabel:
             X(ULONG64) = ((const struct symt_function_point*)type)->parent->address + 
-                ((const struct symt_function_point*)type)->offset;
+                ((const struct symt_function_point*)type)->loc.offset;
             break;
         case SymTagThunk:
             X(ULONG64) = ((const struct symt_thunk*)type)->address;



More information about the wine-patches mailing list