76 result = PyUnicode_FromString (self_string->
encoding);
99 Py_INCREF (str_obj->
type);
100 return str_obj->
type;
111 _(
"Cannot create a value from NULL."));
121 struct type *realtype;
124 gdb_assert (
type != NULL);
126 switch (realtype->
code ())
131 if (self_string->
length != -1)
137 0, self_string->
length - 1);
150 catch (
const gdb_exception &except)
164 Py_TYPE (self)->tp_free (self);
175 const char *encoding,
struct type *
type)
178 struct type *realtype;
182 PyErr_SetString (PyExc_ValueError, _(
"Invalid length."));
186 if (address == 0 &&
length != 0)
189 _(
"Cannot create a lazy string with address 0x0, " \
190 "and a non-zero length."));
196 PyErr_SetString (PyExc_RuntimeError,
197 _(
"A lazy string's type cannot be NULL."));
202 switch (realtype->
code ())
204 case TYPE_CODE_ARRAY:
206 LONGEST array_length = -1;
207 LONGEST low_bound, high_bound;
210 array_length = high_bound - low_bound + 1;
213 else if (
length != array_length)
215 PyErr_SetString (PyExc_ValueError, _(
"Invalid length."));
228 if (encoding == NULL || !strcmp (encoding,
""))
231 str_obj->
encoding = xstrdup (encoding);
261 struct type *realtype;
263 gdb_assert (
type != NULL);
266 switch (realtype->
code ())
269 case TYPE_CODE_ARRAY:
283 struct type **str_elt_type,
285 gdb::unique_xmalloc_ptr<char> *encoding)
308 opts.addressprint =
false;
317 catch (
const gdb_exception &exc)
331 "Create a (lazy) value that contains a pointer to the string." },
340 {
"type",
stpy_get_type, NULL,
"Type associated with the string.", NULL },
345 PyVarObject_HEAD_INIT (NULL, 0)
365 "GDB lazy string object",
const char * c_str() const
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
static PyObject * stpy_str(PyObject *self)
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 int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_lazy_string(void)
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 host_string_to_python_string(const char *str)
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)
#define CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
#define GDBPY_INITIALIZE_FILE(INIT,...)
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, frame_info_ptr frame)
int val_print_string(struct type *elttype, const char *encoding, CORE_ADDR addr, int len, struct ui_file *stream, const struct value_print_options *options)
void get_user_print_options(struct value_print_options *opts)
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)