[PATCH 0/5] MR51: Fix handling of dbghelp's basic type

eric pouech (@epo) wine at gitlab.winehq.org
Tue May 10 10:41:07 CDT 2022


 Wine's dbghelp's implementation differ from native regarding basic types' handling
(the basic types like char, int, long...)
- Wine's dbghelp exposes a name for such a type, while native doesn't
- parsing of basic type from dwarf & pdb don't always exactly return the correct
  information. Two examples (among others) of discrepancies:
  - in C, under Windows assumption, char, signed char and unsigned char are mapped
    to 2 types (as char = signed char); while in C++, they are mapped to three 
    different types (char and signed char are two different types). Wine's dbhelp
    doesn't report correctly the C++ char types, and the char/signed char is broken
    too. 
  - MS compiler shamelessly maps WCHAR to btWChar (basic type), while it's a
    typedef to unsigned short (which is mapped to btInt of size 2)

This series's result is that Wine dbghelp's now returns the same basic types as native.
(Tested with most of the C & C++ basic types)

This requires:
- to implement the re-generation of the basic types' name in WineDbg. This is done
  by adding data model tables (ILP32, LP64 and LLP64), and picking up the right one
  depending on current executable. Option is also added in WineDbg to force a(nother)
  data model. This is only used when printing types, not when reading/writing integer
  values as this (mostly) relies on the size of the integer.
- fixing the pdb and dwarf backends in dbghelp to retarget the correct base types
  (for C and C++ basic types)
- removing the name field from dbghelp's struct symt_basic allowed some simplification
  inside dbghelp:
  + all basic types are now only allocated once across every compilation unit and module)
    (small speed and memory consumption gain)
  + dwarf's backend used a basic type cache which is also removed

Note: when using a basic type in WineDbg (like casting an integral value to another
integral value), this serie doesn't change the data model used for getting the type's size.

The data model used is currently ILP32 on 32 bit, and always LP64 on 64 bit.
Yet to come serie shall use the current data model instead.

-- 
https://gitlab.winehq.org/wine/wine/-/merge_requests/51



More information about the wine-devel mailing list