* gdbtypes.c (create_string_type): Receive character type as argument.

* gdbtypes.h (create_string_type): Add character type argument.
        * dwarf2read.c (read_tag_string_type): Pass character type to
	create_string_type.

	* value.h (value_string): Add character type argument.
	* valops.c (value_string): Add character type argument.  Pass it to
	create_string_type.  Do not allocate space in inferior.
	* valarith.c (value_concat): Pass character type to value_string.

	* value.h (value_typed_string): Rename to ...
	(value_cstring): ... this.
	* valops.c (value_typed_string): Rename to ...
	(value_cstring): ... this.
	* c-lang.c (evaluate_subexp_c): Update.

	* python/python-value.c (builtin_type_pychar): New define.
	(convert_value_from_python): Call value_cstring instead
	of value_from_string.
	* value.c (value_from_string): Remove.
	* value.h (value_from_string): Remove.

	* eval.c (evaluate_subexp_standard): Pass character type to
	value_string.  Pass expression architecture to value_nsstring
	and lookup_child_selector.
	* objc-lang.h (lookup_objc_class): Add GDBARCH parameter.
	(lookup_child_selector): Likewise.
	(value_nsstring): Likewise.
	* objc-lang.c (lookup_objc_class): Add GDBARCH parameter.
	Pass character type to value_string..
	(lookup_child_selector): Likewise.
	(value_nsstring): Add GDBARCH parameter, use it instead of
	objfile architecture.  Pass architecture to lookup_objc_class
	and lookup_child_selector. Pass character type to value_string.
	(end_msglist): Pass architecture to lookup_objc_class.
	* objc-exp.y: Pass architecture to lookup_objc_class.
This commit is contained in:
Ulrich Weigand
2009-06-17 18:47:35 +00:00
parent e6c014f28f
commit 3b7538c031
14 changed files with 111 additions and 96 deletions

View File

@@ -1349,7 +1349,7 @@ value_array (int lowbound, int highbound, struct value **elemvec)
}
struct value *
value_typed_string (char *ptr, int len, struct type *char_type)
value_cstring (char *ptr, int len, struct type *char_type)
{
struct value *val;
int lowbound = current_language->string_lower_bound;
@@ -1376,34 +1376,21 @@ value_typed_string (char *ptr, int len, struct type *char_type)
string may contain embedded null bytes. */
struct value *
value_string (char *ptr, int len)
value_string (char *ptr, int len, struct type *char_type)
{
struct value *val;
int lowbound = current_language->string_lower_bound;
int highbound = len / TYPE_LENGTH (char_type);
struct type *rangetype = create_range_type ((struct type *) NULL,
builtin_type_int32,
lowbound,
len + lowbound - 1);
highbound + lowbound - 1);
struct type *stringtype
= create_string_type ((struct type *) NULL, rangetype);
CORE_ADDR addr;
= create_string_type ((struct type *) NULL, char_type, rangetype);
if (current_language->c_style_arrays == 0)
{
val = allocate_value (stringtype);
memcpy (value_contents_raw (val), ptr, len);
return val;
}
/* Allocate space to store the string in the inferior, and then copy
LEN bytes from PTR in gdb to that address in the inferior. */
addr = allocate_space_in_inferior (len);
write_memory (addr, (gdb_byte *) ptr, len);
val = value_at_lazy (stringtype, addr);
return (val);
val = allocate_value (stringtype);
memcpy (value_contents_raw (val), ptr, len);
return val;
}
struct value *