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