blob: e8f633f2a521592c481f7132d8b399de26409141 [file] [log] [blame]
Elliott Hughes872d4ec2011-10-21 17:07:15 -07001/*
2 * Copyright (C) 2008 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 * Handle registration of events, and debugger event notification.
18 */
19#ifndef ART_JDWP_JDWPEVENT_H_
20#define ART_JDWP_JDWPEVENT_H_
21
22#include "jdwp/jdwp_constants.h"
23#include "jdwp/jdwp_expand_buf.h"
24
25namespace art {
26
27namespace JDWP {
28
29/*
30 * Event modifiers. A JdwpEvent may have zero or more of these.
31 */
32union JdwpEventMod {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080033 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070034 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080035 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070036 int count;
37 } count;
38 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080039 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070040 uint32_t exprId;
41 } conditional;
42 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080043 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070044 ObjectId threadId;
45 } threadOnly;
46 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080047 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070048 RefTypeId refTypeId;
49 } classOnly;
50 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080051 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070052 char* classPattern;
53 } classMatch;
54 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080055 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070056 char* classPattern;
57 } classExclude;
58 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080059 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070060 JdwpLocation loc;
61 } locationOnly;
62 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080063 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070064 uint8_t caught;
65 uint8_t uncaught;
66 RefTypeId refTypeId;
67 } exceptionOnly;
68 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080069 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070070 RefTypeId refTypeId;
71 FieldId fieldId;
72 } fieldOnly;
73 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080074 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070075 ObjectId threadId;
76 int size; /* JdwpStepSize */
77 int depth; /* JdwpStepDepth */
78 } step;
79 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080080 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070081 ObjectId objectId;
82 } instanceOnly;
83};
84
85/*
86 * One of these for every registered event.
87 *
88 * We over-allocate the struct to hold the modifiers.
89 */
90struct JdwpEvent {
91 JdwpEvent* prev; /* linked list */
92 JdwpEvent* next;
93
94 JdwpEventKind eventKind; /* what kind of event is this? */
95 JdwpSuspendPolicy suspendPolicy; /* suspend all, none, or self? */
96 int modCount; /* #of entries in mods[] */
97 uint32_t requestId; /* serial#, reported to debugger */
98
99 JdwpEventMod mods[1]; /* MUST be last field in struct */
100};
101
102/*
103 * Allocate an event structure with enough space.
104 */
105JdwpEvent* EventAlloc(int numMods);
106void EventFree(JdwpEvent* pEvent);
107
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700108} // namespace JDWP
109
110} // namespace art
111
112#endif // ART_JDWP_JDWPEVENT_H_