data.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. // Copyright (c) 2015, Google Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.devtools.clouddebugger.v2;
  16. import "google/api/annotations.proto";
  17. import "google/devtools/source/v1/source_context.proto";
  18. import "google/protobuf/timestamp.proto";
  19. import "google/protobuf/wrappers.proto";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "DataProto";
  22. option java_package = "com.google.devtools.clouddebugger.v2";
  23. // Represents a message with parameters.
  24. message FormatMessage {
  25. // Format template for the message. The `format` uses placeholders `$0`,
  26. // `$1`, etc. to reference parameters. `$$` can be used to denote the `$`
  27. // character.
  28. //
  29. // Examples:
  30. //
  31. // * `Failed to load '$0' which helps debug $1 the first time it
  32. // is loaded. Again, $0 is very important.`
  33. // * `Please pay $$10 to use $0 instead of $1.`
  34. string format = 1;
  35. // Optional parameters to be embedded into the message.
  36. repeated string parameters = 2;
  37. }
  38. // Represents a contextual status message.
  39. // The message can indicate an error or informational status, and refer to
  40. // specific parts of the containing object.
  41. // For example, the `Breakpoint.status` field can indicate an error referring
  42. // to the `BREAKPOINT_SOURCE_LOCATION` with the message `Location not found`.
  43. message StatusMessage {
  44. // Enumerates references to which the message applies.
  45. enum Reference {
  46. // Status doesn't refer to any particular input.
  47. UNSPECIFIED = 0;
  48. // Status applies to the breakpoint and is related to its location.
  49. BREAKPOINT_SOURCE_LOCATION = 3;
  50. // Status applies to the breakpoint and is related to its condition.
  51. BREAKPOINT_CONDITION = 4;
  52. // Status applies to the breakpoint and is related to its expressions.
  53. BREAKPOINT_EXPRESSION = 7;
  54. // Status applies to the entire variable.
  55. VARIABLE_NAME = 5;
  56. // Status applies to variable value (variable name is valid).
  57. VARIABLE_VALUE = 6;
  58. }
  59. // Distinguishes errors from informational messages.
  60. bool is_error = 1;
  61. // Reference to which the message applies.
  62. Reference refers_to = 2;
  63. // Status message text.
  64. FormatMessage description = 3;
  65. }
  66. // Represents a location in the source code.
  67. message SourceLocation {
  68. // Path to the source file within the source context of the target binary.
  69. string path = 1;
  70. // Line inside the file. The first line in the file has the value `1`.
  71. int32 line = 2;
  72. }
  73. // Represents a variable or an argument possibly of a compound object type.
  74. // Note how the following variables are represented:
  75. //
  76. // 1) A simple variable:
  77. //
  78. // int x = 5
  79. //
  80. // { name: "x", value: "5", type: "int" } // Captured variable
  81. //
  82. // 2) A compound object:
  83. //
  84. // struct T {
  85. // int m1;
  86. // int m2;
  87. // };
  88. // T x = { 3, 7 };
  89. //
  90. // { // Captured variable
  91. // name: "x",
  92. // type: "T",
  93. // members { name: "m1", value: "3", type: "int" },
  94. // members { name: "m2", value: "7", type: "int" }
  95. // }
  96. //
  97. // 3) A pointer where the pointee was captured:
  98. //
  99. // T x = { 3, 7 };
  100. // T* p = &x;
  101. //
  102. // { // Captured variable
  103. // name: "p",
  104. // type: "T*",
  105. // value: "0x00500500",
  106. // members { name: "m1", value: "3", type: "int" },
  107. // members { name: "m2", value: "7", type: "int" }
  108. // }
  109. //
  110. // 4) A pointer where the pointee was not captured:
  111. //
  112. // T* p = new T;
  113. //
  114. // { // Captured variable
  115. // name: "p",
  116. // type: "T*",
  117. // value: "0x00400400"
  118. // status { is_error: true, description { format: "unavailable" } }
  119. // }
  120. //
  121. // The status should describe the reason for the missing value,
  122. // such as `<optimized out>`, `<inaccessible>`, `<pointers limit reached>`.
  123. //
  124. // Note that a null pointer should not have members.
  125. //
  126. // 5) An unnamed value:
  127. //
  128. // int* p = new int(7);
  129. //
  130. // { // Captured variable
  131. // name: "p",
  132. // value: "0x00500500",
  133. // type: "int*",
  134. // members { value: "7", type: "int" } }
  135. //
  136. // 6) An unnamed pointer where the pointee was not captured:
  137. //
  138. // int* p = new int(7);
  139. // int** pp = &p;
  140. //
  141. // { // Captured variable
  142. // name: "pp",
  143. // value: "0x00500500",
  144. // type: "int**",
  145. // members {
  146. // value: "0x00400400",
  147. // type: "int*"
  148. // status {
  149. // is_error: true,
  150. // description: { format: "unavailable" } }
  151. // }
  152. // }
  153. // }
  154. //
  155. // To optimize computation, memory and network traffic, variables that
  156. // repeat in the output multiple times can be stored once in a shared
  157. // variable table and be referenced using the `var_table_index` field. The
  158. // variables stored in the shared table are nameless and are essentially
  159. // a partition of the complete variable. To reconstruct the complete
  160. // variable, merge the referencing variable with the referenced variable.
  161. //
  162. // When using the shared variable table, the following variables:
  163. //
  164. // T x = { 3, 7 };
  165. // T* p = &x;
  166. // T& r = x;
  167. //
  168. // { name: "x", var_table_index: 3, type: "T" } // Captured variables
  169. // { name: "p", value "0x00500500", type="T*", var_table_index: 3 }
  170. // { name: "r", type="T&", var_table_index: 3 }
  171. //
  172. // { // Shared variable table entry #3:
  173. // members { name: "m1", value: "3", type: "int" },
  174. // members { name: "m2", value: "7", type: "int" }
  175. // }
  176. //
  177. // Note that the pointer address is stored with the referencing variable
  178. // and not with the referenced variable. This allows the referenced variable
  179. // to be shared between pointers and references.
  180. //
  181. // The type field is optional. The debugger agent may or may not support it.
  182. message Variable {
  183. // Name of the variable, if any.
  184. string name = 1;
  185. // Simple value of the variable.
  186. string value = 2;
  187. // Variable type (e.g. `MyClass`). If the variable is split with
  188. // `var_table_index`, `type` goes next to `value`. The interpretation of
  189. // a type is agent specific. It is recommended to include the dynamic type
  190. // rather than a static type of an object.
  191. string type = 6;
  192. // Members contained or pointed to by the variable.
  193. repeated Variable members = 3;
  194. // Reference to a variable in the shared variable table. More than
  195. // one variable can reference the same variable in the table. The
  196. // `var_table_index` field is an index into `variable_table` in Breakpoint.
  197. google.protobuf.Int32Value var_table_index = 4;
  198. // Status associated with the variable. This field will usually stay
  199. // unset. A status of a single variable only applies to that variable or
  200. // expression. The rest of breakpoint data still remains valid. Variables
  201. // might be reported in error state even when breakpoint is not in final
  202. // state.
  203. //
  204. // The message may refer to variable name with `refers_to` set to
  205. // `VARIABLE_NAME`. Alternatively `refers_to` will be set to `VARIABLE_VALUE`.
  206. // In either case variable value and members will be unset.
  207. //
  208. // Example of error message applied to name: `Invalid expression syntax`.
  209. //
  210. // Example of information message applied to value: `Not captured`.
  211. //
  212. // Examples of error message applied to value:
  213. //
  214. // * `Malformed string`,
  215. // * `Field f not found in class C`
  216. // * `Null pointer dereference`
  217. StatusMessage status = 5;
  218. }
  219. // Represents a stack frame context.
  220. message StackFrame {
  221. // Demangled function name at the call site.
  222. string function = 1;
  223. // Source location of the call site.
  224. SourceLocation location = 2;
  225. // Set of arguments passed to this function.
  226. // Note that this might not be populated for all stack frames.
  227. repeated Variable arguments = 3;
  228. // Set of local variables at the stack frame location.
  229. // Note that this might not be populated for all stack frames.
  230. repeated Variable locals = 4;
  231. }
  232. // Represents the breakpoint specification, status and results.
  233. message Breakpoint {
  234. // Actions that can be taken when a breakpoint hits.
  235. // Agents should reject breakpoints with unsupported or unknown action values.
  236. enum Action {
  237. // Capture stack frame and variables and update the breakpoint.
  238. // The data is only captured once. After that the breakpoint is set
  239. // in a final state.
  240. CAPTURE = 0;
  241. // Log each breakpoint hit. The breakpoint remains active until
  242. // deleted or expired.
  243. LOG = 1;
  244. }
  245. // Log severity levels.
  246. enum LogLevel {
  247. // Information log message.
  248. INFO = 0;
  249. // Warning log message.
  250. WARNING = 1;
  251. // Error log message.
  252. ERROR = 2;
  253. }
  254. // Breakpoint identifier, unique in the scope of the debuggee.
  255. string id = 1;
  256. // Action that the agent should perform when the code at the
  257. // breakpoint location is hit.
  258. Action action = 13;
  259. // Breakpoint source location.
  260. SourceLocation location = 2;
  261. // Condition that triggers the breakpoint.
  262. // The condition is a compound boolean expression composed using expressions
  263. // in a programming language at the source location.
  264. string condition = 3;
  265. // List of read-only expressions to evaluate at the breakpoint location.
  266. // The expressions are composed using expressions in the programming language
  267. // at the source location. If the breakpoint action is `LOG`, the evaluated
  268. // expressions are included in log statements.
  269. repeated string expressions = 4;
  270. // Only relevant when action is `LOG`. Defines the message to log when
  271. // the breakpoint hits. The message may include parameter placeholders `$0`,
  272. // `$1`, etc. These placeholders are replaced with the evaluated value
  273. // of the appropriate expression. Expressions not referenced in
  274. // `log_message_format` are not logged.
  275. //
  276. // Example: `Message received, id = $0, count = $1` with
  277. // `expressions` = `[ message.id, message.count ]`.
  278. string log_message_format = 14;
  279. // Indicates the severity of the log. Only relevant when action is `LOG`.
  280. LogLevel log_level = 15;
  281. // When true, indicates that this is a final result and the
  282. // breakpoint state will not change from here on.
  283. bool is_final_state = 5;
  284. // Time this breakpoint was created by the server in seconds resolution.
  285. google.protobuf.Timestamp create_time = 11;
  286. // Time this breakpoint was finalized as seen by the server in seconds
  287. // resolution.
  288. google.protobuf.Timestamp final_time = 12;
  289. // E-mail address of the user that created this breakpoint
  290. string user_email = 16;
  291. // Breakpoint status.
  292. //
  293. // The status includes an error flag and a human readable message.
  294. // This field is usually unset. The message can be either
  295. // informational or an error message. Regardless, clients should always
  296. // display the text message back to the user.
  297. //
  298. // Error status indicates complete failure of the breakpoint.
  299. //
  300. // Example (non-final state): `Still loading symbols...`
  301. //
  302. // Examples (final state):
  303. //
  304. // * `Invalid line number` referring to location
  305. // * `Field f not found in class C` referring to condition
  306. StatusMessage status = 10;
  307. // The stack at breakpoint time.
  308. repeated StackFrame stack_frames = 7;
  309. // Values of evaluated expressions at breakpoint time.
  310. // The evaluated expressions appear in exactly the same order they
  311. // are listed in the `expressions` field.
  312. // The `name` field holds the original expression text, the `value` or
  313. // `members` field holds the result of the evaluated expression.
  314. // If the expression cannot be evaluated, the `status` inside the `Variable`
  315. // will indicate an error and contain the error text.
  316. repeated Variable evaluated_expressions = 8;
  317. // The `variable_table` exists to aid with computation, memory and network
  318. // traffic optimization. It enables storing a variable once and reference
  319. // it from multiple variables, including variables stored in the
  320. // `variable_table` itself.
  321. // For example, the same `this` object, which may appear at many levels of
  322. // the stack, can have all of its data stored once in this table. The
  323. // stack frame variables then would hold only a reference to it.
  324. //
  325. // The variable `var_table_index` field is an index into this repeated field.
  326. // The stored objects are nameless and get their name from the referencing
  327. // variable. The effective variable is a merge of the referencing variable
  328. // and the referenced variable.
  329. repeated Variable variable_table = 9;
  330. // A set of custom breakpoint properties, populated by the agent, to be
  331. // displayed to the user.
  332. map<string, string> labels = 17;
  333. }
  334. // Represents the application to debug. The application may include one or more
  335. // replicated processes executing the same code. Each of these processes is
  336. // attached with a debugger agent, carrying out the debugging commands.
  337. // The agents attached to the same debuggee are identified by using exactly the
  338. // same field values when registering.
  339. message Debuggee {
  340. // Unique identifier for the debuggee generated by the controller service.
  341. string id = 1;
  342. // Project the debuggee is associated with.
  343. // Use the project number when registering a Google Cloud Platform project.
  344. string project = 2;
  345. // Debuggee uniquifier within the project.
  346. // Any string that identifies the application within the project can be used.
  347. // Including environment and version or build IDs is recommended.
  348. string uniquifier = 3;
  349. // Human readable description of the debuggee.
  350. // Including a human-readable project name, environment name and version
  351. // information is recommended.
  352. string description = 4;
  353. // If set to `true`, indicates that the debuggee is considered as inactive by
  354. // the Controller service.
  355. bool is_inactive = 5;
  356. // Version ID of the agent release. The version ID is structured as
  357. // following: `domain/type/vmajor.minor` (for example
  358. // `google.com/gcp-java/v1.1`).
  359. string agent_version = 6;
  360. // If set to `true`, indicates that the agent should disable itself and
  361. // detach from the debuggee.
  362. bool is_disabled = 7;
  363. // Human readable message to be displayed to the user about this debuggee.
  364. // Absence of this field indicates no status. The message can be either
  365. // informational or an error status.
  366. StatusMessage status = 8;
  367. // References to the locations and revisions of the source code used in the
  368. // deployed application.
  369. //
  370. // NOTE: This field is deprecated. Consumers should use
  371. // `ext_source_contexts` if it is not empty. Debug agents should populate
  372. // both this field and `ext_source_contexts`.
  373. repeated google.devtools.source.v1.SourceContext source_contexts = 9;
  374. // References to the locations and revisions of the source code used in the
  375. // deployed application.
  376. //
  377. // Contexts describing a remote repo related to the source code
  378. // have a `category` label of `remote_repo`. Source snapshot source
  379. // contexts have a `category` of `snapshot`.
  380. repeated google.devtools.source.v1.ExtendedSourceContext ext_source_contexts = 13;
  381. // A set of custom debuggee properties, populated by the agent, to be
  382. // displayed to the user.
  383. map<string, string> labels = 11;
  384. }