* [gcc patch] DWARF-5: Define DW_IDX_GNU_static and DW_IDX_GNU_external
@ 2017-05-26 18:17 Jan Kratochvil
2017-06-14 19:05 ` Jan Kratochvil
2017-06-23 8:58 ` ping: " Jan Kratochvil
0 siblings, 2 replies; 6+ messages in thread
From: Jan Kratochvil @ 2017-05-26 18:17 UTC (permalink / raw)
To: gcc-patches; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]
Hi,
I missed the DWARF-5 deadline so I have submitted this for DWARF-6
(not yet on http://dwarfstd.org ):
------------------------------------------------------------------------------
.gdb_index contained an attribute for each symbol whether it is DW_AT_external
or not.
/* Whether the symbol is in GLOBAL_BLOCK (== 0) or STATIC_BLOCK (== 1). */
#define GDB_INDEX_SYMBOL_STATIC_SHIFT 31
#define GDB_INDEX_SYMBOL_STATIC_MASK 1
The reason is:
Performance issue with .gdb_index and large numbers of shared libs
https://sourceware.org/bugzilla/show_bug.cgi?id=14125
When .gdb_index is in use there isn't a bit that specifies GLOBAL_BLOCK vs
STATIC_BLOCK, so if something is in STATIC_BLOCK (say "int") it matches so
gdb will expand the symbol table, but the match doesn't take into account
the block kind. So gdb will proceed to expand one symbol table from every
objfile looking for "int" in GLOBAL_BLOCK, finding it, but not using it.
Only after that is done will GDB try STATIC_BLOCK. In a large enough app
(e.g., >1000 shared libs) this is painful.
Proposing and asking for pre-allocation:
DW_IDX_static = 6 = DW_FORM_flag_present = DIE's DW_AT_external is not present
DW_IDX_external = 7 = DW_FORM_flag_present = DIE's DW_AT_external is present
------------------------------------------------------------------------------
If those new DW_IDX_* get allocated in a reasonable time GDB could already use
them, otherwise sending the patch below.
These symbols are both produced and consumed only by GDB, not by GCC.
Jan
[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 4283 bytes --]
include/ChangeLog
2017-05-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset)
(DW_IDX_parent, DW_IDX_type_hash, DW_IDX_lo_user, DW_IDX_hi_user)
(DW_IDX_GNU_static, DW_IDX_GNU_external): New.
* dwarf2.h (DW_IDX, DW_IDX_DUP, DW_FIRST_IDX, DW_END_IDX): New.
(enum dwarf_name_index_attribute): Remove.
(get_DW_IDX_name): New declaration.
libiberty/ChangeLog
2017-05-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarfnames.c (DW_FIRST_IDX, DW_END_IDX, DW_IDX, DW_IDX_DUP): New.
diff --git a/include/dwarf2.def b/include/dwarf2.def
index ea6194e..1f0d50f 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -782,3 +782,15 @@ DW_CFA (DW_CFA_GNU_args_size, 0x2e)
DW_CFA (DW_CFA_GNU_negative_offset_extended, 0x2f)
DW_END_CFA
+
+/* Index attributes in the Abbreviations Table. */
+DW_FIRST_IDX (DW_IDX_compile_unit, 1)
+DW_IDX (DW_IDX_type_unit, 2)
+DW_IDX (DW_IDX_die_offset, 3)
+DW_IDX (DW_IDX_parent, 4)
+DW_IDX (DW_IDX_type_hash, 5)
+DW_IDX_DUP (DW_IDX_lo_user, 0x2000)
+DW_IDX (DW_IDX_hi_user, 0x3fff)
+DW_IDX (DW_IDX_GNU_static, 0x2000)
+DW_IDX (DW_IDX_GNU_external, 0x2001)
+DW_END_IDX
diff --git a/include/dwarf2.h b/include/dwarf2.h
index 9c78880..14b6f22 100644
--- a/include/dwarf2.h
+++ b/include/dwarf2.h
@@ -52,6 +52,8 @@
#define DW_ATE(name, value) , name = value
#define DW_ATE_DUP(name, value) , name = value
#define DW_CFA(name, value) , name = value
+#define DW_IDX(name, value) , name = value
+#define DW_IDX_DUP(name, value) , name = value
#define DW_FIRST_TAG(name, value) enum dwarf_tag { \
name = value
@@ -71,6 +73,9 @@
#define DW_FIRST_CFA(name, value) enum dwarf_call_frame_info { \
name = value
#define DW_END_CFA };
+#define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
+ name = value
+#define DW_END_IDX };
#include "dwarf2.def"
@@ -86,6 +91,8 @@
#undef DW_END_ATE
#undef DW_FIRST_CFA
#undef DW_END_CFA
+#undef DW_FIRST_IDX
+#undef DW_END_IDX
#undef DW_TAG
#undef DW_TAG_DUP
@@ -97,6 +104,8 @@
#undef DW_ATE
#undef DW_ATE_DUP
#undef DW_CFA
+#undef DW_IDX
+#undef DW_IDX_DUP
/* Flag that tells whether entry has a child or not. */
#define DW_children_no 0
@@ -420,18 +429,6 @@ enum dwarf_macro_record_type
DW_MACRO_GNU_hi_user = 0xff
};
-/* Index attributes in the Abbreviations Table. */
-enum dwarf_name_index_attribute
- {
- DW_IDX_compile_unit = 1,
- DW_IDX_type_unit = 2,
- DW_IDX_die_offset = 3,
- DW_IDX_parent = 4,
- DW_IDX_type_hash = 5,
- DW_IDX_lo_user = 0x2000,
- DW_IDX_hi_user = 0x3fff
- };
-
/* Range list entry kinds in .debug_rnglists* section. */
enum dwarf_range_list_entry
{
@@ -524,6 +521,10 @@ extern const char *get_DW_ATE_name (unsigned int enc);
recognized. */
extern const char *get_DW_CFA_name (unsigned int opc);
+/* Return the name of a DW_IDX_ constant, or NULL if the value is not
+ recognized. */
+extern const char *get_DW_IDX_name (unsigned int idx);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/libiberty/dwarfnames.c b/libiberty/dwarfnames.c
index 62563b7..e58d03c 100644
--- a/libiberty/dwarfnames.c
+++ b/libiberty/dwarfnames.c
@@ -59,6 +59,11 @@ Boston, MA 02110-1301, USA. */
switch (opc) { \
DW_CFA (name, value)
#define DW_END_CFA } return 0; }
+#define DW_FIRST_IDX(name, value) \
+ const char *get_DW_IDX_name (unsigned int idx) { \
+ switch (idx) { \
+ DW_IDX (name, value)
+#define DW_END_IDX } return 0; }
#define DW_TAG(name, value) case name: return # name ;
#define DW_TAG_DUP(name, value)
@@ -70,6 +75,8 @@ Boston, MA 02110-1301, USA. */
#define DW_ATE(name, value) case name: return # name ;
#define DW_ATE_DUP(name, value)
#define DW_CFA(name, value) case name: return # name ;
+#define DW_IDX(name, value) case name: return # name ;
+#define DW_IDX_DUP(name, value)
#include "dwarf2.def"
@@ -85,6 +92,8 @@ Boston, MA 02110-1301, USA. */
#undef DW_END_ATE
#undef DW_FIRST_CFA
#undef DW_END_CFA
+#undef DW_FIRST_IDX
+#undef DW_END_IDX
#undef DW_TAG
#undef DW_TAG_DUP
@@ -96,3 +105,5 @@ Boston, MA 02110-1301, USA. */
#undef DW_ATE
#undef DW_ATE_DUP
#undef DW_CFA
+#undef DW_IDX
+#undef DW_IDX_DUP
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [gcc patch] DWARF-5: Define DW_IDX_GNU_static and DW_IDX_GNU_external
2017-05-26 18:17 [gcc patch] DWARF-5: Define DW_IDX_GNU_static and DW_IDX_GNU_external Jan Kratochvil
@ 2017-06-14 19:05 ` Jan Kratochvil
2017-06-23 8:58 ` ping: " Jan Kratochvil
1 sibling, 0 replies; 6+ messages in thread
From: Jan Kratochvil @ 2017-06-14 19:05 UTC (permalink / raw)
To: gcc-patches; +Cc: gdb-patches
On Fri, 26 May 2017 20:14:08 +0200, Jan Kratochvil wrote:
> If those new DW_IDX_* get allocated in a reasonable time GDB could already use
> them, otherwise sending the patch below.
Preallocation of the numbers has been denied by DWARF committee. Therefore
asking for approval of this patch in its DW_IDX_GNU_* posted form.
http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/2017-June/004370.html
Thanks,
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* ping: [gcc patch] DWARF-5: Define DW_IDX_GNU_static and DW_IDX_GNU_external
2017-05-26 18:17 [gcc patch] DWARF-5: Define DW_IDX_GNU_static and DW_IDX_GNU_external Jan Kratochvil
2017-06-14 19:05 ` Jan Kratochvil
@ 2017-06-23 8:58 ` Jan Kratochvil
2017-07-02 7:25 ` ping^2: " Jan Kratochvil
1 sibling, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2017-06-23 8:58 UTC (permalink / raw)
To: gcc-patches; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 896 bytes --]
http://dwarfstd.org/ShowIssue.php?issue=170527.1
170527.1 Jan Kratochvil DW_IDX_* for static/extern symbols Enhancement Open
Section 6.1.1.4.7, pg 147
When a debugger wants to print 'somename' it logically tries to find first 'somename' as an
external symbol in all available libraries. Only if none such external symbol is found the
debugger starts searching for a static 'somename' symbol in those libraries.
This requires to know whether a symbol in .debug_names index has DW_AT_external or not.
Otherwise a lot of needless CU expansions happen. This extension improves performance
gain of the .debug_names index.
(Discovered in an original fix by Doug Evans - GDB Bug 14125.)
Proposing and asking for pre-allocation:
DW_IDX_static = 6 = DW_FORM_flag_present = DIE's DW_AT_external is not present
DW_IDX_external = 7 = DW_FORM_flag_present = DIE's DW_AT_external is present
[-- Attachment #2: 1 --]
[-- Type: text/plain, Size: 4283 bytes --]
include/ChangeLog
2017-05-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset)
(DW_IDX_parent, DW_IDX_type_hash, DW_IDX_lo_user, DW_IDX_hi_user)
(DW_IDX_GNU_static, DW_IDX_GNU_external): New.
* dwarf2.h (DW_IDX, DW_IDX_DUP, DW_FIRST_IDX, DW_END_IDX): New.
(enum dwarf_name_index_attribute): Remove.
(get_DW_IDX_name): New declaration.
libiberty/ChangeLog
2017-05-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarfnames.c (DW_FIRST_IDX, DW_END_IDX, DW_IDX, DW_IDX_DUP): New.
diff --git a/include/dwarf2.def b/include/dwarf2.def
index ea6194e..1f0d50f 100644
--- a/include/dwarf2.def
+++ b/include/dwarf2.def
@@ -782,3 +782,15 @@ DW_CFA (DW_CFA_GNU_args_size, 0x2e)
DW_CFA (DW_CFA_GNU_negative_offset_extended, 0x2f)
DW_END_CFA
+
+/* Index attributes in the Abbreviations Table. */
+DW_FIRST_IDX (DW_IDX_compile_unit, 1)
+DW_IDX (DW_IDX_type_unit, 2)
+DW_IDX (DW_IDX_die_offset, 3)
+DW_IDX (DW_IDX_parent, 4)
+DW_IDX (DW_IDX_type_hash, 5)
+DW_IDX_DUP (DW_IDX_lo_user, 0x2000)
+DW_IDX (DW_IDX_hi_user, 0x3fff)
+DW_IDX (DW_IDX_GNU_static, 0x2000)
+DW_IDX (DW_IDX_GNU_external, 0x2001)
+DW_END_IDX
diff --git a/include/dwarf2.h b/include/dwarf2.h
index 9c78880..14b6f22 100644
--- a/include/dwarf2.h
+++ b/include/dwarf2.h
@@ -52,6 +52,8 @@
#define DW_ATE(name, value) , name = value
#define DW_ATE_DUP(name, value) , name = value
#define DW_CFA(name, value) , name = value
+#define DW_IDX(name, value) , name = value
+#define DW_IDX_DUP(name, value) , name = value
#define DW_FIRST_TAG(name, value) enum dwarf_tag { \
name = value
@@ -71,6 +73,9 @@
#define DW_FIRST_CFA(name, value) enum dwarf_call_frame_info { \
name = value
#define DW_END_CFA };
+#define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
+ name = value
+#define DW_END_IDX };
#include "dwarf2.def"
@@ -86,6 +91,8 @@
#undef DW_END_ATE
#undef DW_FIRST_CFA
#undef DW_END_CFA
+#undef DW_FIRST_IDX
+#undef DW_END_IDX
#undef DW_TAG
#undef DW_TAG_DUP
@@ -97,6 +104,8 @@
#undef DW_ATE
#undef DW_ATE_DUP
#undef DW_CFA
+#undef DW_IDX
+#undef DW_IDX_DUP
/* Flag that tells whether entry has a child or not. */
#define DW_children_no 0
@@ -420,18 +429,6 @@ enum dwarf_macro_record_type
DW_MACRO_GNU_hi_user = 0xff
};
-/* Index attributes in the Abbreviations Table. */
-enum dwarf_name_index_attribute
- {
- DW_IDX_compile_unit = 1,
- DW_IDX_type_unit = 2,
- DW_IDX_die_offset = 3,
- DW_IDX_parent = 4,
- DW_IDX_type_hash = 5,
- DW_IDX_lo_user = 0x2000,
- DW_IDX_hi_user = 0x3fff
- };
-
/* Range list entry kinds in .debug_rnglists* section. */
enum dwarf_range_list_entry
{
@@ -524,6 +521,10 @@ extern const char *get_DW_ATE_name (unsigned int enc);
recognized. */
extern const char *get_DW_CFA_name (unsigned int opc);
+/* Return the name of a DW_IDX_ constant, or NULL if the value is not
+ recognized. */
+extern const char *get_DW_IDX_name (unsigned int idx);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/libiberty/dwarfnames.c b/libiberty/dwarfnames.c
index 62563b7..e58d03c 100644
--- a/libiberty/dwarfnames.c
+++ b/libiberty/dwarfnames.c
@@ -59,6 +59,11 @@ Boston, MA 02110-1301, USA. */
switch (opc) { \
DW_CFA (name, value)
#define DW_END_CFA } return 0; }
+#define DW_FIRST_IDX(name, value) \
+ const char *get_DW_IDX_name (unsigned int idx) { \
+ switch (idx) { \
+ DW_IDX (name, value)
+#define DW_END_IDX } return 0; }
#define DW_TAG(name, value) case name: return # name ;
#define DW_TAG_DUP(name, value)
@@ -70,6 +75,8 @@ Boston, MA 02110-1301, USA. */
#define DW_ATE(name, value) case name: return # name ;
#define DW_ATE_DUP(name, value)
#define DW_CFA(name, value) case name: return # name ;
+#define DW_IDX(name, value) case name: return # name ;
+#define DW_IDX_DUP(name, value)
#include "dwarf2.def"
@@ -85,6 +92,8 @@ Boston, MA 02110-1301, USA. */
#undef DW_END_ATE
#undef DW_FIRST_CFA
#undef DW_END_CFA
+#undef DW_FIRST_IDX
+#undef DW_END_IDX
#undef DW_TAG
#undef DW_TAG_DUP
@@ -96,3 +105,5 @@ Boston, MA 02110-1301, USA. */
#undef DW_ATE
#undef DW_ATE_DUP
#undef DW_CFA
+#undef DW_IDX
+#undef DW_IDX_DUP
^ permalink raw reply [flat|nested] 6+ messages in thread
* ping^2: [gcc patch] DWARF-5: Define DW_IDX_GNU_static and DW_IDX_GNU_external
2017-06-23 8:58 ` ping: " Jan Kratochvil
@ 2017-07-02 7:25 ` Jan Kratochvil
2017-07-02 16:23 ` Jason Merrill
0 siblings, 1 reply; 6+ messages in thread
From: Jan Kratochvil @ 2017-07-02 7:25 UTC (permalink / raw)
To: gcc-patches; +Cc: gdb-patches
http://dwarfstd.org/ShowIssue.php?issue=170527.1
170527.1 Jan Kratochvil DW_IDX_* for static/extern symbols Enhancement Open
Section 6.1.1.4.7, pg 147
When a debugger wants to print 'somename' it logically tries to find first 'somename' as an
external symbol in all available libraries. Only if none such external symbol is found the
debugger starts searching for a static 'somename' symbol in those libraries.
This requires to know whether a symbol in .debug_names index has DW_AT_external or not.
Otherwise a lot of needless CU expansions happen. This extension improves performance
gain of the .debug_names index.
(Discovered in an original fix by Doug Evans - GDB Bug 14125.)
Proposing and asking for pre-allocation:
DW_IDX_static = 6 = DW_FORM_flag_present = DIE's DW_AT_external is not present
DW_IDX_external = 7 = DW_FORM_flag_present = DIE's DW_AT_external is present
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ping^2: [gcc patch] DWARF-5: Define DW_IDX_GNU_static and DW_IDX_GNU_external
2017-07-02 7:25 ` ping^2: " Jan Kratochvil
@ 2017-07-02 16:23 ` Jason Merrill
2017-07-02 20:02 ` [gcc commit] " Jan Kratochvil
0 siblings, 1 reply; 6+ messages in thread
From: Jason Merrill @ 2017-07-02 16:23 UTC (permalink / raw)
To: Jan Kratochvil; +Cc: gcc-patches List, gdb-patches
On Sun, Jul 2, 2017 at 3:25 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> http://dwarfstd.org/ShowIssue.php?issue=170527.1
>
> 170527.1 Jan Kratochvil DW_IDX_* for static/extern symbols Enhancement Open
>
> Section 6.1.1.4.7, pg 147
> When a debugger wants to print 'somename' it logically tries to find first 'somename' as an
> external symbol in all available libraries. Only if none such external symbol is found the
> debugger starts searching for a static 'somename' symbol in those libraries.
>
> This requires to know whether a symbol in .debug_names index has DW_AT_external or not.
> Otherwise a lot of needless CU expansions happen. This extension improves performance
> gain of the .debug_names index.
>
> (Discovered in an original fix by Doug Evans - GDB Bug 14125.)
>
> Proposing and asking for pre-allocation:
> DW_IDX_static = 6 = DW_FORM_flag_present = DIE's DW_AT_external is not present
> DW_IDX_external = 7 = DW_FORM_flag_present = DIE's DW_AT_external is present
I'd suggest "internal" rather than "static". Otherwise the patch looks good.
Jason
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-07-02 20:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26 18:17 [gcc patch] DWARF-5: Define DW_IDX_GNU_static and DW_IDX_GNU_external Jan Kratochvil
2017-06-14 19:05 ` Jan Kratochvil
2017-06-23 8:58 ` ping: " Jan Kratochvil
2017-07-02 7:25 ` ping^2: " Jan Kratochvil
2017-07-02 16:23 ` Jason Merrill
2017-07-02 20:02 ` [gcc commit] " Jan Kratochvil
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).