aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2009-06-17 18:47:35 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2009-06-17 18:47:35 +0000
commit3b7538c0317072d430eca4e808b183dac5bd5e45 (patch)
tree5d181808a477c585f4840272098ebd6c8b9f8321 /gdb/valarith.c
parente6c014f28ffa7d52bf7e9b599422f5ca910a17dd (diff)
downloadfsf-binutils-gdb-3b7538c0317072d430eca4e808b183dac5bd5e45.zip
fsf-binutils-gdb-3b7538c0317072d430eca4e808b183dac5bd5e45.tar.gz
fsf-binutils-gdb-3b7538c0317072d430eca4e808b183dac5bd5e45.tar.bz2
* 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.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 57e6194..6f08705 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -624,6 +624,7 @@ value_concat (struct value *arg1, struct value *arg2)
char inchar;
struct type *type1 = check_typedef (value_type (arg1));
struct type *type2 = check_typedef (value_type (arg2));
+ struct type *char_type;
/* First figure out if we are dealing with two values to be concatenated
or a repeat count and a value to be repeated. INVAL1 is set to the
@@ -659,6 +660,7 @@ value_concat (struct value *arg1, struct value *arg2)
ptr = (char *) alloca (count * inval2len);
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
{
+ char_type = type2;
inchar = (char) unpack_long (type2,
value_contents (inval2));
for (idx = 0; idx < count; idx++)
@@ -668,13 +670,14 @@ value_concat (struct value *arg1, struct value *arg2)
}
else
{
+ char_type = TYPE_TARGET_TYPE (type2);
for (idx = 0; idx < count; idx++)
{
memcpy (ptr + (idx * inval2len), value_contents (inval2),
inval2len);
}
}
- outval = value_string (ptr, count * inval2len);
+ outval = value_string (ptr, count * inval2len, char_type);
}
else if (TYPE_CODE (type2) == TYPE_CODE_BITSTRING
|| TYPE_CODE (type2) == TYPE_CODE_BOOL)
@@ -700,10 +703,12 @@ value_concat (struct value *arg1, struct value *arg2)
ptr = (char *) alloca (inval1len + inval2len);
if (TYPE_CODE (type1) == TYPE_CODE_CHAR)
{
+ char_type = type1;
*ptr = (char) unpack_long (type1, value_contents (inval1));
}
else
{
+ char_type = TYPE_TARGET_TYPE (type1);
memcpy (ptr, value_contents (inval1), inval1len);
}
if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
@@ -715,7 +720,7 @@ value_concat (struct value *arg1, struct value *arg2)
{
memcpy (ptr + inval1len, value_contents (inval2), inval2len);
}
- outval = value_string (ptr, inval1len + inval2len);
+ outval = value_string (ptr, inval1len + inval2len, char_type);
}
else if (TYPE_CODE (type1) == TYPE_CODE_BITSTRING
|| TYPE_CODE (type1) == TYPE_CODE_BOOL)