76 result = PyString_FromString (self_string->
encoding);
91 return PyLong_FromLong (self_string->
length);
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;
128 if (self_string->
length != -1)
134 0, self_string->
length - 1);
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."));
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);
229 return (PyObject *) str_obj;
256 struct type *realtype;
278 struct type **str_elt_type,
298 "Create a (lazy) value that contains a pointer to the string." },
307 {
"type",
stpy_get_type, NULL,
"Type associated with the string.", NULL },
332 "GDB lazy string object",
static PyObject * stpy_get_encoding(PyObject *self, void *closure)
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
static PyObject * stpy_get_address(PyObject *self, void *closure)
static PyObject * stpy_convert_to_value(PyObject *self, PyObject *args)
struct type * type_object_to_type(PyObject *obj)
int gdbpy_initialize_lazy_string(void)
#define gdb_py_long_from_ulongest
static struct type * stpy_lazy_string_elt_type(lazy_string_object *lazy)
#define PyVarObject_HEAD_INIT(type, size)
PyTypeObject lazy_string_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF("lazy_string_object")
static void stpy_dealloc(PyObject *self)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
static PyMethodDef lazy_string_object_methods[]
struct type * check_typedef(struct type *type)
#define CATCH(EXCEPTION, MASK)
std::unique_ptr< T, xfree_deleter< T > > unique_xmalloc_ptr
static gdb_PyGetSetDef lazy_string_object_getset[]
PyObject * value_to_value_object(struct value *val)
struct value * value_at_lazy(struct type *type, CORE_ADDR addr)
static PyObject * stpy_get_length(PyObject *self, void *closure)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)
void gdbpy_extract_lazy_string(PyObject *string, CORE_ADDR *addr, struct type **str_elt_type, long *length, gdb::unique_xmalloc_ptr< char > *encoding)
#define TYPE_TARGET_TYPE(thistype)
#define TYPE_CODE(thistype)
PyTypeObject lazy_string_object_type
int gdbpy_is_lazy_string(PyObject *result)
PyObject * gdbpy_gdb_memory_error
PyObject * gdbpy_create_lazy_string_object(CORE_ADDR address, long length, const char *encoding, struct type *type)
static PyObject * stpy_get_type(PyObject *self, void *closure)
PyObject_HEAD CORE_ADDR address
int get_array_bounds(struct type *type, LONGEST *low_bound, LONGEST *high_bound)
PyObject * type_to_type_object(struct type *type)