blob: 2a8af839d55120bbed90024ef46172c48062cc13 [file] [log] [blame]
Christopher Ferris6f3981c2017-07-27 09:29:18 -07001/*
2 * Copyright (C) 2017 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_UNWINDSTACK_MAP_H
18#define _LIBBACKTRACE_UNWINDSTACK_MAP_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
Christopher Ferris5f118512017-09-01 11:17:16 -070023#include <memory>
24
Christopher Ferris6f3981c2017-07-27 09:29:18 -070025#include <backtrace/BacktraceMap.h>
26#include <unwindstack/Maps.h>
27
28class UnwindStackMap : public BacktraceMap {
29 public:
30 explicit UnwindStackMap(pid_t pid);
31 ~UnwindStackMap() = default;
32
33 bool Build() override;
34
35 void FillIn(uintptr_t addr, backtrace_map_t* map) override;
36
Josh Gao358de182017-09-06 22:16:09 -070037 virtual std::string GetFunctionName(uintptr_t pc, uintptr_t* offset) override;
38
Christopher Ferris6f3981c2017-07-27 09:29:18 -070039 unwindstack::Maps* stack_maps() { return stack_maps_.get(); }
40
Christopher Ferris5f118512017-09-01 11:17:16 -070041 const std::shared_ptr<unwindstack::Memory>& process_memory() { return process_memory_; }
42
Christopher Ferris6f3981c2017-07-27 09:29:18 -070043 protected:
44 std::unique_ptr<unwindstack::Maps> stack_maps_;
Christopher Ferris5f118512017-09-01 11:17:16 -070045 std::shared_ptr<unwindstack::Memory> process_memory_;
Christopher Ferris6f3981c2017-07-27 09:29:18 -070046};
47
48#endif // _LIBBACKTRACE_UNWINDSTACK_MAP_H