+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 Hui Zhu <teawater@gmail.com>
* i386-tdep.c (i386_process_record): Add support for insn
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);
}
{
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;
}
+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.
+
2010-04-07 H.J. Lu <hongjiu.lu@intel.com>
* gdb.arch/i386-avx.c: New.
int *p = a;
int i = 2;
int *ptr_i = &i;
-
+ const char *sn = 0;
s.a = 3;
s.b = 5;
u.a = 7;
gdb_py_test_silent_cmd "python lstr = sptr.lazy_string()" "Aquire lazy string" 1
gdb_test "python print lstr.type" "const char \*." "Test type name equality"
gdb_test "python print sptr.type" "const char \*." "Test type name equality"
+ gdb_test "print sn" "0x0"
+ gdb_py_test_silent_cmd "python snptr = gdb.history (0)" "Get value from history" 1
+ gdb_test "python snstr = snptr.lazy_string(length=5)" ".*Cannot create a lazy string with address.*" "Test lazy string"
+ gdb_py_test_silent_cmd "python snstr = snptr.lazy_string(length=0)" "Succesfully create a lazy string" 1
+ gdb_test "python print snstr.length" "0" "Test lazy string length"
+ gdb_test "python print snstr.address" "0" "Test lazy string address"
}