Commit graph

1422 commits

Author SHA1 Message Date
Alistair Leslie-Hughes dd009533b1 dbghelp: Remove DECLSPEC_HIDDEN usage. 2023-11-13 11:04:45 +01:00
Alexandre Julliard acad49573a makefiles: Always use the global SOURCES variable for .c files. 2023-11-01 22:44:03 +01:00
Alexandre Julliard 7ccb5df0fc makefiles: Always use the global SOURCES variable for .rc files. 2023-11-01 22:43:56 +01:00
Alexandre Julliard 52618e1d3c dbghelp: Fix a compiler warning on ARM64. 2023-10-18 20:46:59 +02:00
Eric Pouech 43598133e6 dbghelp: Remove unneeded parameter to pe_map_file.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-10-18 11:01:56 +02:00
Eric Pouech d4104e8505 dbghelp: Simplified module_find_by_addr().
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-10-18 11:01:56 +02:00
Eric Pouech e1064850ff dbghelp: Set the machine type for mach-O modules.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-10-18 11:01:56 +02:00
Eric Pouech 0a1de579a7 dbghelp: Use is_host_64bit for handling bitness of mach-o libs.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55650
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-10-18 11:01:51 +02:00
Eric Pouech d6096057f5 dbghelp: Rename internal field (system -> host).
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-10-18 11:01:50 +02:00
Alexandre Julliard 7e957a17f6 makefiles: Remove unnecessary imports of version.dll.
The functions are in kernelbase nowadays.
2023-10-12 10:34:21 +02:00
Eric Pouech 152e72c82c dbghelp: Read debuggee environment by page.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-10-09 20:52:00 +02:00
Eric Pouech 733bf91606 dbghelp: Simplify allocation code.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-10-09 20:52:00 +02:00
Alexandre Julliard 0ee4bec912 dbghelp: Consistently use the IMAGE_FIRST_SECTION helper macro. 2023-09-25 13:02:09 +02:00
Eric Pouech 9a28dbfb27 dbghelp: Check that dwarf unwinder did actually unwind.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55560
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-09-18 20:35:58 +02:00
Eric Pouech 776ba1304e dbghelp: Don't insert dwz file map into module's file maps' chain.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-09-15 21:15:28 +02:00
Eric Pouech ced42c449a dbghelp: Fix sign extension issues on 32bit compilation.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-08-21 22:47:42 +02:00
Francois Gouget fddb797768 dbghelp/tests: Fix the case of a comment. 2023-07-27 16:36:14 +09:00
Eric Pouech 5f9119447c dbghelp: Use nameless union/structs.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-07-06 20:54:30 +02:00
Jacek Caban 439a36e33a dbghelp: Use V_INT macro to access VARIANT value. 2023-07-06 20:54:30 +02:00
Alexandre Julliard 03ce134d6f dbghelp: Use nameless union/structs. 2023-07-05 17:03:30 +02:00
Eric Pouech f93d7114c7 dbghelp/tests: Use indirect call for SymSetExtendedOption.
(sigh 1d281c62 was incomplete).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55128
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-30 17:35:48 +02:00
Alex Henrie 00df1bea9a dbghelp: Allocate real_path with the CRT and copy it to the module heap.
Fixes both a memory leak and an alloc/free mismatch, and the module heap
is the most appropriate place to hold the variable long-term.
2023-06-27 11:58:05 +02:00
Eric Pouech 1d281c620d dbghelp/tests: Don't call SymSetExtendedOption() directly.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55128
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-26 20:20:27 +02:00
Eric Pouech bbc2a9ab5b dbghelp: Implement SymSrvGetFileIndexInfo for PDB files.
Only done for DS format.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-26 16:49:45 +02:00
Eric Pouech f4c1860480 dbghelp: Add tests for SymSrvGetFileIndexInfo() for PDB files.
Add infrastructure to generate fake .PDB files.

Only done in DS format.

I'm not sure we care about JG anymore, DS format has been introduced
by MS in early 2000 to supersede JG, and is still mainstream today).
For the record, LLVM in its PDB handling doesn't support JG format.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-26 16:49:45 +02:00
Eric Pouech eb1f62bb31 dbghelp: Fix reading Wine loader's base address.
Note: the 32bit tests in new wow mode are still marked
todo as the ELF debug header is located above the 4G limit
and "default" module management in dbghelp compiled in 32bit
is (mostly) done with 32 bit addresses.
The correct fix should be to always consider ELF (and macho-O)
modules with 64bit addresses (which means likely to move all
modules handling to 64bit even in 32bit compilations).
But that goes far beyond this patch.

This limitation will only impact debuggers compiled in 32bit,
using 32bit builtin dbghelp on a 32bit debuggee.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55058
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55096
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-23 11:28:19 +02:00
Eric Pouech 1ed646ebf6 dbghelp/tests: Add explicit tests about loading ELF modules.
Perhaps next time ELF loader is modified, it'll be noticed if it breaks
things.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55058
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55096
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-23 11:28:08 +02:00
Eric Pouech 5efe29edc0 dbghelp: Implement SymSrvGetFileIndexInfo for PE modules.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-06-20 20:29:53 +02:00
Eric Pouech 4d32b2ee30 dbghelp/tests: Add tests for SymSrvGetInfoIndexes.
Tests related to debug directories.
Extending the PE image generator with debug directories.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-20 20:29:52 +02:00
Eric Pouech 954f302f70 dbghelp/tests: Add tests for SymSrvGetIndexesInfo.
Tests on PE image (header part, no debug directory).
Add infrastructure to generate PE image (derived from
kernel32/tests/loader.c).

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-20 20:29:49 +02:00
Eric Pouech 1f437ed89a dbghelp: Create implementation basis for SymSrvGetFileIndex*().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-06-20 20:29:48 +02:00
Eric Pouech af7b97e780 dbghelp: Reimplement EnumerateLoadedModules().
- correctly taking into accoung SYMOPT_INCLUDE_32BIT_MODULES option
- converting, for 32bit modules requested from a 64bit module,
  the system32 paths into syswow64

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-06-02 20:47:28 +02:00
Eric Pouech 79bae0ed37 dbghelp/tests: Add more tests for module imagename handling.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-06-02 20:47:25 +02:00
Eric Pouech ed532a36b3 dbghelp/tests: Review old-wow64 expected values.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-06-02 20:47:01 +02:00
Eric Pouech 76d922983d dbghelp/tests: Fix process kind detection on old Windows machines.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-06-02 20:35:53 +02:00
Michael Stefaniuc cf3815dc59 dbghelp: Remove superfluous casts to self. 2023-06-01 22:00:19 +02:00
Eric Pouech 542ccaaf84 dbghelp: Better handle very long C++ qualified identifiers in dwarf.
This fixes some crashes especially when dealing with very long C++ names
(like template classes).

Fortunately, dwarf internals don't require type lookup by name (eg.
on forward declaration), so the impact of thrashing some names is limited.

It's very likely native doesn't store directly these very long names
(it could either store the qualified mangled name - which can be way shorter
for template classes - or use the names in lexical hierarchy: both boil down
to storing less information, and recompute it (unmangle or class hierarchy
walk) upon request).
But this would need a proper C++ support in dbghelp. Not for today.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-05-30 20:56:31 +02:00
Eric Pouech 812b4b1ca3 dbghelp: Use source file path as stored in debug info format.
Currently, dbghelp returns the source file either:
- in DOS format when native module option isn't enabled
- as stored in debug info format otherwise

This used to work for PE modules inside ELF shared libraries but is broken
since evolution to REAL modules. This generates several issues:
- winedbg does not always set the native module option when calling dbghelp
  for source file related functions, leading to heterogenous output to user
- some dbghelp function rely on matching source paths, hence leading to
  errors in winedbg when mixing the two formats for the same source file.

Introduce a new Wine only dbghelp option to return the source paths as they
are stored inside debug information format, and activate it unconditionaly
inside winedbg.

This fixes some failure cases of command 'break <NN>' in winedbg.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-04-18 18:17:44 +02:00
Eric Pouech 13afaa7c16 dbghelp/tests: Use msinfo32.exe instead of notepad.exe.
Under Windows 11, notepad.exe has been migrated into the UWP framework,
and can no longer be launched as a 32bit process:
- even if c:\windows\syswow64\notepad.exe is still a 32 bit PE file
- the process created from c:\windows\syswow64\notepad.exe is not a
  wow64 process.

So use msinfo32.exe instead. Like notepad.exe, it's a gui application,
present on Wine and all test-bot:ed windows platforms. But unlike
notepad.exe, it's not an UWP app on Windows 11.

(May not fully fix all the bugs below, but will get rid of a bunch
 of errors).

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54535
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54536
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54537
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-08 18:08:23 +01:00
Eric Pouech 5477ee640b dbghelp: Fix vdso.so lookup.
- should have been fixed when libwine.so has been removed
- code was broken anyway
- enhanced protect against error when reading debuggee's memory

Introducing helper to correctly read pointer's from debuggee
(and other integral values).

vdso is now listed in ELF's module list (except if Wine's preloader
removes it from auxilary vector)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-08 17:49:00 +01:00
Eric Pouech 9877ba9732 dbghelp: Don't set ELF loader when wine's loader isn't accessible.
For dbghelp in 32-bit, when accessing a live debuggee in multi-arch
configuration, Wine's ELF loader is likely mapped above 4G, hence
not accessible with 32bit Windows APIs.
So don't try to expose the ELF libraries in that case.
Introducing a new loader operation class to support live targets, for
which system operations are not accessible, but pretending they are
successful.

Note:
- when Wine's loader ELF module isn't registered by dbghelp,
  any other ELF module will not be registered by dbghelp.
- further work may be needed for winedbg in auto mode (launched with
  AeDebug key on process exception) as in that mode winedbg
  doesn't relaunch itself in 64bit, so won't be able to access
  (64bit) ELF information (in multi-arch configuration).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-08 17:49:00 +01:00
Eric Pouech 0f98972fe2 dbghelp/tests: Add tests for SymRefreshModuleList() on non-live target.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-08 17:49:00 +01:00
Eric Pouech aabb4e12bc dbghelp: Use 'wine' as loader on multi-arch configuration.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-08 17:49:00 +01:00
Eric Pouech e1f41c0a17 dbghelp/tests: Preserve last error in process_get_kind().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-08 17:49:00 +01:00
Eric Pouech 2d3b6d03fe dbghelp/tests: Better use global variables.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-03-08 17:49:00 +01:00
Francois Gouget ed6ab3222e dbghelp/tests: Let the tests run on Windows 7, 8 and 10 <= 1607.
Provide a fallback if IsWow64Process2() is not available.

Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=54605
2023-03-07 17:25:08 +01:00
Eric Pouech 291daf542d dbghelp/tests: Fix tests for process count in wow64.
Introduce get_process_kind() to discriminate configurations.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-02-27 16:36:22 +01:00
Eric Pouech 8aea039507 dbghelp/tests: Introduce get_machine_bitness() helper.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-02-27 16:36:22 +01:00
Eric Pouech 160d961e32 dbghelp/tests: Only retrieve the system directories once.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-02-27 16:36:22 +01:00
Eric Pouech 91a644ae8a dbghelp/tests: Introduce ends_withW helper.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2023-02-27 16:36:22 +01:00