public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org, brobecker@adacore.com
Subject: [patch] dwarf2read.c: Don't read pc/line-number mapping for type units
Date: Tue, 10 Jan 2012 03:51:00 -0000	[thread overview]
Message-ID: <20120110014616.957501E25C7@ruffy2.mtv.corp.google.com> (raw)
Message-ID: <20120110035100.4H84Eecn1NtNLV2U_jPhkxIIqqoY1oiTfscOASeMdlE@z> (raw)

Hi.

fyi, I'm checking this in.
Type units don't need the pc/line-number mapping,
and this can save a lot of space.
[There's still a fair bit of wasted space, but that's for another day.
This brings the amount down to a tolerable level.]

Joel: I'd also like to check this into the 7.4 branch.
IMO it's safe enough.

[btw, the cleanup handling of the line header here feels clumsy.
It's accomplished as a side-effect of handle_DW_AT_stmt_list.
It feels cleaner to let the caller decide how it wants to clean things up.
That is also left for another day.]

2012-01-09  Doug Evans  <dje@google.com>

	* dwarf2read.c (handle_DW_AT_stmt_list): Add function comment.
	New arg "want_line_info".  All callers updated.
	(read_file_scope,read_type_unit_scope): Move comment from
	handle_DW_AT_stmt_list to here.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.605
diff -u -p -r1.605 dwarf2read.c
--- dwarf2read.c	9 Jan 2012 17:40:05 -0000	1.605
+++ dwarf2read.c	10 Jan 2012 01:30:13 -0000
@@ -5521,19 +5521,19 @@ find_file_and_directory (struct die_info
     *name = "<unknown>";
 }
 
-/* Handle DW_AT_stmt_list for a compilation unit.  */
+/* Handle DW_AT_stmt_list for a compilation unit or type unit.
+   DIE is the DW_TAG_compile_unit or DW_TAG_type_unit die for CU.
+   COMP_DIR is the compilation directory.
+   WANT_LINE_INFO is non-zero if the pc/line-number mapping is needed.  */
 
 static void
 handle_DW_AT_stmt_list (struct die_info *die, struct dwarf2_cu *cu,
-			const char *comp_dir)
+			const char *comp_dir, int want_line_info)
 {
   struct attribute *attr;
   struct objfile *objfile = cu->objfile;
   bfd *abfd = objfile->obfd;
 
-  /* Decode line number information if present.  We do this before
-     processing child DIEs, so that the line header table is available
-     for DW_AT_decl_file.  */
   attr = dwarf2_attr (die, DW_AT_stmt_list, cu);
   if (attr)
     {
@@ -5545,7 +5545,8 @@ handle_DW_AT_stmt_list (struct die_info 
         {
           cu->line_header = line_header;
           make_cleanup (free_cu_line_header, cu);
-          dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
+	  if (want_line_info)
+	    dwarf_decode_lines (line_header, comp_dir, abfd, cu, NULL);
         }
     }
 }
@@ -5604,7 +5605,10 @@ read_file_scope (struct die_info *die, s
   record_debugformat ("DWARF 2");
   record_producer (cu->producer);
 
-  handle_DW_AT_stmt_list (die, cu, comp_dir);
+  /* Decode line number information if present.  We do this before
+     processing child DIEs, so that the line header table is available
+     for DW_AT_decl_file.  */
+  handle_DW_AT_stmt_list (die, cu, comp_dir, 1);
 
   /* Process all dies in compilation unit.  */
   if (die->child != NULL)
@@ -5707,7 +5711,11 @@ read_type_unit_scope (struct die_info *d
   record_debugformat ("DWARF 2");
   record_producer (cu->producer);
 
-  handle_DW_AT_stmt_list (die, cu, comp_dir);
+  /* Decode line number information if present.  We do this before
+     processing child DIEs, so that the line header table is available
+     for DW_AT_decl_file.
+     We don't need the pc/line-number mapping for type units.  */
+  handle_DW_AT_stmt_list (die, cu, comp_dir, 0);
 
   /* Process the dies in the type unit.  */
   if (die->child == NULL)

             reply	other threads:[~2012-01-10  1:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-10  1:46 Doug Evans [this message]
2012-01-10  3:51 ` Doug Evans
2012-01-10  3:55 ` Joel Brobecker
2012-01-10 21:46   ` Doug Evans
2012-01-11  9:06     ` Joel Brobecker
2012-01-11 19:24       ` Doug Evans

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=20120110014616.957501E25C7@ruffy2.mtv.corp.google.com \
    --to=dje@google.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).