@@ -1300,28 +1300,28 @@ calls. This descriptor results in the following DWARF tag:
13001300 Debugging information format
13011301============================
13021302
1303- Debugging Information Extension for Objective C Properties
1303+ Debugging Information Extension for Objective- C Properties
13041304----------------------------------------------------------
13051305
13061306Introduction
13071307^^^^^^^^^^^^
13081308
1309- Objective C provides a simpler way to declare and define accessor methods using
1309+ Objective- C provides a simpler way to declare and define accessor methods using
13101310declared properties. The language provides features to declare a property and
13111311to let compiler synthesize accessor methods.
13121312
1313- The debugger lets developer inspect Objective C interfaces and their instance
1313+ The debugger lets developer inspect Objective- C interfaces and their instance
13141314variables and class variables. However, the debugger does not know anything
1315- about the properties defined in Objective C interfaces. The debugger consumes
1315+ about the properties defined in Objective- C interfaces. The debugger consumes
13161316information generated by compiler in DWARF format. The format does not support
1317- encoding of Objective C properties. This proposal describes DWARF extensions to
1318- encode Objective C properties, which the debugger can use to let developers
1319- inspect Objective C properties.
1317+ encoding of Objective- C properties. This proposal describes DWARF extensions to
1318+ encode Objective- C properties, which the debugger can use to let developers
1319+ inspect Objective- C properties.
13201320
13211321Proposal
13221322^^^^^^^^
13231323
1324- Objective C properties exist separately from class members. A property can be
1324+ Objective- C properties exist separately from class members. A property can be
13251325defined only by "setter" and "getter" selectors, and be calculated anew on each
13261326access. Or a property can just be a direct access to some declared ivar.
13271327Finally it can have an ivar "automatically synthesized" for it by the compiler,
@@ -1624,24 +1624,24 @@ The BUCKETS are an array of offsets to DATA for each hash:
16241624
16251625 So for ``bucket[3] `` in the example above, we have an offset into the table
162616260x000034f0 which points to a chain of entries for the bucket. Each bucket must
1627- contain a next pointer, full 32 bit hash value, the string itself, and the data
1627+ contain a next pointer, full 32- bit hash value, the string itself, and the data
16281628for the current string value.
16291629
16301630.. code-block :: none
16311631
16321632 .------------.
16331633 0x000034f0: | 0x00003500 | next pointer
1634- | 0x12345678 | 32 bit hash
1634+ | 0x12345678 | 32- bit hash
16351635 | "erase" | string value
16361636 | data[n] | HashData for this bucket
16371637 |------------|
16381638 0x00003500: | 0x00003550 | next pointer
1639- | 0x29273623 | 32 bit hash
1639+ | 0x29273623 | 32- bit hash
16401640 | "dump" | string value
16411641 | data[n] | HashData for this bucket
16421642 |------------|
16431643 0x00003550: | 0x00000000 | next pointer
1644- | 0x82638293 | 32 bit hash
1644+ | 0x82638293 | 32- bit hash
16451645 | "main" | string value
16461646 | data[n] | HashData for this bucket
16471647 `------------'
@@ -1650,17 +1650,17 @@ The problem with this layout for debuggers is that we need to optimize for the
16501650negative lookup case where the symbol we're searching for is not present. So
16511651if we were to lookup "``printf ``" in the table above, we would make a 32-bit
16521652hash for "``printf ``", it might match ``bucket[3] ``. We would need to go to
1653- the offset 0x000034f0 and start looking to see if our 32 bit hash matches. To
1653+ the offset 0x000034f0 and start looking to see if our 32- bit hash matches. To
16541654do so, we need to read the next pointer, then read the hash, compare it, and
16551655skip to the next bucket. Each time we are skipping many bytes in memory and
1656- touching new pages just to do the compare on the full 32 bit hash. All of
1656+ touching new pages just to do the compare on the full 32- bit hash. All of
16571657these accesses then tell us that we didn't have a match.
16581658
16591659Name Hash Tables
16601660""""""""""""""""
16611661
16621662To solve the issues mentioned above we have structured the hash tables a bit
1663- differently: a header, buckets, an array of all unique 32 bit hash values,
1663+ differently: a header, buckets, an array of all unique 32- bit hash values,
16641664followed by an array of hash value data offsets, one for each hash value, then
16651665the data for all hash values:
16661666
@@ -1679,11 +1679,11 @@ the data for all hash values:
16791679 `-------------'
16801680
16811681 The ``BUCKETS `` in the name tables are an index into the ``HASHES `` array. By
1682- making all of the full 32 bit hash values contiguous in memory, we allow
1682+ making all of the full 32- bit hash values contiguous in memory, we allow
16831683ourselves to efficiently check for a match while touching as little memory as
1684- possible. Most often checking the 32 bit hash values is as far as the lookup
1684+ possible. Most often checking the 32- bit hash values is as far as the lookup
16851685goes. If it does match, it usually is a match with no collisions. So for a
1686- table with "``n_buckets ``" buckets, and "``n_hashes ``" unique 32 bit hash
1686+ table with "``n_buckets ``" buckets, and "``n_hashes ``" unique 32- bit hash
16871687values, we can clarify the contents of the ``BUCKETS ``, ``HASHES `` and
16881688``OFFSETS `` as:
16891689
@@ -1698,11 +1698,11 @@ values, we can clarify the contents of the ``BUCKETS``, ``HASHES`` and
16981698 | HEADER.header_data_len | uint32_t
16991699 | HEADER_DATA | HeaderData
17001700 |-------------------------|
1701- | BUCKETS | uint32_t[n_buckets] // 32 bit hash indexes
1701+ | BUCKETS | uint32_t[n_buckets] // 32- bit hash indexes
17021702 |-------------------------|
1703- | HASHES | uint32_t[n_hashes] // 32 bit hash values
1703+ | HASHES | uint32_t[n_hashes] // 32- bit hash values
17041704 |-------------------------|
1705- | OFFSETS | uint32_t[n_hashes] // 32 bit offsets to hash value data
1705+ | OFFSETS | uint32_t[n_hashes] // 32- bit offsets to hash value data
17061706 |-------------------------|
17071707 | ALL HASH DATA |
17081708 `-------------------------'
@@ -1761,26 +1761,26 @@ with:
17611761 | |
17621762 |------------|
17631763 0x000034f0: | 0x00001203 | .debug_str ("erase")
1764- | 0x00000004 | A 32 bit array count - number of HashData with name "erase"
1764+ | 0x00000004 | A 32- bit array count - number of HashData with name "erase"
17651765 | 0x........ | HashData[0]
17661766 | 0x........ | HashData[1]
17671767 | 0x........ | HashData[2]
17681768 | 0x........ | HashData[3]
17691769 | 0x00000000 | String offset into .debug_str (terminate data for hash)
17701770 |------------|
17711771 0x00003500: | 0x00001203 | String offset into .debug_str ("collision")
1772- | 0x00000002 | A 32 bit array count - number of HashData with name "collision"
1772+ | 0x00000002 | A 32- bit array count - number of HashData with name "collision"
17731773 | 0x........ | HashData[0]
17741774 | 0x........ | HashData[1]
17751775 | 0x00001203 | String offset into .debug_str ("dump")
1776- | 0x00000003 | A 32 bit array count - number of HashData with name "dump"
1776+ | 0x00000003 | A 32- bit array count - number of HashData with name "dump"
17771777 | 0x........ | HashData[0]
17781778 | 0x........ | HashData[1]
17791779 | 0x........ | HashData[2]
17801780 | 0x00000000 | String offset into .debug_str (terminate data for hash)
17811781 |------------|
17821782 0x00003550: | 0x00001203 | String offset into .debug_str ("main")
1783- | 0x00000009 | A 32 bit array count - number of HashData with name "main"
1783+ | 0x00000009 | A 32- bit array count - number of HashData with name "main"
17841784 | 0x........ | HashData[0]
17851785 | 0x........ | HashData[1]
17861786 | 0x........ | HashData[2]
@@ -1795,13 +1795,13 @@ with:
17951795
17961796 So we still have all of the same data, we just organize it more efficiently for
17971797debugger lookup. If we repeat the same "``printf ``" lookup from above, we
1798- would hash "``printf ``" and find it matches ``BUCKETS[3] `` by taking the 32 bit
1798+ would hash "``printf ``" and find it matches ``BUCKETS[3] `` by taking the 32- bit
17991799hash value and modulo it by ``n_buckets ``. ``BUCKETS[3] `` contains "6" which
18001800is the index into the ``HASHES `` table. We would then compare any consecutive
1801- 32 bit hashes values in the ``HASHES `` array as long as the hashes would be in
1801+ 32- bit hashes values in the ``HASHES `` array as long as the hashes would be in
18021802``BUCKETS[3] ``. We do this by verifying that each subsequent hash value modulo
18031803``n_buckets `` is still 3. In the case of a failed lookup we would access the
1804- memory for ``BUCKETS[3] ``, and then compare a few consecutive 32 bit hashes
1804+ memory for ``BUCKETS[3] ``, and then compare a few consecutive 32- bit hashes
18051805before we know that we have no match. We don't end up marching through
18061806multiple words of memory and we really keep the number of processor data cache
18071807lines being accessed as small as possible.
@@ -1842,10 +1842,10 @@ header is:
18421842 HeaderData header_data; // Implementation specific header data
18431843 };
18441844
1845- The header starts with a 32 bit "``magic ``" value which must be ``'HASH' ``
1845+ The header starts with a 32- bit "``magic ``" value which must be ``'HASH' ``
18461846encoded as an ASCII integer. This allows the detection of the start of the
18471847hash table and also allows the table's byte order to be determined so the table
1848- can be correctly extracted. The "``magic ``" value is followed by a 16 bit
1848+ can be correctly extracted. The "``magic ``" value is followed by a 16- bit
18491849``version `` number which allows the table to be revised and modified in the
18501850future. The current version number is 1. ``hash_function `` is a ``uint16_t ``
18511851enumeration that specifies which hash function was used to produce this table.
@@ -1858,8 +1858,8 @@ The current values for the hash function enumerations include:
18581858 eHashFunctionDJB = 0u, // Daniel J Bernstein hash function
18591859 };
18601860
1861- ``bucket_count `` is a 32 bit unsigned integer that represents how many buckets
1862- are in the ``BUCKETS `` array. ``hashes_count `` is the number of unique 32 bit
1861+ ``bucket_count `` is a 32- bit unsigned integer that represents how many buckets
1862+ are in the ``BUCKETS `` array. ``hashes_count `` is the number of unique 32- bit
18631863hash values that are in the ``HASHES `` array, and is the same number of offsets
18641864are contained in the ``OFFSETS `` array. ``header_data_len `` specifies the size
18651865in bytes of the ``HeaderData `` that is filled in by specialized versions of
@@ -1875,12 +1875,12 @@ The header is followed by the buckets, hashes, offsets, and hash value data.
18751875 struct FixedTable
18761876 {
18771877 uint32_t buckets[Header.bucket_count]; // An array of hash indexes into the "hashes[]" array below
1878- uint32_t hashes [Header.hashes_count]; // Every unique 32 bit hash for the entire table is in this table
1878+ uint32_t hashes [Header.hashes_count]; // Every unique 32- bit hash for the entire table is in this table
18791879 uint32_t offsets[Header.hashes_count]; // An offset that corresponds to each item in the "hashes[]" array above
18801880 };
18811881
1882- ``buckets `` is an array of 32 bit indexes into the ``hashes `` array. The
1883- ``hashes `` array contains all of the 32 bit hash values for all names in the
1882+ ``buckets `` is an array of 32- bit indexes into the ``hashes `` array. The
1883+ ``hashes `` array contains all of the 32- bit hash values for all names in the
18841884hash table. Each hash in the ``hashes `` table has an offset in the ``offsets ``
18851885array that points to the data for the hash value.
18861886
@@ -1967,13 +1967,13 @@ array to be:
19671967 HeaderData.atoms[0].form = DW_FORM_data4;
19681968
19691969 This defines the contents to be the DIE offset (eAtomTypeDIEOffset) that is
1970- encoded as a 32 bit value (DW_FORM_data4). This allows a single name to have
1970+ encoded as a 32- bit value (DW_FORM_data4). This allows a single name to have
19711971multiple matching DIEs in a single file, which could come up with an inlined
19721972function for instance. Future tables could include more information about the
19731973DIE such as flags indicating if the DIE is a function, method, block,
19741974or inlined.
19751975
1976- The KeyType for the DWARF table is a 32 bit string table offset into the
1976+ The KeyType for the DWARF table is a 32- bit string table offset into the
19771977".debug_str" table. The ".debug_str" is the string table for the DWARF which
19781978may already contain copies of all of the strings. This helps make sure, with
19791979help from the compiler, that we reuse the strings between all of the DWARF
@@ -1982,7 +1982,7 @@ compiler generate all strings as DW_FORM_strp in the debug info, is that
19821982DWARF parsing can be made much faster.
19831983
19841984After a lookup is made, we get an offset into the hash data. The hash data
1985- needs to be able to deal with 32 bit hash collisions, so the chunk of data
1985+ needs to be able to deal with 32- bit hash collisions, so the chunk of data
19861986at the offset in the hash data consists of a triple:
19871987
19881988.. code-block :: c
@@ -1992,7 +1992,7 @@ at the offset in the hash data consists of a triple:
19921992 HashData[hash_data_count]
19931993
19941994 If "str_offset" is zero, then the bucket contents are done. 99.9% of the
1995- hash data chunks contain a single item (no 32 bit hash collision):
1995+ hash data chunks contain a single item (no 32- bit hash collision):
19961996
19971997.. code-block :: none
19981998
@@ -2025,7 +2025,7 @@ If there are collisions, you will have multiple valid string offsets:
20252025 `------------'
20262026
20272027 Current testing with real world C++ binaries has shown that there is around 1
2028- 32 bit hash collision per 100,000 name entries.
2028+ 32- bit hash collision per 100,000 name entries.
20292029
20302030Contents
20312031^^^^^^^^
0 commit comments