data.proto 16 KB

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