|
From: <sv...@va...> - 2008-05-25 16:37:16
|
Author: bart
Date: 2008-05-25 17:37:22 +0100 (Sun, 25 May 2008)
New Revision: 8127
Log:
- Added support for querying information about .plt sections.
- Added support for .got.plt sections.
Modified:
trunk/coregrind/m_debuginfo/debuginfo.c
trunk/coregrind/m_debuginfo/priv_storage.h
trunk/coregrind/m_debuginfo/readelf.c
trunk/include/pub_tool_debuginfo.h
Modified: trunk/coregrind/m_debuginfo/debuginfo.c
===================================================================
--- trunk/coregrind/m_debuginfo/debuginfo.c 2008-05-25 16:25:51 UTC (rev 8126)
+++ trunk/coregrind/m_debuginfo/debuginfo.c 2008-05-25 16:37:22 UTC (rev 8127)
@@ -2191,6 +2191,26 @@
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 @@
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) {
Modified: trunk/coregrind/m_debuginfo/priv_storage.h
===================================================================
--- trunk/coregrind/m_debuginfo/priv_storage.h 2008-05-25 16:25:51 UTC (rev 8126)
+++ trunk/coregrind/m_debuginfo/priv_storage.h 2008-05-25 16:37:22 UTC (rev 8127)
@@ -331,6 +331,10 @@
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;
Modified: trunk/coregrind/m_debuginfo/readelf.c
===================================================================
--- trunk/coregrind/m_debuginfo/readelf.c 2008-05-25 16:25:51 UTC (rev 8126)
+++ trunk/coregrind/m_debuginfo/readelf.c 2008-05-25 16:37:22 UTC (rev 8127)
@@ -1468,6 +1468,18 @@
}
}
+ /* 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) */
Modified: trunk/include/pub_tool_debuginfo.h
===================================================================
--- trunk/include/pub_tool_debuginfo.h 2008-05-25 16:25:51 UTC (rev 8126)
+++ trunk/include/pub_tool_debuginfo.h 2008-05-25 16:37:22 UTC (rev 8127)
@@ -119,6 +119,10 @@
/* 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 @@
Vg_SectBSS,
Vg_SectGOT,
Vg_SectPLT,
+ Vg_SectGOTPLT,
Vg_SectOPD
}
VgSectKind;
|