diff options
author | Phil Muldoon <pmuldoon@redhat.com> | 2010-04-08 10:28:42 +0000 |
---|---|---|
committer | Phil Muldoon <pmuldoon@redhat.com> | 2010-04-08 10:28:42 +0000 |
commit | fff5cc649e7498fe4618557c13b1f98692c2d1f7 (patch) | |
tree | 60b6492f3238f47765eb57efa905b6a230dc250c /gdb/python | |
parent | f8c4f480201a0ec57a9b9597c0ed91e7594c462a (diff) | |
download | gdb-fff5cc649e7498fe4618557c13b1f98692c2d1f7.zip gdb-fff5cc649e7498fe4618557c13b1f98692c2d1f7.tar.gz gdb-fff5cc649e7498fe4618557c13b1f98692c2d1f7.tar.bz2 |
2010-04-08 Phil Muldoon <pmuldoon@redhat.com>
PR python/11417
* python/py-lazy-string.c (stpy_convert_to_value): Check for
a NULL address.
(gdbpy_create_lazy_string_object): Allow strings with a NULL
address and a zero length.
2010-04-08 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-value: Add null string variable.
(test_lazy_string): Test zero length, NULL address lazy
strings.
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-lazy-string.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c index 8309527..a2faa0e 100644 --- a/gdb/python/py-lazy-string.c +++ b/gdb/python/py-lazy-string.c @@ -94,6 +94,13 @@ stpy_convert_to_value (PyObject *self, PyObject *args) lazy_string_object *self_string = (lazy_string_object *) self; struct value *val; + if (self_string->address == 0) + { + PyErr_SetString (PyExc_MemoryError, + "Cannot create a value from NULL"); + return NULL; + } + val = value_at_lazy (self_string->type, self_string->address); return value_to_value_object (val); } @@ -111,10 +118,11 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length, { lazy_string_object *str_obj = NULL; - if (address == 0) + if (address == 0 && length != 0) { PyErr_SetString (PyExc_MemoryError, - "Cannot create a lazy string from a GDB-side string."); + _("Cannot create a lazy string with address 0x0, " \ + "and a non-zero length.")); return NULL; } |