Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Make SIZE element for dwarf_block as size_t
Date: Sun, 22 Jul 2012 07:47:00 -0000	[thread overview]
Message-ID: <20120722131658.2809309e@spoyarek> (raw)

[-- Attachment #1: Type: text/plain, Size: 953 bytes --]

Hi,

dwarf_block.SIZE should be size_t to accept larger data blocks in case
of DW_FORM_block, since the size of the length of a DW_FORM_block is
not specified and can be anything encoded in a uleb128. The
dwarf2_loclist_baton and dwarf2_locexpr_baton SIZE members also need to
be made size_t just to eliminate splint warnings.

I have run the testsuite on x86_64 to ensure that there are no
regressions. This was part of the bitpos-expand[1] change that I am
currently reviewing and I realized that this could go in as a
separate independent change. Does this look OK to commit?

Thanks,
Siddhesh

gdb/ChangeLog:

2012-07-22  Siddhesh Poyarekar  <siddhesh@redhat.com>

	* dwarf2loc.h (struct dwarf2_locexpr_baton): Make SIZE as
	size_t.
	(struct dwarf2_loclist_baton): Likewise.
	* dwarf2read.c (struct dwarf_block): Likewise.
	(dump_die_shallow): Use pulongest to print dwarf_block.size.

[1] http://sourceware.org/ml/gdb-patches/2012-06/msg00851.html

[-- Attachment #2: dwblock-size.patch --]
[-- Type: text/x-patch, Size: 1652 bytes --]

diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
index e9d06a3..0f2af3c 100644
--- a/gdb/dwarf2loc.h
+++ b/gdb/dwarf2loc.h
@@ -97,7 +97,7 @@ struct dwarf2_locexpr_baton
 
   /* Length of the location expression.  For optimized out expressions it is
      zero.  */
-  unsigned long size;
+  size_t size;
 
   /* The compilation unit containing the symbol whose location
      we're computing.  */
@@ -114,7 +114,7 @@ struct dwarf2_loclist_baton
   const gdb_byte *data;
 
   /* Length of the location list.  */
-  unsigned long size;
+  size_t size;
 
   /* The compilation unit containing the symbol whose location
      we're computing.  */
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 187d1e8..6f671c7 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -887,7 +887,7 @@ struct die_info
 /* Blocks are a bunch of untyped bytes.  */
 struct dwarf_block
   {
-    unsigned int size;
+    size_t size;
 
     /* Valid only if SIZE is not zero.  */
     gdb_byte *data;
@@ -15074,12 +15074,12 @@ dump_die_shallow (struct ui_file *f, int indent, struct die_info *die)
 	case DW_FORM_block4:
 	case DW_FORM_block:
 	case DW_FORM_block1:
-	  fprintf_unfiltered (f, "block: size %d",
-			      DW_BLOCK (&die->attrs[i])->size);
+	  fprintf_unfiltered (f, "block: size %s",
+			      pulongest (DW_BLOCK (&die->attrs[i])->size));
 	  break;
 	case DW_FORM_exprloc:
-	  fprintf_unfiltered (f, "expression: size %u",
-			      DW_BLOCK (&die->attrs[i])->size);
+	  fprintf_unfiltered (f, "expression: size %s",
+			      pulongest (DW_BLOCK (&die->attrs[i])->size));
 	  break;
 	case DW_FORM_ref_addr:
 	  fprintf_unfiltered (f, "ref address: ");

             reply	other threads:[~2012-07-22  7:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-22  7:47 Siddhesh Poyarekar [this message]
2012-07-22  8:28 ` Siddhesh Poyarekar
2012-07-23 14:41   ` Tom Tromey
2012-07-23 17:29     ` Siddhesh Poyarekar
2012-07-23 18:53       ` Tom Tromey
2012-07-25 17:21         ` [PATCH][v2] " Siddhesh Poyarekar
2012-07-25 17:58           ` Tom Tromey

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=20120722131658.2809309e@spoyarek \
    --to=siddhesh@redhat.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