Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: gdb@sourceware.org
Subject: 29 bits for dwarf2_per_cu_data.length ?
Date: Sun, 28 Sep 2008 20:46:00 -0000	[thread overview]
Message-ID: <20080928204518.2FD9E1C78DF@localhost> (raw)

For my DW_FORM_sig8 work I've found a need to distinguish DW_TAG_type_unit
CUs (or TUs) from normal DW_TAG_compile_unit CUs in dwarf2_per_cu_data.
The easy way is to make length 29 bits.

 struct dwarf2_per_cu_data
 {
-  /* The start offset and length of this compilation unit.  2**30-1
+  /* The start offset and length of this compilation unit.  2**29-1
      bytes should suffice to store the length of any compilation unit
      - if it doesn't, GDB will fall over anyway.  */
   unsigned long offset;
-  unsigned long length : 30;
+  unsigned long length : 29;
+
+  /* Non-zero if this CU is from .debug_types.
+     Otherwise it's from .debug_info.  */
+  unsigned long from_debug_types : 1;
 
That shrinks the maximum size of a CU from 1G to 512M.
I'm guessing it's a non-starter (although 512M for one CU is still a lot),
but before I try something else I thought I'd check.

OTOH, on 64 bit targets there is 32 bits of alignment padding
in dwarf2_per_cu_data.  DIE's are a lot smaller these days, and there
are a whole lot more of them than CUs.
Can I spend a teensy bit of that gain and make dwarf2_per_cu_data 32 bits
bigger for 32-bit targets?


A related question: dwarf2_per_cu_data.offset is 64 bits on 64-bit
targets (unsigned long) and yet most other places only use 32 bits
(unsigned int). E.g., partial_die_info.offset.
Can I change everything to use an unsigned it?


E.g.,

diff -u -p -d -u -r1.284 dwarf2read.c
--- dwarf2read.c	23 Sep 2008 17:36:51 -0000	1.284
+++ dwarf2read.c	28 Sep 2008 20:34:50 -0000
@@ -358,15 +358,13 @@ struct dwarf2_cu
 
 struct dwarf2_per_cu_data
 {
-  /* The start offset and length of this compilation unit.  2**30-1
-     bytes should suffice to store the length of any compilation unit
-     - if it doesn't, GDB will fall over anyway.  */
-  unsigned long offset;
-  unsigned long length : 30;
+  /* The start offset and length of this compilation unit.  */
+  unsigned int offset;
+  unsigned int length;
 
   /* Flag indicating this compilation unit will be read in before
      any of the current compilation units are processed.  */
-  unsigned long queued : 1;
+  unsigned int queued : 1;
 
   /* This flag will be set if we need to load absolutely all DIEs
      for this compilation unit, instead of just the ones we think
@@ -374,6 +372,10 @@ struct dwarf2_per_cu_data
      hash table and don't find it.  */
   unsigned int load_all_dies : 1;
 
+  /* Non-zero if this CU is from .debug_types.
+     Otherwise it's from .debug_info.  */
+  unsigned int from_debug_types : 1;
+
   /* Set iff currently read in.  */
   struct dwarf2_cu *cu;
 


             reply	other threads:[~2008-09-28 20:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-28 20:46 Doug Evans [this message]
2008-09-29 13:39 ` Daniel Jacobowitz

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=20080928204518.2FD9E1C78DF@localhost \
    --to=dje@google.com \
    --cc=gdb@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