Commit graph

1474 commits

Author SHA1 Message Date
Alexandre Julliard 754f11a4ad dbghelp: Ignore a couple of Dwarf-3 opcodes. 2024-04-28 20:23:20 +02:00
Eric Pouech f0d0562881 dbghelp: Store thread names in minidump.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-04-15 18:10:44 +02:00
Eric Pouech 167902f318 dbghelp: Test thread names in minidump.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-04-15 18:10:44 +02:00
Eric Pouech 819d8692c6 dbghelp: No longer embed unwind information in minidump (x86_64).
This can generate very long time when saving the minidump, but
also when reloading it.
Unwind information is expected to be gotten from an image matching
the modules listed in the minidump for Normal mode.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55798
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-15 15:06:38 +01:00
Eric Pouech ca95533e8a dbghelp: Add support for V2 unwind info (x86_64).
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-15 15:06:38 +01:00
Kyrylo Babikov b16b366327 dbghelp: Fix PDB processing using the FPO stream instead of FPOEXT. 2024-03-15 15:06:37 +01:00
Eric Pouech 7f10145a91 dbghelp: Simplify thread info generation in minidump.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-14 18:41:42 +01:00
Eric Pouech f799bf025b dbghelp: Don't write minidump from running thread.
In case a minidump is written from current process, create
a dedicated thread to write the minidump (and hide that thread
from the minidump).

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-14 18:41:42 +01:00
Eric Pouech 56193155a0 dbghelp: Use an intermediate buffer in SymFunctionTableAccess (x86_64).
This mainly allows to release internal resources bound to image.
Also follow chained RUNTIME_FUNCTION entries (if any).

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-14 18:41:42 +01:00
Eric Pouech da22ef6c0d dbghelp/tests: Add tests for function table lookup.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-14 18:41:42 +01:00
Eric Pouech 0d616f9eb0 dbghelp/tests: Test exception information in minidump.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-13 21:04:34 +01:00
Eric Pouech 504d0caae5 dbghelp/tests: Add tests about minidump's callback.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-13 21:04:34 +01:00
Eric Pouech 3316f59041 dbghelp/tests: Add tests about generated memory chunks.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-13 21:04:34 +01:00
Eric Pouech 9620340b6b dbghelp/tests: Add tests for minidumps.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-13 21:04:34 +01:00
Eric Pouech d094bde414 dbghelp: Fixed module information when unmatched pdb file is loaded.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-07 22:56:12 +01:00
Eric Pouech 6ab88cafaa dbghelp: Don't fail in SymAddSymbol for modules without debug information.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-07 22:56:12 +01:00
Eric Pouech 61f9f5a05f dbghelp: Support SLMFLAG_NO_SYMBOLS in SymLoadModuleEx*().
Also correctly handling ImageName (the passed image name
in SymLoadModule) and LoadedImageName, which is only set when
debug info have been loaded (and is always an absolute path,
contrary to ImageName which can be relative).

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-07 22:56:12 +01:00
Eric Pouech 51a0aaeff4 dbghelp/tests: Extend the tests for SymLoadModule().
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-07 22:56:12 +01:00
Eric Pouech 83476e3d4a dbghelp: Fix some corner case of virtual module loading.
Seen when debugging some game, one can load a virtual module with
a NULL image name.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-06 22:05:51 +01:00
Eric Pouech 4f80a599b6 dbghelp: Mimic native behavior for module name.
Module names appear in three spots in dbghelp:
  A) SymGetModuleInfo() .ModuleName
  B) module enumeration (as parameter in callback)
  C) in symbol/type research in module!name form

Tests show that:
- A) and B) always use only the derivation of the image
  name, whatever the passed module name in SymLoadModule().
- C) can use either the form derived from image name
  {as A) and B)}, but also the passed module name in
  SymLoadModule().

Note: B) is limited to 64 characters, while A) is limited to 32
characters (not tested here).

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-06 22:05:49 +01:00
Eric Pouech d6d22677da dbghelp: Change order when trying to load modules.
Change from: dll.so   > PE image > ELF/Mach-O images
into         PE image > dll.so   > ELF/Mach-O images

Main goal is in SymLoadModule*(), to not resynchronize the system
modules list when requesting loading of a PE image.
This can gain quite some time in some situations.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-06 22:05:47 +01:00
Eric Pouech 0e3dba2a7a dbghelp: Relax failure conditions.
dbghelp tests build PDB files, without hash table in TPI stream,
but also no types. Native is able to load these PDB files.
So, don't fail when loading a PDB without a TPI hash table and
without any types.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-06 22:05:34 +01:00
Eric Pouech d05b7c8e19 dbghelp: Search subdirectories in element path.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-06 22:05:34 +01:00
Eric Pouech ad921b3c56 dbghelp: Return matched information for path_find_symbol_file.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-05 20:46:36 +01:00
Eric Pouech f824a72c7f dbghelp: Get rid of struct pdb_lookup.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-05 20:46:36 +01:00
Eric Pouech feee77f84d dbghelp: Rework loading of PDB string table.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-05 20:46:36 +01:00
Eric Pouech f014745676 dbghelp: Always use SymGetSrvIndexFileInfo() for files lookup.
This will help separate debug info files lookup from their actual
loading once found and correctly matched.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-05 20:46:34 +01:00
Eric Pouech ec099b8ea3 dbghelp/tests: Add more tests for SymLoadModule*.
- SymLoadModules flags (SLMFLAG_VIRTUAL and SLMFLAG_NO_SYMBOLS),
- handling of load details (SymType, ImageName vs LoadedImageName,
  various instances of module name).

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-05 20:46:26 +01:00
Eric Pouech c1b8db0c28 dbghelp: Don't search the passed path in SymFindFileInPath.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-04 22:52:13 +01:00
Eric Pouech 1648569fad dbghelp: Don't fail on loading 64bit modules on 32bit applications.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-04 22:52:13 +01:00
Eric Pouech 0ca1350a03 dbghelp/tests: Add tests about SymLoadModule and finding pdb files.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-04 22:52:13 +01:00
Eric Pouech a56b018713 dbghelp/tests: Add tests for SymFindFileInPath for pdb files.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-04 22:52:13 +01:00
Eric Pouech 2abbee9540 dbghelp/tests: Add tests for image files lookup.
Signed-off-by: Eric Pouech <epouech@codeweavers.com>
2024-03-04 22:52:13 +01:00
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