]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
- Added support for querying information about .plt sections.
authorBart Van Assche <bvanassche@acm.org>
Sun, 25 May 2008 16:37:22 +0000 (16:37 +0000)
committerBart Van Assche <bvanassche@acm.org>
Sun, 25 May 2008 16:37:22 +0000 (16:37 +0000)
- Added support for .got.plt sections.

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

coregrind/m_debuginfo/debuginfo.c
coregrind/m_debuginfo/priv_storage.h
coregrind/m_debuginfo/readelf.c
include/pub_tool_debuginfo.h

index c5c7a7586451b283666133b4a4894642202b5356..960633049198dbb108f0ad7c0309a78d48d0cffe 100644 (file)
@@ -2191,6 +2191,26 @@ SizeT VG_(seginfo_get_text_size)(const DebugInfo* di)
    return di->text_present ? di->text_size : 0; 
 }
 
+Addr VG_(seginfo_get_plt_avma)(const DebugInfo* di)
+{
+   return di->plt_present ? di->plt_avma : 0; 
+}
+
+SizeT VG_(seginfo_get_plt_size)(const DebugInfo* di)
+{
+   return di->plt_present ? di->plt_size : 0; 
+}
+
+Addr VG_(seginfo_get_gotplt_avma)(const DebugInfo* di)
+{
+   return di->gotplt_present ? di->gotplt_avma : 0; 
+}
+
+SizeT VG_(seginfo_get_gotplt_size)(const DebugInfo* di)
+{
+   return di->gotplt_present ? di->gotplt_size : 0; 
+}
+
 const UChar* VG_(seginfo_soname)(const DebugInfo* di)
 {
    return di->soname;
@@ -2306,6 +2326,12 @@ VgSectKind VG_(seginfo_sect_kind)( /*OUT*/UChar* name, SizeT n_name,
          res = Vg_SectGOT;
          break;
       }
+      if (di->gotplt_present
+          && di->gotplt_size > 0
+          && a >= di->gotplt_avma && a < di->gotplt_avma + di->gotplt_size) {
+         res = Vg_SectGOTPLT;
+         break;
+      }
       if (di->opd_present
           && di->opd_size > 0
           && a >= di->opd_avma && a < di->opd_avma + di->opd_size) {
index 7822fd34852941fa284f7e31cb73c9a16bfaf056..51f0a1493604e1a8e0d873596eaf3b79ac6d6548 100644 (file)
@@ -331,6 +331,10 @@ struct _DebugInfo {
    Bool   got_present;
    Addr   got_avma;
    SizeT  got_size;
+   /* .got.plt */
+   Bool   gotplt_present;
+   Addr   gotplt_avma;
+   SizeT  gotplt_size;
    /* .opd -- needed on ppc64-linux for finding symbols */
    Bool   opd_present;
    Addr   opd_avma;
index 5d33dd83c242f548253afd3bb8b28024e7f1efc4..a11439712e365caacf2f0e2983b8b44060744f76 100644 (file)
@@ -1468,6 +1468,18 @@ Bool ML_(read_elf_debug_info) ( struct _DebugInfo* di )
          }
       }
 
+      /* Accept .got.plt where mapped as rw (data) */
+      if (0 == VG_(strcmp)(name, ".got.plt")) {
+         if (inrw && size > 0 && !di->gotplt_present) {
+            di->gotplt_present = True;
+            di->gotplt_avma = di->rw_map_avma + foff - di->rw_map_foff;
+            di->gotplt_size = size;
+            TRACE_SYMTAB("acquiring .got.plt avma = %p\n", di->gotplt_avma);
+         } else {
+            BAD(".got.plt");
+         }
+      }
+
       /* PLT is different on different platforms, it seems. */
 #     if defined(VGP_x86_linux) || defined(VGP_amd64_linux)
       /* Accept .plt where mapped as rx (code) */
index a6849ab6dc254145fe75ff7b7483d3a4ee04929d..b43e0a6bc0fd5f742de2810901b7a8f8b56628ab 100644 (file)
@@ -119,6 +119,10 @@ extern       DebugInfo* VG_(find_seginfo)      ( Addr a );
 /* Fish bits out of DebugInfos. */
 extern       Addr     VG_(seginfo_get_text_avma)( const DebugInfo *di );
 extern       SizeT    VG_(seginfo_get_text_size)( const DebugInfo *di );
+extern       Addr     VG_(seginfo_get_plt_avma) ( const DebugInfo *di );
+extern       SizeT    VG_(seginfo_get_plt_size) ( const DebugInfo *di );
+extern       Addr     VG_(seginfo_get_gotplt_avma)( const DebugInfo *di );
+extern       SizeT    VG_(seginfo_get_gotplt_size)( const DebugInfo *di );
 extern const UChar*   VG_(seginfo_soname)       ( const DebugInfo *di );
 extern const UChar*   VG_(seginfo_filename)     ( const DebugInfo *di );
 extern       ULong    VG_(seginfo_get_text_bias)( const DebugInfo *di );
@@ -151,6 +155,7 @@ typedef
       Vg_SectBSS,
       Vg_SectGOT,
       Vg_SectPLT,
+      Vg_SectGOTPLT,
       Vg_SectOPD
    }
    VgSectKind;