summaryrefslogtreecommitdiff
path: root/absl/debugging/symbolize_elf.inc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/debugging/symbolize_elf.inc')
-rw-r--r--absl/debugging/symbolize_elf.inc16
1 files changed, 10 insertions, 6 deletions
diff --git a/absl/debugging/symbolize_elf.inc b/absl/debugging/symbolize_elf.inc
index 97d767ab..5b16bb8b 100644
--- a/absl/debugging/symbolize_elf.inc
+++ b/absl/debugging/symbolize_elf.inc
@@ -925,6 +925,14 @@ static const char *GetHex(const char *start, const char *end,
return p;
}
+// Normally we are only interested in "r?x" maps.
+// On the PowerPC, function pointers point to descriptors in the .opd
+// section. The descriptors themselves are not executable code, so
+// we need to relax the check below to "r??".
+static bool ShouldUseMapping(const char *const flags) {
+ return flags[0] == 'r' && (kPlatformUsesOPDSections || flags[2] == 'x');
+}
+
// Read /proc/self/maps and run "callback" for each mmapped file found. If
// "callback" returns false, stop scanning and return true. Else continue
// scanning /proc/self/maps. Return true if no parse error is found.
@@ -994,12 +1002,8 @@ static ABSL_ATTRIBUTE_NOINLINE bool ReadAddrMap(
return false;
}
- // Check flags. Normally we are only interested in "r-x" maps. On
- // the PowerPC, function pointers point to descriptors in the .opd
- // section. The descriptors themselves are not executable code. So
- // we need to relax the check below to "r**".
- if (memcmp(flags_start, "r-x", 3) != 0 && // Not a "r-x" map.
- !(kPlatformUsesOPDSections && flags_start[0] == 'r')) {
+ // Check flags.
+ if (!ShouldUseMapping(flags_start)) {
continue; // We skip this map.
}
++cursor; // Skip ' '.