GDBVariableObject.st
changeset 111 7ce18f6f18ac
parent 110 727d8a9e6d5d
child 112 a8138ced2f5e
--- a/GDBVariableObject.st	Tue Feb 13 23:54:02 2018 +0000
+++ b/GDBVariableObject.st	Wed Feb 07 12:07:19 2018 +0000
@@ -219,6 +219,32 @@
     "Modified: / 12-02-2018 / 22:00:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+valueFormatted: aGDBOutputFormat
+    "Return the value formatted using given format (as String)"
+
+    | format result |
+
+    aGDBOutputFormat == FormatBinary ifTrue:[ 
+        format := 'binary'
+    ] ifFalse:[aGDBOutputFormat == FormatSignedDecimal ifTrue:[ 
+        format := 'decimal'
+    ] ifFalse:[aGDBOutputFormat == FormatHexadecimal ifTrue:[ 
+        format := 'hexadecimal'
+    ] ifFalse:[aGDBOutputFormat == FormatOctal ifTrue:[ 
+        format := 'octal'
+    ] ifFalse:[aGDBOutputFormat == FormatPaddedHexadecimal ifTrue:[ 
+        format := 'zero-hexadecimal'
+    ] ifFalse:[ 
+        GDBError raiseErrorString: 'Invalid format: ', aGDBOutputFormat displayString  
+    ]]]]].
+    result := debugger send: (GDBMI_var_evaluate_expression arguments: (Array with: '-f' with: 'natural' with: name)).
+    ^ result value
+
+    "Created: / 05-02-2018 / 23:34:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 06-02-2018 / 09:04:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+
+!
+
 visualizer
     "Return the current visualizer used for the variable object.