Commit graph

1342 commits

Author SHA1 Message Date
Alex Henrie 04225e1109 dbghelp: Annotate allocation functions with __WINE_(ALLOC_SIZE|DEALLOC|MALLOC). 2022-12-06 17:04:50 +01:00
Alex Henrie a6218a8145 include: Move wdbgexts.h from dbghelp to include.
This file is a public header in the Windows SDK.
2022-12-05 20:04:54 +01:00
Eric Pouech fbf2301177 dbghelp: Fix typos in codeview_is_type_forward().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-22 21:51:26 +01:00
Eric Pouech 4119430e57 dbghelp: Locate alternate debug info files by their build id.
(including debuginfo client cache)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-21 18:03:53 +01:00
Eric Pouech b718fbc31f dbghelp: Search debug info files into local cache of debuginfod.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-21 18:03:53 +01:00
Eric Pouech 69108af654 dbghelp: Convert of couple more of string literals.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-21 18:03:53 +01:00
Eric Pouech b6205f57fa dbghelp: Add partial implementation of SymQueryInlineTrace.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-18 14:11:50 +01:00
Eric Pouech c99bafb775 dbghelp: Implement SymAddrIncludeInlineTrace().
Replacing symt_get_inlinesite_depth() with SymAddrIncludeInlineTrace()
as they look very (very) similar.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-18 14:11:50 +01:00
Mohamad Al-Jaf 51c81714f2 dbghelp: Add SymAddrIncludeInlineTrace stub.
Football Manager 2023 Editor calls this function.

Signed-off-by: Mohamad Al-Jaf <mohamadaljaf@gmail.com>
2022-11-18 14:11:47 +01:00
Eric Pouech dcbb145658 dbghelp: Function static variables should be found by address.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-18 14:04:28 +01:00
Eric Pouech f763332b93 dbghelp: Create a single compiland instance by name in PDB.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-18 14:00:04 +01:00
Eric Pouech e37f1ada64 dbghelp: Use same compiland's pathname as native (PDB).
In PDB debug information, compiland's pathname is stored twice:
- both refer to the same file, but with variations in path handling
  (eg: one could be foo1\foo2\bar.obj and the other
   foo1\deadbeef\..\foo2\bar.obj)

Use same pathname string as native when storing compiland's pathname
(it eases comparison of dumps between the two).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-18 14:00:04 +01:00
Eric Pouech de3a836629 dbghelp: Fix handling of BA_OP_ChangeCodeLength (PDB).
This op is heavily used by clang with PDB debug info, while
MSVC barely uses it.

This fixes a bunch of problems when loading PDB files generated
by clang (eg. the PDB files from wine-gecko).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-17 16:35:54 +01:00
Eric Pouech 1ed24f7ec6 dbghelp: Support loading modules from Wine's multi-arch build tree.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-09 21:23:48 +01:00
Eric Pouech 31e76b5333 dbghelp: Introduce a helper for module lookup.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-09 21:23:48 +01:00
Eric Pouech e6fd3021ba dbghelp: Added missing DECLSPEC_HIDDEN attribute.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-09 21:23:48 +01:00
Eric Pouech c4f1f5b185 dbghelp: Get rid of symt_inlinesite by merging it inside symt_function.
Basically:
- extending symt_function to enable storage of multiple address ranges
- symt_function and sym_inlinesite now share the same fields, so
  get rid to the later.

Note that only the first range of a top level function is actually
stored and used (even if the structure allows for more).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-01 17:53:57 +01:00
Eric Pouech 790a2852aa dbghelp: Use addr_range for storing symt_function address and size.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-01 17:53:57 +01:00
Eric Pouech c576b0c73f dbghelp: Store address range as FAM in symt_inlinesite.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-01 17:53:57 +01:00
Eric Pouech a6f1f7be7e dbghelp: No longer pass inline site's address upon creation.
Instead use the first address of the first defined range of address.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-11-01 17:53:51 +01:00
Eric Pouech 363f1f49a8 dbghelp: Realloc array of buckets inside struct vector.
Instead of silently leaking no longer used chunks.
Be more robust to OOM conditions.
Introducing pool_realloc().

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-21 23:18:06 +02:00
Eric Pouech c5f4874e7b dbghelp: Use heap functions for allocation.
Create a dedicated heap for each module (as it was done for the
private home grown pools).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-21 23:18:06 +02:00
Francois Gouget 0eb40cdbd0 dbghelp: Fix the spelling of a couple of comments. 2022-10-20 20:58:06 +02:00
Francois Gouget 5bd74d0e58 dbghelp: Fix the trailing linefeed of a WARN() message. 2022-10-20 20:58:06 +02:00
Eric Pouech 0c3d78269f dbghelp: Silence some FIXMEs.
In some 32bit modules, MingW/GCC generates in Dwarf debug information,
a cfa address to be computed as:
   deref(register XX + offset)
which is too complicated to be expressed through regular DbgHelp APIs.

So silence the FIXME, and report a 'too complex' error (instead of
'internal').

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52790
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-19 21:08:03 +02:00
Eric Pouech 3dee69106a dbghelp: Allow symt_block to be defined over non contiguous chunks.
This improves correctness of functions like SymFromAddr()
when searching local variables.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-19 21:07:27 +02:00
Eric Pouech eb820b37c9 dbghelp: No longer call read_range() for inline site (dwarf).
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-19 21:07:27 +02:00
Eric Pouech aa29948966 dbghelp: Rework dwarf2_get_ranges() helper.
- split in two sub helpers (one to get size, the other to fill content in)
  (this avoids reallocating buffer)
- return error in case no range is present (but range dwarf attribute is)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-19 21:07:20 +02:00
Eric Pouech 1bcdb17455 dbghelp: Remove symt_close_func_block() stabs's only parameter.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-10 11:11:21 +02:00
Eric Pouech 6f8ba8119a dbghelp: Keep compiland's address for Dwarf debug format.
Partly reverting 99eb63bd7a
(it's still needed on Dwarf for blocks with multiple
non-contiguous address ranges).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-10 11:11:15 +02:00
Eric Pouech 96c3f58783 dbghelp: Silence some FIXME for SymGetTypeInfo/TI_GET_OFFSET.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-10 11:11:15 +02:00
Eric Pouech 106a056c99 dbghelp: No longer use wine_dbgstr_longlong.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-10-10 11:11:15 +02:00
Eric Pouech b990eaa8a6 dbghelp: Expose local static variables' address.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-30 21:20:19 +02:00
Eric Pouech 99eb63bd7a dbghelp: Remove address field from symt_compiland.
It's mostly always set at 0, and native dbghelp doesn't expose it anyway.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-30 21:20:09 +02:00
Eric Pouech 50dc4ad0bf dbghelp: SymFromName* should first look in local context.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-29 16:02:56 +02:00
Eric Pouech 1c5eadb482 dbghelp: Improve de-duping global symbols information (PDB).
We have dups in global / file static variables definition:
- between compiland stream and global (DBI) stream
  (we need to de-dup these)
- still adding variables only present global DBI stream
- keeping in mind, we need to keep:
  + two variables of different names at same address (aliasing)
  + variables of same name at different addresses
    (MS linker generate those)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-28 15:28:58 +02:00
Eric Pouech 908004c3a9 dbghelp: Don't load invalid records for global symbol stream.
Only load records that are listed in global hash file when handling
the global symbol stream.
Do the same thing for the public symbols.

When using MS linker in incremental mode:
- old variable definitions are kept in the (DBI) global symbol stream
  along side the new definition
- but only the latest (valid) definition is referenced from the hash
  table

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-28 15:28:56 +02:00
Eric Pouech 108cd66933 dbghelp: Fix variable storage information (Dwarf).
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-28 15:28:56 +02:00
Eric Pouech 0e345d6c43 dbghelp: Fix container for global variables (Dwarf).
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-28 15:28:56 +02:00
Eric Pouech a523361b10 dbghelp: Add support for static variables at function scope (PDB).
These should be stored in function's children vector.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-28 15:28:53 +02:00
Eric Pouech 805ffc8adb winedump: Dump global hash table out of PDB symbols' stream.
Introduce relevant structures in include/wine/msvcpdb.h.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-27 18:29:27 +02:00
Eric Pouech 25108ba266 dbghelp: Fix local scope reset upon module unloading.
Change strategy for resetting local scope when unloading a module.
Old strategy was keeping the local scoped symbol alive on some code path when
unloading a module.
This caused some bad behavior as we kept a pointer to a deleted object.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-26 21:49:54 +02:00
Eric Pouech 6424b9d6b7 dbghelp: Store all address ranges for inline sites.
Store all the internal address ranges for an inline site
(as we already do in dwarf debug info).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-13 22:07:22 +02:00
Eric Pouech cffdaabbc9 dbghelp: Support depth relating to top function for inline sites.
When using an inline context which depth points towards the top level function
(so when it's not strictly speaking an inline context), native falls
back to picking information in the top level function.

So we do now in SymSetScopeFromInlineContext() and SymFromInlineContext()
(instead of returning an error).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-13 22:07:22 +02:00
Gijs Vermeulen 4f90e88d0b dbghelp: Add SymSrvGetFileIndexInfo stub.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48600
2022-09-12 17:28:23 +02:00
Eric Pouech 553798224d dbghelp: Displacements are optional.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-12 17:28:23 +02:00
Eric Pouech d1f7bc7c05 dbghelp: Support SymGetTypeInfo/TI_GET_LENGTH for variables.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-12 17:28:23 +02:00
Eric Pouech 12f2a1768c dbghelp: Correctly handle the absence of IPI stream.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-12 17:28:23 +02:00
Eric Pouech 1c5491555b dbghelp: Harden reading strings from string table.
Making use of PDB_STRING_TABLE.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-09-12 17:28:23 +02:00
Francois Gouget b25b2ed31a dbghelp: Fix a couple of spelling errors in a comment. 2022-08-30 22:00:55 +02:00