diff options
Diffstat (limited to 'libunwindstack/include/unwindstack/Unwinder.h')
-rw-r--r-- | libunwindstack/include/unwindstack/Unwinder.h | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/libunwindstack/include/unwindstack/Unwinder.h b/libunwindstack/include/unwindstack/Unwinder.h index 8b01654..a04d7c3 100644 --- a/libunwindstack/include/unwindstack/Unwinder.h +++ b/libunwindstack/include/unwindstack/Unwinder.h @@ -24,7 +24,6 @@ #include <string> #include <vector> -#include <unwindstack/DexFiles.h> #include <unwindstack/Error.h> #include <unwindstack/JitDebug.h> #include <unwindstack/Maps.h> @@ -34,6 +33,7 @@ namespace unwindstack { // Forward declarations. +class DexFile; class Elf; enum ArchEnum : uint8_t; @@ -63,14 +63,14 @@ struct FrameData { class Unwinder { public: - Unwinder(size_t max_frames, Maps* maps, Regs* regs, std::shared_ptr<Memory> process_memory) - : max_frames_(max_frames), maps_(maps), regs_(regs), process_memory_(process_memory) { - frames_.reserve(max_frames); - } + Unwinder(size_t max_frames, Maps* maps, Regs* regs, std::shared_ptr<Memory> process_memory); Unwinder(size_t max_frames, Maps* maps, std::shared_ptr<Memory> process_memory) - : max_frames_(max_frames), maps_(maps), process_memory_(process_memory) { - frames_.reserve(max_frames); - } + : Unwinder(max_frames, maps, nullptr, process_memory) {} + + Unwinder(const Unwinder&) = delete; + Unwinder& operator=(const Unwinder&) = delete; + Unwinder(Unwinder&&) = default; + Unwinder& operator=(Unwinder&&) = default; virtual ~Unwinder() = default; @@ -90,9 +90,7 @@ class Unwinder { std::string FormatFrame(size_t frame_num); std::string FormatFrame(const FrameData& frame); - void SetJitDebug(JitDebug* jit_debug, ArchEnum arch); - - void SetRegs(Regs* regs) { regs_ = regs; } + void SetRegs(Regs* regs); Maps* GetMaps() { return maps_; } std::shared_ptr<Memory>& GetProcessMemory() { return process_memory_; } @@ -107,10 +105,6 @@ class Unwinder { void SetDisplayBuildID(bool display_build_id) { display_build_id_ = display_build_id; } -#if !defined(NO_LIBDEXFILE_SUPPORT) - void SetDexFiles(DexFiles* dex_files, ArchEnum arch); -#endif - ErrorCode LastErrorCode() { return last_error_.code; } uint64_t LastErrorAddress() { return last_error_.address; } @@ -126,9 +120,9 @@ class Unwinder { Regs* regs_; std::vector<FrameData> frames_; std::shared_ptr<Memory> process_memory_; - JitDebug* jit_debug_ = nullptr; + std::unique_ptr<JitDebug<Elf>> jit_debug_; #if !defined(NO_LIBDEXFILE_SUPPORT) - DexFiles* dex_files_ = nullptr; + std::unique_ptr<JitDebug<DexFile>> dex_files_; #endif bool resolve_names_ = true; bool embedded_soname_ = true; @@ -141,15 +135,11 @@ class UnwinderFromPid : public Unwinder { UnwinderFromPid(size_t max_frames, pid_t pid) : Unwinder(max_frames), pid_(pid) {} virtual ~UnwinderFromPid() = default; - bool Init(ArchEnum arch); + bool Init(); private: pid_t pid_; std::unique_ptr<Maps> maps_ptr_; - std::unique_ptr<JitDebug> jit_debug_ptr_; -#if !defined(NO_LIBDEXFILE_SUPPORT) - std::unique_ptr<DexFiles> dex_files_ptr_; -#endif }; } // namespace unwindstack |