data.proto 16 KB

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