aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-lazy-string.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-lazy-string.c')
-rw-r--r--gdb/python/py-lazy-string.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/gdb/python/py-lazy-string.c b/gdb/python/py-lazy-string.c
index 30a171d..1226c28 100644
--- a/gdb/python/py-lazy-string.c
+++ b/gdb/python/py-lazy-string.c
@@ -182,14 +182,6 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
return NULL;
}
- if (address == 0 && length != 0)
- {
- PyErr_SetString (gdbpy_gdb_memory_error,
- _("Cannot create a lazy string with address 0x0, " \
- "and a non-zero length."));
- return NULL;
- }
-
if (!type)
{
PyErr_SetString (PyExc_RuntimeError,
@@ -216,6 +208,23 @@ gdbpy_create_lazy_string_object (CORE_ADDR address, long length,
}
break;
}
+
+ case TYPE_CODE_PTR:
+ if (address == 0)
+ {
+ if (length > 0)
+ {
+ PyErr_SetString (gdbpy_gdb_memory_error,
+ _("Cannot create a lazy string with address 0x0, " \
+ "and a non-zero length."));
+ return nullptr;
+ }
+ length = 0;
+ }
+ break;
+
+ default:
+ gdb_assert_not_reached ("invalid type in gdbpy_create_lazy_string_object");
}
str_obj = PyObject_New (lazy_string_object, &lazy_string_object_type);