From 1651aa771c5d90bfcf9456a86670e430b6eb49a7 Mon Sep 17 00:00:00 2001 From: tromey Date: Wed, 7 Jul 2010 17:23:39 +0000 Subject: [PATCH] gcc * doc/tm.texi: Update. * doc/tm.texi.in (SDB and DWARF) : Add @hook. * target.def (want_debug_pub_sections): New hook. * config/darwin.h (TARGET_WANT_DEBUG_PUB_SECTIONS): Define. * dwarf2out.c (add_pubname_string): Check targetm.want_debug_pub_sections. (add_pubname): Likewise. (add_pubtype): Likewise. gcc/testsuite * g++.dg/debug/dwarf2/pubnames-1.C: Make darwin-specific. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161924 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 12 ++++++++++++ gcc/config/darwin.h | 2 ++ gcc/doc/tm.texi | 4 ++++ gcc/doc/tm.texi.in | 2 ++ gcc/dwarf2out.c | 16 +++++++++++----- gcc/target.def | 7 +++++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C | 2 +- 8 files changed, 43 insertions(+), 6 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 832cf30..45e211a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2010-07-07 Tom Tromey + + * doc/tm.texi: Update. + * doc/tm.texi.in (SDB and DWARF) : + Add @hook. + * target.def (want_debug_pub_sections): New hook. + * config/darwin.h (TARGET_WANT_DEBUG_PUB_SECTIONS): Define. + * dwarf2out.c (add_pubname_string): Check + targetm.want_debug_pub_sections. + (add_pubname): Likewise. + (add_pubtype): Likewise. + 2010-07-07 Jie Zhang * genautomata.c (output_automata_list_min_issue_delay_code): diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index a1e805c..6b681ee 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -471,6 +471,8 @@ extern GTY(()) int darwin_ms_struct; #define DEBUG_STR_SECTION "__DWARF,__debug_str,regular,debug" #define DEBUG_RANGES_SECTION "__DWARF,__debug_ranges,regular,debug" +#define TARGET_WANT_DEBUG_PUB_SECTIONS true + /* When generating stabs debugging, use N_BINCL entries. */ #define DBX_USE_BINCL diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 17b582f..cb878af 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -9278,6 +9278,10 @@ line debug info sections. This will result in much more compact line number tables, and hence is desirable if it works. @end defmac +@deftypevr {Target Hook} bool TARGET_WANT_DEBUG_PUB_SECTIONS +True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections should be emitted. These sections are not used on most platforms, and in particular GDB does not use them. +@end deftypevr + @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2}) A C statement to issue assembly directives that create a difference @var{lab1} minus @var{lab2}, using an integer of the given @var{size}. diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index e79341d..bab073e 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -9277,6 +9277,8 @@ line debug info sections. This will result in much more compact line number tables, and hence is desirable if it works. @end defmac +@hook TARGET_WANT_DEBUG_PUB_SECTIONS + @defmac ASM_OUTPUT_DWARF_DELTA (@var{stream}, @var{size}, @var{label1}, @var{label2}) A C statement to issue assembly directives that create a difference @var{lab1} minus @var{lab2}, using an integer of the given @var{size}. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 55fef55..434783a 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -11238,17 +11238,20 @@ dwarf2_name (tree decl, int scope) static void add_pubname_string (const char *str, dw_die_ref die) { - pubname_entry e; + if (targetm.want_debug_pub_sections) + { + pubname_entry e; - e.die = die; - e.name = xstrdup (str); - VEC_safe_push (pubname_entry, gc, pubname_table, &e); + e.die = die; + e.name = xstrdup (str); + VEC_safe_push (pubname_entry, gc, pubname_table, &e); + } } static void add_pubname (tree decl, dw_die_ref die) { - if (TREE_PUBLIC (decl)) + if (targetm.want_debug_pub_sections && TREE_PUBLIC (decl)) { const char *name = dwarf2_name (decl, 1); if (name) @@ -11263,6 +11266,9 @@ add_pubtype (tree decl, dw_die_ref die) { pubname_entry e; + if (!targetm.want_debug_pub_sections) + return; + e.name = NULL; if ((TREE_PUBLIC (decl) || die->die_parent == comp_unit_die) diff --git a/gcc/target.def b/gcc/target.def index 6270925..3eb52a6 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -2337,6 +2337,13 @@ DEFHOOKPOD "", bool, false) +DEFHOOKPOD +(want_debug_pub_sections, + "True if the @code{.debug_pubtypes} and @code{.debug_pubnames} sections\ + should be emitted. These sections are not used on most platforms, and\ + in particular GDB does not use them.", + bool, false) + /* Leave the boolean fields at the end. */ /* Empty macro arguments are undefined in C90, so use an empty macro. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a031acc..189c556 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2010-07-07 Tom Tromey + + * g++.dg/debug/dwarf2/pubnames-1.C: Make darwin-specific. + 2010-07-07 H.J. Lu PR target/44844 diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C index 543439d..18d1df0 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C @@ -1,7 +1,7 @@ // Contributed by Dodji Seketeli // Origin PR debug/39706 +// { dg-do compile { target *-*-darwin* } } // { dg-options "-g -dA -fno-merge-debug-strings" } -// { dg-do compile } // // There should be one debug_pubnames section generated. // On Darwin though, there is also a label pointing at the begining of the -- 2.7.4