summaryrefslogtreecommitdiff
path: root/gdb/gdbtk/library/gdbevent.itb
blob: 630f460456960879d237af54dee934595d393daa (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# GDB event class implementations for Insight.
# Copyright (C) 2001 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License (GPL) as published by
# the Free Software Foundation; either version 2 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# ------------------------------------------------------------
#  PUBLIC METHOD:  get - Retrieve data about the event
# ------------------------------------------------------------
itcl::body BreakpointEvent::get {what} {

  switch $what {
    action       { return $action }
    number       { return $number }
    file         { return $_file }
    function     { return $_function }
    line         { return $_line }
    address      { return $_address }
    type         { return $_type }
    enabled      { return $_enabled }
    disposition  { return $_disposition }
    ignore_count { return $_ignore_count }
    commands     { return $_commands }
    condition    { return $_condition }
    thread       { return $_thread }
    hit_count    { return $_hit_count }
    user_specification { return $_user_specification }

    default { error "unknown event data \"$what\": should be: action|number|file|function|line|address|type|enabled|disposition|ignore_count|commands|condition|thread|hit_count|user_specification" }
  }
}

# ------------------------------------------------------------
#  PRIVATE METHOD:  _init - Initialize all private data
# ------------------------------------------------------------
itcl::body BreakpointEvent::_init {} {
  if {[catch {gdb_get_breakpoint_info $number} bpinfo]} {
    set _file         {}
    set _function     {}
    set _line         {}
    set _address      {}
    set _type         {}
    set _enabled      {}
    set _disposition  {}
    set _ignore_count {}
    set _commands     {}
    set _condition    {}
    set _thread       {}
    set _hit_count    {}
    set _user_specification {}
  } else {
    lassign $bpinfo \
      _file         \
      _function     \
      _line         \
      _address      \
      _type         \
      _enabled      \
      _disposition  \
      _ignore_count \
      _commands     \
      _condition    \
      _thread       \
      _hit_count    \
      _user_specification
  }
}

# When the breakpoint number for the event changes,
# update the private data in the event.
itcl::configbody BreakpointEvent::number {
  _init
}

# ------------------------------------------------------------
#  PUBLIC METHOD:  get - Retrieve data about the event
# ------------------------------------------------------------
itcl::body TracepointEvent::get {what} {

  switch $what {
    action     { return $action }
    number     { return $number }
    file       { return $_file }
    function   { return $_function }
    line       { return $_line }
    address    { return $_address }
    enabled    { return $_enabled }
    pass_count { return $_pass_count }
    step_count { return $_step_count }
    thread     { return $_thread }
    hit_count  { return $_hit_count }
    actions    { return $_actions }

    default { error "unknown event data \"$what\": should be: action|number|file|function|line|address|pass_count|step_count|thread|hit_count|actions" }
  }
}

# ------------------------------------------------------------
#  PRIVATE METHOD:  _init - Initialize all private data
# ------------------------------------------------------------
itcl::body TracepointEvent::_init {} {
  if {[catch {gdb_get_tracepoint_info $number} tpinfo]} {
    set _file         {}
    set _function     {}
    set _line         {}
    set _address      {}
    set _enabled      {}
    set _pass_count   {}
    set _step_count   {}
    set _thread       {}
    set _hit_count    {}
    set _actions      {}
  } else {
    lassign $tpinfo \
      _file         \
      _function     \
      _line         \
      _address      \
      _enabled      \
      _pass_count   \
      _step_count   \
      _thread       \
      _hit_count    \
      _actions
  }
}

# When the tracepoint number for the event changes,
# update the private data in the event.
itcl::configbody TracepointEvent::number {
  _init
}

# ------------------------------------------------------------
#  PUBLIC METHOD:  get - Retrieve data about the event
# ------------------------------------------------------------
itcl::body TracepointEvent::get {what} {

  switch $what {
    action     { return $action }
    number     { return $number }
    file       { return $_file }
    function   { return $_function }
    line       { return $_line }
    address    { return $_address }
    enabled    { return $_enabled }
    pass_count { return $_pass_count }
    step_count { return $_step_count }
    thread     { return $_thread }
    hit_count  { return $_hit_count }
    actions    { return $_actions }

    default { error "unknown event data \"$what\": should be: action|number|file|function|line|address|pass_count|step_count|thread|hit_count|actions" }
  }
}

# ------------------------------------------------------------
#  PUBLIC METHOD:  get - Retrieve data about the event
# ------------------------------------------------------------
itcl::body SetVariableEvent::get {what} {

  switch $what {
    variable { return $variable }
    value    { return $value }

    default { error "unknown event data \"$what\": should be: variable|value" }
  }
}

# ------------------------------------------------------------
#  CONSTRUCTOR: Create an UpdateEvent
# ------------------------------------------------------------
itcl::body UpdateEvent::constructor {args} {
  if {[catch {gdb_loc} loc]} {
    dbug E "could not get current location: $loc"
  } else {
    lassign $loc _compile_filename _function _full_filename \
      _line _frame_pc _pc _shlib
  }
}

# ------------------------------------------------------------
#  PUBLIC METHOD:  get - Retrieve data about the event
# ------------------------------------------------------------
itcl::body UpdateEvent::get {what} {

  switch $what {
    compile_filename { return $_compile_filename }
    full_filename    { return $_full_filename }
    function         { return $_function }
    line             { return $_line }
    frame_pc         { return $_frame_pc }
    pc               { return $_pc }
    shlib            { return $_shlib }

    default { error "unknown event data \"$what\": should be: variable|value" }
  }
}