76 result = PyUnicode_FromString (self_string->
encoding);
99 Py_INCREF (str_obj->
type);
100 return str_obj->
type;
107 struct value *val = NULL;
112 _(
"Cannot create a value from NULL."));
119 struct type *realtype;
121 gdb_assert (
type != NULL);
123 switch (realtype->
code ())
128 if (self_string->
length != -1)
134 0, self_string->
length - 1);
145 catch (
const gdb_exception &except)
159 Py_TYPE (self)->tp_free (self);
170 const char *encoding,
struct type *
type)
173 struct type *realtype;
177 PyErr_SetString (PyExc_ValueError, _(
"Invalid length."));
181 if (address == 0 &&
length != 0)
184 _(
"Cannot create a lazy string with address 0x0, " \
185 "and a non-zero length."));
191 PyErr_SetString (PyExc_RuntimeError,
192 _(
"A lazy string's type cannot be NULL."));
197 switch (realtype->
code ())
199 case TYPE_CODE_ARRAY:
201 LONGEST array_length = -1;
202 LONGEST low_bound, high_bound;
205 array_length = high_bound - low_bound + 1;
208 else if (
length != array_length)
210 PyErr_SetString (PyExc_ValueError, _(
"Invalid length."));
223 if (encoding == NULL || !strcmp (encoding,
""))
226 str_obj->
encoding = xstrdup (encoding);
256 struct type *realtype;
258 gdb_assert (
type != NULL);
261 switch (realtype->
code ())
264 case TYPE_CODE_ARRAY:
278 struct type **str_elt_type,
280 gdb::unique_xmalloc_ptr<char> *encoding)
298 "Create a (lazy) value that contains a pointer to the string." },
307 {
"type",
stpy_get_type, NULL,
"Type associated with the string.", NULL },
312 PyVarObject_HEAD_INIT (NULL, 0)
332 "GDB lazy string object",
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
bool get_array_bounds(struct type *type, LONGEST *low_bound, LONGEST *high_bound)
struct type * check_typedef(struct type *type)
void gdbpy_extract_lazy_string(PyObject *string, CORE_ADDR *addr, struct type **str_elt_type, long *length, gdb::unique_xmalloc_ptr< char > *encoding)
static PyObject * stpy_get_address(PyObject *self, void *closure)
static PyMethodDef lazy_string_object_methods[]
PyTypeObject lazy_string_object_type
int gdbpy_initialize_lazy_string(void)
static PyObject * stpy_convert_to_value(PyObject *self, PyObject *args)
int gdbpy_is_lazy_string(PyObject *result)
PyObject * gdbpy_create_lazy_string_object(CORE_ADDR address, long length, const char *encoding, struct type *type)
static gdb_PyGetSetDef lazy_string_object_getset[]
static PyObject * stpy_get_length(PyObject *self, void *closure)
static PyObject * stpy_get_type(PyObject *self, void *closure)
static PyObject * stpy_get_encoding(PyObject *self, void *closure)
static struct type * stpy_lazy_string_elt_type(lazy_string_object *lazy)
static void stpy_dealloc(PyObject *self)
PyObject * type_to_type_object(struct type *type)
struct type * type_object_to_type(PyObject *obj)
gdbpy_ref gdb_py_object_from_longest(LONGEST l)
gdbpy_ref gdb_py_object_from_ulongest(ULONGEST l)
PyObject * value_to_value_object(struct value *val)
#define CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF(ARG)
PyObject * gdbpy_gdb_memory_error
#define GDB_PY_HANDLE_EXCEPTION(Exception)
PyObject_HEAD CORE_ADDR address
struct type * target_type() const
struct value * value_at_lazy(struct type *type, CORE_ADDR addr)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)