blob: d2697619999122292d50fc74ec9b5c5e17d7b55f [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 */
Brian Carlstromfc0e3212013-07-17 14:40:12 -070019#ifndef ART_RUNTIME_JDWP_JDWP_EVENT_H_
20#define ART_RUNTIME_JDWP_JDWP_EVENT_H_
Elliott Hughes872d4ec2011-10-21 17:07:15 -070021
Elliott Hughes07ed66b2012-12-12 18:34:25 -080022#include "jdwp/jdwp.h"
Elliott Hughes872d4ec2011-10-21 17:07:15 -070023#include "jdwp/jdwp_constants.h"
24#include "jdwp/jdwp_expand_buf.h"
25
26namespace art {
27
28namespace JDWP {
29
30/*
31 * Event modifiers. A JdwpEvent may have zero or more of these.
32 */
33union JdwpEventMod {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080034 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070035 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080036 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070037 int count;
38 } count;
39 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080040 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070041 uint32_t exprId;
42 } conditional;
43 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080044 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070045 ObjectId threadId;
46 } threadOnly;
47 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080048 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070049 RefTypeId refTypeId;
50 } classOnly;
51 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080052 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070053 char* classPattern;
54 } classMatch;
55 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080056 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070057 char* classPattern;
58 } classExclude;
59 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080060 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070061 JdwpLocation loc;
62 } locationOnly;
63 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080064 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070065 uint8_t caught;
66 uint8_t uncaught;
67 RefTypeId refTypeId;
68 } exceptionOnly;
69 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080070 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070071 RefTypeId refTypeId;
72 FieldId fieldId;
73 } fieldOnly;
74 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080075 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070076 ObjectId threadId;
77 int size; /* JdwpStepSize */
78 int depth; /* JdwpStepDepth */
79 } step;
80 struct {
Elliott Hughes7b3cdfc2011-12-08 21:28:17 -080081 JdwpModKind modKind;
Elliott Hughes872d4ec2011-10-21 17:07:15 -070082 ObjectId objectId;
83 } instanceOnly;
84};
85
86/*
87 * One of these for every registered event.
88 *
89 * We over-allocate the struct to hold the modifiers.
90 */
91struct JdwpEvent {
92 JdwpEvent* prev; /* linked list */
93 JdwpEvent* next;
94
95 JdwpEventKind eventKind; /* what kind of event is this? */
Elliott Hughesf8349362012-06-18 15:00:06 -070096 JdwpSuspendPolicy suspend_policy; /* suspend all, none, or self? */
Elliott Hughes872d4ec2011-10-21 17:07:15 -070097 int modCount; /* #of entries in mods[] */
98 uint32_t requestId; /* serial#, reported to debugger */
99
100 JdwpEventMod mods[1]; /* MUST be last field in struct */
101};
102
103/*
104 * Allocate an event structure with enough space.
105 */
106JdwpEvent* EventAlloc(int numMods);
107void EventFree(JdwpEvent* pEvent);
108
Elliott Hughes872d4ec2011-10-21 17:07:15 -0700109} // namespace JDWP
110
111} // namespace art
112
Brian Carlstromfc0e3212013-07-17 14:40:12 -0700113#endif // ART_RUNTIME_JDWP_JDWP_EVENT_H_