GDBMI_var_set_visualizer.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 08 Jul 2019 12:34:18 +0100
changeset 200 e9250da35d87
parent 112 a8138ced2f5e
child 259 651864c2aa29
permissions -rw-r--r--
API: add method for importing Python support code This can be used by VDB, VDB plugins or any other user of libgdbs to load Python support code.

"{ Encoding: utf8 }"

"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
"{ Package: 'jv:libgdbs' }"

"{ NameSpace: Smalltalk }"

GDBMICommand subclass:#GDBMI_var_set_visualizer
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'GDB-Core-Commands-MI'
!

!GDBMI_var_set_visualizer class methodsFor:'documentation'!

copyright
"
jv:libgdbs - GNU Debugger Interface Library
Copyright (C) 2015-now Jan Vrany

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License. 

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
"
!

documentation
"
Synopsis

 -var-set-visualizer name visualizer

Set a visualizer for the variable object name.

visualizer is the visualizer to use. The special value ‘None’ means to disable any visualizer in use.

If not ‘None’, visualizer must be a Python expression. This expression must evaluate to a callable object which accepts a single argument. GDB will call this object with the value of the varobj name as an argument (this is done so that the same Python pretty-printing code can be used for both the CLI and MI). When called, this object must return an object which conforms to the pretty-printing interface (see Pretty Printing API).

The pre-defined function gdb.default_visualizer may be used to select a visualizer by following the built-in process (see Selecting Pretty-Printers). This is done automatically when a varobj is created, and so ordinarily is not needed.

This feature is only available if Python support is enabled. The MI command -list-features (see GDB/MI Support Commands) can be used to check this.
Example

Resetting the visualizer:

(gdb)
-var-set-visualizer V None
^done

Reselecting the default (type-based) visualizer:

(gdb)
-var-set-visualizer V gdb.default_visualizer
^done

Suppose SomeClass is a visualizer class. A lambda expression can be used to instantiate this class for a varobj:

(gdb)
-var-set-visualizer V 'lambda val: SomeClass()'
^done

"
! !

!GDBMI_var_set_visualizer methodsFor:'accessing'!

operation
	^ 'var-set-visualizer'
! !

!GDBMI_var_set_visualizer class methodsFor:'documentation'!

version_HG

    ^ '$Changeset: <not expanded> $'
! !