blob: 7cb125c6ce3f3b5afcce3008f70bbcad7491b62a [file] [log] [blame]
Christopher Ferris17e91d42013-10-21 13:30:52 -07001/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _LIBBACKTRACE_CORKSCREW_H
18#define _LIBBACKTRACE_CORKSCREW_H
19
20#include <inttypes.h>
21
22#include <string>
23
24#include <backtrace/backtrace.h>
25#include <backtrace/Backtrace.h>
26
27#include <corkscrew/backtrace.h>
28
29#include "Backtrace.h"
30#include "BacktraceThread.h"
31
32class CorkscrewCommon : public BacktraceImpl {
33public:
34 bool GenerateFrameData(backtrace_frame_t* cork_frames, ssize_t num_frames);
35};
36
37class CorkscrewCurrent : public CorkscrewCommon {
38public:
39 CorkscrewCurrent();
40 virtual ~CorkscrewCurrent();
41
42 virtual bool Unwind(size_t num_ignore_threads);
43
44 virtual std::string GetFunctionNameRaw(uintptr_t pc, uintptr_t* offset);
45};
46
47class CorkscrewThread : public CorkscrewCurrent, public BacktraceThreadInterface {
48public:
49 CorkscrewThread();
50 virtual ~CorkscrewThread();
51
52 virtual bool Init();
53
54 virtual void ThreadUnwind(
55 siginfo_t* siginfo, void* sigcontext, size_t num_ignore_frames);
56
57private:
58 map_info_t* corkscrew_map_info_;
59};
60
61class CorkscrewPtrace : public CorkscrewCommon {
62public:
63 CorkscrewPtrace();
64 virtual ~CorkscrewPtrace();
65
66 virtual std::string GetFunctionNameRaw(uintptr_t pc, uintptr_t* offset);
67
68 virtual bool Unwind(size_t num_ignore_threads);
69
70private:
71 ptrace_context_t* ptrace_context_;
72};
73
74#endif // _LIBBACKTRACE_CORKSCREW_H