summaryrefslogtreecommitdiff
path: root/libbacktrace/include/backtrace
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2018-01-18 11:15:49 -0800
committerChristopher Ferris <cferris@google.com>2018-01-18 17:26:20 -0800
commit911531884df312a8bd9f3c85e5db27724faa177d (patch)
tree70584e053eb05473bd94bd5d6f9d79fe8f44bd9b /libbacktrace/include/backtrace
parent58fc1d54012d77c6812d5183ce882bdf3a9217c0 (diff)
downloadunwinding-911531884df312a8bd9f3c85e5db27724faa177d.tar.gz
Change all uintptr_t to uint64_t in API.
In order to support the offline unwinding properly, get rid of the usage of non-fixed type uintptr_t from all API calls. In addition, completely remove the old local and remote unwinding code that used libunwind. The next step will be to move the offline unwinding to the new unwinder. Bug: 65682279 Test: Ran unit tests for libbacktrace/debuggerd. Test: Ran debuggerd -b on a few arm and arm64 processes. Test: Ran crasher and crasher64 and verified tombstones look correct. Change-Id: Ib0c6cee3ad6785a102b74908a3d8e5e93e5c6b33
Diffstat (limited to 'libbacktrace/include/backtrace')
-rw-r--r--libbacktrace/include/backtrace/Backtrace.h27
-rw-r--r--libbacktrace/include/backtrace/BacktraceMap.h22
2 files changed, 25 insertions, 24 deletions
diff --git a/libbacktrace/include/backtrace/Backtrace.h b/libbacktrace/include/backtrace/Backtrace.h
index 5922664..18e9f61 100644
--- a/libbacktrace/include/backtrace/Backtrace.h
+++ b/libbacktrace/include/backtrace/Backtrace.h
@@ -26,11 +26,11 @@
#include <backtrace/backtrace_constants.h>
#include <backtrace/BacktraceMap.h>
-#if __LP64__
-#define PRIPTR "016" PRIxPTR
+#if defined(__LP64__)
+#define PRIPTR "016" PRIx64
typedef uint64_t word_t;
#else
-#define PRIPTR "08" PRIxPTR
+#define PRIPTR "08" PRIx64
typedef uint32_t word_t;
#endif
@@ -77,13 +77,14 @@ struct BacktraceUnwindError {
struct backtrace_frame_data_t {
size_t num; // The current fame number.
- uintptr_t pc; // The absolute pc.
- uintptr_t rel_pc; // The relative pc.
- uintptr_t sp; // The top of the stack.
+ uint64_t pc; // The absolute pc.
+ uint64_t rel_pc; // The relative pc.
+ uint64_t sp; // The top of the stack.
size_t stack_size; // The size of the stack, zero indicate an unknown stack size.
backtrace_map_t map; // The map associated with the given pc.
std::string func_name; // The function name associated with this pc, NULL if not found.
- uintptr_t func_offset; // pc relative to the start of the function, only valid if func_name is not NULL.
+ uint64_t func_offset; // pc relative to the start of the function, only valid if func_name is not
+ // NULL.
};
#if defined(__APPLE__)
@@ -138,20 +139,20 @@ public:
// Get the function name and offset into the function given the pc.
// If the string is empty, then no valid function name was found,
// or the pc is not in any valid map.
- virtual std::string GetFunctionName(uintptr_t pc, uintptr_t* offset,
+ virtual std::string GetFunctionName(uint64_t pc, uint64_t* offset,
const backtrace_map_t* map = NULL);
// Fill in the map data associated with the given pc.
- virtual void FillInMap(uintptr_t pc, backtrace_map_t* map);
+ virtual void FillInMap(uint64_t pc, backtrace_map_t* map);
// Read the data at a specific address.
- virtual bool ReadWord(uintptr_t ptr, word_t* out_value) = 0;
+ virtual bool ReadWord(uint64_t ptr, word_t* out_value) = 0;
// Read arbitrary data from a specific address. If a read request would
// span from one map to another, this call only reads up until the end
// of the current map.
// Returns the total number of bytes actually read.
- virtual size_t Read(uintptr_t addr, uint8_t* buffer, size_t bytes) = 0;
+ virtual size_t Read(uint64_t addr, uint8_t* buffer, size_t bytes) = 0;
// Create a string representing the formatted line of backtrace information
// for a single frame.
@@ -188,9 +189,9 @@ protected:
// The name returned is not demangled, GetFunctionName() takes care of
// demangling the name.
- virtual std::string GetFunctionNameRaw(uintptr_t pc, uintptr_t* offset) = 0;
+ virtual std::string GetFunctionNameRaw(uint64_t pc, uint64_t* offset) = 0;
- virtual bool VerifyReadWordArgs(uintptr_t ptr, word_t* out_value);
+ virtual bool VerifyReadWordArgs(uint64_t ptr, word_t* out_value);
bool BuildMap();
diff --git a/libbacktrace/include/backtrace/BacktraceMap.h b/libbacktrace/include/backtrace/BacktraceMap.h
index 4ae68dd..4d020e6 100644
--- a/libbacktrace/include/backtrace/BacktraceMap.h
+++ b/libbacktrace/include/backtrace/BacktraceMap.h
@@ -39,10 +39,10 @@
static constexpr int PROT_DEVICE_MAP = 0x8000;
struct backtrace_map_t {
- uintptr_t start = 0;
- uintptr_t end = 0;
- uintptr_t offset = 0;
- uintptr_t load_bias = 0;
+ uint64_t start = 0;
+ uint64_t end = 0;
+ uint64_t offset = 0;
+ uint64_t load_bias = 0;
int flags = 0;
std::string name;
};
@@ -91,7 +91,7 @@ public:
return nullptr;
}
backtrace_map_t* map = &map_->maps_[index_];
- if (map->load_bias == static_cast<uintptr_t>(-1)) {
+ if (map->load_bias == static_cast<uint64_t>(-1)) {
map->load_bias = map_->GetLoadBias(index_);
}
return map;
@@ -106,15 +106,15 @@ public:
iterator end() { return iterator(this, maps_.size()); }
// Fill in the map data structure for the given address.
- virtual void FillIn(uintptr_t addr, backtrace_map_t* map);
+ virtual void FillIn(uint64_t addr, backtrace_map_t* map);
// Only supported with the new unwinder.
- virtual std::string GetFunctionName(uintptr_t /*pc*/, uintptr_t* /*offset*/) { return ""; }
+ virtual std::string GetFunctionName(uint64_t /*pc*/, uint64_t* /*offset*/) { return ""; }
virtual std::shared_ptr<unwindstack::Memory> GetProcessMemory() { return nullptr; }
// The flags returned are the same flags as used by the mmap call.
// The values are PROT_*.
- int GetFlags(uintptr_t pc) {
+ int GetFlags(uint64_t pc) {
backtrace_map_t map;
FillIn(pc, &map);
if (IsValid(map)) {
@@ -123,9 +123,9 @@ public:
return PROT_NONE;
}
- bool IsReadable(uintptr_t pc) { return GetFlags(pc) & PROT_READ; }
- bool IsWritable(uintptr_t pc) { return GetFlags(pc) & PROT_WRITE; }
- bool IsExecutable(uintptr_t pc) { return GetFlags(pc) & PROT_EXEC; }
+ bool IsReadable(uint64_t pc) { return GetFlags(pc) & PROT_READ; }
+ bool IsWritable(uint64_t pc) { return GetFlags(pc) & PROT_WRITE; }
+ bool IsExecutable(uint64_t pc) { return GetFlags(pc) & PROT_EXEC; }
// In order to use the iterators on this object, a caller must
// call the LockIterator and UnlockIterator function to guarantee