Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 25 | namespace art { |
| 26 | |
| 27 | namespace JDWP { |
| 28 | |
| 29 | /* |
| 30 | * Event modifiers. A JdwpEvent may have zero or more of these. |
| 31 | */ |
| 32 | union JdwpEventMod { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 33 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 34 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 35 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 36 | int count; |
| 37 | } count; |
| 38 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 39 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 40 | uint32_t exprId; |
| 41 | } conditional; |
| 42 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 43 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 44 | ObjectId threadId; |
| 45 | } threadOnly; |
| 46 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 47 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 48 | RefTypeId refTypeId; |
| 49 | } classOnly; |
| 50 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 51 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 52 | char* classPattern; |
| 53 | } classMatch; |
| 54 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 55 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 56 | char* classPattern; |
| 57 | } classExclude; |
| 58 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 59 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 60 | JdwpLocation loc; |
| 61 | } locationOnly; |
| 62 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 63 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 64 | uint8_t caught; |
| 65 | uint8_t uncaught; |
| 66 | RefTypeId refTypeId; |
| 67 | } exceptionOnly; |
| 68 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 69 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 70 | RefTypeId refTypeId; |
| 71 | FieldId fieldId; |
| 72 | } fieldOnly; |
| 73 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 74 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 75 | ObjectId threadId; |
| 76 | int size; /* JdwpStepSize */ |
| 77 | int depth; /* JdwpStepDepth */ |
| 78 | } step; |
| 79 | struct { |
Elliott Hughes | 7b3cdfc | 2011-12-08 21:28:17 -0800 | [diff] [blame] | 80 | JdwpModKind modKind; |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 81 | 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 | */ |
| 90 | struct JdwpEvent { |
| 91 | JdwpEvent* prev; /* linked list */ |
| 92 | JdwpEvent* next; |
| 93 | |
| 94 | JdwpEventKind eventKind; /* what kind of event is this? */ |
Elliott Hughes | f834936 | 2012-06-18 15:00:06 -0700 | [diff] [blame] | 95 | JdwpSuspendPolicy suspend_policy; /* suspend all, none, or self? */ |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 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 | */ |
| 105 | JdwpEvent* EventAlloc(int numMods); |
| 106 | void EventFree(JdwpEvent* pEvent); |
| 107 | |
Elliott Hughes | 872d4ec | 2011-10-21 17:07:15 -0700 | [diff] [blame] | 108 | } // namespace JDWP |
| 109 | |
| 110 | } // namespace art |
| 111 | |
| 112 | #endif // ART_JDWP_JDWPEVENT_H_ |