Class: Google::Apis::ClouddebuggerV2::Variable

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
generated/google/apis/clouddebugger_v2/classes.rb,
generated/google/apis/clouddebugger_v2/representations.rb,
generated/google/apis/clouddebugger_v2/representations.rb

Overview

Represents a variable or an argument possibly of a compound object type. Note how the following variables are represented: 1) A simple variable: int x = 5 name: "x", value: "5", type: "int" // Captured variable 2) A compound object: struct T int m1; int m2;; T x = 3, 7; // Captured variable name: "x" , type: "T", members name: "m1", value: "3", type: "int" , members name: " m2", value: "7", type: "int" 3) A pointer where the pointee was captured: T x = 3, 7; T* p = &x; // Captured variable name: "p", type: "T*", value: "0x00500500", members name: "m1", value: "3", type: "int" , members name: "m2", value: "7", type: "int" 4) A pointer where the pointee was not captured: T* p = new T; // Captured variable name: "p", type: "T*", value: " 0x00400400" status is_error: true, description format: "unavailable" The status should describe the reason for the missing value, such as ,, ` . Note that a null pointer should not have members. 5) An unnamed value: int* p = new int(7); // Captured variable name: "p", value: "0x00500500", type: " int*", members value: "7", type: "int" 6) An unnamed pointer where the pointee was not captured: int* p = new int(7); int** pp = &p; // Captured variable name: "pp", value: "0x00500500", type: "int*", members ` value: " 0x00400400", type: "int" status is_error: true, description: format: " unavailable" To optimize computation, memory and network traffic, variables that repeat in the output multiple times can be stored once in a shared variable table and be referenced using thevar_table_indexfield. The variables stored in the shared table are nameless and are essentially a partition of the complete variable. To reconstruct the complete variable, merge the referencing variable with the referenced variable. When using the shared variable table, the following variables: T x = 3, 7 ; T* p = &x; T& r = x; name: "x", var_table_index: 3, type: "T" // Captured variables name: "p", value "0x00500500", type="T*", var_table_index: 3 name: "r", type="T&", var_table_index: 3 // Shared variable table entry #3: members name: "m1", value: "3", type: "int", members name: "m2", value: "7", type: "int" ` Note that the pointer address is stored with the referencing variable and not with the referenced variable. This allows the referenced variable to be shared between pointers and references. The type field is optional. The debugger agent may or may not support it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Google::Apis::Core::JsonObjectSupport

#to_json

Methods included from Google::Apis::Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ Variable

Returns a new instance of Variable.


1038
1039
1040
# File 'generated/google/apis/clouddebugger_v2/classes.rb', line 1038

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#membersArray<Google::Apis::ClouddebuggerV2::Variable>

Members contained or pointed to by the variable. Corresponds to the JSON property members


1003
1004
1005
# File 'generated/google/apis/clouddebugger_v2/classes.rb', line 1003

def members
  @members
end

#nameString

Name of the variable, if any. Corresponds to the JSON property name

Returns:

  • (String)

1008
1009
1010
# File 'generated/google/apis/clouddebugger_v2/classes.rb', line 1008

def name
  @name
end

#statusGoogle::Apis::ClouddebuggerV2::StatusMessage

Represents a contextual status message. The message can indicate an error or informational status, and refer to specific parts of the containing object. For example, the Breakpoint.status field can indicate an error referring to the BREAKPOINT_SOURCE_LOCATION with the message Location not found. Corresponds to the JSON property status


1016
1017
1018
# File 'generated/google/apis/clouddebugger_v2/classes.rb', line 1016

def status
  @status
end

#typeString

Variable type (e.g. MyClass). If the variable is split with var_table_index , type goes next to value. The interpretation of a type is agent specific. It is recommended to include the dynamic type rather than a static type of an object. Corresponds to the JSON property type

Returns:

  • (String)

1024
1025
1026
# File 'generated/google/apis/clouddebugger_v2/classes.rb', line 1024

def type
  @type
end

#valueString

Simple value of the variable. Corresponds to the JSON property value

Returns:

  • (String)

1029
1030
1031
# File 'generated/google/apis/clouddebugger_v2/classes.rb', line 1029

def value
  @value
end

#var_table_indexFixnum

Reference to a variable in the shared variable table. More than one variable can reference the same variable in the table. The var_table_index field is an index into variable_table in Breakpoint. Corresponds to the JSON property varTableIndex

Returns:

  • (Fixnum)

1036
1037
1038
# File 'generated/google/apis/clouddebugger_v2/classes.rb', line 1036

def var_table_index
  @var_table_index
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object


1043
1044
1045
1046
1047
1048
1049
1050
# File 'generated/google/apis/clouddebugger_v2/classes.rb', line 1043

def update!(**args)
  @members = args[:members] if args.key?(:members)
  @name = args[:name] if args.key?(:name)
  @status = args[:status] if args.key?(:status)
  @type = args[:type] if args.key?(:type)
  @value = args[:value] if args.key?(:value)
  @var_table_index = args[:var_table_index] if args.key?(:var_table_index)
end