2 * Copyright (C) 2008 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * Handle registration of events, and debugger event notification.
19 #ifndef _DALVIK_JDWP_JDWPEVENT
20 #define _DALVIK_JDWP_JDWPEVENT
22 #include "JdwpConstants.h"
23 #include "ExpandBuf.h"
26 * Event modifiers. A JdwpEvent may have zero or more of these.
28 typedef union JdwpEventMod {
29 u1 modKind; /* JdwpModKind */
44 RefTypeId referenceTypeId;
72 int size; /* JdwpStepSize */
73 int depth; /* JdwpStepDepth */
82 * One of these for every registered event.
84 * We over-allocate the struct to hold the modifiers.
86 typedef struct JdwpEvent {
87 struct JdwpEvent* prev; /* linked list */
88 struct JdwpEvent* next;
90 enum JdwpEventKind eventKind; /* what kind of event is this? */
91 enum JdwpSuspendPolicy suspendPolicy; /* suspend all, none, or self? */
92 int modCount; /* #of entries in mods[] */
93 u4 requestId; /* serial#, reported to debugger */
95 JdwpEventMod mods[1]; /* MUST be last field in struct */
99 * Allocate an event structure with enough space.
101 JdwpEvent* dvmJdwpEventAlloc(int numMods);
102 void dvmJdwpEventFree(JdwpEvent* pEvent);
105 * Register an event by adding it to the event list.
107 * "*pEvent" must be storage allocated with jdwpEventAlloc(). The caller
108 * may discard its pointer after calling this.
110 JdwpError dvmJdwpRegisterEvent(JdwpState* state, JdwpEvent* pEvent);
113 * Unregister an event, given the requestId.
115 void dvmJdwpUnregisterEventById(JdwpState* state, u4 requestId);
118 * Unregister all events.
120 void dvmJdwpUnregisterAll(JdwpState* state);
123 * Send an event, formatted into "pReq", to the debugger.
125 * (Messages are sent asynchronously, and do not receive a reply.)
127 bool dvmJdwpSendRequest(JdwpState* state, ExpandBuf* pReq);
129 #endif /*_DALVIK_JDWP_JDWPEVENT*/