Commit Graph

289 Commits

Author SHA1 Message Date
Eric Pouech 00a11ff73d dbghelp: Don't use .debug_frame section if non present when unwinding.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52295
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-03 14:50:29 +01:00
Alistair Leslie-Hughes 33308a577c dbghelp: Fix possible memory leak (Coverity).
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 17:14:59 +01:00
Eric Pouech 441838b7b2 dbghelp/dwarf: Don't unmap the fmap of a DWZ module twice.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Eric Pouech 82ea35cbb5 dbghelp/dwarf: Fix computation of some location attributes.
Dwarf4 clarified that only FORM_sec_offset can refer to location
lists, fix dwarf2_compute_location_attr accordingly.

This fixes the 'fixme:dwarf2_parse_udt_member: Found register, while
not expecting it' messages.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:01:47 +01:00
Eric Pouech 61c8728a6e dbghelp/dwarf: Don't register labels without address.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:01:35 +01:00
Eric Pouech 19f97c5fd8 dbghelp/dwarf: Make use of AT_type if present when parsing an enumeration type.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:01:28 +01:00
Eric Pouech acfcd84a05 dbghelp/dwarf: Workaround functions with multiple range of addresses.
gcc can emit functions with code spread across non contiguous code areas.
We used to register those functions with an address range enclosing all ranges
(meaning that all addresses not actually belonging to the function but
lying in that address range could be returned by dbghelp as belonging
to the function).

Work around this by registering the function with only the first range
of addresses (this will avoid the errors described above), but will
fail to mark the other address ranges as part of the function.

dbghelp doesn't seem to have explicit support of those cases, even if
pdb/codeview also support functions with multi range of addresses
(see S_SEPCODE).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:16:26 +01:00
Eric Pouech b332bda8e2 dbghelp/dwarf: Introduce a helper to read properly multiple range of addresses.
Use it to reimplement dwarf2_feed_inlined_ranges.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:16:17 +01:00
Eric Pouech 9f3e8a515f dbghelp: Use cpu from debuggee's modules rather than debugger's.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech e8b195329e dbghelp: Use module's cpu word size instead of sizeof(void*) or sizeof(DWORD_PTR).
This fixes a couple of wrong pointer size computation when debugging a
WoW64 process from a 64 bit debugger.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech f83e647547 dbghelp/dwarf: Don't skip functions when their inlined flag comes from an abstract origin.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-05 17:10:45 +01:00
Eric Pouech 7bde153afe dbghelp/dwarf: Store line numbers and file info for inlined functions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:28:19 +02:00
Eric Pouech 1c5989465e dbghelp: Make symt_add_func_line() last parameter an absolute address.
It used to be an offset to the start of function, but it's actually
stored as an absolute address afterwards. This avoids unnecessary
computations.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:27:41 +02:00
Eric Pouech fb34c82ef8 dbghelp/dwarf: Store each subrange for an inlined function.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech 690c2e51bf dbghelp/dwarf: Generate proper inline functions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech ecb91941b3 dbghelp/dwarf: Add current block as a field in dwarf2_subprogram_t.
Instead of passing it as a parameter in various subprogram related
functions.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech b9290c987a dbghelp: Introduce symt_inlinesite (SymTagInlineSite) to support inline sites.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech 066bb761cc dbghelp: Add local scope information in struct process.
- make SymSetContext() generate this information
- let SymEnumSymboli() (when dealing with local symbols) use this
  information instead of the stack frame

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech 7bc6eb9d25 dbghelp/dwarf: Properly handle error cases while computing frame_cfa.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:59:13 +02:00
Alexandre Julliard 8b58eca071 dbghelp: Use the bundled zlib.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 11:08:00 +02:00
Eric Pouech 099a8bbfd3 dbghelp: Add helper to initialize a module_pair.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 22:52:25 +02:00
Eric Pouech 58d5b3c880 dbghelp: Use proper macros for VARIANT.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 22:52:25 +02:00
Eric Pouech 2da1698312 dbghelp/dwarf: Correctly compute address of label.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech 9768ea5637 dbghelp/dwarf: Bump max supported version (by default) up to 4.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 21:48:59 +02:00
Eric Pouech 56969bc80e dbghelp/dwarf: Fix incorrect WARN.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 21:48:59 +02:00
Eric Pouech dd67b78ed3 dbghelp/dwarf: Add support for local variables with constant values.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 21:48:59 +02:00
Eric Pouech 0de0a80940 dbghelp/dwarf: Downgrade FIXME into WARN for empty range.
It happens to be generated for some inline functions, that we badly
support yet.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-28 21:48:59 +02:00
Eric Pouech e039a28e3b dbghelp/dwarf: Silence a couple of dwarf DIE's tag in load_one_debug_entry.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Eric Pouech d8c9171c78 dbghelp/dwarf: Added support for OP_call_frame_cfa.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Eric Pouech 1ecd66200d dbghelp/dwarf: Split dwarf2_virtual_unwind into two functions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Eric Pouech eabeb1da5c dbghelp/dwarf: Pass cuhead to loc_compute_frame.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Eric Pouech c2d1d76531 dbghelp/dwarf: Add support for DW_TAG_imported_unit.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Eric Pouech e5a1b8b334 dbghelp/dwarf: Add support for partial compilation units.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Eric Pouech e362ed8c28 dbghelp/dwarf: Fix a couple of parent/child mismatch.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-27 17:40:14 +02:00
Eric Pouech 15eb6a2560 dbghelp/dwarf: Handle C++ rvalue reference type as a reference.
As we don't handle C++ references yet, it'll be a pointer in the end.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:02:21 +02:00
Eric Pouech 79cd318b77 dbghelp/dwarf: Support more dwarf's TAG related to types in udt parsing.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:02:09 +02:00
Eric Pouech 88840187f5 dbghelp/dwarf: Added support for DW_TAG_subrange_type in various places.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:02:05 +02:00
Eric Pouech 44bcae3f8d dbghelp/dwarf: Support enumeration as index type for arrays.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:02:00 +02:00
Eric Pouech 09d2a6cffb dbghelp/dwarf: Added support for parsing dwarf's 3 restrict type TAG.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:01:52 +02:00
Eric Pouech 87485ea107 dbghelp/dwarf: Handle some Dwarf4 tweaks in high / low pc attributes.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:01:46 +02:00
Eric Pouech 23c325276b dbghelp: Remove unneeded #include <limits.h>.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:01:03 +02:00
Eric Pouech 69d07126fe dbghelp/dwarf: Properly detect base address selection in AT_ranges.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:00:59 +02:00
Eric Pouech ab8fdb191c dbghelp/dwarf: In DW_AT_ranges, the values are relative to the start of the CU.
And not the module, as most of the other addresses.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-21 19:00:34 +02:00
Eric Pouech 8547aac2dc dbghelp/dwarf: When loading a DWZ alternate file, don't force loading of all debug_infos.
Can have huge performance impact: libgcc_s.so.8 load time decreased
from 40 seconds down to less than 1 second.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Eric Pouech dc0ac71f5a dbghelp/dwarf: Add proper support for DW_FORM_GNU_ref_alt.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Eric Pouech d832d51c2c dbghelp/dwarf: Add a helper to jump into another debug_info.
This helper takes into account that source and destination debug_info
can be in different dwarf units, and even different debug files (DWZ).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Eric Pouech def87b2aef dbghelp/dwarf: No longer pas a unit context when parsing debug_info content.
Use debug_info's unit_context instead.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Eric Pouech 87b70fb272 dbghelp/dwarf: Fold printing info about unit context when printing debug_info's.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Eric Pouech e804b0754f dbghelp/dwarf: No longer pass a unit context to dwarf2_get_cpp_name.
Use debug_info's unit context instead.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00
Eric Pouech 61af17e6cf dbghelp/dwarf: No longer pass a parse context to dwarf2_find_attribute.
Use debug_info's unit context instead.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-16 22:22:44 +02:00