Ken Thomases : dbghelp/stabs: For Mach-O, line numbers use absolute address , not offset.

Alexandre Julliard julliard at winehq.org
Wed Mar 25 10:31:31 CDT 2009


Module: wine
Branch: master
Commit: 3a96219d5784d7a924b2dab8f7eac842ad3a120f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3a96219d5784d7a924b2dab8f7eac842ad3a120f

Author: Ken Thomases <ken at codeweavers.com>
Date:   Fri Mar 13 11:48:21 2009 -0500

dbghelp/stabs: For Mach-O, line numbers use absolute address, not offset.

So, compute the offset by subtracting the function address.

---

 dlls/dbghelp/stabs.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c
index fd88722..b2df46a 100644
--- a/dlls/dbghelp/stabs.c
+++ b/dlls/dbghelp/stabs.c
@@ -1202,6 +1202,8 @@ static void pending_flush(struct pending_list* pending, struct module* module,
                                 block, pending->objs[i].u.var.type, pending->objs[i].u.var.name);
             break;
         case PENDING_LINE:
+            if (module->type == DMT_MACHO)
+                pending->objs[i].u.line.offset -= func->address;
             symt_add_func_line(module, func, pending->objs[i].u.line.source_idx,
                                pending->objs[i].u.line.line_num, pending->objs[i].u.line.offset);
             break;
@@ -1485,8 +1487,11 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset,
             assert(source_idx >= 0);
             if (curr_func != NULL)
             {
+                unsigned long offset = stab_ptr->n_value;
+                if (module->type == DMT_MACHO)
+                    offset -= curr_func->address;
                 symt_add_func_line(module, curr_func, source_idx, 
-                                   stab_ptr->n_desc, stab_ptr->n_value);
+                                   stab_ptr->n_desc, offset);
             }
             else pending_add_line(&pending_func, source_idx, stab_ptr->n_desc,
                                   stab_ptr->n_value);




More information about the wine-cvs mailing list