This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR15123: when PR15123_ASSUME_MFENTRY is set, don't check for -mfentry flag


-mfentry flag is recorded in `DW_AT_producer` only if
`CFLAGS=-grecord-gcc-switches` was used at compilation-time. We
provide PR15123_ASSUME_MFENTRY as an environment variable to override
this detection. The user is expected to set this variable only if it
is confident that that CFLAGS=-mfentry was used.
---
 dwflpp.cxx | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/dwflpp.cxx b/dwflpp.cxx
index 176b602..bef33fa 100644
--- a/dwflpp.cxx
+++ b/dwflpp.cxx
@@ -3768,7 +3768,11 @@ dwflpp::pr15123_retry_addr (Dwarf_Addr pc, Dwarf_Die* die)
   // - if the architecture is familiar enough that we can have a
   // hard-coded constant to skip over the prologue.
   //
-  // Otherwise, we could give a false-positive - return corrupted data.
+  // Otherwise, we could give a false-positive - return corrupted
+  // data. Use of -mfentry is detected only if
+  // CFLAGS=-grecord-gcc-switches was used. The detection can
+  // therefore be overriden if PR15123_ASSUME_MFENTRY environment
+  // variable is present.
 
   if (getenv ("PR15123_DISABLE"))
     return 0;
@@ -3779,11 +3783,13 @@ dwflpp::pr15123_retry_addr (Dwarf_Addr pc, Dwarf_Die* die)
   if (! dwarf_attr_integrate(&cudie, DW_AT_producer, &cudie_producer))
     return 0;
 
-  const char* producer = dwarf_formstring(&cudie_producer);
-  if (!producer)
-    return 0;
-  if (! strstr(producer, "-mfentry"))
-    return 0;
+  if (!getenv ("PR15123_ASSUME_MFENTRY")) {
+    const char* producer = dwarf_formstring(&cudie_producer);
+    if (!producer)
+      return 0;
+    if (! strstr(producer, "-mfentry"))
+      return 0;
+  }
 
   // Determine if this pc maps to the beginning of a
   // real function (not some inlined doppelganger.  This
-- 
1.8.4.rc3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]