This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
get python string from gdb.Value
- From: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- To: archer ml <archer at sourceware dot org>
- Date: Wed, 12 Nov 2008 18:43:07 -0200
- Subject: get python string from gdb.Value
Hi,
Just thought I'd give a heads up of what I'm doing (which is what I
mentioned in the archer call today):
I'm writing the in_scope convenience function in python, as an exercise
to spot rough edges and missing things that are needed for a useful real
world python script. So I have a few local smallish bugfixes and
additions to gdb.Block and gdb.Function, nothing major.
I stumbled upon the bigger problem that there's no way to get a Python
string (or unicode string, rather) object out of a gdb.Value holding an
inferior string. I'm working on implementing a gdb.Value.string method
which will return a Unicode string, and have an optional encoding
argument (defaulting to target-charset) to specify the charset of the
string in the inferior.
For that I factored out a read-string-from-inferior function out of
val_print_string, and I am starting to add an la_getstr function to
language_defn so that code in python-value.c can obtain a string from
the inferior in a language-agnostic way.
--
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center