Stop printing at null char option, from Oliver Meyer

(omeyer@i3.informatik.rwth-aachen.de).
	* valprint.h, valprint.c (stop_print_at_null): New global.
	* valprint.c (_initialize_valprint): New print set subcommand
	"null-stop".
	* c-valprint.c (c_val_print): If stop_print_at_null is on, and
	printing a char	array, adjust the number of chars to print.
This commit is contained in:
Stan Shebs 1994-07-15 23:53:04 +00:00
parent 14c11f4482
commit 0568ccb0ac
3 changed files with 34 additions and 3 deletions

View File

@ -1,3 +1,13 @@
Fri Jul 15 16:43:33 1994 Stan Shebs (shebs@andros.cygnus.com)
Stop printing at null char option, from Oliver Meyer
(omeyer@i3.informatik.rwth-aachen.de).
* valprint.h, valprint.c (stop_print_at_null): New global.
* valprint.c (_initialize_valprint): New print set subcommand
"null-stop".
* c-valprint.c (c_val_print): If stop_print_at_null is on, and
printing a char array, adjust the number of chars to print.
Fri Jul 15 14:33:40 1994 Stan Shebs (shebs@andros.cygnus.com)
From Kevin A. Buettner (kev@cujo.geg.mot.com).

View File

@ -1,6 +1,6 @@
/* Support for printing C values for GDB, the GNU debugger.
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994
Free Software Foundation, Inc.
Free Software Foundation, Inc.
This file is part of GDB.
@ -109,9 +109,26 @@ c_val_print (type, valaddr, address, stream, format, deref_ref, recurse,
print_spaces_filtered (2 + 2 * recurse, stream);
}
/* For an array of chars, print with string syntax. */
if (eltlen == 1 && TYPE_CODE (elttype) == TYPE_CODE_INT
if (eltlen == 1 &&
((TYPE_CODE (elttype) == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
&& (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
&& (format == 0 || format == 's'))
{
/* If requested, look for the first null char and only print
elements up to it. */
if (stop_print_at_null)
{
int temp_len;
/* Look for a NULL char. */
for (temp_len = 0;
valaddr[temp_len]
&& temp_len < len && temp_len < print_max;
temp_len++);
len = temp_len;
}
LA_PRINT_STRING (stream, valaddr, len, 0);
i = len;
}

View File

@ -1,5 +1,6 @@
/* Declarations for value printing routines for GDB, the GNU debugger.
Copyright 1986, 1988, 1989, 1991 Free Software Foundation, Inc.
Copyright 1986, 1988, 1989, 1991, 1992, 1993, 1994
Free Software Foundation, Inc.
This file is part of GDB.
@ -29,8 +30,11 @@ extern int objectprint; /* Controls looking up an object's derived type
using what we find in its vtables. */
extern unsigned int print_max; /* Max # of chars for strings/vectors */
extern int output_format;
extern int stop_print_at_null; /* Stop printing at null char? */
extern void
val_print_array_elements PARAMS ((struct type *, char *, CORE_ADDR, GDB_FILE *,
int, int, int, enum val_prettyprint, int));