]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Merge patch from JeremyF:
authorJulian Seward <jseward@acm.org>
Thu, 14 Nov 2002 23:16:58 +0000 (23:16 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 14 Nov 2002 23:16:58 +0000 (23:16 +0000)
41-linefix

When working out the source:line information for a stack backtrace,
subtract 1 from return addresses in the hope that this points to the
line of the caller rather than the line after the caller.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1317

coregrind/vg_symtab2.c

index 9a37eeaae90825db3da2fc850b9a800f30941f6a..ba70ce4a777db6c97054748c83e77ee403a328ba 100644 (file)
@@ -2238,15 +2238,18 @@ void VG_(mini_stack_dump) ( ExeContext* ec )
 
    i = 0;
    do {
+      Addr eip = ec->eips[i];
       n = 0;
-      know_fnname  = get_fnname (True, ec->eips[i], buf_fn,  M_VG_ERRTXT, True, False);
-      know_objname = VG_(get_objname)(ec->eips[i], buf_obj, M_VG_ERRTXT);
-      know_srcloc  = VG_(get_filename_linenum)(ec->eips[i], 
+      if (i > 0)
+        eip--;                 /* point to calling line */
+      know_fnname  = get_fnname (True, eip, buf_fn,  M_VG_ERRTXT, True, False);
+      know_objname = VG_(get_objname)(eip, buf_obj, M_VG_ERRTXT);
+      know_srcloc  = VG_(get_filename_linenum)(eip, 
                                                buf_srcloc, M_VG_ERRTXT, 
                                                &lineno);
       if (i == 0) APPEND("   at ") else APPEND("   by ");
       
-      VG_(sprintf)(ibuf,"0x%x: ", ec->eips[i]);
+      VG_(sprintf)(ibuf,"0x%x: ", eip);
       APPEND(ibuf);
       if (know_fnname) { 
          APPEND(buf_fn);