diff options
author | Doug Evans <dje@google.com> | 2012-06-23 22:23:47 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2012-06-23 22:23:47 +0000 |
commit | 156942c7d192e742f3b8cadd132d0a6ded28ebbd (patch) | |
tree | 924acee73ed1fe6b969b011fca48f3514bbed5ad /gdb/doc | |
parent | 0d8b534dde845ba3fedd5c5a3f74f61c696e2a87 (diff) | |
download | gdb-156942c7d192e742f3b8cadd132d0a6ded28ebbd.zip gdb-156942c7d192e742f3b8cadd132d0a6ded28ebbd.tar.gz gdb-156942c7d192e742f3b8cadd132d0a6ded28ebbd.tar.bz2 |
PR 14125
* NEWS: Document additions to .gdb_index.
* dwarf2read.c: #include "gdb/gdb-index.h".
(DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE): New macro.
(DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE): New macro.
(DW2_GDB_INDEX_CU_SET_VALUE): New macro.
(dwarf2_read_index): Recognize version 7.
(dw2_do_expand_symtabs_matching): New args want_specific_block,
block_kind, domain): All callers updated.
(dw2_find_symbol_file): Handle new index CU values.
(dw2_expand_symtabs_matching): Match symbol kind if requested.
(add_index_entry): New args is_static, kind. All callers updated.
(offset_type_compare, uniquify_cu_indices): New functions
(symbol_kind): New function.
(write_psymtabs_to_index): Remove duplicate CU values.
(write_psymtabs_to_index): Write .gdb_index version 7.
doc/
* gdb.texinfo (Index Section Format): Document version 7 format.
include/gdb/
* gdb-index.h: New file.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 98 |
2 files changed, 98 insertions, 4 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 8a3a89f..ebd9584 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2012-06-23 Doug Evans <dje@google.com> + + * gdb.texinfo (Index Section Format): Document version 7 format. + 2012-06-22 Yao Qi <yao@codesourcery.com> * gdb.texinfo: Add missing cindex for some packets. diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index ddee55d..e563303 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -40378,7 +40378,7 @@ index version: @item Version 4 The formula is @code{r = r * 67 + c - 113}. -@item Versions 5 and 6 +@item Versions 5 to 7 The formula is @code{r = r * 67 + tolower (c) - 113}. @end table @@ -40402,13 +40402,103 @@ strings. A CU vector in the constant pool is a sequence of @code{offset_type} values. The first value is the number of CU indices in the vector. -Each subsequent value is the index of a CU in the CU list. This -element in the hash table is used to indicate which CUs define the -symbol. +Each subsequent value is the index and symbol attributes of a CU in +the CU list. This element in the hash table is used to indicate which +CUs define the symbol and how the symbol is used. +See below for the format of each CU index+attributes entry. A string in the constant pool is zero-terminated. @end enumerate +Attributes were added to CU index values in @code{.gdb_index} version 7. +If a symbol has multiple uses within a CU then there is one +CU index+attributes value for each use. + +The format of each CU index+attributes entry is as follows +(bit 0 = LSB): + +@table @asis + +@item Bits 0-23 +This is the index of the CU in the CU list. +@item Bits 24-27 +These bits are reserved for future purposes and must be zero. +@item Bits 28-30 +The kind of the symbol in the CU. + +@table @asis +@item 0 +This value is reserved and should not be used. +By reserving zero the full @code{offset_type} value is backwards compatible +with previous versions of the index. +@item 1 +The symbol is a type. +@item 2 +The symbol is a variable or an enum value. +@item 3 +The symbol is a function. +@item 4 +Any other kind of symbol. +@item 5,6,7 +These values are reserved. +@end table + +@item Bit 31 +This bit is zero if the value is global and one if it is static. + +The determination of whether a symbol is global or static is complicated. +The authorative reference is the file @file{dwarf2read.c} in +@value{GDBN} sources. + +@end table + +This pseudo-code describes the computation of a symbol's kind and +global/static attributes in the index. + +@smallexample +is_external = get_attribute (die, DW_AT_external); +language = get_attribute (cu_die, DW_AT_language); +switch (die->tag) + @{ + case DW_TAG_typedef: + case DW_TAG_base_type: + case DW_TAG_subrange_type: + kind = TYPE; + is_static = 1; + break; + case DW_TAG_enumerator: + kind = VARIABLE; + is_static = (language != CPLUS && language != JAVA); + break; + case DW_TAG_subprogram: + kind = FUNCTION; + is_static = ! (is_external || language == ADA); + break; + case DW_TAG_constant: + kind = VARIABLE; + is_static = ! is_external; + break; + case DW_TAG_variable: + kind = VARIABLE; + is_static = ! is_external; + break; + case DW_TAG_namespace: + kind = TYPE; + is_static = 0; + break; + case DW_TAG_class_type: + case DW_TAG_interface_type: + case DW_TAG_structure_type: + case DW_TAG_union_type: + case DW_TAG_enumeration_type: + kind = TYPE; + is_static = (language != CPLUS && language != JAVA); + break; + default: + assert (0); + @} +@end smallexample + @include gpl.texi @node GNU Free Documentation License |