Commit graph

1407 commits

Author SHA1 Message Date
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
Francois Gouget
188e8988ab dbghelp: Fix the spelling of a comment.
Signed-off-by: Francois Gouget <fgouget@free.fr>
2022-07-18 19:44:12 +02:00
Eric Pouech
fe52589cdd dbghelp: Set constants lexical parent to module when no compiland is present.
Especially needed for enumeration's values.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-12 22:51:29 +02:00
Eric Pouech
9cb69964d6 dbghelp: Member's lexical parent is module (not parent UDT).
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-12 22:51:29 +02:00
Eric Pouech
a5c6cd5aef dbghelp: Only reply to offset requests on symt_data in SymGetTypeInfo() for locals and parameters.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-12 22:51:29 +02:00
Eric Pouech
d2a5f434c4 dbghelp: Create lexical relationship between global vars and symt_module.
Global (non static) variables are now stored in symt_module.
(static variables are stored in symt_compiland).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-12 22:51:29 +02:00
Eric Pouech
87e2b00774 dbghelp: Don't include global & static variables from S_LOCAL* records.
PDB supports description of a global or static variable:
- accessed from a register
- stored as a local variable record inside a function

This likely describes access to a global/static variable where
intermediate computation is kept in a register.

We cannot store this kind of entries in local variable lists
(builtin dbghelp and winedbg are not prepared to handle a global variable)

Note: the global or static Codeview data record is still present (with a
relocatable address), so the variable should still be available from global
access (but could be not up-to-date if temporarly stored in a register).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-12 22:51:29 +02:00
Eric Pouech
437e73883b mscvpdb.h: Use bitfield for defrange's variable flag.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-12 22:51:29 +02:00
Eric Pouech
bf68ec1f8a dbghelp: Silence a couple of FIXMEs in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-07-12 22:51:29 +02:00
Eric Pouech
bb52ed3532 dbghelp/msc: Support LF_INDEX* in enumeration type definition.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-06-29 23:23:41 +02:00
Eric Pouech
29dd844439 dbghelp: Use remap table from PDB hash stream.
The PDB hash stream from TPI header contains information to force a remap
to a given type record (whatever the order in the bucket hash list).
This is generated by the incremental linker in some occasions.

Use that information to remap the corresponding types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-06-28 20:30:05 +02:00
Eric Pouech
d12d5c7245 dbghelp: Preserve PDB's partial order for types of same name.
The PDB types can contain several times a type definition with an identical
name. It seems to appear when modifying a type in source (like adding new
fields to a struct):
- as the PDB file (generated from first compilation) is updated (and not
  fully rewritten), the debug information for the old type is not flushed;
  a new record (for the same struct name) is emitted, and inserted
  before the old one in the hash table (bucket list).

Even if dbghelp's hash table is different from PDB's internal one (ie
number of buckets & bucket lists are different), we must maintain the order
of records of identical names (they end up in the same bucket) as a lookup
by name *must* return the first record in PDB's order.
Lookup by name is used:
- when resolving a forward definition (to get the full UDT definition
  including for example a struct/class fields's list)
- when searching by type name from dbghelp APIs, like SymGetTypeFromName()

This patch implements the preservation of that order.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-06-28 20:30:05 +02:00
Eric Pouech
ddbd341bd0 dbghelp: Clearly separate the type loading into two passes.
- create (contentless) UDT & enum in first pass
- fill UDT&enum content and load the rest of types in second pass.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-06-28 20:30:05 +02:00
Eric Pouech
eb14fad72a mscvpdb.h: Redefine property with bitfields.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-06-28 20:30:05 +02:00
Eric Pouech
b7c231c78f dbghelp: Rely on first/last type index from type header.
Code now follows these guidelines:
- define PDB & Codeview internals in cvconst.h and mscvinfo.h (instead
  of having definitions in .c files, some of them being duplicate of .h
  content, and their "duplicate" values eventually diverged over time)
- index of first type comes from PDB type header (instead of always being
  hardcoded as FIRST_DEFINABLE_TYPE)
- use index of last typex from type header (instead of guessing the right
  value while parsing types, which also allows a single allocation
  instead of enlarging buffer while parsing).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-06-28 20:30:05 +02:00
Eric Pouech
ba12b5ae88 winedump: Explore a bit more TPI hash elements.
Rename a couple of fields in PDB structures for clarity.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
2022-06-28 20:24:18 +02:00
Eric Pouech
5aa9340c3d dbghelp: Set correct basic types definition.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-13 22:11:41 +02:00
Eric Pouech
d94f4747e8 dbghelp: Fix conversion of dwarf's basic types into dbghelp's basic types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-13 22:11:41 +02:00
Eric Pouech
14462bbeab dbghelp: Let symt_basic be trans-module and nameless.
Rationale:
- native doesn't report names for SymTagBaseType objects
  => so remove typename for sym_basic
- since symt_basic becomes pretty simple, it's possible to share the object
  across all modules loaded in dbghelp (simplicity, memory usage reduction)
- removed dwarf basic types cache in dwarf.c as we now have a generic one

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-13 22:11:41 +02:00
Jactry Zeng
22ea4cd29e dbghelp: Use RtlGetVersion() for system version detection instead.
Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-13 09:58:26 +02:00
Eric Pouech
99c7818097 dbghelp: Introduce symt_find_symbol_at().
To be used in place of symt_find_nearest().
symt_find_symbol_at() ensures that the address passed is within the
boundaries of the returned symbol (while find_nearest() doesn't).

This fixes erroneous backtraces in debugger like:
$ ./wine winedbg notepad
WineDbg starting on pid 0104
RtlDefaultNpAcl () at Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731
0x00000170054805 ntdll+0x54805 [Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731]: ret
1731    }
Wine-dbg>bt
Backtrace:
=>0 0x00000170054805 RtlDefaultNpAcl+0x2d5(pAcl=<internal error>) [Z:\home\eric\work\wine\dlls\ntdll\sec.c:1731] in ntdll (0x000001700701a4)
  1 0x0000017002d6c4 __wine_pop_frame(pAcl=<internal error>) [Z:\home\eric\work\wine\include\wine\exception.h:273] in ntdll (0x000001700701a4)
  2 0x0000017002d6c4 process_breakpoint+0x84() [Z:\home\eric\work\wine\dlls\ntdll\loader.c:3912] in ntdll (0x000001700701a4)
  3 0x000001700354c9 LdrInitializeThunk+0x509(context=<register R13 not accessible in this frame>, unknown2=<internal error>, unknown3=<internal error>, unknown4=<internal error>) [Z:\home\eric\work\wine\dlls\ntdll\loader.c:4200] in ntdll (0x000001700701a4)

where RtlDefaultNpAcl() has nothing to do here (it's the symbol below RIP
and we don't have a symbol with debug information for that address).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-04 21:27:25 +02:00
Eric Pouech
4643bb2852 dbghelp: Properly fail on PDB files generated by MSVC compiler version 14.31.
Some internal bits of PDB files are different, so report & abort loading of
such PDB file until it's properly understood & supported (instead of
crashing).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-05-03 20:27:42 +02:00
Alexandre Julliard
53ab4c5385 include: Avoid Windows types in CodeView structure definitions.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-22 16:01:54 +02:00
Austin English
8d3ca2130a dbghelp: Downgrade a FIXME to a WARN.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52790
Signed-off-by: Austin English <austinenglish@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-14 09:27:46 +02:00
Eric Pouech
4d7eccd616 dbghelp: Trace 64-bit integers with I64 width modifier.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-08 11:50:06 +02:00
Eric Pouech
56681b5314 dbghelp/tests: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-24 20:22:21 +01:00
Francois Gouget
9be9c32781 dbghelp: Fix the spelling and tweak the wording of a comment.
Signed-off-by: Francois Gouget <fgouget@free.fr>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-18 22:10:47 +01:00
Eric Pouech
a64d157928 dbghelp: Enable compilation with long types.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-09 18:37:32 +01:00
Alex Henrie
950792ae2b dbghelp: Fix memory leak on error path in dwarf2_read_range (cppcheck).
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-02 18:43:10 +01:00
Alexandre Julliard
f0cd33c69e include: Add support for defining Win32 types as 'long' where possible.
Add -DWINE_NO_LONG_TYPES to modules that still have compilation
warnings with long types.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-27 20:38:22 +01:00
Eric Pouech
00a11ff73d dbghelp: Don't use .debug_frame section if non present when unwinding.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52295
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-03 14:50:29 +01:00
Eric Pouech
6c64e6dee4 dbghelp: Silence some FIXMEs.
Reading gecko's PDB generate a lot of those.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-16 20:29:38 +01:00
Alistair Leslie-Hughes
e19b18dd82 dbghelp: Fix use after free.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-13 18:02:58 +01:00
Eric Pouech
a6bf722bff dbghelp: Implement SymEnumTypesByName(W).
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-10 22:00:17 +01:00
Alistair Leslie-Hughes
33308a577c dbghelp: Fix possible memory leak (Coverity).
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-09 17:14:59 +01:00
Eric Pouech
fdc48ba767 dbghelp: In SymGetTypeInfo(), return the correct basetype for enums.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-12-08 22:14:44 +01:00
Alexandre Julliard
c210a0e607 mountmgr: Return a Unix file name in the IOCTL_MOUNTMGR_QUERY_SYMBOL_FILE request.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-26 18:07:30 +01:00
Eric Pouech
9f1766193e dbghelp: Simplify code for searching alternate debug info files.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Eric Pouech
789512beee dbghelp: Fix allocation error in image_load_debugaltlink.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Eric Pouech
f10635ab08 dbghelp: In SymEnumerateLoadedModules, don't limit the number of modules.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Eric Pouech
4cc7a3ba90 dbghelp: Remove incorrect FIXME in SymEnumerateLoadedModules.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Eric Pouech
441838b7b2 dbghelp/dwarf: Don't unmap the fmap of a DWZ module twice.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Eric Pouech
0bbb161c41 dbghelp: Protect against missing compiland when adding global function.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52045
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Eric Pouech
5e56bc3b21 dbghelp: Fix potential crash when loading a builtin PE module embedded in an ELF image.
Regression introduced by ced12a1a3a.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-22 22:20:50 +01:00
Eric Pouech
b65ef71fc0 dbghelp: Improve collision handling in SymLoadModuleEx().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 22:14:54 +01:00
Eric Pouech
1465c7de2a dbghelp: Detect collision by looking at module's base address in SymLoadModuleEx().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 22:14:40 +01:00
Eric Pouech
ced12a1a3a dbghelp: Move debug info loading out of image backends into SymLoadModuleEx().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 22:14:24 +01:00
Eric Pouech
1b7bce4bf8 dbghelp: Allow 32bit dbghelp to handle 64 addresses.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 22:14:05 +01:00
Eric Pouech
8e8243a308 dbghelp: Always search current directory when loading PE modules.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 22:13:51 +01:00
Eric Pouech
e00f0d81fb dbghelp: Fix module name construction.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-16 22:13:45 +01:00
Thomas Faber
40dfd9b8b1 dbghelp: Use _NT_ALT_SYMBOL_PATH.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:04:04 +01:00
Thomas Faber
bb2802984d dbghelp: Use . instead of concrete path for search path.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:03:56 +01:00
Thomas Faber
6bedd7cce6 dbghelp/tests: Add tests for SymSetSearchPath.
Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:03:37 +01:00
Thomas Faber
06f1c40f17 dbghelp: Accept NULL search path in SymSetSearchPath.
Fixes a crash when starting kernrate.exe.

Signed-off-by: Thomas Faber <thomas.faber@reactos.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:03:24 +01:00
Eric Pouech
cb8aef440e dbghelp/msc: Support S_SEPCODE codeview record.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:02:04 +01:00
Eric Pouech
7fec9fdcb2 dbghelp/msc: Silence a couple of unneeded codeview entries while parsing PDB.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:02:00 +01:00
Eric Pouech
82ea35cbb5 dbghelp/dwarf: Fix computation of some location attributes.
Dwarf4 clarified that only FORM_sec_offset can refer to location
lists, fix dwarf2_compute_location_attr accordingly.

This fixes the 'fixme:dwarf2_parse_udt_member: Found register, while
not expecting it' messages.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:01:47 +01:00
Eric Pouech
61c8728a6e dbghelp/dwarf: Don't register labels without address.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:01:35 +01:00
Eric Pouech
19f97c5fd8 dbghelp/dwarf: Make use of AT_type if present when parsing an enumeration type.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:01:28 +01:00
Eric Pouech
10a20b2d22 dbghelp: Relax some failure conditions in SymSetContext and SymSetScopeFromAddr.
They shouldn't fail if passed address is inside a module, even if it
doesn't point to a function.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-15 20:01:16 +01:00
Eric Pouech
acfcd84a05 dbghelp/dwarf: Workaround functions with multiple range of addresses.
gcc can emit functions with code spread across non contiguous code areas.
We used to register those functions with an address range enclosing all ranges
(meaning that all addresses not actually belonging to the function but
lying in that address range could be returned by dbghelp as belonging
to the function).

Work around this by registering the function with only the first range
of addresses (this will avoid the errors described above), but will
fail to mark the other address ranges as part of the function.

dbghelp doesn't seem to have explicit support of those cases, even if
pdb/codeview also support functions with multi range of addresses
(see S_SEPCODE).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:16:26 +01:00
Eric Pouech
b332bda8e2 dbghelp/dwarf: Introduce a helper to read properly multiple range of addresses.
Use it to reimplement dwarf2_feed_inlined_ranges.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:16:17 +01:00
Eric Pouech
0c3274b526 dbghelp/msc: Better detect whether IPI stream is present.
Old version of PDB files can have a stream #4 which is not an IPI stream
Available documentation isn't 100% clear about when IPI has been
introduced.
So decide that IPI is present when header of stream looks like a type
stream header.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:14:08 +01:00
Eric Pouech
92fabc64e5 dbghelp/pdb: Fix start adress of block.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-10 20:13:27 +01:00
Eric Pouech
d8f26a4233 dbghelp/pdb: Add line number to inline sites.
Requires to join DEBUG_S_INLINEES subsection with symbol annotations.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
bfc0edb8cf dbghelp/pdb: Handle a block in DEBUG_S_LINES subsection spreading across several symbols.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
cab92c90e0 dbghelp/pdb: Added support for S_INLINESITE and S_INLINESITE_END.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
3bc073d8bf dbghelp/pdb: Let codeview_snarf() handle all module debug information.
Except old linetab v1.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
54ec50d859 dbghelp/pdb: Introduce codeview_init_type_parse() to handle init of type streams.
Currently used for TPI stream.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
b73ca9f05e dbghelp/pdb: Implement loc_compute for pdb backend.
Add support for S_DEFRANGE* entries.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
7ad847bc34 dbghelp/pdb: Handle S_LOCAL codeview entries.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
de5fe89357 dbghelp/pdb: Add new basic type to represent char8_t introduced in C++20.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
9f3e8a515f dbghelp: Use cpu from debuggee's modules rather than debugger's.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
e8b195329e dbghelp: Use module's cpu word size instead of sizeof(void*) or sizeof(DWORD_PTR).
This fixes a couple of wrong pointer size computation when debugging a
WoW64 process from a 64 bit debugger.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
d72e6ac772 dbghelp: Attach a struct cpu* to every module.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
e105e9d35e dbghelp: Check that we don't add same line number twice.
This happens (at least) in dwarf debug info where there could be two entries
with same source file and line number, but different column numbers
(and we don't store columns).

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-08 21:00:57 +01:00
Eric Pouech
f83e647547 dbghelp/dwarf: Don't skip functions when their inlined flag comes from an abstract origin.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-05 17:10:45 +01:00
Eric Pouech
5f9bcb13b7 mscvpdb.h: Move parsing definitions to dbghelp.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-02 20:32:51 +01:00
Eric Pouech
fbc65b802b dbghelp/pdb: Convert to new debug subsection definitions (in linetab2).
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-02 20:32:51 +01:00
Eric Pouech
f0b8518333 mscvpdb.h: Update symbol header for linetab2's block size.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-02 20:32:51 +01:00
Eric Pouech
c967245ba8 dbghelp: Silence a couple more CV entries.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:28:36 +02:00
Eric Pouech
ec0af6dc3e dbghelp: Silence a couple of C++ oriented requests in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:28:32 +02:00
Eric Pouech
7bde153afe dbghelp/dwarf: Store line numbers and file info for inlined functions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:28:19 +02:00
Eric Pouech
27f133732f dbghelp: Implement SymGetLineFromInlineContext(W) for inlined frame.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:28:14 +02:00
Eric Pouech
3d6b65dd38 dbghelp: In SymGetLine* family, compute displacement relative to line_info's address.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:28:02 +02:00
Eric Pouech
1c5989465e dbghelp: Make symt_add_func_line() last parameter an absolute address.
It used to be an offset to the start of function, but it's actually
stored as an absolute address afterwards. This avoids unnecessary
computations.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:27:41 +02:00
Eric Pouech
0187675065 dbghelp: Rename line_info's pc_offset field into address.
It's actually an absolute address.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-29 21:27:23 +02:00
Eric Pouech
232681da96 dbghelp: Implement SymSetScopeFromInlineContext for inlined frames.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:17 +02:00
Eric Pouech
eee701ad52 dbghelp: Implement SymFromInlineContext for inlined frames.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech
82bac5d080 dbghelp: Implement StackWalkEx for inlined frames.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech
fb34c82ef8 dbghelp/dwarf: Store each subrange for an inlined function.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech
690c2e51bf dbghelp/dwarf: Generate proper inline functions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech
ecb91941b3 dbghelp/dwarf: Add current block as a field in dwarf2_subprogram_t.
Instead of passing it as a parameter in various subprogram related
functions.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech
b9290c987a dbghelp: Introduce symt_inlinesite (SymTagInlineSite) to support inline sites.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech
fd5c709c6b dbghelp: Correct type of exported function addresses in PE module.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-28 18:25:16 +02:00
Eric Pouech
8592e9088f dbghelp: Implement SymSetScopeFromInlineContext() when context isn't inlined.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech
706c5400e9 dbghelp: Rewrite SymSetContext() on top of SymSetScopeFromAddr().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech
925182b09f dbghelp: Implement SymSetScopeFromAddr() and SymSetScopeFromIndex().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech
066bb761cc dbghelp: Add local scope information in struct process.
- make SymSetContext() generate this information
- let SymEnumSymboli() (when dealing with local symbols) use this
  information instead of the stack frame

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech
e250c6fb98 dbghelp: Implement SymGetLineFromInlineContext*() when context isn't in inline mode.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech
219e4b6e75 dbghelp: Implement SymFromInlineContext() when context isn't in inline mode.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech
2a0495743b dbghelp: Let StackWalkEx() succeed even when inline mode is requested.
Fallback to regular StackWalk64() behavior.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-27 22:40:50 +02:00
Eric Pouech
7bc6eb9d25 dbghelp/dwarf: Properly handle error cases while computing frame_cfa.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:59:13 +02:00
Eric Pouech
8f272e25af dbghelp: Factorize SymUnloadModule and SymUnloadModule64.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:59:07 +02:00
Eric Pouech
8b4d5e6eef dbghelp: Improve error handling in SymSetContext().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:59:01 +02:00
Eric Pouech
76c4e691af dbghelp: Add stub implementations for the SymSetScope* functions.
Also move SymSetScopeFromAddr out of symbol.c into dbghelp.c which
makes more sense as modification of process settings.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:58:38 +02:00
Eric Pouech
26e06f5b79 dbghelp: Add stub implementations of SymGetLineFromInlineContext(W).
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:58:12 +02:00
Eric Pouech
9a1a849b95 dbghelp: Add stub implementation of SymFromInlineContext(W).
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:58:00 +02:00
Eric Pouech
bef7e1f202 dbghelp: Start implementing StackWalkEx.
Simple copy of StackWalk implementation.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:57:31 +02:00
Eric Pouech
e9fac51ae0 dbghelp: Add stubs for inline-related APIs.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:56:21 +02:00
Eric Pouech
2f093aef26 dbghelp: Handle some more error conditions in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:55:45 +02:00
Eric Pouech
d3a876f172 dbghelp: Use wide string literals.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-19 20:55:41 +02:00
Alexandre Julliard
8b58eca071 dbghelp: Use the bundled zlib.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-18 11:08:00 +02:00
Alistair Leslie-Hughes
40f0119739 dbghelp: Support UWOP_EPILOG in unwind.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-14 18:59:53 +02:00
Eric Pouech
099a8bbfd3 dbghelp: Add helper to initialize a module_pair.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 22:52:25 +02:00
Eric Pouech
eded75f8d2 dbghelp: Report a couple more VARIANT types in symbol info for constants.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 22:52:25 +02:00
Eric Pouech
58d5b3c880 dbghelp: Use proper macros for VARIANT.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-13 22:52:25 +02:00
Alexandre Julliard
97479d3d32 ntdll: Move some exception definitions to winternl.h.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-07 13:52:42 +02:00
Eric Pouech
b6044788ea dbghelp: Added support for custom symbols.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
841083898b dbghelp: Handle address of labels not included in functions.
(MASM generate those)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
e1132a6e5a dbghelp: MapDebugInformation and UnmapDebugInformation are not available on 64 bit architectures.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
2da1698312 dbghelp/dwarf: Correctly compute address of label.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
94abe0761e dbghelp: Report once FIXME of unsupported requests in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
2716e20438 dbghelp: Return SymTagExe when requesting lexical parent of SymTagPublicSymbol in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
f2fbf59246 dbghelp: Return lexical parent of SymTag(FuncDebugStart|FuncDebugEnd|Label) in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
507a3ef304 dbghelp: Return SymTagExe when requesting lexical parent of types in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
f3107eb095 dbghelp: Return error when requesting SymTagLabel's size in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
dd572227cb dbghelp: Silence FIXMEs in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
a4ebfe8c76 dbghelp: Expose no children in SymGetTypeInfo() for some SymTags.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
dbcc714cef dbghelp: SymTagFunctionArgType's lexical parent is module, not SymTagFunctionType.
(as any other type)

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
f376dfd1fd dbghelp: Update SymGetTypeInfo() requests and SymTagEnum to latest dbghelp definitions.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
11d8338f7a dbghelp: Expose SymTagBlock's address and size in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
4540d4f492 dbghelp: Expose SymTagBlock's children in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
4bf83f21ca dbghelp: Silence FIXME when requesting SymTagExe lexical parent in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
24a7de70a6 dbghelp: Manage parent/child relationship between SymTagExe and SymTagCompiland.
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00
Eric Pouech
8e50fea66b dbghelp: Expose compiland's children in SymGetTypeInfo().
Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 20:29:34 +02:00