Commit Graph

1113 Commits

Author SHA1 Message Date
Eric Pouech e87f3dd5b8 dbghelp/dwarf: Properly parse line number header for DWARF4 debug info.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech e28ec5a0fb dbghelp/dwarf: Detect auto reference between a dwarf's DIE and its type.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech 3111daa222 dbghelp/dwarf: Validate that a string is in the section boundary before using it.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech 23f0ebbca6 dbghelp/dwarf: Add definitions of some GNU extensions for FORMs.
And return failure when encoutering them, as they are not supported yet.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech 12a778426d dbghelp/dwarf: Handle errors in dwarf2_fill_attr by returning a boolean.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech 40877456ea dbghelp/dwarf: Add support for FORM_exprloc.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech 6bd22a2f50 dbghelp/dwarf: Add support for FORM_loc_offset and FORM_sec_offset.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech 8241fe3877 dbghelp/dwarf: Correctly handle attributes according to 32bit or 64bit format.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech d78c09aa37 dbghelp/dwarf: Properly parse 32 vs bit 64bit entities.
Store the offset_size in dwarf2_cuhead_t.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:35:52 +02:00
Eric Pouech 92b3f1bf2a dbghelp/dwarf: Don't recompute location when said location is complex.
This was generating a global symbol instead of a local symbol.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-14 21:24:47 +02:00
Eric Pouech f4afcb3f5a dbghelp: Ensure all adresses are stored at least in DWORD_PTR.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-10 20:22:11 +02:00
Eric Pouech c031d5aa8c dbghelp: Use correct parameter name.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-10 20:22:11 +02:00
Eric Pouech 7f2eb08304 dbghelp/dwarf: Initialize module's word_size at module load time.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-10 20:22:11 +02:00
Eric Pouech 7bb85884e0 dbghelp/dwarf: Pass dwarf2_cuhead_t to lookuploclist().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-10 20:22:11 +02:00
Eric Pouech 0b7f8373e3 dbghelp/dwarf: Use word_size from cuhead_t.
Removed word_size from traverse context and make use of cuhead_t's
equivalent field instead

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:33:12 +02:00
Eric Pouech ff7ec0d829 dbghelp/dwarf: Pass word_size as a parameter to a couple of frame related functions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:32:56 +02:00
Eric Pouech bb5d9cf63d dbghelp/dwarf: Pass a parse_cuhead_t to compute_location().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:32:43 +02:00
Eric Pouech d12c754806 dbghelp/dwarf: Pass dwarf2_cuhead_t for addr details to swallow_attribute.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:32:31 +02:00
Eric Pouech f4da45d9f5 dbghelp/dwarf: Add word size parameter to parse_addr() internal function.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:32:14 +02:00
Eric Pouech d648dcd3a6 dbghelp/dwarf: Share compilation unit header information.
Store cu information for dwarf content
- in each compiland
- and queue the unique one's inside the module.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:31:54 +02:00
Eric Pouech 1c8869e79a dbghelp/dwarf: Add dwarf2_cuhead_s structure to hold compilation unit parsing info.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:31:30 +02:00
Eric Pouech 31b6640e48 dbghelp/dwarf: Allow tweaking from env variable which DWARF version is to be loaded.
This is a temporary feature while implementing the required bits for Dwarf3
and Dwarf4 format.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 22:31:28 +02:00
Akihiro Sagawa 70032f8863 dbghelp: Get rid of useless while loop.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-09 19:34:12 +02:00
Eric Pouech cee52d5988 dbghelp: Get rid of useless symt_normalize_func().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-07 23:19:22 +02:00
Eric Pouech 707a2273ec dbghelp: Set is_first and is_last flags on the fly in symt_add_func_line.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-07 23:19:22 +02:00
Eric Pouech cd8b85e4a9 dbghelp: Rewrite SymGetLinePrev* with internal_line_t.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-07 23:19:22 +02:00
Eric Pouech 8557fd5b34 dbghelp: Implement all SymGetLineNext* functions using internal_line_t.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-07 23:19:22 +02:00
Eric Pouech fabc4f7e12 dbghelp: Add internal_line_t structure as help in Line manipulation.
the rationale is that:
- the file name in IMAGEHLP_LINE* structures is returned as a pointer to
  an internal buffer
- in the W64 variant of APIs, two calls to fetch_buffer() are currently needed
  (one for first A allocation, second for W conversion)
- this generate bugs as it's assumed the two buffers are different

so the internal_line_t purpose is to factorize the implementations
of the 3 variants (A32, A64, W64) into a single code path
this insures a unique allocation, and at most, one conversion

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-07 23:19:22 +02:00
Eric Pouech d459301de6 dbghelp: Make symt_fill_func_line_info() and symt_get_func_line_next() static functions inside symbol.c.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-07 23:19:22 +02:00
Eric Pouech ffc3efe775 dbghelp: Manage the new MachineType field in IMAGEHLP_MODULE(W)64.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-06 17:59:11 +02:00
Eric Pouech b882ab2b25 dbghelp: Use the correct module name for lookups including module's name.
(modulename is truncated at 64 chars, while module.ModuleName at 32 chars)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-06 17:58:43 +02:00
Eric Pouech b9ebb3fb62 dbghelp: Use module->modulename instead of module->module.ModuleName in traces.
The former is truncated to 64 chars while the latter is truncated to
32 chars.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-06 17:58:29 +02:00
Eric Pouech 2296b4952a dbghelp: Return correct error code when reloading a module in SymLoadModule*.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-06 17:58:20 +02:00
Eric Pouech aed40b934c dbghelp: Allow loading virtual module at any address.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-06 17:58:05 +02:00
Eric Pouech f2f27b6b95 dbghelp: SymLoadModule* should return the base address in case of success, and 0 otherwise.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-06 17:57:51 +02:00
Eric Pouech a4b206b384 dbghelp: Handle the case where loader isn't what WINELOADER reports.
use case, in a WoW setup:
	wine programs/winedbg/winedbg.exe.so notepad.exe
where both winedbg and notepad are 64bit exec:s

in this case, dbghelp (loaded from winedbg) reads '<...>/wine' from WINELOADER
windows env block inside notepad
(but the unix env block is correctly set to wine64 by the tweak in
ntdll/unix/loader.c)

as a consequence dbghelp doesn't get the ELF information (it tries to read 32bit
ELF entities, and fails); hence misses all the loaded ELF libraries
winedbg's command 'info share' only reports the PE modules

note: the 'dual' case
  wine64 programs/winedbg/winedbg.exe.so c:\\windows\\syswow64\\notepad.exe
  where winedbg is a 64bit exec and notepad a 32bit
  shows the same failures

workaround this in dbghelp by tweaking the value of WINELOADER whether
the debuggee is 32 or 64bit

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:51:04 +02:00
Eric Pouech ca00b056b8 dbghelp: Properly handle errors when reading first DIE in compilation unit.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:50:52 +02:00
Eric Pouech e05bac0fd5 dbghelp: Fix erroneous string manipulation when said string is empty.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:50:45 +02:00
Eric Pouech ebff1e8c9b dbghelp: Harden inspection of Dwarf line number information.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:50:38 +02:00
Eric Pouech 0b84fa05a1 dbghelp: Don't call assert() on missing subprogram dwarf's information.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:50:28 +02:00
Eric Pouech c8fede5efb dbghelp: Check correctness of type (esp. in case of unknown ones).
Since with the unknown type entry, we can end up with types which don't
match the expected symt->tag, we need to check before the conversions.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:50:14 +02:00
Eric Pouech ee3ea1e163 dbghelp: Added an unknown type in symt_cache for handling bad references to types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:50:06 +02:00
Eric Pouech e08b80a752 dbghelp: Mostly get rid of symt_cache in dwarf debug information.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:49:57 +02:00
Eric Pouech c9b0483689 dbghelp: Always return a type in lookup_type, even in case of errors.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:49:42 +02:00
Eric Pouech 50144e2732 dbghelp: Fix dwarf constants.
The 32bit CIE_ID is an unsigned integer (will become important when
handling 32 vs 64 bit values).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:49:31 +02:00
Eric Pouech 1a2d1e1a8a dbghelp: Update/clarify dwarf definitions for 3/3f/4 standard versions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:49:13 +02:00
Eric Pouech 598e577475 dbghelp: Add a couple of more traces when querying an attribute's value.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:49:11 +02:00
Eric Pouech 0020265286 dbghelp: Add dwarf support of DW_FORM_ref_udata.
DW_FORM_ref_udata value is an offset from current unit (as the others
DW_FORM_ref[1,2,3,4] are)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:48:37 +02:00
Eric Pouech 7790b395ce dbghelp: Fix dwarf2 subprogram handling.
Fix dwarf2_parse_subprogram_block when looking for inner information
to use the child's debug_info (not the lexical_block one!)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-09-03 13:48:26 +02:00
Eric Pouech 35c45857ae dbghelp: Tidy up internals for array type.
Mainly remove hackish storage of information with negative value and
use a uniform min/count pair for all debug formats.

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