]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Minor tidyings:
authorJulian Seward <jseward@acm.org>
Thu, 22 Jan 2009 21:18:15 +0000 (21:18 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 22 Jan 2009 21:18:15 +0000 (21:18 +0000)
search_all_symtabs: look for data symbols also in .sbss and .rodata
sections.

VG_(seginfo_sect_kind): identify addresses in .sbss sections.

VG_(pp_SectKind): handle missing case Vg_SectGOTPLT

search_all_loctabs, VG_(get_objname), VG_(find_seginfo): augment tests
"di->text_present" with "&& di->text_size > 0" (probably not
necessary, but is clearer, and more consistent in that most places
that look at DebugInfo.text_{size,avma} first perform both of those
tests).

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

coregrind/m_debuginfo/debuginfo.c

index 03269dfb55a65edba01dbc9ea29f6d8bb2cb5b5c..4cc2182077ef0cebeeb1a6af5f7f2536668e5f54 100644 (file)
@@ -1036,7 +1036,17 @@ static void search_all_symtabs ( Addr ptr, /*OUT*/DebugInfo** pdi,
                    (di->bss_present
                     && di->bss_size > 0
                     && di->bss_avma <= ptr 
-                    && ptr < di->bss_avma + di->bss_size);
+                    && ptr < di->bss_avma + di->bss_size)
+                   ||
+                   (di->sbss_present
+                    && di->sbss_size > 0
+                    && di->sbss_avma <= ptr 
+                    && ptr < di->sbss_avma + di->sbss_size)
+                   ||
+                   (di->rodata_present
+                    && di->rodata_size > 0
+                    && di->rodata_avma <= ptr 
+                    && ptr < di->rodata_avma + di->rodata_size);
       }
 
       if (!inRange) continue;
@@ -1064,6 +1074,7 @@ static void search_all_loctabs ( Addr ptr, /*OUT*/DebugInfo** pdi,
    DebugInfo* di;
    for (di = debugInfo_list; di != NULL; di = di->next) {
       if (di->text_present
+          && di->text_size > 0
           && di->text_avma <= ptr 
           && ptr < di->text_avma + di->text_size) {
          lno = ML_(search_one_loctab) ( di, ptr );
@@ -1250,6 +1261,7 @@ Bool VG_(get_objname) ( Addr a, Char* buf, Int nbuf )
       expect this to produce a result. */
    for (di = debugInfo_list; di != NULL; di = di->next) {
       if (di->text_present
+          && di->text_size > 0
           && di->text_avma <= a 
           && a < di->text_avma + di->text_size) {
          VG_(strncpy_safely)(buf, di->filename, nbuf);
@@ -1288,6 +1300,7 @@ DebugInfo* VG_(find_seginfo) ( Addr a )
    DebugInfo* di;
    for (di = debugInfo_list; di != NULL; di = di->next) {
       if (di->text_present
+          && di->text_size > 0
           && di->text_avma <= a 
           && a < di->text_avma + di->text_size) {
          return di;
@@ -2939,6 +2952,7 @@ const HChar* VG_(pp_SectKind)( VgSectKind kind )
       case Vg_SectGOT:     return "GOT";
       case Vg_SectPLT:     return "PLT";
       case Vg_SectOPD:     return "OPD";
+      case Vg_SectGOTPLT:  return "GOTPLT";
       default:             vg_assert(0);
    }
 }
@@ -2989,6 +3003,12 @@ VgSectKind VG_(seginfo_sect_kind)( /*OUT*/UChar* name, SizeT n_name,
          res = Vg_SectBSS;
          break;
       }
+      if (di->sbss_present
+          && di->sbss_size > 0
+          && a >= di->sbss_avma && a < di->sbss_avma + di->sbss_size) {
+         res = Vg_SectBSS;
+         break;
+      }
       if (di->plt_present
           && di->plt_size > 0
           && a >= di->plt_avma && a < di->plt_avma + di->plt_size) {