blob: a6f9af30c917d920054d060e572923c0f49873ce (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
#ifndef USER_SELECTION_H
#define USER_SELECTION_H
class user_selection {
public:
/* Default constructor, nothing is selected. */
user_selection ()
: m_inferior (nullptr),
m_thread (nullptr),
m_frame_id (null_frame_id),
m_frame_level (INVALID_FRAME_LEVEL)
{}
/* Make INF the selected inferior. If NOTIFY is true, call the observer
indicating a selection change.
Return true if the newly selected inferior is different than the previously
selected inferior. */
bool select_inferior (struct inferior *inf, bool notify);
/* Make THREAD the selected thread. If NOTIFY is true, call the observer
indicating a selection change.
Return true if the newly selected thread is different than the previously
selected thread. */
bool select_thread (struct thread_info *thread, bool notify);
/* Make FRAME the selected frame. If NOTIFY is true, call the observer
indicating a selection change.
Return true if the newly selected frame is different than the previously
selected frame. */
bool select_frame (struct frame_info *frame, bool notify);
/* Get the selected inferior. */
struct inferior *inferior () const
{ return m_inferior; }
/* Get the selected thread. */
struct thread_info *thread () const
{ return m_thread; }
/* Get the selected frame. */
struct frame_info *
frame ()
{
if (!has_valid_frame ())
try_select_current_frame ();
if (!has_valid_frame ())
return NULL;
return frame_find_by_id (m_frame_id);
}
frame_id
raw_frame_id () const
{ return m_frame_id; }
int
raw_frame_level () const
{ return m_frame_level; }
bool has_valid_frame () const
{ return m_frame_level != INVALID_FRAME_LEVEL; }
private:
struct inferior *m_inferior;
struct thread_info *m_thread;
struct frame_id m_frame_id;
int m_frame_level;
void sanity_check () const;
void try_select_current_frame ();
};
/* Get the global user selection. */
user_selection *global_user_selection ();
/* Initialize the global user selection. This must be called after the initial
inferior has been created. */
void init_global_user_selection ();
/* Apply the global user selection to core of gdb. */
void apply_global_user_selection ();
#endif /* USER_SELECTION_H */
|