mirror of
https://github.com/davea42/libdwarf-code.git
synced 2025-10-14 02:58:29 +08:00
Compare commits
28 Commits
f1506f6321
...
11852a16c4
Author | SHA1 | Date | |
---|---|---|---|
![]() |
11852a16c4 | ||
![]() |
9c638a2135 | ||
![]() |
5956743e11 | ||
![]() |
d958345842 | ||
![]() |
3217f1b257 | ||
![]() |
ec8571a7a0 | ||
![]() |
2bff154986 | ||
![]() |
b1d87d3ebd | ||
![]() |
651ceb7069 | ||
![]() |
85f03e8dc1 | ||
![]() |
c89a5b5381 | ||
![]() |
cda478d9ad | ||
![]() |
24f6d3387c | ||
![]() |
a503fa3bb0 | ||
![]() |
050867385d | ||
![]() |
c76434db74 | ||
![]() |
9f3b8c7804 | ||
![]() |
bef88bf8d5 | ||
![]() |
a5a9232442 | ||
![]() |
5ff80544d4 | ||
![]() |
c64744e948 | ||
![]() |
f8eda5e03c | ||
![]() |
5d4a13a633 | ||
![]() |
df27d0012d | ||
![]() |
a0268d0507 | ||
![]() |
c81b51c4f1 | ||
![]() |
390e33b900 | ||
![]() |
d8b18839e8 |
188
ChangeLog
188
ChangeLog
@@ -1,3 +1,191 @@
|
||||
2025-09-21: David Anderson
|
||||
commit b1d87d3ebd60d0f7ea5269add0f37d1a11fa61c6
|
||||
|
||||
Removing blocks surrounded by #if 0 and #endif.
|
||||
These are obsolete.
|
||||
modified: src/bin/dwarfdump/dwarfdump.c
|
||||
modified: src/bin/dwarfdump/print_loclists_codes.c
|
||||
modified: src/bin/dwarfdump/print_section_groups.c
|
||||
|
||||
2025-09-21: David Anderson
|
||||
commit 651ceb7069b311911152a87efcf7c2fc44925f67
|
||||
|
||||
Altering to fix indents and remove trailing whitespace,
|
||||
resulting in code following the project codingstyle.
|
||||
modified: src/lib/libdwarf/dwarf_form.c
|
||||
modified: src/lib/libdwarf/dwarf_line.c
|
||||
modified: src/lib/libdwarf/dwarf_machoread.c
|
||||
|
||||
Fixes oss fuzz 446356422. A corrupt mach-o
|
||||
object caused writing bogus data into improper
|
||||
memory address.
|
||||
libdwarfbug id: DW202509-001
|
||||
The bug has been in the source for two days.
|
||||
modified: src/lib/libdwarf/dwarf_opaque.h
|
||||
|
||||
2025-09-21: David Anderson
|
||||
commit 85f03e8dc1d2aab1491b869cf18d85df0cea3940
|
||||
|
||||
Correcting indents and trailing whitespace
|
||||
to follow project codingstyle.
|
||||
modified: src/bin/dwarfdump/dd_command_options.c
|
||||
modified: src/bin/dwarfdump/dd_sanitized.c
|
||||
modified: src/bin/dwarfdump/dwarfdump.c
|
||||
modified: src/lib/libdwarf/dwarf_machoread.c
|
||||
|
||||
2025-09-21: David Anderson
|
||||
commit c89a5b5381d68ae8dabe5c29c101657135e50801
|
||||
|
||||
Corrected tentative 2.2.0 release
|
||||
modified: README.md
|
||||
|
||||
2025-09-21: David Anderson
|
||||
commit cda478d9ad9f40eeac07aa7e9d5e54471238a71c
|
||||
|
||||
Mention planned release October 10 for version 2.2.0.
|
||||
modified: README.md
|
||||
Document recent Changes/bug-fixes for 2.2.0.
|
||||
modified: doc/libdwarf.dox
|
||||
|
||||
2025-09-21: David Anderson
|
||||
commit 24f6d3387c8b2c265ad4c69fbe87dd70831236db
|
||||
|
||||
Document the use of normal extensions to the standard
|
||||
for what FORMS can be used in what attributes.
|
||||
modified: src/bin/attr_form/attr_formclass_ext.list
|
||||
Regenerated
|
||||
modified: src/bin/dwarfdump/dwarfdump-af-table-ext.h
|
||||
|
||||
2025-09-19: David Anderson
|
||||
commit a503fa3bb08e26d6c04fbd11eb74eb1f64b59c9e
|
||||
|
||||
Now reads __TEXT segment section data so we can get __text
|
||||
(.text in elf) bounds for line table checks.
|
||||
Made the table of mach-o to elf name transforms
|
||||
better looking.
|
||||
modified: src/lib/libdwarf/dwarf_machoread.c
|
||||
|
||||
2025-09-19: David Anderson
|
||||
commit 050867385de45271b3ed8170ad0bf56924b5b209
|
||||
|
||||
_dwarf_decode_line_string_form() now handles strx forms,
|
||||
this should have been done months ago.
|
||||
Oversight.
|
||||
modified: src/lib/libdwarf/dwarf_line.c
|
||||
|
||||
2025-09-19: David Anderson
|
||||
commit c76434db7482bc9983e164240b9761d42bb75267
|
||||
|
||||
_dwarf_read_str_index_val_itself() has a new argument
|
||||
so callers wanting to know how much space used in the
|
||||
form have that data. Related to reading index
|
||||
(as strx) to resolve the index to find a string
|
||||
modified: src/lib/libdwarf/dwarf_form.c
|
||||
|
||||
2025-09-19: David Anderson
|
||||
commit 9f3b8c7804a3adf5abf02627d57956a7cdf2d9c1
|
||||
|
||||
One internal function now used with dwarf_form.c
|
||||
and dwarf_line.c, so public (not static) now.
|
||||
modified: src/lib/libdwarf/dwarf_opaque.h
|
||||
|
||||
2025-09-19: David Anderson
|
||||
commit bef88bf8d5e7e0564824656c56c546062f1b1f48
|
||||
|
||||
Rearranged a few lines for clarity.
|
||||
modified: src/bin/dwarfdump/dwarfdump.c
|
||||
|
||||
2025-09-08: David Anderson
|
||||
commit a5a92324429e5016aa97b07ba73483735592a8d9
|
||||
|
||||
Up to date with git log
|
||||
modified: ChangeLog
|
||||
|
||||
2025-09-08: David Anderson
|
||||
commit 5ff80544d49da5977ea23cab6cb6382d0e852f54
|
||||
|
||||
Changed a particular error in dwarf_string()
|
||||
report a couple of the relevant values
|
||||
for clarity (same error, just more detail
|
||||
in the error).
|
||||
One user situation encountered the error,
|
||||
see github issue #269.
|
||||
modified: src/lib/libdwarf/dwarf_form.c
|
||||
|
||||
2025-09-08: David Anderson
|
||||
commit c64744e948d13050238e0ecb35efa396d7f95f4b
|
||||
|
||||
Used by LLVM in Macos Sequoia.
|
||||
|
||||
DW_AT_APPLE_sdk
|
||||
DW_FORM_CLASS_STRING
|
||||
|
||||
modified: src/bin/attr_form/attr_formclass_ext.list
|
||||
modified: src/bin/dwarfdump/dwarfdump-af-table-ext.h
|
||||
|
||||
2025-09-07: David Anderson
|
||||
commit f8eda5e03cc549963b21ac99123c006abc928cec
|
||||
|
||||
On Macos, certain extensions of
|
||||
the standard attributes for DW_TAG_compile_unit
|
||||
DW_AT_LLVM_sysroot and DW_AT_APPLE_sdk
|
||||
as well as identifying DW_AT_LLVM_sysroot
|
||||
being of DW_FORM_CLASS_STRING
|
||||
are now in use.
|
||||
Regenerated the .h files to match
|
||||
so -ka does not issue warnings on seeing these now-normal
|
||||
items.
|
||||
modified: src/bin/attr_form/attr_formclass_ext.list
|
||||
modified: src/bin/tag_attr/tag_attr_ext.list
|
||||
modified: src/bin/dwarfdump/dwarfdump-af-table-ext.h
|
||||
modified: src/bin/dwarfdump/dwarfdump-ta-ext-table.h
|
||||
|
||||
2025-09-06: David Anderson
|
||||
commit 5d4a13a633ca13e1075dda09aee091b4a9d8c284
|
||||
|
||||
Added new option for regression testing:
|
||||
now can stop after N fdes.
|
||||
modified: dwarfexample/frame1.c
|
||||
|
||||
2025-09-06: David Anderson
|
||||
commit df27d0012db0e5e4d802aac4cf18c4a021408145
|
||||
|
||||
Up to date with git log.
|
||||
modified: ChangeLog
|
||||
|
||||
2025-09-06: David Anderson
|
||||
commit a0268d0507b010b1a4aa0f4611690fe73b3ccd07
|
||||
|
||||
For DW_EXPR_EXPRESSION set the ru_register as its
|
||||
register number (no longer unknown or SAME_FRAME)
|
||||
modified: src/lib/libdwarf/dwarf_frame.c
|
||||
|
||||
2025-09-06: David Anderson
|
||||
commit c81b51c4f11d226400aa3d538366e5deee56ad5e
|
||||
|
||||
Added explanation about the frame instruction tables
|
||||
for Dwarf_Regtable_Entry3.
|
||||
modified: src/lib/libdwarf/libdwarf.h
|
||||
|
||||
2025-09-06: David Anderson
|
||||
commit 390e33b900670f72965ab302e3a6ba9389450528
|
||||
|
||||
This example is much more complete.
|
||||
modified: src/bin/dwarfexample/frame1.c
|
||||
|
||||
2025-09-02: David Anderson
|
||||
commit d8b18839e8073e0f41d2e794cdbb1b74ee038b02
|
||||
|
||||
Normal update to current month.
|
||||
modified: bugxml/dwarfbug.html
|
||||
modified: bugxml/dwarfbuglohi.html
|
||||
|
||||
2025-08-30: David Anderson
|
||||
commit f1506f63219ca484f79b5153f155a3390659af99
|
||||
|
||||
Up to date with git log
|
||||
modified: ChangeLog
|
||||
|
||||
2025-08-30: David Anderson
|
||||
commit 331433447b76f1b9d269b581565d572ebd15747c
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
# This is libdwarf README.md
|
||||
|
||||
Updated 18 May 2025
|
||||
Updated 19 September 2025
|
||||
|
||||
## Goal
|
||||
Libdwarf has been focused for years
|
||||
@@ -34,6 +34,7 @@ using configure,cmake, and meson.
|
||||
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/7275)
|
||||
|
||||
Version 2.2.0 Tentative 10 October 2025.
|
||||
Version 2.1.0 Released 20 July 2025.
|
||||
Version 2.0.0 Released 20 May 2025.
|
||||
Version 0.12.0 Released 2 April 2025.
|
||||
|
141
bugxml/data.txt
141
bugxml/data.txt
@@ -1,4 +1,145 @@
|
||||
|
||||
id: DW202509-009
|
||||
fuzzer: oss fuzz 446726228
|
||||
datereported: 2025-09-23
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Excessive time in fuzz_debuglink testcase.
|
||||
product: libdwarf
|
||||
description: Vulnerability involving slow access to
|
||||
a corrupted Mach-o object. Where 'command-size' times
|
||||
'command-count' exceeds the size of the object file.
|
||||
The fix for DW202509-002 oss fuzz 446726229
|
||||
also added these checks for error.
|
||||
Been a vulnerability since Mach-o support added in 2018.
|
||||
datefixed: 2025-09-23
|
||||
references: regressiontests/ossfuzz446726228/fuzz_debuglink-4854619680604160
|
||||
gitfixid: 9c638a21357279b9e4b1ee0c4ff7a128c3f1632e 9c638a21357279b9e4b1ee0c4ff7a128c3f1632e
|
||||
tarrelease:
|
||||
endrec: DW202509-009
|
||||
|
||||
|
||||
|
||||
id: DW202509-008
|
||||
fuzzer: oss fuzz 446831123
|
||||
datereported: 2025-09-23
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Excessive time in fuzz_rng testcase.
|
||||
product: libdwarf
|
||||
description:
|
||||
datefixed:
|
||||
references: regressiontests/ossfuzz446831123/
|
||||
gitfixid:
|
||||
tarrelease:
|
||||
endrec: DW202509-008
|
||||
|
||||
|
||||
id: DW202509-007
|
||||
fuzzer: oss fuzz 446735540
|
||||
datereported: 2025-09-23
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Excessive time in fuzz_dnames testcase.
|
||||
product: libdwarf
|
||||
description:
|
||||
datefixed:
|
||||
references: regressiontests/ossfuzz446735540/
|
||||
gitfixid:
|
||||
tarrelease:
|
||||
endrec: DW202509-007
|
||||
|
||||
id: DW202509-006
|
||||
fuzzer: oss fuzz 446856589
|
||||
datereported: 2025-09-23
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Excessive time in fuzz_tie testcase.
|
||||
product: libdwarf
|
||||
description:
|
||||
datefixed:
|
||||
references: regressiontests/ossfuzz446856589/
|
||||
gitfixid:
|
||||
tarrelease:
|
||||
endrec: DW202509-006
|
||||
|
||||
|
||||
|
||||
id: DW202509-005
|
||||
fuzzer: oss fuzz 446746574
|
||||
datereported: 2025-09-23
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Excessive time in fuzz_aranges testcase.
|
||||
product: libdwarf
|
||||
description:
|
||||
datefixed:
|
||||
references: regressiontests/ossfuzz446746574/
|
||||
gitfixid:
|
||||
tarrelease:
|
||||
endrec: DW202509-005
|
||||
|
||||
|
||||
id: DW202509-004
|
||||
fuzzer: oss fuzz 446781574
|
||||
datereported: 2025-09-22
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Excessive time in fuzz_gdbindex testcase.
|
||||
product: libdwarf
|
||||
description:
|
||||
datefixed:
|
||||
references: regressiontests/ossfuzz446781574/
|
||||
gitfixid:
|
||||
tarrelease:
|
||||
endrec: DW202509-004
|
||||
|
||||
|
||||
|
||||
id: DW202509-003
|
||||
fuzzer: oss fuzz 446729093
|
||||
datereported: 2025-09-22
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Excessive time in fuzz_init_binary testcase.
|
||||
product: libdwarf
|
||||
description:
|
||||
datefixed:
|
||||
references: regressiontests/ossfuzz446729093/
|
||||
gitfixid:
|
||||
tarrelease: Predicting 2.2.0
|
||||
endrec: DW202509-003
|
||||
|
||||
id: DW202509-002
|
||||
fuzzer: oss fuzz 446726229
|
||||
datereported: 2025-09-22
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Excessive time in fuzz_globals testcase.
|
||||
product: libdwarf
|
||||
description: A corrupted MacOS objectfile containing
|
||||
segments with unknown strings as the
|
||||
segment name exceeded reasonable bounds on run time.
|
||||
Segment names are defined by the compiler
|
||||
and we now check for valid segment names.
|
||||
This vulnerability has been present since Mach-o
|
||||
object support was added in 2018.
|
||||
We now check that section names are plain ASCII
|
||||
(such are defined by the ABI and compiler-writers.)
|
||||
datefixed: 2025-09-23
|
||||
references: regressiontests/ossfuzz446726229/fuzz_globals-5387186766938112
|
||||
gitfixid: 9c638a21357279b9e4b1ee0c4ff7a128c3f1632e
|
||||
tarrelease: Predicting 2.2.0
|
||||
endrec: DW202509-002
|
||||
|
||||
id: DW202509-001
|
||||
fuzzer: oss fuzz 446356422
|
||||
datereported: 2025-09-19
|
||||
reportedby: David Korczynski
|
||||
vulnerability: Heap buffer overflow loading Mach-o section data
|
||||
product: libdwarf
|
||||
description: A corrupt (fuzzed) Apple Mach-o object file resulted
|
||||
in an overflow in copying object data to internal structures.
|
||||
Possibly leading to crash and denial of service.
|
||||
The bug was present in the code for 2 days.
|
||||
datefixed: 2025-09-21
|
||||
references: regressiontests/ossfuzz446356422/fuzz_crc_32-4931308642172928
|
||||
gitfixid: 651ceb7069b311911152a87efcf7c2fc44925f67
|
||||
tarrelease: predicting 2.2.0
|
||||
endrec: DW202509-001
|
||||
|
||||
id: DW202508-001
|
||||
fuzzer: oss fuzz 437060549
|
||||
datereported: 2025-08-07
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,154 @@
|
||||
<?xml version="1.0" encoding="us-ascii"?>
|
||||
<dwarfbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-009</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446726228</fuzzer>
|
||||
<datereported>2025-09-23</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Excessive time in fuzz_debuglink testcase.
|
||||
</vulnerability>
|
||||
<description></description>
|
||||
<datefixed></datefixed>
|
||||
<references> regressiontests/ossfuzz446726228/
|
||||
</references>
|
||||
<gitfixid></gitfixid>
|
||||
<tarrelease></tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-008</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446831123</fuzzer>
|
||||
<datereported>2025-09-23</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Excessive time in fuzz_rng testcase.
|
||||
</vulnerability>
|
||||
<description></description>
|
||||
<datefixed></datefixed>
|
||||
<references> regressiontests/ossfuzz446831123/
|
||||
</references>
|
||||
<gitfixid></gitfixid>
|
||||
<tarrelease></tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-007</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446735540</fuzzer>
|
||||
<datereported>2025-09-23</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Excessive time in fuzz_dnames testcase.
|
||||
</vulnerability>
|
||||
<description></description>
|
||||
<datefixed></datefixed>
|
||||
<references> regressiontests/ossfuzz446735540/
|
||||
</references>
|
||||
<gitfixid></gitfixid>
|
||||
<tarrelease></tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-006</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446856589</fuzzer>
|
||||
<datereported>2025-09-23</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Excessive time in fuzz_tie testcase.
|
||||
</vulnerability>
|
||||
<description></description>
|
||||
<datefixed></datefixed>
|
||||
<references> regressiontests/ossfuzz446856589/
|
||||
</references>
|
||||
<gitfixid></gitfixid>
|
||||
<tarrelease></tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-005</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446746574</fuzzer>
|
||||
<datereported>2025-09-23</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Excessive time in fuzz_aranges testcase.
|
||||
</vulnerability>
|
||||
<description></description>
|
||||
<datefixed></datefixed>
|
||||
<references> regressiontests/ossfuzz446746574/
|
||||
</references>
|
||||
<gitfixid></gitfixid>
|
||||
<tarrelease></tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-004</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446781574</fuzzer>
|
||||
<datereported>2025-09-22</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Excessive time in fuzz_gdbindex testcase.
|
||||
</vulnerability>
|
||||
<description></description>
|
||||
<datefixed></datefixed>
|
||||
<references> regressiontests/ossfuzz446781574/
|
||||
</references>
|
||||
<gitfixid></gitfixid>
|
||||
<tarrelease></tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-003</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446729093</fuzzer>
|
||||
<datereported>2025-09-22</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Excessive time in fuzz_init_binary testcase.
|
||||
</vulnerability>
|
||||
<description></description>
|
||||
<datefixed></datefixed>
|
||||
<references> regressiontests/ossfuzz446729093/
|
||||
</references>
|
||||
<gitfixid></gitfixid>
|
||||
<tarrelease></tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-002</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446726229</fuzzer>
|
||||
<datereported>2025-09-22</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Excessive time in fuzz_globals testcase.
|
||||
</vulnerability>
|
||||
<description></description>
|
||||
<datefixed></datefixed>
|
||||
<references> regressiontests/ossfuzz446726229/
|
||||
</references>
|
||||
<gitfixid></gitfixid>
|
||||
<tarrelease></tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202509-001</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 446356422</fuzzer>
|
||||
<datereported>2025-09-19</datereported>
|
||||
<reportedby>David Korczynski</reportedby>
|
||||
<product>libdwarf</product>
|
||||
<vulnerability> Heap buffer overflow loading Mach-o section data
|
||||
</vulnerability>
|
||||
<description> A corrupt (fuzzed) Apple Mach-o object file resulted
|
||||
in an overflow in copying object data to internal structures.
|
||||
Possibly leading to crash and denial of service.
|
||||
The bug was present in the code for 2 days.
|
||||
</description>
|
||||
<datefixed>2025-09-21</datefixed>
|
||||
<references> regressiontests/ossfuzz446356422/fuzz_crc_32-4931308642172928
|
||||
</references>
|
||||
<gitfixid>651ceb7069b311911152a87efcf7c2fc44925f67</gitfixid>
|
||||
<tarrelease>predicting 2.2.0</tarrelease>
|
||||
</dwbug>
|
||||
<dwbug>
|
||||
<dwid>DW202508-001</dwid>
|
||||
<cve></cve>
|
||||
<fuzzer>oss fuzz 437060549</fuzzer>
|
||||
|
@@ -48,8 +48,8 @@ Vulnerabilities <a href="./dwarfbug.html">listed newest-first</a>.
|
||||
Vulnerabilities <a href="./dwarfbuglohi.html">listed oldest-first</a>.
|
||||
</p>
|
||||
<H2>LibDwarf Vulnerabilities Oldest First</H2>
|
||||
</p>as of August 2025</p>
|
||||
<p> Record count: 203 </p>
|
||||
</p>as of September 2025</p>
|
||||
<p> Record count: 212 </p>
|
||||
<h3 id="DW201412-001">1) DW201412-001</h3>
|
||||
<p>id: DW201412-001
|
||||
</p>
|
||||
@@ -6712,6 +6712,202 @@ Vulnerabilities <a href="./dwarfbuglohi.html">listed oldest-first</a>.
|
||||
<p>tarrelease: predicting 2.2.0
|
||||
</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-001">204) DW202509-001</h3>
|
||||
<p>id: DW202509-001
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446356422
|
||||
</p>
|
||||
<p>datereported: 2025-09-19
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Heap buffer overflow loading Mach-o section data
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description: A corrupt (fuzzed) Apple Mach-o object file resulted
|
||||
in an overflow in copying object data to internal structures.
|
||||
Possibly leading to crash and denial of service.
|
||||
The bug was present in the code for 2 days.
|
||||
</p>
|
||||
<p>datefixed: 2025-09-21
|
||||
</p>
|
||||
<p>references: regressiontests/ossfuzz446356422/fuzz_crc_32-4931308642172928
|
||||
</p>
|
||||
<p>gitfixid: 651ceb7069b311911152a87efcf7c2fc44925f67
|
||||
</p>
|
||||
<p>tarrelease: predicting 2.2.0
|
||||
</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-002">205) DW202509-002</h3>
|
||||
<p>id: DW202509-002
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446726229
|
||||
</p>
|
||||
<p>datereported: 2025-09-22
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Excessive time in fuzz_globals testcase.
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description:</p>
|
||||
<p>datefixed:</p>
|
||||
<p>references: regressiontests/ossfuzz446726229/
|
||||
</p>
|
||||
<p>gitfixid:</p>
|
||||
<p>tarrelease:</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-003">206) DW202509-003</h3>
|
||||
<p>id: DW202509-003
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446729093
|
||||
</p>
|
||||
<p>datereported: 2025-09-22
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Excessive time in fuzz_init_binary testcase.
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description:</p>
|
||||
<p>datefixed:</p>
|
||||
<p>references: regressiontests/ossfuzz446729093/
|
||||
</p>
|
||||
<p>gitfixid:</p>
|
||||
<p>tarrelease:</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-004">207) DW202509-004</h3>
|
||||
<p>id: DW202509-004
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446781574
|
||||
</p>
|
||||
<p>datereported: 2025-09-22
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Excessive time in fuzz_gdbindex testcase.
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description:</p>
|
||||
<p>datefixed:</p>
|
||||
<p>references: regressiontests/ossfuzz446781574/
|
||||
</p>
|
||||
<p>gitfixid:</p>
|
||||
<p>tarrelease:</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-005">208) DW202509-005</h3>
|
||||
<p>id: DW202509-005
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446746574
|
||||
</p>
|
||||
<p>datereported: 2025-09-23
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Excessive time in fuzz_aranges testcase.
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description:</p>
|
||||
<p>datefixed:</p>
|
||||
<p>references: regressiontests/ossfuzz446746574/
|
||||
</p>
|
||||
<p>gitfixid:</p>
|
||||
<p>tarrelease:</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-006">209) DW202509-006</h3>
|
||||
<p>id: DW202509-006
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446856589
|
||||
</p>
|
||||
<p>datereported: 2025-09-23
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Excessive time in fuzz_tie testcase.
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description:</p>
|
||||
<p>datefixed:</p>
|
||||
<p>references: regressiontests/ossfuzz446856589/
|
||||
</p>
|
||||
<p>gitfixid:</p>
|
||||
<p>tarrelease:</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-007">210) DW202509-007</h3>
|
||||
<p>id: DW202509-007
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446735540
|
||||
</p>
|
||||
<p>datereported: 2025-09-23
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Excessive time in fuzz_dnames testcase.
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description:</p>
|
||||
<p>datefixed:</p>
|
||||
<p>references: regressiontests/ossfuzz446735540/
|
||||
</p>
|
||||
<p>gitfixid:</p>
|
||||
<p>tarrelease:</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-008">211) DW202509-008</h3>
|
||||
<p>id: DW202509-008
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446831123
|
||||
</p>
|
||||
<p>datereported: 2025-09-23
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Excessive time in fuzz_rng testcase.
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description:</p>
|
||||
<p>datefixed:</p>
|
||||
<p>references: regressiontests/ossfuzz446831123/
|
||||
</p>
|
||||
<p>gitfixid:</p>
|
||||
<p>tarrelease:</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<h3 id="DW202509-009">212) DW202509-009</h3>
|
||||
<p>id: DW202509-009
|
||||
</p>
|
||||
<p>cve:</p>
|
||||
<p>fuzzer: oss fuzz 446726228
|
||||
</p>
|
||||
<p>datereported: 2025-09-23
|
||||
</p>
|
||||
<p>reportedby: David Korczynski
|
||||
</p>
|
||||
<p>vulnerability: Excessive time in fuzz_debuglink testcase.
|
||||
</p>
|
||||
<p>product: libdwarf
|
||||
</p>
|
||||
<p>description:</p>
|
||||
<p>datefixed:</p>
|
||||
<p>references: regressiontests/ossfuzz446726228/
|
||||
</p>
|
||||
<p>gitfixid:</p>
|
||||
<p>tarrelease:</p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
<p> <a href="#top">[top]</a> </p>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
@tableofcontents{HTML:3,LaTeX:3}
|
||||
@author David Anderson
|
||||
@copyright This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
|
||||
@date 2025-08-07 v2.2.0
|
||||
@date 2025-09-21 v2.2.0
|
||||
|
||||
@section draft Suggestions for improvement are welcome.
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
Anything else you find misleading or confusing?
|
||||
Send suggestions to ( libdwarf (at)
|
||||
linuxmail with final characters .org ) Sorry
|
||||
about the simple obfuscation to keep bots
|
||||
away.
|
||||
linuxmail with final characters .org ).
|
||||
Sorry about the simple obfuscation to keep bots away.
|
||||
|
||||
Thanks in advance for any suggestions.
|
||||
|
||||
@@ -1168,12 +1167,18 @@
|
||||
enabling access to all the fields relevant in
|
||||
DWARF6 DW_AT_language_version attributes.
|
||||
|
||||
In builds using (for example) -std=c99
|
||||
In builds using (for example) cc -std=c99
|
||||
gcc will turn off visibility of
|
||||
strdup() in string.h leading to
|
||||
a build failure. So now we
|
||||
define _GNU_SOURCE in builds.
|
||||
|
||||
Corrected a bug in reading line table data
|
||||
that used DW_FORM_strx (and other strx forms).
|
||||
|
||||
Fixed a failure to handle a corrupted Apple Mach-o object
|
||||
file.
|
||||
|
||||
<b>Changes 2.0.0 to 2.1.0</b>
|
||||
|
||||
Released 20 July 2025
|
||||
|
@@ -68,6 +68,7 @@ DW_AT_APPLE_major_runtime_vers
|
||||
|
||||
0xffffffff
|
||||
DW_AT_APPLE_omit_frame_ptr
|
||||
DW_FORM_CLASS_FLAG
|
||||
|
||||
0xffffffff
|
||||
DW_AT_APPLE_optimized
|
||||
@@ -75,6 +76,10 @@ DW_AT_APPLE_optimized
|
||||
0xffffffff
|
||||
DW_AT_APPLE_runtime_class
|
||||
|
||||
0xffffffff
|
||||
DW_AT_APPLE_sdk
|
||||
DW_FORM_CLASS_STRING
|
||||
|
||||
0xffffffff
|
||||
DW_AT_GNAT_descriptive_type
|
||||
|
||||
@@ -249,6 +254,10 @@ DW_AT_HP_prof_version_id
|
||||
0xffffffff
|
||||
DW_AT_INTEL_other_endian
|
||||
|
||||
0xffffffff
|
||||
DW_AT_LLVM_sysroot
|
||||
DW_FORM_CLASS_STRING
|
||||
|
||||
0xffffffff
|
||||
DW_AT_MIPS_abstract_name
|
||||
DW_FORM_CLASS_STRING
|
||||
|
@@ -2775,14 +2775,14 @@ lacking_normal_args (int argct,char **args)
|
||||
const char *
|
||||
process_args(int argc, char *argv[])
|
||||
{
|
||||
/* If building for a regression test run
|
||||
on msys2 (and everywhere) , use fixed
|
||||
name, fullname instead of argv[0], so tests pass
|
||||
identically in all supported environments */
|
||||
/* If building for a regression test run
|
||||
on msys2 (and everywhere) , use fixed
|
||||
name, fullname instead of argv[0], so tests pass
|
||||
identically in all supported environments */
|
||||
#ifdef DWREGRESSIONTEMP
|
||||
/* for the benefit of testing on msys2 so names
|
||||
match. We do it for all platforms for
|
||||
full consistency. */
|
||||
match. We do it for all platforms for
|
||||
full consistency. */
|
||||
glflags.program_name = "./dwarfdump";
|
||||
glflags.program_fullname = "./dwarfdump";
|
||||
#else /* ! DWREGRESSIONTEMP */
|
||||
|
@@ -71,7 +71,8 @@ print_language_version_table(void)
|
||||
if (res == DW_DLV_NO_ENTRY) {
|
||||
break;
|
||||
}
|
||||
res = dwarf_get_LNAME_name(language_name,
|
||||
res = dwarf_get_LNAME_name(
|
||||
(unsigned int)language_name,
|
||||
&language_name_string);
|
||||
if (res == DW_DLV_NO_ENTRY) {
|
||||
language_name_string = "<unknown>";
|
||||
|
@@ -293,26 +293,26 @@ static int
|
||||
look_for_substr(const char *s,const char *match,
|
||||
int matchlen)
|
||||
{
|
||||
const char *cp = s;
|
||||
int remaining = strlen(s);
|
||||
const char *cp = s;
|
||||
int remaining = strlen(s);
|
||||
|
||||
if (remaining < matchlen) {
|
||||
return -1;
|
||||
}
|
||||
for ( ; *cp ; ++cp,--remaining) {
|
||||
if (*cp != match[0]) {
|
||||
continue;
|
||||
}
|
||||
if (remaining < matchlen) {
|
||||
/* No match possible */
|
||||
return -1;
|
||||
}
|
||||
if (strncmp(cp,match,matchlen)) {
|
||||
continue;
|
||||
}
|
||||
return (int)(cp - s);
|
||||
}
|
||||
return -1;
|
||||
if (remaining < matchlen) {
|
||||
return -1;
|
||||
}
|
||||
for ( ; *cp ; ++cp,--remaining) {
|
||||
if (*cp != match[0]) {
|
||||
continue;
|
||||
}
|
||||
if (remaining < matchlen) {
|
||||
/* No match possible */
|
||||
return -1;
|
||||
}
|
||||
if (strncmp(cp,match,matchlen)) {
|
||||
continue;
|
||||
}
|
||||
return (int)(cp - s);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/* This makes the simplifying assumption that
|
||||
a Windows path will only appear once in a string,
|
||||
@@ -320,20 +320,20 @@ look_for_substr(const char *s,const char *match,
|
||||
static Dwarf_Bool
|
||||
fullpathtohome(const char *s,struct esb_s *out)
|
||||
{
|
||||
int pos = -1;
|
||||
const char *match="C:/msys64/davea/home/admin";
|
||||
size_t strlenmatch = strlen(match);
|
||||
int pos = -1;
|
||||
const char *match="C:/msys64/davea/home/admin";
|
||||
size_t strlenmatch = strlen(match);
|
||||
|
||||
pos = look_for_substr(s,match,(int)strlenmatch);
|
||||
if (pos < 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (pos > 0) {
|
||||
esb_appendn(out,s,pos);
|
||||
}
|
||||
esb_append(out,"$HOME");
|
||||
esb_append(out,s+strlenmatch);
|
||||
return TRUE;
|
||||
pos = look_for_substr(s,match,(int)strlenmatch);
|
||||
if (pos < 0) {
|
||||
return FALSE;
|
||||
}
|
||||
if (pos > 0) {
|
||||
esb_appendn(out,s,pos);
|
||||
}
|
||||
esb_append(out,"$HOME");
|
||||
esb_append(out,s+strlenmatch);
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* DWREGRESSIONTEMP */
|
||||
|
||||
@@ -357,24 +357,24 @@ sanitized(const char *s)
|
||||
Dwarf_Bool changed = FALSE;
|
||||
switch (usehomeifynum) {
|
||||
case 0:
|
||||
hsp = &localhomeifya;
|
||||
usehomeifynum = 1;
|
||||
break;
|
||||
hsp = &localhomeifya;
|
||||
usehomeifynum = 1;
|
||||
break;
|
||||
case 1:
|
||||
hsp = &localhomeifyb;
|
||||
usehomeifynum = 2;
|
||||
break;
|
||||
hsp = &localhomeifyb;
|
||||
usehomeifynum = 2;
|
||||
break;
|
||||
case 2:
|
||||
hsp = &localhomeifyc;
|
||||
usehomeifynum = 0;
|
||||
break;
|
||||
hsp = &localhomeifyc;
|
||||
usehomeifynum = 0;
|
||||
break;
|
||||
default: /* Impossible! */
|
||||
hsp = &localhomeifya;
|
||||
usehomeifynum = 1;
|
||||
break;
|
||||
hsp = &localhomeifya;
|
||||
usehomeifynum = 1;
|
||||
break;
|
||||
}
|
||||
esb_empty_string(hsp);
|
||||
changed = fullpathtohome(s,hsp);
|
||||
changed = fullpathtohome(s,hsp);
|
||||
if (changed) {
|
||||
s = (const char *)esb_get_string(hsp);
|
||||
}
|
||||
@@ -408,21 +408,21 @@ sanitized(const char *s)
|
||||
#endif /* TESTING */
|
||||
switch (usebufnum) {
|
||||
case 0:
|
||||
lsp = &localesba;
|
||||
usebufnum = 1;
|
||||
break;
|
||||
lsp = &localesba;
|
||||
usebufnum = 1;
|
||||
break;
|
||||
case 1:
|
||||
lsp = &localesbb;
|
||||
usebufnum = 2;
|
||||
break;
|
||||
lsp = &localesbb;
|
||||
usebufnum = 2;
|
||||
break;
|
||||
case 2:
|
||||
lsp = &localesbc;
|
||||
usebufnum = 0;
|
||||
break;
|
||||
lsp = &localesbc;
|
||||
usebufnum = 0;
|
||||
break;
|
||||
default: /* Impossible! */
|
||||
lsp = &localesba;
|
||||
usebufnum = 1;
|
||||
break;
|
||||
lsp = &localesba;
|
||||
usebufnum = 1;
|
||||
break;
|
||||
}
|
||||
esb_empty_string(lsp);
|
||||
do_sanity_insert(s,lsp);
|
||||
|
@@ -21,8 +21,11 @@ struct Three_Key_Entry_s dd_threekey_af_table_ext [] = {
|
||||
/* 0x3fe3 DW_AT_APPLE_isa */
|
||||
/* 0x3fe5 DW_AT_APPLE_major_runtime_vers */
|
||||
/* 0x3fe7 DW_AT_APPLE_omit_frame_ptr */
|
||||
{0x3fe7,0x0005,0,2,0,0},
|
||||
/* 0x3fe1 DW_AT_APPLE_optimized */
|
||||
/* 0x3fe6 DW_AT_APPLE_runtime_class */
|
||||
/* 0x3fef DW_AT_APPLE_sdk */
|
||||
{0x3fef,0x000b,0,2,0,0},
|
||||
/* 0x2302 DW_AT_GNAT_descriptive_type */
|
||||
/* 0x2133 DW_AT_GNU_addr_base */
|
||||
{0x2133,0x000e,0,2,0,0},
|
||||
@@ -93,6 +96,8 @@ struct Three_Key_Entry_s dd_threekey_af_table_ext [] = {
|
||||
/* 0x201a DW_AT_HP_linkage_name */
|
||||
/* 0x2015 DW_AT_HP_prof_version_id */
|
||||
/* 0x2026 DW_AT_INTEL_other_endian */
|
||||
/* 0x3e02 DW_AT_LLVM_sysroot */
|
||||
{0x3e02,0x000b,0,2,0,0},
|
||||
/* 0x2009 DW_AT_MIPS_abstract_name */
|
||||
{0x2009,0x000b,0,2,0,0},
|
||||
/* 0x200f DW_AT_MIPS_allocatable_dopetype */
|
||||
|
@@ -8,6 +8,7 @@ struct Three_Key_Entry_s dd_threekey_ta_ext [] = {
|
||||
{0x0013,0x2007,0,2,0,0},
|
||||
/* 0x11 - DW_TAG_compile_unit */
|
||||
{0x0011,0x3fe1,0,2,0,0},
|
||||
{0x0011,0x3fef,0,2,0,0},
|
||||
{0x0011,0x2131,0,2,0,0},
|
||||
{0x0011,0x2134,0,2,0,0},
|
||||
{0x0011,0x2135,0,2,0,0},
|
||||
@@ -15,6 +16,7 @@ struct Three_Key_Entry_s dd_threekey_ta_ext [] = {
|
||||
{0x0011,0x2132,0,2,0,0},
|
||||
{0x0011,0x2133,0,2,0,0},
|
||||
{0x0011,0x2119,0,2,0,0},
|
||||
{0x0011,0x3e02,0,2,0,0},
|
||||
/* 0x4a - DW_TAG_skeleton_unit */
|
||||
{0x004a,0x2131,0,2,0,0},
|
||||
{0x004a,0x2134,0,2,0,0},
|
||||
|
@@ -558,7 +558,7 @@ main(int argc, char *argv[])
|
||||
homeify((char *)tied_file_name,&m);
|
||||
printf(
|
||||
"%s ERROR: tied file not an object file '%s'.\n",
|
||||
glflags.program_name,
|
||||
glflags.program_name,
|
||||
sanitized(esb_get_string(&m)));
|
||||
esb_destructor(&m);
|
||||
}
|
||||
@@ -1024,15 +1024,7 @@ calculate_likely_limits_of_code(Dwarf_Debug dbg,
|
||||
return DW_DLV_NO_ENTRY;
|
||||
}
|
||||
|
||||
if (dw_ftype != DW_FTYPE_ELF) {
|
||||
lncount = LIKELYNAMESMAX;
|
||||
memset(likely_names,0,sizeof(likely_names));
|
||||
res = limit_of_code_non_elf(dbg,
|
||||
likely_names,
|
||||
lncount,
|
||||
&basesize,&baselow);
|
||||
ln = likely_names;
|
||||
} else {
|
||||
if (dw_ftype == DW_FTYPE_ELF ) {
|
||||
lncount = (int)dwarf_get_section_count(dbg);
|
||||
if (!lncount) {
|
||||
return DW_DLV_NO_ENTRY;
|
||||
@@ -1055,6 +1047,14 @@ calculate_likely_limits_of_code(Dwarf_Debug dbg,
|
||||
ln = 0;
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
lncount = LIKELYNAMESMAX;
|
||||
memset(likely_names,0,sizeof(likely_names));
|
||||
res = limit_of_code_non_elf(dbg,
|
||||
likely_names,
|
||||
lncount,
|
||||
&basesize,&baselow);
|
||||
ln = likely_names;
|
||||
}
|
||||
|
||||
qsort(ln,lncount,sizeof(struct likely_names_s),
|
||||
@@ -1101,36 +1101,6 @@ homeify(char *s, struct esb_s* out)
|
||||
esb_append(out,s);
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
/* sanitized() takes care of this for Msys2 Windows */
|
||||
{
|
||||
/* Windows In msys2
|
||||
$HOME might be C:\msys64\home\admin
|
||||
which messes up regression testing.
|
||||
And it shows as "C:/msys64/davea/".
|
||||
For msys2 with a simple setup this
|
||||
helps regressiontesting.
|
||||
$HOME in msys2 should be /home/admin/
|
||||
in testing (running as user admin).
|
||||
and that is C:/msys64/home/davea
|
||||
when windows is providing a windows-centric full path.
|
||||
Somewhat odd, but we do see slash(/)
|
||||
not backslash (\) . */
|
||||
char *winprefix = "C:/msys64/home/davea/home/admin";
|
||||
/*char *domain = getenv("USERDOMAIN"); */
|
||||
char *user = getenv("USER");
|
||||
size_t winlen = strlen(winprefix);
|
||||
|
||||
if (user && !strncmp(s,winprefix,winlen)) {
|
||||
/* Change to $HOME so regressiontests work
|
||||
reliably */
|
||||
size_t userlen = strlen(user);
|
||||
esb_append(out,"$HOME");
|
||||
esb_append(out,s+winlen+userlen);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif /* 0 */
|
||||
homelen = strlen(home);
|
||||
if (strlen(s) <= homelen) {
|
||||
/* Giving up, s is shorter than $HOME alone. */
|
||||
@@ -1174,7 +1144,6 @@ process_one_file(
|
||||
const char *title = 0;
|
||||
unsigned char path_source = 0;
|
||||
int localerrno = 0;
|
||||
|
||||
|
||||
if (glflags.gf_no_check_duplicated_attributes) {
|
||||
/* This means libdwarf won't check for duplicated
|
||||
|
@@ -8613,7 +8613,8 @@ get_attr_value(Dwarf_Debug dbg, Dwarf_Half tag,
|
||||
DROP_ERROR_INSTANCE(dbg,atres,*err);
|
||||
} else if (atres == DW_DLV_OK &&
|
||||
!suppress_block_as_string(attrblk)) {
|
||||
restf = looks_like_string(tempb->bl_len,
|
||||
restf = looks_like_string(
|
||||
(unsigned long)tempb->bl_len,
|
||||
(unsigned char *)tempb->bl_data);
|
||||
if (restf) {
|
||||
esb_append(esbp,"Block As Quoted String: '");
|
||||
|
@@ -266,7 +266,7 @@ print_debug_loclists_linecodes(Dwarf_Bool checking,
|
||||
}
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
#if 0 /* Would probably be wasteful ? */
|
||||
esb_append_printf_u(esbp," length: %u",lle_byte_count);
|
||||
#endif
|
||||
return DW_DLV_OK;
|
||||
|
@@ -77,47 +77,6 @@ freeall_groups_tables(void)
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#if 0 /* No longer needed, not used now */
|
||||
static struct glfsetting_s {
|
||||
const char *secname;
|
||||
Dwarf_Bool *flag;
|
||||
Dwarf_Bool origset;
|
||||
Dwarf_Bool origflag;
|
||||
} glftab[] = {
|
||||
{".debug_abbrev", &glflags.gf_abbrev_flag,FALSE,FALSE},
|
||||
{".debug_aranges", &glflags.gf_aranges_flag,FALSE,FALSE},
|
||||
{".debug_debug_macinfo",&glflags.gf_macinfo_flag,FALSE,FALSE},
|
||||
{".debug_debug_macro", &glflags.gf_macro_flag,FALSE,FALSE},
|
||||
{".debug_debug_names", &glflags.gf_debug_names_flag,FALSE,FALSE},
|
||||
{".debug_eh_frame", &glflags.gf_eh_frame_flag,FALSE,FALSE},
|
||||
{".debug_frame", &glflags.gf_frame_flag,FALSE,FALSE},
|
||||
{".gdb_index", &glflags.gf_gdbindex_flag,FALSE,FALSE},
|
||||
{".debug_info", &glflags.gf_info_flag,FALSE,FALSE},
|
||||
{".debug_line", &glflags.gf_line_flag,FALSE,FALSE},
|
||||
{".debug_loc", &glflags.gf_loc_flag,FALSE,FALSE},
|
||||
/*{".debug_loclists", &glflags.gf_loclists_flag,FALSE,FALSE}, */
|
||||
{".debug_pubnames", &glflags.gf_pubnames_flag,FALSE,FALSE},
|
||||
|
||||
/* SGI only */
|
||||
{".debug_pubtypes", &glflags.gf_pubtypes_flag,FALSE,FALSE},
|
||||
|
||||
{".debug_ranges", &glflags.gf_ranges_flag,FALSE,FALSE},
|
||||
/*{".debug_rnglists", &glflags.gf_rnglists_flag,FALSE,FALSE}, */
|
||||
|
||||
/* SGI only */
|
||||
{".debug_static_func", &glflags.gf_static_func_flag,FALSE,FALSE},
|
||||
|
||||
/* SGI only */
|
||||
{".debug_static_var", &glflags.gf_static_var_flag,FALSE,FALSE},
|
||||
|
||||
{".debug_str", &glflags.gf_string_flag,FALSE,FALSE},
|
||||
{".debug_types", &glflags.gf_types_flag,FALSE,FALSE},
|
||||
|
||||
/* SGI only */
|
||||
{".debug_weaknames", &glflags.gf_weakname_flag,FALSE,FALSE},
|
||||
{0,0,0,0}
|
||||
};
|
||||
#endif /* 0 */
|
||||
|
||||
/* If a section is not in group N but is in group 1
|
||||
then turn off its flag. Since sections are never
|
||||
|
@@ -52,16 +52,23 @@ for anyone to use for any purpose.
|
||||
# define O_BINARY 0 /* So it does nothing in Linux/Unix */
|
||||
# endif
|
||||
#endif /* O_BINARY */
|
||||
static int print_frame_instrs(Dwarf_Debug dbg,
|
||||
Dwarf_Frame_Instr_Head frame_instr_head,
|
||||
Dwarf_Unsigned frame_instr_count,
|
||||
Dwarf_Error *error);
|
||||
|
||||
static void read_frame_data(Dwarf_Debug dbg,const char *sec);
|
||||
static void print_fde_instrs(Dwarf_Debug dbg, Dwarf_Fde fde,
|
||||
Dwarf_Error *error);
|
||||
static void print_regtable(Dwarf_Regtable3 *tab3);
|
||||
static void print_cie_instrs(Dwarf_Cie cie,Dwarf_Error *error);
|
||||
static void print_cie_instrs(Dwarf_Debug dbg,
|
||||
Dwarf_Cie cie,Dwarf_Error *error);
|
||||
static void print_fde_selected_regs( Dwarf_Fde fde);
|
||||
static void print_reg(int r);
|
||||
|
||||
static int just_print_selected_regs = 0;
|
||||
static int print_selected_regs = 0;
|
||||
static int stop_at_n_fdes = 0;
|
||||
|
||||
/* Depending on the ABI we set INITIAL_VAL
|
||||
differently. For ia64 initial value is
|
||||
@@ -69,10 +76,11 @@ static int just_print_selected_regs = 0;
|
||||
value is SAME_VAL.
|
||||
Here we'll set it UNDEF_VAL
|
||||
as that way we'll see when first set. */
|
||||
#define UNDEF_VAL 2000
|
||||
#define SAME_VAL 2001
|
||||
#define CFA_VAL 2002
|
||||
#define INITIAL_VAL UNDEF_VAL
|
||||
#define UNDEF_VAL DW_FRAME_UNDEFINED_VAL
|
||||
#define SAME_VAL DW_FRAME_SAME_VAL
|
||||
#define CFA_VAL DW_FRAME_CFA_COL
|
||||
/*#define INITIAL_VAL UNDEF_VAL */
|
||||
#define INITIAL_VAL SAME_VAL
|
||||
|
||||
/* Dumping a dwarf-expression as a byte stream. */
|
||||
static void
|
||||
@@ -107,6 +115,8 @@ main(int argc, char **argv)
|
||||
Dwarf_Ptr errarg = 0;
|
||||
int regtabrulecount = 0;
|
||||
int curopt = 0;
|
||||
const char *countstr = "--stop-at-fde-n=";
|
||||
int countstr_len = strlen(countstr);
|
||||
|
||||
for (curopt = 1;curopt < argc; ++curopt) {
|
||||
if (strncmp(argv[curopt],"--",2)) {
|
||||
@@ -116,6 +126,20 @@ main(int argc, char **argv)
|
||||
just_print_selected_regs++;
|
||||
continue;
|
||||
}
|
||||
if (!strncmp(argv[curopt],countstr,countstr_len)) {
|
||||
char *carg = argv[curopt];
|
||||
if (!carg[countstr_len]) {
|
||||
printf("Improper %s arg, needs a number. Ignored\n",
|
||||
carg);
|
||||
} else {
|
||||
stop_at_n_fdes = atoi((const char *)
|
||||
(carg+countstr_len));
|
||||
}
|
||||
}
|
||||
if (!strcmp(argv[curopt],"--print-selected-regs")) {
|
||||
print_selected_regs++;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(argv[curopt],"--suppress-de-alloc-tree")) {
|
||||
/* Do nothing, ignore the argument */
|
||||
continue;
|
||||
@@ -219,6 +243,11 @@ read_frame_data(Dwarf_Debug dbg,const char *sect)
|
||||
for (fdenum = 0; fdenum < fde_element_count; ++fdenum) {
|
||||
Dwarf_Cie cie = 0;
|
||||
|
||||
if (stop_at_n_fdes && fdenum >= stop_at_n_fdes) {
|
||||
printf("\nStopping at %d FDEs by request\n",
|
||||
stop_at_n_fdes);
|
||||
break;
|
||||
}
|
||||
res = dwarf_get_cie_of_fde(fde_data[fdenum],&cie,&error);
|
||||
if (res != DW_DLV_OK) {
|
||||
printf("Error accessing cie of fdenum %" DW_PR_DSd
|
||||
@@ -226,12 +255,15 @@ read_frame_data(Dwarf_Debug dbg,const char *sect)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("Print cie of fde %" DW_PR_DSd "\n",fdenum);
|
||||
print_cie_instrs(cie,&error);
|
||||
printf("Print fde %" DW_PR_DSd "\n",fdenum);
|
||||
print_cie_instrs(dbg,cie,&error);
|
||||
printf("\nPrint fde %" DW_PR_DSd "\n",fdenum);
|
||||
if (just_print_selected_regs) {
|
||||
print_fde_selected_regs(fde_data[fdenum]);
|
||||
} else {
|
||||
print_fde_instrs(dbg,fde_data[fdenum],&error);
|
||||
if (print_selected_regs) {
|
||||
print_fde_selected_regs(fde_data[fdenum]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +275,7 @@ read_frame_data(Dwarf_Debug dbg,const char *sect)
|
||||
|
||||
/* Simply shows the instructions at hand for this fde. */
|
||||
static void
|
||||
print_cie_instrs(Dwarf_Cie cie,Dwarf_Error *error)
|
||||
print_cie_instrs(Dwarf_Debug dbg,Dwarf_Cie cie,Dwarf_Error *error)
|
||||
{
|
||||
int res = DW_DLV_ERROR;
|
||||
Dwarf_Unsigned bytes_in_cie = 0;
|
||||
@@ -255,6 +287,7 @@ print_cie_instrs(Dwarf_Cie cie,Dwarf_Error *error)
|
||||
Dwarf_Small *instrp = 0;
|
||||
Dwarf_Unsigned instr_len = 0;
|
||||
Dwarf_Half offset_size = 0;
|
||||
Dwarf_Signed cie_index = 0;
|
||||
|
||||
res = dwarf_get_cie_info_b(cie,&bytes_in_cie,
|
||||
&version, &augmentation, &code_alignment_factor,
|
||||
@@ -264,6 +297,46 @@ print_cie_instrs(Dwarf_Cie cie,Dwarf_Error *error)
|
||||
printf("Unable to get cie info!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
res = dwarf_get_cie_index(cie,&cie_index,error);
|
||||
if (res != DW_DLV_OK) {
|
||||
printf("Unable to get cie index!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("CIE info\n");
|
||||
printf(" cie index : %" DW_PR_DSd "\n",
|
||||
cie_index);
|
||||
printf(" cie length : 0x%" DW_PR_DUx " (%"
|
||||
DW_PR_DUu ")\n",
|
||||
bytes_in_cie,bytes_in_cie);
|
||||
printf(" cie version : %d\n",version);
|
||||
printf(" cie augmenter : %s\n",
|
||||
augmentation?augmentation:"<none>");
|
||||
printf(" code alignment factor : %" DW_PR_DUu "\n",
|
||||
code_alignment_factor);
|
||||
printf(" data alignment factor : %" DW_PR_DSd "\n",
|
||||
data_alignment_factor);
|
||||
printf(" return address register: %u\n",
|
||||
return_address_register_rule);
|
||||
printf(" initial instructions length: %" DW_PR_DUu "\n",
|
||||
instr_len);
|
||||
printf(" offset size : %u\n",offset_size);
|
||||
{
|
||||
Dwarf_Frame_Instr_Head frame_instr_head = 0;
|
||||
Dwarf_Unsigned frame_instr_count = 0;
|
||||
res = dwarf_expand_frame_instructions(cie,
|
||||
instrp,instr_len,
|
||||
&frame_instr_head,
|
||||
&frame_instr_count,
|
||||
error);
|
||||
if (res != DW_DLV_OK) {
|
||||
printf("dwarf_expand_frame_instructions failed!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("CIE op count: %" DW_PR_DUu "\n",frame_instr_count);
|
||||
print_frame_instrs(dbg,frame_instr_head,
|
||||
frame_instr_count, error);
|
||||
dwarf_dealloc_frame_instr_head(frame_instr_head);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -281,27 +354,31 @@ print_fde_col(Dwarf_Signed k,
|
||||
char *type_title = "";
|
||||
Dwarf_Unsigned rule_id = k;
|
||||
|
||||
printf(" pc=0x%" DW_PR_DUx ,jsave);
|
||||
(void)has_more_rows;
|
||||
(void)subsequent_pc;
|
||||
if (row_pc != jsave) {
|
||||
printf(" row_pc=0x%" DW_PR_DUx ,row_pc);
|
||||
}
|
||||
printf(" col=%" DW_PR_DSd " ",k);
|
||||
switch(value_type) {
|
||||
case DW_EXPR_OFFSET:
|
||||
type_title = "off";
|
||||
type_title = "DW_EXPR_OFFSET";
|
||||
goto preg2;
|
||||
case DW_EXPR_VAL_OFFSET:
|
||||
type_title = "valoff";
|
||||
type_title = "DW_EXPR_VAL_OFFSET";
|
||||
|
||||
preg2:
|
||||
printf("<%s ", type_title);
|
||||
if (reg_used == SAME_VAL) {
|
||||
printf(" SAME_VAL");
|
||||
break;
|
||||
/* break; */
|
||||
} else if (reg_used == INITIAL_VAL) {
|
||||
printf(" INITIAL_VAL");
|
||||
break;
|
||||
/*break; */
|
||||
} else if (reg_used == UNDEF_VAL) {
|
||||
printf(" UNDEF_VAL");
|
||||
}
|
||||
printf("[");
|
||||
print_reg(rule_id);
|
||||
|
||||
printf("=");
|
||||
@@ -314,12 +391,13 @@ print_fde_col(Dwarf_Signed k,
|
||||
print_reg(reg_used);
|
||||
printf(") ");
|
||||
}
|
||||
printf("]");
|
||||
break;
|
||||
case DW_EXPR_EXPRESSION:
|
||||
type_title = "expr";
|
||||
type_title = "DW_EXPR_EXPRESSION";
|
||||
goto pexp2;
|
||||
case DW_EXPR_VAL_EXPRESSION:
|
||||
type_title = "valexpr";
|
||||
type_title = "DW_EXPR_VAL_EXPRESSION";
|
||||
|
||||
pexp2:
|
||||
printf("<%s ", type_title);
|
||||
@@ -354,9 +432,17 @@ print_fde_col(Dwarf_Signed k,
|
||||
value_type);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf(" more=%d",has_more_rows);
|
||||
printf(" next=0x%" DW_PR_DUx,subsequent_pc);
|
||||
printf("%s", "> ");
|
||||
#if 0
|
||||
if (has_more_rows) {
|
||||
printf(" has_more_rows? %s next pc: 0x%"
|
||||
DW_PR_DUx ">",
|
||||
has_more_rows?"yes.":"no.",
|
||||
subsequent_pc);
|
||||
} else {
|
||||
printf("%s", ">");
|
||||
}
|
||||
#endif
|
||||
printf("%s", ">");
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -377,7 +463,8 @@ print_fde_selected_regs( Dwarf_Fde fde)
|
||||
{
|
||||
Dwarf_Error oneferr = 0;
|
||||
/* Arbitrary column numbers for testing. */
|
||||
static int selected_cols[] = {1,3,5};
|
||||
static int selected_cols[] = {1,2,3,4,5,6,7,8,
|
||||
9,10,11,12,13,14,15,16};
|
||||
static int selected_cols_count =
|
||||
sizeof(selected_cols)/sizeof(selected_cols[0]);
|
||||
Dwarf_Signed k = 0;
|
||||
@@ -430,6 +517,8 @@ print_fde_selected_regs( Dwarf_Fde fde)
|
||||
jsave = next_jsave) {
|
||||
next_jsave = jsave+1;
|
||||
printf("\n");
|
||||
printf(" FDE columns (registers) for pc 0x%"
|
||||
DW_PR_DUx "\n",jsave);
|
||||
for (k = 0; k < selected_cols_count ; ++k ) {
|
||||
Dwarf_Unsigned reg = 0;
|
||||
Dwarf_Unsigned offset_relevant = 0;
|
||||
@@ -524,7 +613,8 @@ print_frame_instrs(Dwarf_Debug dbg,
|
||||
switch(fields[0]) {
|
||||
case 'u': {
|
||||
if (!fields[1]) {
|
||||
printf("%" DW_PR_DUu "\n",u0);
|
||||
printf("%" DW_PR_DUu " (0x%" DW_PR_DUx "\n",
|
||||
u0,u0);
|
||||
}
|
||||
if (fields[1] == 'c') {
|
||||
Dwarf_Unsigned final =
|
||||
@@ -556,7 +646,7 @@ print_frame_instrs(Dwarf_Debug dbg,
|
||||
Dwarf_Signed final =
|
||||
(Dwarf_Signed)u0 *
|
||||
data_alignment_factor;
|
||||
printf("%" DW_PR_DUu ,final);
|
||||
printf("%" DW_PR_DSd ,final);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
@@ -715,13 +805,19 @@ print_fde_instrs(Dwarf_Debug dbg,
|
||||
printf("dwarf_get_fde_info_for_all_regs3_b failed!\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
printf("iterating Requested addr of row 0x%" DW_PR_DUx
|
||||
" Actual addr 0x%" DW_PR_DUx
|
||||
#if 0
|
||||
" More rows? %s Subsequent_pc 0x%" DW_PR_DUx "\n",
|
||||
arbitrary_addr,actual_pc,has_more_rows?"yes":"no",
|
||||
subsequent_pc);
|
||||
#endif
|
||||
printf("\nRegtable at pc 0x%" DW_PR_DUx "\n",actual_pc);
|
||||
print_regtable(&tab3);
|
||||
if (has_more_rows) {
|
||||
printf(" Next row to print is pc 0x%"
|
||||
DW_PR_DUx "\n",subsequent_pc);
|
||||
}
|
||||
}
|
||||
print_regtable(&tab3);
|
||||
/*print_regtable(&tab3); */
|
||||
|
||||
res = dwarf_get_fde_instr_bytes(fde,&outinstrs,&instrslen,error);
|
||||
if (res != DW_DLV_OK) {
|
||||
@@ -767,57 +863,81 @@ print_reg(int r)
|
||||
{
|
||||
switch(r) {
|
||||
case SAME_VAL:
|
||||
printf(" %d SAME_VAL ",r);
|
||||
printf(" [DW_FRAME_SAME_VAL] ");
|
||||
break;
|
||||
case UNDEF_VAL:
|
||||
printf(" %d UNDEF_VAL ",r);
|
||||
printf(" [DW_FRAME_UNDEF_VAL] ");
|
||||
break;
|
||||
case CFA_VAL:
|
||||
printf(" %d (CFA) ",r);
|
||||
printf(" [(CFA)] ");
|
||||
break;
|
||||
default:
|
||||
printf(" r%d ",r);
|
||||
printf(" [r%d] ",r);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
value_type_name(int valuetype,char *buf,unsigned buflen)
|
||||
{
|
||||
buf[0] = 0;
|
||||
switch(valuetype) {
|
||||
case DW_EXPR_OFFSET:
|
||||
return "DW_EXPR_OFFSET";
|
||||
case DW_EXPR_VAL_OFFSET:
|
||||
return "DW_EXPR_VAL_OFFSET";
|
||||
case DW_EXPR_EXPRESSION:
|
||||
return "DW_EXPR_EXPRESSION";
|
||||
case DW_EXPR_VAL_EXPRESSION:
|
||||
return "DW_EXPR_VAL_EXPRESSION";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
snprintf(buf,buflen, "Unknown(%d)",valuetype);
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void
|
||||
print_one_regentry(const char *prefix,
|
||||
print_one_regentry(const char *prefix_i,
|
||||
struct Dwarf_Regtable_Entry3_s *entry)
|
||||
{
|
||||
char buf[100];
|
||||
const char *prefix = prefix_i;
|
||||
int is_cfa = !strcmp("cfa",prefix);
|
||||
if (is_cfa) {
|
||||
prefix="cfa ";
|
||||
}
|
||||
|
||||
buf[0] = 0;
|
||||
printf("%s ",prefix);
|
||||
printf("type: %d %s ",
|
||||
entry->dw_value_type,
|
||||
(entry->dw_value_type == DW_EXPR_OFFSET)? "DW_EXPR_OFFSET":
|
||||
(entry->dw_value_type == DW_EXPR_VAL_OFFSET)?
|
||||
"DW_EXPR_VAL_OFFSET":
|
||||
(entry->dw_value_type == DW_EXPR_EXPRESSION)?
|
||||
"DW_EXPR_EXPRESSION":
|
||||
(entry->dw_value_type == DW_EXPR_VAL_EXPRESSION)?
|
||||
"DW_EXPR_VAL_EXPRESSION":
|
||||
"Unknown");
|
||||
printf("type: [%s] ",
|
||||
value_type_name(entry->dw_value_type,
|
||||
buf,(unsigned)sizeof(buf)));
|
||||
switch(entry->dw_value_type) {
|
||||
case DW_EXPR_OFFSET:
|
||||
print_reg(entry->dw_regnum);
|
||||
printf(" offset_rel? %d ",entry->dw_offset_relevant);
|
||||
printf(" [offset_rel? %s ",
|
||||
entry->dw_offset_relevant?"yes.":"no.");
|
||||
if (entry->dw_offset_relevant) {
|
||||
printf(" offset %" DW_PR_DSd " " ,
|
||||
printf(" Offset %" DW_PR_DSd " " ,
|
||||
(Dwarf_Signed)entry->dw_offset);
|
||||
if (is_cfa) {
|
||||
printf("defines cfa value");
|
||||
printf("Defines cfa value");
|
||||
} else {
|
||||
printf("address of value is CFA plus signed offset");
|
||||
printf("Address of value is CFA plus signed offset");
|
||||
}
|
||||
if (!is_cfa && entry->dw_regnum != CFA_VAL) {
|
||||
printf(" compiler botch, regnum != CFA_VAL");
|
||||
}
|
||||
} else {
|
||||
printf("value in register");
|
||||
printf("Value in register");
|
||||
}
|
||||
printf("]");
|
||||
break;
|
||||
case DW_EXPR_VAL_OFFSET:
|
||||
print_reg(entry->dw_regnum);
|
||||
printf("[");
|
||||
printf(" offset %" DW_PR_DSd " " ,
|
||||
(Dwarf_Signed)entry->dw_offset);
|
||||
if (is_cfa) {
|
||||
@@ -828,9 +948,11 @@ print_one_regentry(const char *prefix,
|
||||
if (!is_cfa && entry->dw_regnum != CFA_VAL) {
|
||||
printf(" compiler botch, regnum != CFA_VAL");
|
||||
}
|
||||
printf("]");
|
||||
break;
|
||||
case DW_EXPR_EXPRESSION:
|
||||
print_reg(entry->dw_regnum);
|
||||
printf("[");
|
||||
if (entry->dw_offset_relevant) {
|
||||
printf(" FAIL. ERROR: a DW_EXPR_EXPRESSION "
|
||||
"must not have the dw_offset marked as "
|
||||
@@ -845,8 +967,10 @@ print_one_regentry(const char *prefix,
|
||||
printf(" Value is at address given by expr val ");
|
||||
/* printf(" block-ptr 0x%" DW_PR_DUx " ",
|
||||
(Dwarf_Unsigned)entry->dw_block_ptr); */
|
||||
printf("]");
|
||||
break;
|
||||
case DW_EXPR_VAL_EXPRESSION:
|
||||
printf("[");
|
||||
printf(" expression byte len %" DW_PR_DUu " " ,
|
||||
entry->dw_block.bl_len);
|
||||
printf("Block ptr set? %s ",
|
||||
@@ -867,6 +991,7 @@ print_one_regentry(const char *prefix,
|
||||
}
|
||||
/* printf(" block-ptr 0x%" DW_PR_DUx " ",
|
||||
(Dwarf_Unsigned)entry->dw_block.bl_data); */
|
||||
printf("]");
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@@ -883,7 +1008,6 @@ print_regtable(Dwarf_Regtable3 *tab3)
|
||||
max = tab3->rt3_reg_table_size;
|
||||
}
|
||||
print_one_regentry("cfa",&tab3->rt3_cfa_rule);
|
||||
|
||||
for (r = 0; r < max; r++) {
|
||||
char rn[30];
|
||||
snprintf(rn,sizeof(rn),"reg %d",r);
|
||||
|
@@ -55,6 +55,7 @@ DW_AT_MIPS_linkage_name
|
||||
0xffffffff
|
||||
DW_TAG_compile_unit
|
||||
DW_AT_APPLE_optimized /* Used by LLVM */
|
||||
DW_AT_APPLE_sdk /* Used by LLVM */
|
||||
DW_AT_GNU_dwo_id
|
||||
DW_AT_GNU_pubnames
|
||||
DW_AT_GNU_pubtypes
|
||||
@@ -62,6 +63,7 @@ DW_AT_GNU_dwo_name
|
||||
DW_AT_GNU_ranges_base
|
||||
DW_AT_GNU_addr_base
|
||||
DW_AT_GNU_macros
|
||||
DW_AT_LLVM_sysroot
|
||||
|
||||
0xffffffff
|
||||
DW_TAG_skeleton_unit
|
||||
|
@@ -1119,53 +1119,64 @@ dwarf_get_debug_addr_index(Dwarf_Attribute attr,
|
||||
/* The index value here is the value of the
|
||||
attribute with this form.
|
||||
FORMs passed in are always strx forms. */
|
||||
static int
|
||||
dw_read_str_index_val_itself(Dwarf_Debug dbg,
|
||||
int
|
||||
_dwarf_read_str_index_val_itself(Dwarf_Debug dbg,
|
||||
unsigned theform,
|
||||
Dwarf_Small *info_ptr,
|
||||
Dwarf_Small *section_end,
|
||||
Dwarf_Unsigned *return_index,
|
||||
Dwarf_Unsigned *return_index_length,
|
||||
Dwarf_Error *error)
|
||||
{
|
||||
Dwarf_Unsigned index = 0;
|
||||
Dwarf_Unsigned indexlen = 0;
|
||||
|
||||
switch(theform) {
|
||||
case DW_FORM_strx:
|
||||
case DW_FORM_GNU_str_index:
|
||||
DECODE_LEB128_UWORD_CK(info_ptr,index,
|
||||
DECODE_LEB128_UWORD_LEN_CK(info_ptr,index, indexlen,
|
||||
dbg,error,section_end);
|
||||
break;
|
||||
case DW_FORM_strx1:
|
||||
READ_UNALIGNED_CK(dbg, index, Dwarf_Unsigned,
|
||||
info_ptr, 1,
|
||||
error,section_end);
|
||||
indexlen = 1;
|
||||
break;
|
||||
case DW_FORM_strx2:
|
||||
READ_UNALIGNED_CK(dbg, index, Dwarf_Unsigned,
|
||||
info_ptr, 2,
|
||||
error,section_end);
|
||||
indexlen = 2;
|
||||
break;
|
||||
case DW_FORM_strx3:
|
||||
READ_UNALIGNED_CK(dbg, index, Dwarf_Unsigned,
|
||||
info_ptr, 3,
|
||||
error,section_end);
|
||||
indexlen = 3;
|
||||
break;
|
||||
case DW_FORM_strx4:
|
||||
READ_UNALIGNED_CK(dbg, index, Dwarf_Unsigned,
|
||||
info_ptr, 4,
|
||||
error,section_end);
|
||||
indexlen = 4;
|
||||
break;
|
||||
default:
|
||||
_dwarf_error(dbg, error, DW_DLE_ATTR_FORM_NOT_STR_INDEX);
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
if (return_index_length) {
|
||||
*return_index_length = indexlen;
|
||||
}
|
||||
*return_index = index;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
|
||||
/* Part of DebugFission. So a dwarf dumper application
|
||||
can get the index and print it for the user.
|
||||
A convenience function. New May 2014
|
||||
Returns/
|
||||
A convenience function.
|
||||
New May 2014
|
||||
Also used with DWARF5 forms. */
|
||||
int
|
||||
dwarf_get_debug_str_index(Dwarf_Attribute attr,
|
||||
@@ -1191,12 +1202,18 @@ dwarf_get_debug_str_index(Dwarf_Attribute attr,
|
||||
_dwarf_calculate_info_section_end_ptr(cu_context);
|
||||
info_ptr = attr->ar_debug_ptr;
|
||||
|
||||
indxres = dw_read_str_index_val_itself(dbg, theform, info_ptr,
|
||||
section_end, &index,error);
|
||||
indxres = _dwarf_read_str_index_val_itself(dbg, theform, info_ptr,
|
||||
section_end, &index,0,error);
|
||||
if (indxres == DW_DLV_OK) {
|
||||
*return_index = index;
|
||||
return indxres;
|
||||
}
|
||||
res = _dwarf_load_section(dbg, &dbg->de_debug_str_offsets,
|
||||
error);
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
}
|
||||
|
||||
length_size = cu_context->cc_length_size;
|
||||
sectionlen = dbg->de_debug_str_offsets.dss_size;
|
||||
if (index > sectionlen ||
|
||||
@@ -1797,9 +1814,15 @@ dwarf_formblock(Dwarf_Attribute attr,
|
||||
}
|
||||
|
||||
/* This is called for attribute with strx form
|
||||
or macro5 with strx form.
|
||||
No relation to the Name Table or
|
||||
to FIXME */
|
||||
or macro5 with strx form or line table header
|
||||
with strx form.
|
||||
No relation to the Name Table.
|
||||
This returns an offset into .debug_line_str (if line table)
|
||||
or .debug_str (if macro5 or a DIE).
|
||||
If line table use .debug_str_offsets[.dwo].
|
||||
See DWARF5, page 158.
|
||||
*/
|
||||
|
||||
int
|
||||
_dwarf_extract_string_offset_via_str_offsets(Dwarf_Debug dbg,
|
||||
Dwarf_Small *data_ptr,
|
||||
@@ -1834,9 +1857,12 @@ _dwarf_extract_string_offset_via_str_offsets(Dwarf_Debug dbg,
|
||||
length_size = cu_context->cc_length_size;
|
||||
/* If this is a dwp we look there, but I suppose
|
||||
we could also look for the section in the tied
|
||||
executable object file it is not here. FIXME */
|
||||
idxres = dw_read_str_index_val_itself(dbg,
|
||||
attrform,data_ptr,end_data_ptr,&index_to_offset_entry,error);
|
||||
executable object file it is not here. FIXME
|
||||
We are reading a value which is to be used
|
||||
to index into .debug_str_offsets. */
|
||||
idxres = _dwarf_read_str_index_val_itself(dbg,
|
||||
attrform,data_ptr,end_data_ptr,&index_to_offset_entry,
|
||||
0,error);
|
||||
if ( idxres != DW_DLV_OK) {
|
||||
return idxres;
|
||||
}
|
||||
@@ -1848,19 +1874,31 @@ _dwarf_extract_string_offset_via_str_offsets(Dwarf_Debug dbg,
|
||||
baseoffset += cu_context->cc_str_offsets_tab_to_array;
|
||||
have_array_offset = TRUE;
|
||||
} else { /* do nothing */}
|
||||
indexoffset = index_to_offset_entry * length_size;
|
||||
/* We know where to go in the string offsets table,
|
||||
but first validate the actual place to look
|
||||
in the table to be sure it seems legitimate. */
|
||||
if (baseoffset > sectionlen ||
|
||||
(baseoffset+length_size) > sectionlen ||
|
||||
(baseoffset+(index_to_offset_entry *length_size)) >
|
||||
sectionlen) {
|
||||
_dwarf_error_string(dbg, error,
|
||||
DW_DLE_ATTR_FORM_SIZE_BAD,
|
||||
(baseoffset+indexoffset) > sectionlen) {
|
||||
dwarfstring m;
|
||||
|
||||
dwarfstring_constructor(&m);
|
||||
dwarfstring_append_printf_u(&m,
|
||||
"DW_DLE_ATTR_FORM_SIZE_BAD: "
|
||||
"An Attribute value (offset into "
|
||||
".debug_str_offsets) is impossibly "
|
||||
"large. Corrupt Dwarf.");
|
||||
".debug_str_offsets) exceeds "
|
||||
"section length "
|
||||
"of 0x%x.",sectionlen);
|
||||
dwarfstring_append_printf_u(&m,
|
||||
" Invalid offset is 0x%x ."
|
||||
"Corrupt Dwarf.",baseoffset+indexoffset);
|
||||
_dwarf_error_string(dbg, error,
|
||||
DW_DLE_ATTR_FORM_SIZE_BAD,
|
||||
dwarfstring_string(&m));
|
||||
dwarfstring_destructor(&m);
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
indexoffset = index_to_offset_entry* length_size;
|
||||
if (!have_array_offset) {
|
||||
/* missing any connection to a specific
|
||||
str_offsets table this guesses at table zero.
|
||||
@@ -1873,8 +1911,7 @@ _dwarf_extract_string_offset_via_str_offsets(Dwarf_Debug dbg,
|
||||
DWARF5. but some early GNU compilers emitted
|
||||
DWARF4 .debug_str_offsets, so lets check
|
||||
the first table. */
|
||||
Dwarf_Unsigned stsize =
|
||||
dbg->de_debug_str_offsets.dss_size;
|
||||
Dwarf_Unsigned stsize = 0;
|
||||
Dwarf_Unsigned length = 0;
|
||||
Dwarf_Unsigned table_length = 0;
|
||||
Dwarf_Half local_offset_size = 0;
|
||||
@@ -1882,6 +1919,11 @@ _dwarf_extract_string_offset_via_str_offsets(Dwarf_Debug dbg,
|
||||
Dwarf_Half version = 0;
|
||||
Dwarf_Half padding = 0;
|
||||
|
||||
res = _dwarf_load_section(dbg, &dbg->de_debug_str_offsets,error);
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
}
|
||||
stsize = dbg->de_debug_str_offsets.dss_size;
|
||||
res = _dwarf_trial_read_dwarf_five_hdr(dbg,
|
||||
headeroffset,stsize,
|
||||
&table_offset_to_array,
|
||||
@@ -1937,6 +1979,10 @@ _dwarf_extract_string_offset_via_str_offsets(Dwarf_Debug dbg,
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
|
||||
/* Extracts a string from .debug_line_str
|
||||
offset must be a string-table offset, not
|
||||
an offset into a str_offsets table.
|
||||
*/
|
||||
int
|
||||
_dwarf_extract_local_debug_str_string_given_offset(Dwarf_Debug dbg,
|
||||
unsigned attrform,
|
||||
|
@@ -1298,6 +1298,7 @@ _dwarf_exec_frame_instr(Dwarf_Bool make_instr,
|
||||
}
|
||||
localregtab[lreg].ru_is_offset = 0; /* arbitrary */
|
||||
localregtab[lreg].ru_value_type = DW_EXPR_EXPRESSION;
|
||||
localregtab[lreg].ru_register = reg_no;
|
||||
localregtab[lreg].ru_block.bl_data = instr_ptr;
|
||||
localregtab[lreg].ru_block.bl_len = block_len;
|
||||
if (make_instr) {
|
||||
|
@@ -2376,31 +2376,32 @@ _dwarf_decode_line_string_form(Dwarf_Debug dbg,
|
||||
Dwarf_Error * error)
|
||||
{
|
||||
int res = 0;
|
||||
Dwarf_Small *debug_line_str_data =0;
|
||||
Dwarf_Unsigned debug_line_str_size =0;
|
||||
Dwarf_Small *debug_line_str_end =0;
|
||||
|
||||
res = _dwarf_load_section(dbg,
|
||||
&dbg->de_debug_line_str,error);
|
||||
if (res == DW_DLV_ERROR) {
|
||||
return res;
|
||||
}
|
||||
debug_line_str_data = dbg->de_debug_line_str.dss_data;
|
||||
debug_line_str_size = dbg->de_debug_line_str.dss_size;
|
||||
debug_line_str_end = debug_line_str_data + debug_line_str_size;
|
||||
|
||||
switch (form) {
|
||||
case DW_FORM_line_strp: {
|
||||
Dwarf_Small *secstart = 0;
|
||||
Dwarf_Small *secend = 0;
|
||||
Dwarf_Small *strptr = 0;
|
||||
Dwarf_Unsigned offset = 0;
|
||||
Dwarf_Small *offsetptr = *line_ptr;
|
||||
|
||||
res = _dwarf_load_section(dbg,
|
||||
&dbg->de_debug_line_str,error);
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
}
|
||||
|
||||
secstart = dbg->de_debug_line_str.dss_data;
|
||||
secend = secstart + dbg->de_debug_line_str.dss_size;
|
||||
|
||||
READ_UNALIGNED_CK(dbg, offset, Dwarf_Unsigned,
|
||||
offsetptr, offset_size,
|
||||
error,line_ptr_end);
|
||||
*line_ptr += offset_size;
|
||||
strptr = secstart + offset;
|
||||
strptr = debug_line_str_data + offset;
|
||||
res = _dwarf_check_string_valid(dbg,
|
||||
secstart,strptr,secend,
|
||||
debug_line_str_data,strptr,debug_line_str_end,
|
||||
DW_DLE_LINE_STRP_OFFSET_BAD,error);
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
@@ -2422,6 +2423,43 @@ _dwarf_decode_line_string_form(Dwarf_Debug dbg,
|
||||
*line_ptr += strlen((const char *)strptr) + 1;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
case DW_FORM_strx1:
|
||||
case DW_FORM_strx2:
|
||||
case DW_FORM_strx3:
|
||||
case DW_FORM_strx4:
|
||||
case DW_FORM_strx: {
|
||||
Dwarf_Unsigned offset = 0;
|
||||
Dwarf_Unsigned index_length = 0;
|
||||
char *stritself = 0;
|
||||
res = _dwarf_read_str_index_val_itself(dbg,
|
||||
(unsigned int)form,
|
||||
*line_ptr,
|
||||
line_ptr_end,
|
||||
&offset,
|
||||
&index_length,
|
||||
error);
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
}
|
||||
res = _dwarf_extract_local_debug_str_string_given_offset(dbg,
|
||||
(unsigned int)form,
|
||||
offset,
|
||||
&stritself,
|
||||
error);
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
}
|
||||
res = _dwarf_check_string_valid(dbg,
|
||||
debug_line_str_data ,stritself,debug_line_str_end,
|
||||
DW_DLE_LINE_STRING_BAD,error);
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
}
|
||||
*line_ptr = *line_ptr + index_length;
|
||||
*return_str = stritself;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
|
||||
default:
|
||||
report_ltype_form_issue(dbg, (Dwarf_Half)ltype,
|
||||
(Dwarf_Half)form,0,error);
|
||||
|
@@ -849,6 +849,8 @@ struct section_64 { /* for 64-bit architectures */
|
||||
/* protections and catches NULL */
|
||||
/* references for MH_EXECUTE files */
|
||||
|
||||
#define SEG_DWARF "__DWARF" /* Added by libdwarf */
|
||||
#define SEG_DATA_CONST "__DATA_CONST" /* Added by libdwarf */
|
||||
#define SEG_TEXT "__TEXT" /* the tradition UNIX text segment */
|
||||
#define SECT_TEXT "__text"
|
||||
/* the real text part of the text */
|
||||
|
@@ -110,35 +110,82 @@ print_arch_item(unsigned int i,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* One wonders if a duplicated segname name is an error.
|
||||
I suppose so, but we do not yet check for that. */
|
||||
static const char *
|
||||
knownsegnames[] = {
|
||||
SEG_DWARF,
|
||||
SEG_TEXT,
|
||||
SEG_DATA,
|
||||
SEG_DATA_CONST,
|
||||
SEG_ICON,
|
||||
SEG_IMPORT,
|
||||
SEG_LINKEDIT,
|
||||
SEG_OBJC,
|
||||
SEG_PAGEZERO,
|
||||
SEG_UNIXSTACK,
|
||||
};
|
||||
|
||||
static int
|
||||
is_known_segname(char *sname)
|
||||
{
|
||||
char *s_in = sname;
|
||||
int i = 0;
|
||||
int end = sizeof(knownsegnames)/sizeof(char *);
|
||||
|
||||
for ( ; i < end; ++i) {
|
||||
if (strcmp(s_in,knownsegnames[i])) {
|
||||
continue;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
/* We do not expect non-ascii characters in section
|
||||
names, they are defined by the compiler-writers
|
||||
and ABI rules. We allow an empty name... */
|
||||
static int
|
||||
not_ascii(const char *s)
|
||||
{
|
||||
unsigned char *cp = (unsigned char *)s;
|
||||
for ( ; *cp ; ++cp) {
|
||||
if (*cp < 0x20 || *cp > 0x7e) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* There are reports that this limit of the number of bytes of
|
||||
Macho object commands is a hard limit kernel in iOS. */
|
||||
#define MAX_COMMANDS_SIZE 16464
|
||||
|
||||
/* MACH-O and dwarf section names */
|
||||
static struct macho_sect_names_s {
|
||||
char const *ms_moname;
|
||||
char const *ms_dwname;
|
||||
char const *ms_moname; /* Macho sect name */
|
||||
char const *ms_dwname; /* Elf/dwarf name */
|
||||
} const SectionNames [] = {
|
||||
{ "", "" }, /* ELF index-0 entry */
|
||||
{ "__debug_abbrev", ".debug_abbrev" },
|
||||
{ "__debug_aranges", ".debug_aranges" },
|
||||
{ "__debug_frame", ".debug_frame" },
|
||||
{ "__debug_info", ".debug_info" },
|
||||
{ "__debug_addr", ".debug_addr" },
|
||||
{ "__debug_line", ".debug_line" },
|
||||
{ "__debug_rnglists", ".debug_rnglists" },
|
||||
{ "__debug_loclists", ".debug_loclists" },
|
||||
{ "__debug_macinfo", ".debug_macinfo" },
|
||||
{ "__debug_loc", ".debug_loc" },
|
||||
{ "__debug_abbrev", ".debug_abbrev" },
|
||||
{ "__debug_aranges", ".debug_aranges" },
|
||||
{ "__debug_frame", ".debug_frame" },
|
||||
{ "__debug_info", ".debug_info" },
|
||||
{ "__debug_addr", ".debug_addr" },
|
||||
{ "__debug_line", ".debug_line" },
|
||||
{ "__debug_rnglists", ".debug_rnglists" },
|
||||
{ "__debug_loclists", ".debug_loclists" },
|
||||
{ "__debug_macinfo", ".debug_macinfo" },
|
||||
{ "__debug_loc", ".debug_loc" },
|
||||
{ "__debug_pubnames", ".debug_pubnames" },
|
||||
{ "__debug_pubtypes", ".debug_pubtypes" },
|
||||
{ "__debug_str", ".debug_str" },
|
||||
{ "__debug_str_offs", ".debug_str_offsets" },
|
||||
{ "__debug_line_str", ".debug_line_str" },
|
||||
{ "__debug_ranges", ".debug_ranges" },
|
||||
{ "__debug_macro", ".debug_macro" },
|
||||
{ "__debug_names", ".debug_names" },
|
||||
{ "__debug_gdb_scri", ".debug_gdb_scripts" }
|
||||
{ "__debug_str", ".debug_str" },
|
||||
{ "__debug_str_offs", ".debug_str_offsets" },
|
||||
{ "__debug_line_str", ".debug_line_str" },
|
||||
{ "__debug_ranges", ".debug_ranges" },
|
||||
{ "__debug_macro", ".debug_macro" },
|
||||
{ "__debug_names", ".debug_names" },
|
||||
{ "__debug_gdb_scri", ".debug_gdb_scripts" },
|
||||
{ "__text", ".text" },
|
||||
};
|
||||
|
||||
static int
|
||||
@@ -356,7 +403,10 @@ load_macho_header32(dwarf_macho_object_access_internals_t *mfp,
|
||||
if (mfp->mo_command_count >= mfp->mo_filesize ||
|
||||
mfp->mo_command_count >= MAX_COMMANDS_SIZE ||
|
||||
mfp->mo_header.sizeofcmds > MAX_COMMANDS_SIZE ||
|
||||
mfp->mo_header.sizeofcmds >= mfp->mo_filesize) {
|
||||
mfp->mo_header.sizeofcmds >= mfp->mo_filesize ||
|
||||
(mfp->mo_header.sizeofcmds*mfp->mo_command_count >=
|
||||
mfp->mo_filesize)
|
||||
) {
|
||||
*errcode = DW_DLE_MACHO_CORRUPT_HEADER;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
@@ -398,7 +448,9 @@ load_macho_header64(dwarf_macho_object_access_internals_t *mfp,
|
||||
mfp->mo_command_count = (unsigned int)mfp->mo_header.ncmds;
|
||||
if (mfp->mo_command_count >= mfp->mo_filesize ||
|
||||
mfp->mo_command_count >= MAX_COMMANDS_SIZE ||
|
||||
mfp->mo_header.sizeofcmds >= MAX_COMMANDS_SIZE) {
|
||||
mfp->mo_header.sizeofcmds >= MAX_COMMANDS_SIZE ||
|
||||
(mfp->mo_header.sizeofcmds*mfp->mo_command_count >=
|
||||
mfp->mo_filesize)) {
|
||||
*errcode = DW_DLE_MACHO_CORRUPT_HEADER;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
@@ -456,6 +508,10 @@ load_segment_command_content32(
|
||||
_dwarf_safe_strcpy(msp->segname,
|
||||
sizeof(msp->segname),
|
||||
sc.segname,sizeof(sc.segname));
|
||||
if (!is_known_segname(msp->segname)) {
|
||||
*errcode = DW_DLE_MACHO_CORRUPT_COMMAND;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
ASNAR(mfp->mo_copy_word,msp->vmaddr,sc.vmaddr);
|
||||
ASNAR(mfp->mo_copy_word,msp->vmsize,sc.vmsize);
|
||||
ASNAR(mfp->mo_copy_word,msp->fileoff,sc.fileoff);
|
||||
@@ -513,6 +569,9 @@ load_segment_command_content64(
|
||||
ASNAR(mfp->mo_copy_word,msp->cmdsize,sc.cmdsize);
|
||||
_dwarf_safe_strcpy(msp->segname,sizeof(msp->segname),
|
||||
sc.segname,sizeof(sc.segname));
|
||||
if (!is_known_segname(msp->segname)) {
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
ASNAR(mfp->mo_copy_word,msp->vmaddr,sc.vmaddr);
|
||||
ASNAR(mfp->mo_copy_word,msp->vmsize,sc.vmsize);
|
||||
ASNAR(mfp->mo_copy_word,msp->fileoff,sc.fileoff);
|
||||
@@ -602,33 +661,57 @@ _dwarf_macho_load_dwarf_section_details32(
|
||||
Dwarf_Unsigned seci = 0;
|
||||
Dwarf_Unsigned seccount = segp->nsects;
|
||||
Dwarf_Unsigned secalloc = seccount+1;
|
||||
|
||||
/* offset of sections being added */
|
||||
Dwarf_Unsigned curoff = segp->sectionsoffset;
|
||||
Dwarf_Unsigned shdrlen = sizeof(struct section);
|
||||
|
||||
Dwarf_Unsigned newcount = 0;
|
||||
struct generic_macho_section *secs = 0;
|
||||
|
||||
secs = (struct generic_macho_section *)calloc(
|
||||
(size_t)secalloc,
|
||||
sizeof(struct generic_macho_section));
|
||||
if (!secs) {
|
||||
*errcode = DW_DLE_ALLOC_FAIL;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
mfp->mo_dwarf_sections = secs;
|
||||
mfp->mo_dwarf_sectioncount = secalloc;
|
||||
if ((curoff > mfp->mo_filesize) ||
|
||||
(seccount > mfp->mo_filesize) ||
|
||||
(curoff+(seccount*sizeof(struct section)) >
|
||||
mfp->mo_filesize)) {
|
||||
*errcode = DW_DLE_FILE_TOO_SMALL;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
secs->offset_of_sec_rec = curoff;
|
||||
/* Leave 0 section all zeros except our offset,
|
||||
if (mfp->mo_dwarf_sections) {
|
||||
struct generic_macho_section * originalsections =
|
||||
mfp->mo_dwarf_sections;
|
||||
if (!seccount) {
|
||||
/* No sections. Odd. Unexpected. */
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
newcount = mfp->mo_dwarf_sectioncount + seccount;
|
||||
secs = (struct generic_macho_section *)calloc(
|
||||
newcount,
|
||||
sizeof(struct generic_macho_section));
|
||||
if (!secs) {
|
||||
*errcode = DW_DLE_ALLOC_FAIL;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
memcpy(secs,mfp->mo_dwarf_sections,
|
||||
mfp->mo_dwarf_sectioncount *
|
||||
sizeof(struct generic_macho_section));
|
||||
mfp->mo_dwarf_sections = secs;
|
||||
seci = mfp->mo_dwarf_sectioncount ;
|
||||
mfp->mo_dwarf_sectioncount = newcount;
|
||||
free(originalsections);
|
||||
secs += seci;
|
||||
secs->offset_of_sec_rec = curoff;
|
||||
secalloc = newcount;
|
||||
} else {
|
||||
secs = (struct generic_macho_section *)calloc(
|
||||
secalloc,
|
||||
sizeof(struct generic_macho_section));
|
||||
if (!secs) {
|
||||
*errcode = DW_DLE_ALLOC_FAIL;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
newcount = secalloc;
|
||||
mfp->mo_dwarf_sections = secs;
|
||||
mfp->mo_dwarf_sectioncount = secalloc;
|
||||
secs->offset_of_sec_rec = curoff;
|
||||
/* Leave 0 section all zeros except our offset,
|
||||
elf-like in a sense */
|
||||
secs->dwarfsectname = "";
|
||||
++secs;
|
||||
seci = 1;
|
||||
secs->dwarfsectname = "";
|
||||
seci = 1;
|
||||
++secs;
|
||||
}
|
||||
|
||||
for (; seci < secalloc; ++seci,++secs,curoff += shdrlen ) {
|
||||
struct section mosec;
|
||||
int res = 0;
|
||||
@@ -650,6 +733,10 @@ _dwarf_macho_load_dwarf_section_details32(
|
||||
_dwarf_safe_strcpy(secs->sectname,
|
||||
sizeof(secs->sectname),
|
||||
mosec.sectname,sizeof(mosec.sectname));
|
||||
if (not_ascii(secs->sectname) ) {
|
||||
*errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
_dwarf_safe_strcpy(secs->segname,
|
||||
sizeof(secs->segname),
|
||||
mosec.segname,sizeof(mosec.segname));
|
||||
@@ -660,9 +747,13 @@ _dwarf_macho_load_dwarf_section_details32(
|
||||
ASNAR(mfp->mo_copy_word,secs->reloff,mosec.reloff);
|
||||
ASNAR(mfp->mo_copy_word,secs->nreloc,mosec.nreloc);
|
||||
ASNAR(mfp->mo_copy_word,secs->flags,mosec.flags);
|
||||
if (secs->offset > mfp->mo_filesize ||
|
||||
/* __text section size apparently refers to
|
||||
executable, not dSYM, so do not check here */
|
||||
|
||||
if (!strcmp(secs->segname,"__DWARF") &&
|
||||
(secs->offset > mfp->mo_filesize ||
|
||||
secs->size > mfp->mo_filesize ||
|
||||
(secs->offset+secs->size) > mfp->mo_filesize) {
|
||||
(secs->offset+secs->size) > mfp->mo_filesize)) {
|
||||
*errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
@@ -686,30 +777,52 @@ _dwarf_macho_load_dwarf_section_details64(
|
||||
Dwarf_Unsigned secalloc = seccount+1;
|
||||
Dwarf_Unsigned curoff = segp->sectionsoffset;
|
||||
Dwarf_Unsigned shdrlen = sizeof(struct section_64);
|
||||
Dwarf_Unsigned newcount = 0;
|
||||
struct generic_macho_section *secs = 0;
|
||||
|
||||
secs = (struct generic_macho_section *)calloc(
|
||||
(size_t)secalloc,
|
||||
sizeof(struct generic_macho_section));
|
||||
if (!secs) {
|
||||
*errcode = DW_DLE_ALLOC_FAIL;
|
||||
return DW_DLV_ERROR;
|
||||
if (mfp->mo_dwarf_sections) {
|
||||
struct generic_macho_section * originalsections =
|
||||
mfp->mo_dwarf_sections;
|
||||
if (!seccount) {
|
||||
/* No sections. Odd. Unexpected. */
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
newcount = mfp->mo_dwarf_sectioncount + seccount;
|
||||
secs = (struct generic_macho_section *)calloc(
|
||||
newcount,
|
||||
sizeof(struct generic_macho_section));
|
||||
if (!secs) {
|
||||
*errcode = DW_DLE_ALLOC_FAIL;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
memcpy(secs,mfp->mo_dwarf_sections,
|
||||
mfp->mo_dwarf_sectioncount *
|
||||
sizeof(struct generic_macho_section));
|
||||
mfp->mo_dwarf_sections = secs;
|
||||
seci = mfp->mo_dwarf_sectioncount ;
|
||||
mfp->mo_dwarf_sectioncount = newcount;
|
||||
free(originalsections);
|
||||
secs += seci;
|
||||
secs->offset_of_sec_rec = curoff;
|
||||
secalloc = newcount;
|
||||
} else {
|
||||
secs = (struct generic_macho_section *)calloc(
|
||||
secalloc,
|
||||
sizeof(struct generic_macho_section));
|
||||
if (!secs) {
|
||||
*errcode = DW_DLE_ALLOC_FAIL;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
newcount = secalloc;
|
||||
mfp->mo_dwarf_sections = secs;
|
||||
mfp->mo_dwarf_sectioncount = secalloc;
|
||||
secs->offset_of_sec_rec = curoff;
|
||||
/* Leave 0 section all zeros except our offset,
|
||||
elf-like in a sense */
|
||||
secs->dwarfsectname = "";
|
||||
seci = 1;
|
||||
++secs;
|
||||
}
|
||||
mfp->mo_dwarf_sections = secs;
|
||||
mfp->mo_dwarf_sectioncount = secalloc;
|
||||
secs->offset_of_sec_rec = curoff;
|
||||
/* Leave 0 section all zeros except our offset,
|
||||
elf-like in a sense */
|
||||
secs->dwarfsectname = "";
|
||||
++secs;
|
||||
if ((curoff > mfp->mo_filesize) ||
|
||||
(seccount > mfp->mo_filesize) ||
|
||||
(curoff+(seccount*sizeof(struct section_64)) >
|
||||
mfp->mo_filesize)) {
|
||||
*errcode = DW_DLE_FILE_TOO_SMALL;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
seci = 1;
|
||||
for (; seci < secalloc; ++seci,++secs,curoff += shdrlen ) {
|
||||
int res = 0;
|
||||
struct section_64 mosec;
|
||||
@@ -732,9 +845,14 @@ _dwarf_macho_load_dwarf_section_details64(
|
||||
_dwarf_safe_strcpy(secs->sectname,
|
||||
sizeof(secs->sectname),
|
||||
mosec.sectname,sizeof(mosec.sectname));
|
||||
if (not_ascii(secs->sectname) ) {
|
||||
*errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
_dwarf_safe_strcpy(secs->segname,
|
||||
sizeof(secs->segname),
|
||||
mosec.segname,sizeof(mosec.segname));
|
||||
|
||||
ASNAR(mfp->mo_copy_word,secs->addr,mosec.addr);
|
||||
ASNAR(mfp->mo_copy_word,secs->size,mosec.size);
|
||||
ASNAR(mfp->mo_copy_word,secs->offset,mosec.offset);
|
||||
@@ -742,9 +860,13 @@ _dwarf_macho_load_dwarf_section_details64(
|
||||
ASNAR(mfp->mo_copy_word,secs->reloff,mosec.reloff);
|
||||
ASNAR(mfp->mo_copy_word,secs->nreloc,mosec.nreloc);
|
||||
ASNAR(mfp->mo_copy_word,secs->flags,mosec.flags);
|
||||
if (secs->offset > mfp->mo_filesize ||
|
||||
|
||||
/* __text section size apparently refers to executable,
|
||||
not dSYM, so do not check here */
|
||||
if (!strcmp(secs->segname,"__DWARF") &&
|
||||
(secs->offset > mfp->mo_filesize ||
|
||||
secs->size > mfp->mo_filesize ||
|
||||
(secs->offset+secs->size) > mfp->mo_filesize) {
|
||||
(secs->offset+secs->size) > mfp->mo_filesize)) {
|
||||
*errcode = DW_DLE_MACHO_CORRUPT_SECTIONDETAILS;
|
||||
return DW_DLV_ERROR;
|
||||
}
|
||||
@@ -794,26 +916,17 @@ _dwarf_macho_load_dwarf_sections(
|
||||
}
|
||||
for ( ; segi < mfp->mo_segment_count; ++segi,++segp) {
|
||||
int res = 0;
|
||||
|
||||
switch (ftype) {
|
||||
case MH_DSYM: {
|
||||
if (strcmp(segp->segname,"__DWARF")) {
|
||||
/* No DWARF in this segment */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* will have DWARF */
|
||||
break;
|
||||
case MH_OBJECT:
|
||||
/* Likely has DWARF */
|
||||
break;
|
||||
default:
|
||||
/* We do not think it can have DWARF */
|
||||
if (!strcmp(segp->segname,"__PAGEZERO")) {
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(segp->segname,"__LINKEDIT")) {
|
||||
continue;
|
||||
}
|
||||
res = _dwarf_macho_load_dwarf_section_details(mfp,
|
||||
segp,segi,errcode);
|
||||
return res;
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
|
@@ -1231,6 +1231,13 @@ _dwarf_has_SECT_fission(Dwarf_CU_Context ctx,
|
||||
unsigned int SECT_number, /* example: DW_SECT_RNGLISTS */
|
||||
Dwarf_Bool *hasfissionoffset,
|
||||
Dwarf_Unsigned *loclistsbase);
|
||||
int
|
||||
_dwarf_read_str_index_val_itself(Dwarf_Debug dbg,
|
||||
unsigned theform, Dwarf_Small *info_ptr,
|
||||
Dwarf_Small *section_end,
|
||||
Dwarf_Unsigned *return_index,
|
||||
Dwarf_Unsigned *return_index_length,
|
||||
Dwarf_Error *error) ;
|
||||
|
||||
int _dwarf_skip_leb128(char * leb,
|
||||
Dwarf_Unsigned * leblen,
|
||||
|
@@ -153,10 +153,15 @@ dwarf_str_offsets_value_by_index(Dwarf_Str_Offsets_Table sot,
|
||||
Dwarf_Unsigned secsize = 0;
|
||||
Dwarf_Debug dbg = 0;
|
||||
Dwarf_Small *end_ptr = 0;
|
||||
int res = 0;
|
||||
/* so_section_size */
|
||||
|
||||
VALIDATE_SOT(sot)
|
||||
dbg = sot->so_dbg;
|
||||
res = _dwarf_load_section(dbg, &dbg->de_debug_str_offsets,error);
|
||||
if (res != DW_DLV_OK) {
|
||||
return res;
|
||||
}
|
||||
secsize = dbg->de_debug_str_offsets.dss_size;
|
||||
if (index >= sot->so_array_entry_count) {
|
||||
return DW_DLV_NO_ENTRY;
|
||||
|
@@ -543,6 +543,14 @@ typedef struct Dwarf_Ranges_s {
|
||||
block.bl_len.
|
||||
Other values of dw_value_type are an error.
|
||||
|
||||
DWARF is showing what a debugger would act on to
|
||||
calculate actual register values. Libdwarf does
|
||||
not know any register values and cannot calculate
|
||||
any. If a caller wishes to actually do the
|
||||
proper calculations the caller must provide
|
||||
its own register data space and calculate new values
|
||||
and new register status in the caller's register data.
|
||||
|
||||
Note that this definition can only deal correctly
|
||||
with register numbers that fit in a 16 bit
|
||||
unsigned value. Removing this
|
||||
|
Reference in New Issue
Block a user