summaryrefslogtreecommitdiff
path: root/absl/debugging/symbolize_elf.inc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2020-06-16 09:12:55 -0700
committerGravatar Andy Getz <durandal@google.com>2020-06-16 13:01:21 -0400
commitccdbb5941f992fabda7eae3ce72f55efc17c826a (patch)
treecc3fad62dff6f279ce77f17047c4eef5ebbaf251 /absl/debugging/symbolize_elf.inc
parent01f5f81f93c5a18b0b1e35208e654be8d2c69bdd (diff)
Export of internal Abseil changes
-- 05b0b9aaed03199b0041988f3aa31c6257e05712 by Chris Kennelly <ckennelly@google.com>: Accept absl::string_view for internal ForEachSection parameter. PiperOrigin-RevId: 316694540 -- d14d61f1d017e967923bbffaf12b45c4e6b40d36 by Abseil Team <absl-team@google.com>: Allow ABSL_PREDICT_FALSE to be used with a type that's explicitly convertible to bool. So far ABSL_PREDICT_TRUE could be used with these, but not ABSL_PREDICT_FALSE. PiperOrigin-RevId: 316684594 -- 16a8f5e183688b2bd5069f9d3a2c5f2a978d1eaa by Abseil Team <absl-team@google.com>: Allow ABSL_PREDICT_FALSE to be used with a type that's explicitly convertible to bool. So far ABSL_PREDICT_TRUE could be used with these, but not ABSL_PREDICT_FALSE. PiperOrigin-RevId: 316634388 -- 1ecfa42a400a5ea9435110e6a5416a46414bb6fb by Gennadiy Rozental <rogeeff@google.com>: Internal change PiperOrigin-RevId: 316547270 -- ee915dffdf18818b30107b79c82792d6ca7fc691 by Andy Getzendanner <durandal@google.com>: Remove a copy-pasted comment and add a missing cmake dep. PiperOrigin-RevId: 316541265 -- 26c74c5a61269afe37cd459c9a508ddd0a47f8f3 by Gennadiy Rozental <rogeeff@google.com>: Make absl/flag/reflection target publicly visible. PiperOrigin-RevId: 316523446 GitOrigin-RevId: 05b0b9aaed03199b0041988f3aa31c6257e05712 Change-Id: I0aaa8b0b81c2a79fbc42d116c105512176010b25
Diffstat (limited to 'absl/debugging/symbolize_elf.inc')
-rw-r--r--absl/debugging/symbolize_elf.inc8
1 files changed, 4 insertions, 4 deletions
diff --git a/absl/debugging/symbolize_elf.inc b/absl/debugging/symbolize_elf.inc
index ec86f9a9..c05424e0 100644
--- a/absl/debugging/symbolize_elf.inc
+++ b/absl/debugging/symbolize_elf.inc
@@ -74,6 +74,7 @@
#include "absl/base/port.h"
#include "absl/debugging/internal/demangle.h"
#include "absl/debugging/internal/vdso_support.h"
+#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -498,7 +499,7 @@ static ABSL_ATTRIBUTE_NOINLINE bool GetSectionHeaderByType(
const int kMaxSectionNameLen = 64;
bool ForEachSection(int fd,
- const std::function<bool(const std::string &name,
+ const std::function<bool(absl::string_view name,
const ElfW(Shdr) &)> &callback) {
ElfW(Ehdr) elf_header;
if (!ReadFromOffsetExact(fd, &elf_header, sizeof(elf_header), 0)) {
@@ -520,7 +521,7 @@ bool ForEachSection(int fd,
return false;
}
off_t name_offset = shstrtab.sh_offset + out.sh_name;
- char header_name[kMaxSectionNameLen + 1];
+ char header_name[kMaxSectionNameLen];
ssize_t n_read =
ReadFromOffset(fd, &header_name, kMaxSectionNameLen, name_offset);
if (n_read == -1) {
@@ -529,9 +530,8 @@ bool ForEachSection(int fd,
// Long read?
return false;
}
- header_name[n_read] = '\0';
- std::string name(header_name);
+ absl::string_view name(header_name, strnlen(header_name, n_read));
if (!callback(name, out)) {
break;
}