forked from bloomberg/pystack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyframe.h
More file actions
57 lines (47 loc) · 1.58 KB
/
pyframe.h
File metadata and controls
57 lines (47 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include <memory>
#include <unordered_map>
#include "mem.h"
#include "process.h"
#include "pycode.h"
#include "structure.h"
namespace pystack {
class FrameObject
{
public:
// Constructors
FrameObject(
const std::shared_ptr<const AbstractProcessManager>& manager,
remote_addr_t addr,
ssize_t frame_no);
// Getters
ssize_t FrameNo() const;
std::shared_ptr<FrameObject> PreviousFrame();
std::shared_ptr<CodeObject> Code();
const std::unordered_map<std::string, std::string>& Arguments() const;
const std::unordered_map<std::string, std::string>& Locals() const;
bool IsEntryFrame() const;
bool IsShim() const;
// Methods
void resolveLocalVariables();
private:
// Methods
static bool getIsShim(
const std::shared_ptr<const AbstractProcessManager>& manager,
Structure<py_frame_v>& frame);
static std::unique_ptr<CodeObject>
getCode(const std::shared_ptr<const AbstractProcessManager>& manager, Structure<py_frame_v>& frame);
bool
isEntry(const std::shared_ptr<const AbstractProcessManager>& manager, Structure<py_frame_v>& frame);
// Data members
const std::shared_ptr<const AbstractProcessManager> d_manager{};
remote_addr_t d_addr{};
ssize_t d_frame_no{};
std::shared_ptr<FrameObject> d_prev{nullptr};
std::shared_ptr<CodeObject> d_code{nullptr};
std::unordered_map<std::string, std::string> d_arguments{};
std::unordered_map<std::string, std::string> d_locals{};
bool d_is_entry;
bool d_is_shim;
};
} // namespace pystack