aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/printcmd.c')
-rw-r--r--gdb/printcmd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 17c67ee..9fb2e02 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2220,6 +2220,11 @@ printf_c_string (struct ui_file *stream, const char *format,
int j;
tem = value_as_address (value);
+ if (tem == 0)
+ {
+ fprintf_filtered (stream, format, "(null)");
+ return;
+ }
/* This is a %s argument. Find the length of the string. */
for (j = 0;; j++)
@@ -2260,6 +2265,11 @@ printf_wide_c_string (struct ui_file *stream, const char *format,
gdb_byte *buf = (gdb_byte *) alloca (wcwidth);
tem = value_as_address (value);
+ if (tem == 0)
+ {
+ fprintf_filtered (stream, format, "(null)");
+ return;
+ }
/* This is a %s argument. Find the length of the string. */
for (j = 0;; j += wcwidth)