Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: gdb-patches@sourceware.org, muller@ics.u-strasbg.fr
Subject: [rfc] Minor cleanup to pascal_val_print
Date: Thu, 14 May 2009 11:34:00 -0000	[thread overview]
Message-ID: <200905141134.n4EBYOaS032369@d12av02.megacenter.de.ibm.com> (raw)

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


             reply	other threads:[~2009-05-14 11:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 11:34 Ulrich Weigand [this message]
2009-05-14 13:59 ` Pierre Muller
2009-05-18 13:46   ` 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=200905141134.n4EBYOaS032369@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=muller@ics.u-strasbg.fr \
    /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