Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [commit]: dw2_expand_symtabs_with_filename: ignore type units
Date: Wed, 08 Dec 2010 18:11:00 -0000	[thread overview]
Message-ID: <20101208181053.9444E2461AD@ruffy.mtv.corp.google.com> (raw)

Hi.

fyi, I checked this in.

A supplemental patch is to rename expand_symtabs_with_filename.
expand_code_symtabs_with_filename?
Let me know if you want this change too.

Btw, prior to this patch "break main" on one program here
expanded gdb's memory usage by 2.5G.  :-)

2010-12-08  Doug Evans  <dje@google.com>

	* symfile.h (quick_symbol_functions): Clarify usage of
	expand_symtabs_with_filename.
	* dwarf2read.c (dw2_expand_symtabs_with_filename): Only iterate over
	comp units, not type units.

Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.78
diff -u -p -r1.78 symfile.h
--- symfile.h	24 Nov 2010 19:01:51 -0000	1.78
+++ symfile.h	8 Dec 2010 17:23:17 -0000
@@ -209,7 +209,10 @@ struct quick_symbol_functions
   void (*expand_all_symtabs) (struct objfile *objfile);
 
   /* Read all symbol tables associated with OBJFILE which have the
-     file name FILENAME.  */
+     file name FILENAME.
+     This is for the purposes of examining code only, e.g., expand_line_sal.
+     The routine may ignore debug info that is known to not be useful with
+     code, e.g., DW_TAG_type_unit for dwarf debug info.  */
   void (*expand_symtabs_with_filename) (struct objfile *objfile,
 					const char *filename);
 
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.484
diff -u -p -r1.484 dwarf2read.c
--- dwarf2read.c	8 Dec 2010 17:31:52 -0000	1.484
+++ dwarf2read.c	8 Dec 2010 17:44:00 -0000
@@ -2323,8 +2323,13 @@ dw2_expand_symtabs_with_filename (struct
   int i;
 
   dw2_setup (objfile);
-  for (i = 0; i < (dwarf2_per_objfile->n_comp_units
-		   + dwarf2_per_objfile->n_type_comp_units); ++i)
+
+  /* We don't need to consider type units here.
+     This is only called for examining code, e.g. expand_line_sal.
+     There can be an order of magnitude (or more) more type units
+     than comp units, and we avoid them if we can.  */
+
+  for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
     {
       int j;
       struct dwarf2_per_cu_data *per_cu = dw2_get_cu (i);


             reply	other threads:[~2010-12-08 18:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08 18:11 Doug Evans [this message]
2010-12-08 18:16 ` Doug Evans
2010-12-09 16:39   ` Tom Tromey
2010-12-14  4:03     ` Doug Evans
2010-12-09  8:29 ` Yao Qi
2010-12-09 15:43   ` 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=20101208181053.9444E2461AD@ruffy.mtv.corp.google.com \
    --to=dje@google.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