diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/backtrace/Backtrace.h | 21 | ||||
| -rw-r--r-- | include/cutils/klog.h | 4 |
2 files changed, 12 insertions, 13 deletions
diff --git a/include/backtrace/Backtrace.h b/include/backtrace/Backtrace.h index 8c39acb38..290682a74 100644 --- a/include/backtrace/Backtrace.h +++ b/include/backtrace/Backtrace.h @@ -44,9 +44,6 @@ struct backtrace_frame_data_t { uintptr_t func_offset; // pc relative to the start of the function, only valid if func_name is not NULL. }; -// Forward declarations. -class BacktraceImpl; - #if defined(__APPLE__) struct __darwin_ucontext; typedef __darwin_ucontext ucontext_t; @@ -72,7 +69,7 @@ public: virtual ~Backtrace(); // Get the current stack trace and store in the backtrace_ structure. - virtual bool Unwind(size_t num_ignore_frames, ucontext_t* context = NULL); + virtual bool Unwind(size_t num_ignore_frames, ucontext_t* context = NULL) = 0; // Get the function name and offset into the function given the pc. // If the string is empty, then no valid function name was found. @@ -95,9 +92,9 @@ public: virtual std::string FormatFrameData(size_t frame_num); virtual std::string FormatFrameData(const backtrace_frame_data_t* frame); - pid_t Pid() { return pid_; } - pid_t Tid() { return tid_; } - size_t NumFrames() { return frames_.size(); } + pid_t Pid() const { return pid_; } + pid_t Tid() const { return tid_; } + size_t NumFrames() const { return frames_.size(); } const backtrace_frame_data_t* GetFrame(size_t frame_num) { if (frame_num >= frames_.size()) { @@ -117,7 +114,11 @@ public: BacktraceMap* GetMap() { return map_; } protected: - Backtrace(BacktraceImpl* impl, pid_t pid, BacktraceMap* map); + Backtrace(pid_t pid, pid_t tid, BacktraceMap* map); + + // 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 bool VerifyReadWordArgs(uintptr_t ptr, word_t* out_value); @@ -130,10 +131,6 @@ protected: bool map_shared_; std::vector<backtrace_frame_data_t> frames_; - - BacktraceImpl* impl_; - - friend class BacktraceImpl; }; #endif // _BACKTRACE_BACKTRACE_H diff --git a/include/cutils/klog.h b/include/cutils/klog.h index d5ae6d72f..295d62be3 100644 --- a/include/cutils/klog.h +++ b/include/cutils/klog.h @@ -18,6 +18,7 @@ #define _CUTILS_KLOG_H_ #include <sys/cdefs.h> +#include <sys/uio.h> #include <stdarg.h> __BEGIN_DECLS @@ -26,9 +27,10 @@ void klog_init(void); int klog_get_level(void); void klog_set_level(int level); /* TODO: void klog_close(void); - and make klog_fd users thread safe. */ + void klog_write(int level, const char *fmt, ...) __attribute__ ((format(printf, 2, 3))); -void klog_vwrite(int level, const char *fmt, va_list ap); +void klog_writev(int level, const struct iovec* iov, int iov_count); __END_DECLS |
