From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org, brobecker@adacore.com
Subject: [rfc] Ada simplification: ada_val_print_1
Date: Thu, 14 May 2009 11:37:00 -0000 [thread overview]
Message-ID: <200905141136.n4EBas1D002964@d12av02.megacenter.de.ibm.com> (raw)
Hello,
another problematic Ada case: ada_val_print_1 initializes a static type
variable to the result of "make_pointer_type" -- which (implicitly today,
but explicitly in the future) depends on an architecture to determine
the size of a pointer. This could break in a multi-arch scenario.
The whole logic there seems to have the sole purpose of printing a
character string stored at some memory location as a result of an
inferior call. We do have a routine val_print_string that should be
able to do just that, without the need to create a dummy type ...
Joel, is this OK?
Bye,
Ulrich
ChangeLog:
* ada-valprint.c (ada_val_print_1): Use val_print_string to print
result of ada_vax_float_print_function inferior call.
Index: gdb-head/gdb/ada-valprint.c
===================================================================
--- gdb-head.orig/gdb/ada-valprint.c
+++ gdb-head/gdb/ada-valprint.c
@@ -739,22 +739,10 @@ ada_val_print_1 (struct type *type, cons
struct value *func = ada_vax_float_print_function (type);
if (func != 0)
{
- static struct type *parray_of_char = NULL;
- struct value *printable_val;
-
- if (parray_of_char == NULL)
- parray_of_char =
- make_pointer_type
- (create_array_type
- (NULL, builtin_type_true_char,
- create_range_type (NULL, builtin_type_int32, 0, 32)), NULL);
-
- printable_val =
- value_ind (value_cast (parray_of_char,
- call_function_by_hand (func, 1,
- &val)));
-
- fprintf_filtered (stream, "%s", value_contents (printable_val));
+ CORE_ADDR addr;
+ addr = value_as_address (call_function_by_hand (func, 1, &val));
+ val_print_string (builtin_type_true_char,
+ addr, -1, stream, options);
return 0;
}
/* No special printing function. Do as best we can. */
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
next reply other threads:[~2009-05-14 11:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-14 11:37 Ulrich Weigand [this message]
2009-05-15 14:48 ` Joel Brobecker
2009-05-18 13:52 ` Ulrich Weigand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200905141136.n4EBas1D002964@d12av02.megacenter.de.ibm.com \
--to=uweigand@de.ibm.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox