From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7573 invoked by alias); 26 Jun 2012 15:45:22 -0000 Received: (qmail 7559 invoked by uid 22791); 26 Jun 2012 15:45:19 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_BJ,TW_YM,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-vc0-f169.google.com (HELO mail-vc0-f169.google.com) (209.85.220.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jun 2012 15:45:05 +0000 Received: by vcbfl10 with SMTP id fl10so50629vcb.0 for ; Tue, 26 Jun 2012 08:45:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding:x-system-of-record :x-gm-message-state; bh=n0qCEDVvep+EyU51cjM6QXzRwOvtmRo868dYvhYU174=; b=ajE3INpVWrjhHlGKobTJ6jdtgDvL7EqD0lE1Vgi/jkwwk3tmPFrbMFk7j08JYCqr1B OF23HP+4YQkfkdQnEOirJoW/jKT4jBUxZ+RttxAmpLCRelfna6X3hUSEMNIOav4J6SOC x6eMNidfNjlVYVa7s49+s55bJsUugsHqvWOfTp7EltrbmVuynyTQ62nzBc3l+mC9fRnA w5CVO7wPTQi5F9JWg8L2R3oXKkNB0WFuGcSJ8I+apASVjVISI47LvHhMB8+hJTY47U69 j0sMfNYBF793htn2rWnWLHFrUE5OdpEKKhMMfXSpBWgP+9vOT9Oy34dmd6ku1wU9VQ3T 5aGg== Received: by 10.52.66.205 with SMTP id h13mr9373817vdt.131.1340725504437; Tue, 26 Jun 2012 08:45:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.66.205 with SMTP id h13mr9373807vdt.131.1340725504319; Tue, 26 Jun 2012 08:45:04 -0700 (PDT) Received: by 10.52.26.132 with HTTP; Tue, 26 Jun 2012 08:45:04 -0700 (PDT) In-Reply-To: <20120619222645.36C911E26C4@ruffy2.mtv.corp.google.com> References: <20120619222645.36C911E26C4@ruffy2.mtv.corp.google.com> Date: Tue, 26 Jun 2012 15:45:00 -0000 Message-ID: Subject: Re: [doc RFA] "set debug dwarf2-read" and "set debug symtab-create" From: Doug Evans To: eliz@gnu.org Cc: gdb-patches Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-Gm-Message-State: ALoCoQnb/2wMu2d3Di78btr7QcpaKKlKN+3y2F50h9UT2fKS2kIUU1o6UgcPCFay0ZFhEz87h8VT+IfPp9zzv7rtvO+qkWPcXsnK++fWjMfyHZJPHYz9BgFnd7Y3LK73VC78A9kIuFEhH51JmyzvySff7j3IwKnV/idwI1lIgNT/DcgNspZcDDnX48LcmQEjdvlU806csoAM X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00804.txt.bz2 Hi. "Ping." :-) On Tue, Jun 19, 2012 at 3:26 PM, Doug Evans wrote: > Hi. > > I'm committing this after a doc RFA. > [But feel free to suggest changes or enhancements.] > > This adds two options for debugging dwarf2 debug info reading and symbol = table > creation, and adds the beginnings of some useful messages for such. > > 2012-06-19 =A0Doug Evans =A0 > > =A0 =A0 =A0 =A0* NEWS: Mention new options "set debug dwarf2-read" and > =A0 =A0 =A0 =A0"set debug symtab-create". > =A0 =A0 =A0 =A0* dwarf2read.c (dwarf2_read_debug): New static global. > =A0 =A0 =A0 =A0(dwarf2_build_psymtabs_hard): Add debugging printfs. > =A0 =A0 =A0 =A0(process_queue): Ditto. > =A0 =A0 =A0 =A0(process_full_comp_unit): Ditto. > =A0 =A0 =A0 =A0(_initialize_dwarf2_read): Add new option "set debug dwarf= 2-read". > =A0 =A0 =A0 =A0* elfread.c (elf_symfile_read): Add debugging printf. > =A0 =A0 =A0 =A0* minsyms.c (install_minimal_symbols): Ditto. > =A0 =A0 =A0 =A0* psymtab.c (allocate_psymtab): Ditto. > =A0 =A0 =A0 =A0* symfile.c (allocate_symtab): Ditto. > =A0 =A0 =A0 =A0* symtab.c (symtab_create_debug): New global. > =A0 =A0 =A0 =A0(_initialize_symtab): Add new option "set debug symtab-cre= ate". > =A0 =A0 =A0 =A0* symtab.h (symtab_create_debug): Declare. > > =A0 =A0 =A0 =A0doc/ > =A0 =A0 =A0 =A0* gdb.texinfo (Debugging Output): Document debug options d= warf2-read > =A0 =A0 =A0 =A0and symtab-create. > > diff --git a/gdb/NEWS b/gdb/NEWS > index 5450939..e357599 100644 > --- a/gdb/NEWS > +++ b/gdb/NEWS > @@ -462,6 +462,16 @@ tstop [NOTES] > > =A0* New options > > +set debug dwarf2-read > +show debug dwarf2-read > + =A0Turns on or off display of GDB info related to reading DWARF debuggi= ng > + =A0information. =A0The default is off. > + > +set debug symtab-create > +show debug symtab-create > + =A0Turns on or off display of GDB debugging info related to symbol table > + =A0creation. =A0The default is off. > + > =A0set extended-prompt > =A0show extended-prompt > =A0 Set the GDB prompt, and allow escape sequences to be inserted to > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index a14e322..29f7257 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -21741,6 +21741,12 @@ The value is the number of nesting levels to pri= nt. > =A0A value of zero turns off the display. > =A0@item show debug dwarf2-die > =A0Show the current state of DWARF2 DIE debugging. > +@item set debug dwarf2-read > +@cindex DWARF2 Reading > +Turns on or off display of @value{GDBN} info related to reading > +DWARF debugging information. =A0The default is off. > +@item show debug dwarf2-read > +Show the current state of DWARF2 reader debugging. > =A0@item set debug displaced > =A0@cindex displaced stepping debugging info > =A0Turns on or off display of @value{GDBN} debugging info for the > @@ -21838,6 +21844,12 @@ Turns on or off debugging messages for FR-V shar= ed-library code. > =A0@item show debug solib-frv > =A0Display the current state of FR-V shared-library code debugging > =A0messages. > +@item set debug symtab-create > +@cindex Symbol Table Creation > +Turns on or off display of @value{GDBN} debugging info related to > +symbol table creation. =A0The default is off. > +@item show debug symtab-create > +Show the current state of symbol table creation debugging. > =A0@item set debug target > =A0@cindex target debugging info > =A0Turns on or off display of @value{GDBN} target debugging info. This in= fo > diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c > index 097ee7f..d128f77 100644 > --- a/gdb/dwarf2read.c > +++ b/gdb/dwarf2read.c > @@ -81,6 +81,10 @@ > =A0typedef struct symbol *symbolp; > =A0DEF_VEC_P (symbolp); > > +/* When non-zero, print basic high level tracing messages. > + =A0 This is in contrast to the low level DIE reading of dwarf2_die_debu= g. =A0*/ > +static int dwarf2_read_debug =3D 0; > + > =A0/* When non-zero, dump DIEs after they are read in. =A0*/ > =A0static int dwarf2_die_debug =3D 0; > > @@ -4349,6 +4353,12 @@ dwarf2_build_psymtabs_hard (struct objfile *objfil= e) > =A0 struct obstack temp_obstack; > =A0 int i; > > + =A0if (dwarf2_read_debug) > + =A0 =A0{ > + =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, "Building psymtabs of objfil= e %s ...\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 objfile->name); > + =A0 =A0} > + > =A0 dwarf2_per_objfile->reading_partial_symbols =3D 1; > > =A0 dwarf2_read_section (objfile, &dwarf2_per_objfile->info); > @@ -4382,6 +4392,10 @@ dwarf2_build_psymtabs_hard (struct objfile *objfil= e) > =A0 discard_cleanups (addrmap_cleanup); > > =A0 do_cleanups (back_to); > + > + =A0if (dwarf2_read_debug) > + =A0 =A0fprintf_unfiltered (gdb_stdlog, "Done building psymtabs of %s\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 objfile->name); > =A0} > > =A0/* die_reader_func for load_partial_comp_unit. =A0*/ > @@ -5286,6 +5300,13 @@ process_queue (void) > =A0{ > =A0 struct dwarf2_queue_item *item, *next_item; > > + =A0if (dwarf2_read_debug) > + =A0 =A0{ > + =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Expanding one or more = symtabs of objfile %s ...\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwarf2_per_objfile->obj= file->name); > + =A0 =A0} > + > =A0 /* The queue starts out with one item, but following a DIE reference > =A0 =A0 =A0may load a new CU, adding it to the end of the queue. =A0*/ > =A0 for (item =3D dwarf2_queue; item !=3D NULL; dwarf2_queue =3D item =3D= next_item) > @@ -5301,6 +5322,12 @@ process_queue (void) > =A0 =A0 } > > =A0 dwarf2_queue_tail =3D NULL; > + > + =A0if (dwarf2_read_debug) > + =A0 =A0{ > + =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, "Done expanding symtabs of %= s.\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 dwarf2_per_objfile->obj= file->name); > + =A0 =A0} > =A0} > > =A0/* Free all allocated queue entries. =A0This function only releases an= ything if > @@ -5690,6 +5717,14 @@ process_full_comp_unit (struct dwarf2_per_cu_data = *per_cu, > =A0 struct cleanup *back_to, *delayed_list_cleanup; > =A0 CORE_ADDR baseaddr; > > + =A0if (dwarf2_read_debug) > + =A0 =A0{ > + =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Expanding symtab of %s= at offset 0x%x\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 per_cu->is_debug_types = ? "TU" : "CU", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 per_cu->offset.sect_off= ); > + =A0 =A0} > + > =A0 baseaddr =3D ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfi= le)); > > =A0 buildsym_init (); > @@ -5765,6 +5800,14 @@ process_full_comp_unit (struct dwarf2_per_cu_data = *per_cu, > =A0 VEC_safe_push (dwarf2_per_cu_ptr, dwarf2_per_objfile->just_read_cus, = per_cu); > > =A0 do_cleanups (back_to); > + > + =A0if (dwarf2_read_debug) > + =A0 =A0{ > + =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Done expanding symtab = of %s at offset 0x%x\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 per_cu->is_debug_types = ? "TU" : "CU", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 per_cu->offset.sect_off= ); > + =A0 =A0} > =A0} > > =A0/* Process an imported unit DIE. =A0*/ > @@ -18077,6 +18120,15 @@ conversational style, when possible."), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &set_dwarf2_cmdlist, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &show_dwarf2_cmdlist); > > + =A0add_setshow_boolean_cmd ("dwarf2-read", no_class, &dwarf2_read_debug= , _("\ > +Set debugging of the dwarf2 reader."), _("\ > +Show debugging of the dwarf2 reader."), _("\ > +When enabled, debugging messages are printed during dwarf2 reading\n\ > +and symtab expansion."), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &setdebuglist, &sho= wdebuglist); > + > =A0 add_setshow_zinteger_cmd ("dwarf2-die", no_class, &dwarf2_die_debug, = _("\ > =A0Set debugging of the dwarf2 DIE reader."), _("\ > =A0Show debugging of the dwarf2 DIE reader."), _("\ > diff --git a/gdb/elfread.c b/gdb/elfread.c > index 679d081..1edfb27 100644 > --- a/gdb/elfread.c > +++ b/gdb/elfread.c > @@ -1251,6 +1251,13 @@ elf_symfile_read (struct objfile *objfile, int sym= file_flags) > =A0 asymbol **symbol_table =3D NULL, **dyn_symbol_table =3D NULL; > =A0 asymbol *synthsyms; > > + =A0if (symtab_create_debug) > + =A0 =A0{ > + =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Reading minimal symbol= s of objfile %s ...\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 objfile->name); > + =A0 =A0} > + > =A0 init_minimal_symbol_collection (); > =A0 back_to =3D make_cleanup_discard_minimal_symbols (); > > @@ -1443,6 +1450,9 @@ elf_symfile_read (struct objfile *objfile, int symf= ile_flags) > =A0 =A0 =A0 =A0 =A0xfree (debugfile); > =A0 =A0 =A0 =A0} > =A0 =A0 } > + > + =A0if (symtab_create_debug) > + =A0 =A0fprintf_unfiltered (gdb_stdlog, "Done reading minimal symbols.\n= "); > =A0} > > =A0/* Callback to lazily read psymtabs. =A0*/ > diff --git a/gdb/minsyms.c b/gdb/minsyms.c > index d762b2d..1070fff 100644 > --- a/gdb/minsyms.c > +++ b/gdb/minsyms.c > @@ -1167,6 +1167,13 @@ install_minimal_symbols (struct objfile *objfile) > > =A0 if (msym_count > 0) > =A0 =A0 { > + =A0 =A0 =A0if (symtab_create_debug) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Installing %d = minimal symbols of objfile %s.\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 msym_count, obj= file->name); > + =A0 =A0 =A0 } > + > =A0 =A0 =A0 /* Allocate enough space in the obstack, into which we will g= ather the > =A0 =A0 =A0 =A0 =A0bunches of new and existing minimal symbols, sort them= , and then > =A0 =A0 =A0 =A0 =A0compact out the duplicate entries. =A0Once we have a f= inal table, > diff --git a/gdb/psymtab.c b/gdb/psymtab.c > index 647368c..c92cab8 100644 > --- a/gdb/psymtab.c > +++ b/gdb/psymtab.c > @@ -1731,6 +1731,26 @@ allocate_psymtab (const char *filename, struct obj= file *objfile) > =A0 psymtab->next =3D objfile->psymtabs; > =A0 objfile->psymtabs =3D psymtab; > > + =A0if (symtab_create_debug) > + =A0 =A0{ > + =A0 =A0 =A0/* Be a bit clever with debugging messages, and don't print = objfile > + =A0 =A0 =A0 =A0every time, only when it changes. =A0*/ > + =A0 =A0 =A0static char *last_objfile_name =3D NULL; > + > + =A0 =A0 =A0if (last_objfile_name =3D=3D NULL > + =A0 =A0 =A0 =A0 || strcmp (last_objfile_name, objfile->name) !=3D 0) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 xfree (last_objfile_name); > + =A0 =A0 =A0 =A0 last_objfile_name =3D xstrdup (objfile->name); > + =A0 =A0 =A0 =A0 fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Creating one o= r more psymtabs for objfile %s ...\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 last_objfile_na= me); > + =A0 =A0 =A0 } > + =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Created psymtab 0x%lx = for module %s.\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (long) psymtab, filenam= e); > + =A0 =A0} > + > =A0 return (psymtab); > =A0} > > diff --git a/gdb/symfile.c b/gdb/symfile.c > index 37d98d9..01252e2 100644 > --- a/gdb/symfile.c > +++ b/gdb/symfile.c > @@ -2873,6 +2873,26 @@ allocate_symtab (const char *filename, struct objf= ile *objfile) > =A0 symtab->next =3D objfile->symtabs; > =A0 objfile->symtabs =3D symtab; > > + =A0if (symtab_create_debug) > + =A0 =A0{ > + =A0 =A0 =A0/* Be a bit clever with debugging messages, and don't print = objfile > + =A0 =A0 =A0 =A0every time, only when it changes. =A0*/ > + =A0 =A0 =A0static char *last_objfile_name =3D NULL; > + > + =A0 =A0 =A0if (last_objfile_name =3D=3D NULL > + =A0 =A0 =A0 =A0 || strcmp (last_objfile_name, objfile->name) !=3D 0) > + =A0 =A0 =A0 { > + =A0 =A0 =A0 =A0 xfree (last_objfile_name); > + =A0 =A0 =A0 =A0 last_objfile_name =3D xstrdup (objfile->name); > + =A0 =A0 =A0 =A0 fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Creating one o= r more symtabs for objfile %s ...\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 last_objfile_na= me); > + =A0 =A0 =A0 } > + =A0 =A0 =A0fprintf_unfiltered (gdb_stdlog, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "Created symtab 0x%lx f= or module %s.\n", > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (long) symtab, filename= ); > + =A0 =A0} > + > =A0 return (symtab); > =A0} > > diff --git a/gdb/symtab.c b/gdb/symtab.c > index 215c53d..ee37f30 100644 > --- a/gdb/symtab.c > +++ b/gdb/symtab.c > @@ -109,6 +109,9 @@ void _initialize_symtab (void); > > =A0/* */ > > +/* When non-zero, print debugging messages related to symtab creation. = =A0*/ > +int symtab_create_debug =3D 0; > + > =A0/* Non-zero if a file may be known by two different basenames. > =A0 =A0This is the uncommon case, and significantly slows down gdb. > =A0 =A0Default set to "off" to not slow down the common case. =A0*/ > @@ -5014,5 +5017,13 @@ one base name, and gdb will do file name compariso= ns more efficiently."), > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL, NULL, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &setlist, &showlist); > > + =A0add_setshow_boolean_cmd ("symtab-create", no_class, &symtab_create_d= ebug, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0_("Set debugging of = symbol table creation."), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0_("Show debugging of= symbol table creation."), _("\ > +When enabled, debugging messages are printed when building symbol tables= ."), > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &setdebuglist, &sho= wdebuglist); > + > =A0 observer_attach_executable_changed (symtab_observer_executable_change= d); > =A0} > diff --git a/gdb/symtab.h b/gdb/symtab.h > index 8ee187e..57f618d 100644 > --- a/gdb/symtab.h > +++ b/gdb/symtab.h > @@ -1250,6 +1250,8 @@ void fixup_section (struct general_symbol_info *gin= fo, > > =A0struct objfile *lookup_objfile_from_block (const struct block *block); > > +extern int symtab_create_debug; > + > =A0extern int basenames_may_differ; > > =A0int compare_filenames_for_search (const char *filename,