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