17fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris/*
27fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * Copyright (C) 2013 The Android Open Source Project
37fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris *
47fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * Licensed under the Apache License, Version 2.0 (the "License");
57fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * you may not use this file except in compliance with the License.
67fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * You may obtain a copy of the License at
77fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris *
87fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris *      http://www.apache.org/licenses/LICENSE-2.0
97fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris *
107fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * Unless required by applicable law or agreed to in writing, software
117fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * distributed under the License is distributed on an "AS IS" BASIS,
127fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * See the License for the specific language governing permissions and
147fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris * limitations under the License.
157fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris */
167fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris
1717e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris#ifndef _LIBBACKTRACE_UNWIND_PTRACE_H
1817e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris#define _LIBBACKTRACE_UNWIND_PTRACE_H
197fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris
2017e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris#include <string>
217fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris
22df2906186b6952c57b1f662bfef0b65c9f8c2e0dChristopher Ferris#include "BacktraceImpl.h"
237fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris
2417e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris#include <libunwind.h>
257fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris
2617e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferrisclass UnwindPtrace : public BacktraceImpl {
2717e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferrispublic:
2817e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris  UnwindPtrace();
2917e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris  virtual ~UnwindPtrace();
307fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris
31a2efd3ac7abe223aa7a8ba8b5ba448216c4953b4Christopher Ferris  virtual bool Unwind(size_t num_ignore_frames, ucontext_t* ucontext);
327fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris
3317e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris  virtual std::string GetFunctionNameRaw(uintptr_t pc, uintptr_t* offset);
347fb22878d43bddd48b854f8e201afb800393482aChristopher Ferris
3517e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferrisprivate:
3617e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris  unw_addr_space_t addr_space_;
3717e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris  struct UPT_info* upt_info_;
3817e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris};
3917e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris
4017e91d44edf5e6476a477a200bcd89d4327358a3Christopher Ferris#endif // _LIBBACKTRACE_UNWIND_PTRACE_H
41