* [rfc] Minor cleanup to pascal_val_print
@ 2009-05-14 11:34 Ulrich Weigand
2009-05-14 13:59 ` Pierre Muller
0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Weigand @ 2009-05-14 11:34 UTC (permalink / raw)
To: gdb-patches, muller
Hello,
p-valprint.c uses "extract_unsigned_integer" to extract the value of a
reference in order to print it, explicitly using gdbarch_ptr_bit as
length. The corresponding location in the val_print routine of all
other languages (except Ada) simply uses extract_typed_address to get
at that value.
The patch below changes pascal_val_print to do the same thing, getting
rid of a current_gdbarch instance in the process.
Pierre, is there any reason why this would be wrong for Pascal?
Bye,
Ulrich
ChangeLog:
* p-valprint.c (pascal_val_print): Use extract_typed_address
to extract reference value.
Index: gdb-head/gdb/p-valprint.c
===================================================================
--- gdb-head.orig/gdb/p-valprint.c
+++ gdb-head/gdb/p-valprint.c
@@ -251,11 +251,10 @@ pascal_val_print (struct type *type, con
elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (options->addressprint)
{
+ CORE_ADDR addr
+ = extract_typed_address (valaddr + embedded_offset, type);
fprintf_filtered (stream, "@");
- /* Extract the address, assume that it is unsigned. */
- fputs_filtered (paddress (
- extract_unsigned_integer (valaddr + embedded_offset,
- gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT)), stream);
+ fputs_filtered (paddress (addr), stream);
if (options->deref_ref)
fputs_filtered (": ", stream);
}
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [rfc] Minor cleanup to pascal_val_print
2009-05-14 11:34 [rfc] Minor cleanup to pascal_val_print Ulrich Weigand
@ 2009-05-14 13:59 ` Pierre Muller
2009-05-18 13:46 ` Ulrich Weigand
0 siblings, 1 reply; 3+ messages in thread
From: Pierre Muller @ 2009-05-14 13:59 UTC (permalink / raw)
To: 'Ulrich Weigand', gdb-patches
This patch is OK,
even though I am not sure this part can ever be called...
I am not sure that there is an equivalent of C++ reference type
in pascal language... But I might as well be wrong!
Anyhow, I don't want to remove it either,
as it might be useful.
Patch is approved,
please check it in.
Pierre Muller
Pascal language support maintainer for GDB
Pierre
> -----Message d'origine-----
> De : Ulrich Weigand [mailto:uweigand@de.ibm.com]
> Envoyé : Thursday, May 14, 2009 1:34 PM
> À : gdb-patches@sourceware.org; muller@ics.u-strasbg.fr
> Objet : [rfc] Minor cleanup to pascal_val_print
>
> Hello,
>
> p-valprint.c uses "extract_unsigned_integer" to extract the value of a
> reference in order to print it, explicitly using gdbarch_ptr_bit as
> length. The corresponding location in the val_print routine of all
> other languages (except Ada) simply uses extract_typed_address to get
> at that value.
>
> The patch below changes pascal_val_print to do the same thing, getting
> rid of a current_gdbarch instance in the process.
>
> Pierre, is there any reason why this would be wrong for Pascal?
>
> Bye,
> Ulrich
>
>
> ChangeLog:
>
> * p-valprint.c (pascal_val_print): Use extract_typed_address
> to extract reference value.
>
> Index: gdb-head/gdb/p-valprint.c
> ===================================================================
> --- gdb-head.orig/gdb/p-valprint.c
> +++ gdb-head/gdb/p-valprint.c
> @@ -251,11 +251,10 @@ pascal_val_print (struct type *type, con
> elttype = check_typedef (TYPE_TARGET_TYPE (type));
> if (options->addressprint)
> {
> + CORE_ADDR addr
> + = extract_typed_address (valaddr + embedded_offset, type);
> fprintf_filtered (stream, "@");
> - /* Extract the address, assume that it is unsigned. */
> - fputs_filtered (paddress (
> - extract_unsigned_integer (valaddr + embedded_offset,
> - gdbarch_ptr_bit (current_gdbarch) / HOST_CHAR_BIT)),
> stream);
> + fputs_filtered (paddress (addr), stream);
> if (options->deref_ref)
> fputs_filtered (": ", stream);
> }
> --
> Dr. Ulrich Weigand
> GNU Toolchain for Linux on System z and Cell BE
> Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [rfc] Minor cleanup to pascal_val_print
2009-05-14 13:59 ` Pierre Muller
@ 2009-05-18 13:46 ` Ulrich Weigand
0 siblings, 0 replies; 3+ messages in thread
From: Ulrich Weigand @ 2009-05-18 13:46 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
Pierre Muller wrote:
> This patch is OK,
> even though I am not sure this part can ever be called...
>
> I am not sure that there is an equivalent of C++ reference type
> in pascal language... But I might as well be wrong!
> Anyhow, I don't want to remove it either,
> as it might be useful.
>
> Patch is approved,
> please check it in.
I've checked the patch in now, thanks!
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-05-18 13:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-14 11:34 [rfc] Minor cleanup to pascal_val_print Ulrich Weigand
2009-05-14 13:59 ` Pierre Muller
2009-05-18 13:46 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox