Commit graph

1441 commits

Author SHA1 Message Date
Eric Pouech
552bc893e1 dbghelp: Don't expected a fixed number of substreams in DBI header (PDB).
MSC no longer emits a fixed number of substreams (depending on version of
PDB file), but can emit less.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-20 10:51:37 +01:00
Eric Pouech
65109c725d dbghelp: Implement SymFromIndex().
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-19 20:39:43 +01:00
Eric Pouech
9bca18e796 dbghelp: Implement SymSrvGetFileIndexInfo() for PDB/JG files.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-01 21:47:17 +01:00
Eric Pouech
767fc14ef7 dbghelp: Implement SymSrvGetFileIndexInfo() for .dbg files.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-01 21:47:17 +01:00
Eric Pouech
34128f1ae7 dbghelp/tests: Test SymSrvGetFileIndexInfo() on .dbg files.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-01 21:47:17 +01:00
Eric Pouech
27003f8329 dbghelp/tests: Use Unicode encoding for generated PDB filenames.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-02-01 21:47:17 +01:00
Alexandre Julliard
87a21586a8 dbghelp/tests: Mark failing tests as todo. 2024-01-30 22:41:17 +01:00
Bernhard Übelacker
c3ef1a6c67 dbghelp: Return early if HeapAlloc failed.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56223
2024-01-22 10:10:23 +01:00
Eric Pouech
585e9d4985 dbghelp: Support redefinition of a range statement.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56168
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-01-17 10:57:12 +01:00
Eric Pouech
371827c3ef dbghelp/tests: Wait for child window to be up before testing.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-12-21 21:15:47 +01:00
Eric Pouech
7b0d974439 dbghelp: Fix some tests for SymLoadModule*().
On top of being closer to native behavior, this helps some
games where:
- they use dbghelp to gather information of where they generate exceptions,
- they generate exception in the game play,
- and refresh their list of loaded modules in dbghelp.

This can generate some delays (~2ms per module), which affects
game play (freeze, slugginess...).

Credit to Paul Gofman for triaging this.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-12-18 22:26:11 +01:00
Eric Pouech
f5e86cbea6 dbghelp/tests: Extend tests for module loading.
Basically, showing specific behavior when calling SymLoadModule()
with a non-null base address, and that address is already
the exact base address of a loaded module.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-12-18 22:26:09 +01:00
Eric Pouech
f2d98ea7cf dbghelp: Skip deleted vector in hash inside PDB header.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-12-11 23:11:20 +01:00
Eric Pouech
525f990e70 winedump: Don't fail on extra stream entry in PDB.
Latest versions of MSVC use this.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-12-11 23:11:20 +01:00
Eric Pouech
60108ea1bc dbghelp: Pretend mach-o is present in case of failure.
On MacOs, starting with Big Sur 11.0.1, the system dynamic
libraries are no longer directly accessible on disk.
They are still available through dlopen and friends. For getting
access to the images (and their debug symbol), Apple provides,
in the developper kit, the tools to extract the files. Note that
this is handled as a database of all system libraries, where ASLR
is in place such that segments of a given library are no longer
contiguous in memory (dbghelp doesn't currently handle this).

Apart from not having image information nor debug information,
another side effect is that dbghelp tries every time it refreshes the
mach-o module list to reload any library for which it didn't have
an image file. This can be lengthy (esp when a typical process has
more than 300 modules loaded).

This patch forces the creation of the dbghelp module even if the
image file isn't found.

This patch cuts startup time of 'winedbg notepad' from 9.9 to 7.4s.
YMMV.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-11-16 20:56:07 +01:00
Eric Pouech
01c98c5eaf dbghelp: Expose PE native vs builtin information to winedbg.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-11-16 20:56:07 +01:00
Eric Pouech
8d75739b6a dbghelp: No longer decorate ELF/Mach-O module names.
Rely solely on extended module information.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-11-16 20:56:04 +01:00
Eric Pouech
c50e02ec9c dbghelp: Expose some internal information about modules to winedbg.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-11-16 20:56:03 +01:00
Eric Pouech
416d29e26c dbghelp: Remove DMT_ entries for .DBG and .PDB files.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2023-11-16 20:56:03 +01:00
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