winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2022
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
907 discussions
Start a n
N
ew thread
Zebediah Figura : include: Constify the RAWINPUTDEVICE pointer parameter to RegisterRawInputDevices().
by Alexandre Julliard
16 May '22
16 May '22
Module: wine Branch: master Commit: ab34fb78f86698e7c1bb98b673aea33e908bfaaa URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ab34fb78f86698e7c1bb98b6…
Author: Zebediah Figura <zfigura(a)codeweavers.com> Date: Sun May 15 18:31:23 2022 -0500 include: Constify the RAWINPUTDEVICE pointer parameter to RegisterRawInputDevices(). Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/user32/rawinput.c | 2 +- include/winuser.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/user32/rawinput.c b/dlls/user32/rawinput.c index a774f12231b..a014066f988 100644 --- a/dlls/user32/rawinput.c +++ b/dlls/user32/rawinput.c @@ -470,7 +470,7 @@ UINT WINAPI GetRawInputDeviceList(RAWINPUTDEVICELIST *devices, UINT *device_coun /*********************************************************************** * RegisterRawInputDevices (USER32.@) */ -BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(RAWINPUTDEVICE *devices, UINT device_count, UINT size) +BOOL WINAPI DECLSPEC_HOTPATCH RegisterRawInputDevices(const RAWINPUTDEVICE *devices, UINT device_count, UINT size) { struct rawinput_device *d; BOOL ret; diff --git a/include/winuser.h b/include/winuser.h index a227b912e0e..fd3ea879731 100644 --- a/include/winuser.h +++ b/include/winuser.h @@ -4120,7 +4120,7 @@ WINUSERAPI HDEVNOTIFY WINAPI RegisterDeviceNotificationW(HANDLE,LPVOID,DWORD); WINUSERAPI BOOL WINAPI RegisterHotKey(HWND,INT,UINT,UINT); WINUSERAPI BOOL WINAPI RegisterPointerDeviceNotifications(HWND,BOOL); WINUSERAPI HPOWERNOTIFY WINAPI RegisterPowerSettingNotification(HANDLE,LPCGUID,DWORD); -WINUSERAPI BOOL WINAPI RegisterRawInputDevices(PRAWINPUTDEVICE,UINT,UINT); +WINUSERAPI BOOL WINAPI RegisterRawInputDevices(const RAWINPUTDEVICE *,UINT,UINT); WINUSERAPI BOOL WINAPI RegisterShellHookWindow(HWND); WINUSERAPI HPOWERNOTIFY WINAPI RegisterSuspendResumeNotification(HANDLE,DWORD); WINUSERAPI BOOL WINAPI RegisterTouchWindow(HWND,ULONG);
1
0
0
0
Eric Pouech : dbghelp: Set correct basic types definition.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: 5aa9340c3d12ebf42cf4b9f8a170c55e00c48338 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=5aa9340c3d12ebf42cf4b9f8…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Tue May 10 17:11:08 2022 +0200 dbghelp: Set correct basic types definition. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbghelp/msc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/dbghelp/msc.c b/dlls/dbghelp/msc.c index 64d520c2b37..5b45c474160 100644 --- a/dlls/dbghelp/msc.c +++ b/dlls/dbghelp/msc.c @@ -158,13 +158,13 @@ static void codeview_init_basic_types(struct module* module) cv_basic_types[T_NOTYPE] = NULL; cv_basic_types[T_ABS] = NULL; cv_basic_types[T_VOID] = &symt_get_basic(btVoid, 0)->symt; /* void */ - cv_basic_types[T_CHAR] = &symt_get_basic(btChar, 1)->symt; /* char */ + cv_basic_types[T_CHAR] = &symt_get_basic(btInt, 1)->symt; /* signed char (and char in C) */ cv_basic_types[T_SHORT] = &symt_get_basic(btInt, 2)->symt; /* short int */ - cv_basic_types[T_LONG] = &symt_get_basic(btInt, 4)->symt; /* long int */ + cv_basic_types[T_LONG] = &symt_get_basic(btLong, 4)->symt; /* long int */ cv_basic_types[T_QUAD] = &symt_get_basic(btInt, 8)->symt; /* long long int */ cv_basic_types[T_UCHAR] = &symt_get_basic(btUInt, 1)->symt; /* unsigned char */ cv_basic_types[T_USHORT] = &symt_get_basic(btUInt, 2)->symt; /* unsigned short */ - cv_basic_types[T_ULONG] = &symt_get_basic(btUInt, 4)->symt; /* unsigned long */ + cv_basic_types[T_ULONG] = &symt_get_basic(btULong, 4)->symt; /* unsigned long */ cv_basic_types[T_UQUAD] = &symt_get_basic(btUInt, 8)->symt; /* unsigned long long */ cv_basic_types[T_BOOL08] = &symt_get_basic(btBool, 1)->symt; /* BOOL08 */ cv_basic_types[T_BOOL16] = &symt_get_basic(btBool, 2)->symt; /* BOOL16 */ @@ -173,7 +173,7 @@ static void codeview_init_basic_types(struct module* module) cv_basic_types[T_REAL32] = &symt_get_basic(btFloat, 4)->symt; /* float */ cv_basic_types[T_REAL64] = &symt_get_basic(btFloat, 8)->symt; /* double */ cv_basic_types[T_REAL80] = &symt_get_basic(btFloat, 10)->symt; /* long double */ - cv_basic_types[T_RCHAR] = &symt_get_basic(btInt, 1)->symt; /* signed char */ + cv_basic_types[T_RCHAR] = &symt_get_basic(btChar, 1)->symt; /* "real" char (char in C++) */ cv_basic_types[T_WCHAR] = &symt_get_basic(btWChar, 2)->symt; /* char8_t */ cv_basic_types[T_CHAR16] = &symt_get_basic(btChar16, 2)->symt; /* char16_t */ cv_basic_types[T_CHAR32] = &symt_get_basic(btChar32, 4)->symt; /* char32_t */
1
0
0
0
Eric Pouech : dbghelp: Fix conversion of dwarf's basic types into dbghelp's basic types.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: d94f4747e877b87400d4cb0d11d1c09139ad2c87 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d94f4747e877b87400d4cb0d…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Tue May 10 17:11:08 2022 +0200 dbghelp: Fix conversion of dwarf's basic types into dbghelp's basic types. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbghelp/dwarf.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 19c0da933d3..5c0f34d4bf5 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -213,6 +213,7 @@ typedef struct dwarf2_parse_context_s dwarf2_cuhead_t head; enum unit_status status; dwarf2_traverse_context_t traverse_DIE; + unsigned language; } dwarf2_parse_context_t; /* stored in the dbghelp's module internal structure for later reuse */ @@ -1450,16 +1451,43 @@ static struct vector* dwarf2_get_di_children(dwarf2_debug_info_t* di) return NULL; } +/* reconstruct whether integer is long (contains 'long' only once) */ +static BOOL is_long(const char* name) +{ + /* we assume name is made only of basic C keywords: + * int long short unsigned signed void float double char _Bool _Complex + */ + const char* p = strstr(name, "long"); + return p && strstr(p + 4, "long") == NULL; +} + +static BOOL is_c_language(dwarf2_parse_context_t* unit_ctx) +{ + return unit_ctx->language == DW_LANG_C || + unit_ctx->language == DW_LANG_C89 || + unit_ctx->language == DW_LANG_C99; +} + +static BOOL is_cpp_language(dwarf2_parse_context_t* unit_ctx) +{ + return unit_ctx->language == DW_LANG_C_plus_plus; +} + static struct symt* dwarf2_parse_base_type(dwarf2_debug_info_t* di) { struct attribute name; struct attribute size; struct attribute encoding; enum BasicType bt; + BOOL c_language, cpp_language; + if (di->symt) return di->symt; TRACE("%s\n", dwarf2_debug_di(di)); + c_language = is_c_language(di->unit_ctx); + cpp_language = is_cpp_language(di->unit_ctx); + if (!dwarf2_find_attribute(di, DW_AT_name, &name)) name.u.string = NULL; if (!dwarf2_find_attribute(di, DW_AT_byte_size, &size)) size.u.uvalue = 0; @@ -1472,10 +1500,19 @@ static struct symt* dwarf2_parse_base_type(dwarf2_debug_info_t* di) case DW_ATE_boolean: bt = btBool; break; case DW_ATE_complex_float: bt = btComplex; break; case DW_ATE_float: bt = btFloat; break; - case DW_ATE_signed: bt = btInt; break; - case DW_ATE_unsigned: bt = btUInt; break; - case DW_ATE_signed_char: bt = btChar; break; - case DW_ATE_unsigned_char: bt = btChar; break; + case DW_ATE_signed: bt = ((c_language || cpp_language) && is_long(name.u.string)) ? btLong : btInt; break; + case DW_ATE_unsigned: + if ((c_language || cpp_language) && is_long(name.u.string)) bt = btULong; + else if (cpp_language && !strcmp(name.u.string, "wchar_t")) bt = btWChar; + else if (cpp_language && !strcmp(name.u.string, "char8_t")) bt = btChar8; + else if (cpp_language && !strcmp(name.u.string, "char16_t")) bt = btChar16; + else if (cpp_language && !strcmp(name.u.string, "char32_t")) bt = btChar32; + else bt = btUInt; + break; + /* on Windows, in C, char == signed char, but not in C++ */ + case DW_ATE_signed_char: bt = (cpp_language && !strcmp(name.u.string, "signed char")) ? btInt : btChar; break; + case DW_ATE_unsigned_char: bt = btUInt; break; + case DW_ATE_UTF: bt = (size.u.uvalue == 1) ? btChar8 : (size.u.uvalue == 2 ? btChar16 : btChar32); break; default: bt = btNoType; break; } di->symt = &symt_get_basic(bt, size.u.uvalue)->symt; @@ -1497,7 +1534,15 @@ static struct symt* dwarf2_parse_typedef(dwarf2_debug_info_t* di) ref_type = dwarf2_lookup_type(di); if (name.u.string) + { + /* Note: The MS C compiler has tweaks for WCHAR support. + * Even if WCHAR is a typedef to wchar_t, wchar_t is emitted as btUInt/2 (it's defined as + * unsigned short, so far so good), while WCHAR is emitted as btWChar/2). + */ + if ((is_c_language(di->unit_ctx) || is_cpp_language(di->unit_ctx)) && !strcmp(name.u.string, "WCHAR")) + ref_type = &symt_get_basic(btWChar, 2)->symt; di->symt = &symt_new_typedef(di->unit_ctx->module_ctx->module, ref_type, name.u.string)->symt; + } if (dwarf2_get_di_children(di)) FIXME("Unsupported children\n"); return di->symt; } @@ -2917,6 +2962,7 @@ static BOOL dwarf2_parse_compilation_unit(dwarf2_parse_context_t* ctx) unsigned int i; struct attribute stmt_list, low_pc; struct attribute comp_dir; + struct attribute language; if (!dwarf2_find_attribute(di, DW_AT_name, &name)) name.u.string = NULL; @@ -2927,6 +2973,12 @@ static BOOL dwarf2_parse_compilation_unit(dwarf2_parse_context_t* ctx) if (!dwarf2_find_attribute(di, DW_AT_low_pc, &low_pc)) low_pc.u.uvalue = 0; + + if (!dwarf2_find_attribute(di, DW_AT_language, &language)) + language.u.uvalue = DW_LANG_C; + + ctx->language = language.u.uvalue; + ctx->compiland = symt_new_compiland(ctx->module_ctx->module, ctx->module_ctx->load_offset + low_pc.u.uvalue, source_new(ctx->module_ctx->module, comp_dir.u.string, name.u.string)); dwarf2_cache_cuhead(ctx->module_ctx->module->format_info[DFI_DWARF]->u.dwarf2_info, ctx->compiland, &ctx->head);
1
0
0
0
Eric Pouech : dbghelp: Let symt_basic be trans-module and nameless.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: 14462bbeab6c916f2aa01a615b1eb4d8005277e5 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=14462bbeab6c916f2aa01a61…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Tue May 10 17:11:08 2022 +0200 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(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/dbghelp/dbghelp_private.h | 4 +-- dlls/dbghelp/dwarf.c | 46 ++++++++++++++-------------------- dlls/dbghelp/msc.c | 56 +++++++++++++++++++++--------------------- dlls/dbghelp/stabs.c | 48 ++++++++++++++++++------------------ dlls/dbghelp/type.c | 37 ++++++++++++---------------- 5 files changed, 87 insertions(+), 104 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=14462bbeab6c916f2aa0…
1
0
0
0
Eric Pouech : winedbg: Add 'set' command to change data model.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: 6eb18ae6920da897af7e22f43347b3044f172e3c URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6eb18ae6920da897af7e22f4…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Tue May 10 17:11:08 2022 +0200 winedbg: Add 'set' command to change data model. Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/debugger.h | 4 ++++ programs/winedbg/types.c | 10 ++++++---- programs/winedbg/winedbg.c | 24 ++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index de6c8b3e438..ac13a28e3ca 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -265,6 +265,7 @@ struct dbg_process char source_current_file[MAX_PATH]; int source_start_line; int source_end_line; + const struct data_model* data_model; }; /* describes the way the debugger interacts with a given process */ @@ -550,6 +551,9 @@ struct data_model unsigned size; const WCHAR* name; }; +extern const struct data_model ilp32_data_model[]; +extern const struct data_model lp64_data_model[]; +extern const struct data_model llp64_data_model[]; extern struct dbg_internal_var dbg_internal_vars[]; diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index f4ee5a011d5..899e7f472b2 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -714,7 +714,7 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details) return TRUE; } -static const struct data_model ilp32_data_model[] = { +const struct data_model ilp32_data_model[] = { {btVoid, 0, L"void"}, {btChar, 1, L"char"}, {btWChar, 2, L"wchar_t"}, @@ -741,7 +741,7 @@ static const struct data_model ilp32_data_model[] = { {0, 0, NULL} }; -static const struct data_model llp64_data_model[] = { +const struct data_model llp64_data_model[] = { {btVoid, 0, L"void"}, {btChar, 1, L"char"}, {btWChar, 2, L"wchar_t"}, @@ -770,7 +770,7 @@ static const struct data_model llp64_data_model[] = { {0, 0, NULL} }; -static const struct data_model lp64_data_model[] = { +const struct data_model lp64_data_model[] = { {btVoid, 0, L"void"}, {btChar, 1, L"char"}, {btWChar, 2, L"wchar_t"}, @@ -803,7 +803,9 @@ static const struct data_model* get_data_model(DWORD modaddr) { const struct data_model *model; - if (ADDRSIZE == 4) model = ilp32_data_model; + if (dbg_curr_process->data_model) + model = dbg_curr_process->data_model; + else if (ADDRSIZE == 4) model = ilp32_data_model; else { IMAGEHLP_MODULEW64 mi; diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index d11b68ec432..8a5c9bc69ed 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -284,6 +284,7 @@ struct dbg_process* dbg_add_process(const struct be_process_io* pio, DWORD pid, p->source_current_file[0] = '\0'; p->source_start_line = -1; p->source_end_line = -1; + p->data_model = NULL; list_add_head(&dbg_process_list, &p->entry); @@ -467,6 +468,29 @@ void dbg_set_option(const char* option, const char* val) return; } } + else if (!strcasecmp(option, "data_model")) + { + if (!dbg_curr_process) + { + dbg_printf("Not attached to a process\n"); + return; + } + if (!val) + { + const char* model = ""; + if (dbg_curr_process->data_model == NULL) model = "auto"; + else if (dbg_curr_process->data_model == ilp32_data_model) model = "ilp32"; + else if (dbg_curr_process->data_model == llp64_data_model) model = "llp64"; + else if (dbg_curr_process->data_model == lp64_data_model) model = "lp64"; + dbg_printf("Option: data_model %s\n", model); + } + else if (!strcasecmp(val, "auto")) dbg_curr_process->data_model = NULL; + else if (!strcasecmp(val, "ilp32")) dbg_curr_process->data_model = ilp32_data_model; + else if (!strcasecmp(val, "llp64")) dbg_curr_process->data_model = llp64_data_model; + else if (!strcasecmp(val, "lp64")) dbg_curr_process->data_model = lp64_data_model; + else + dbg_printf("Unknown data model %s\n", val); + } else dbg_printf("Unknown option '%s'\n", option); }
1
0
0
0
Eric Pouech : winedbg: Introduce struct data_model to describe the various models for base types.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: 96ecee3211d606eff2585073eb5854aae4142911 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=96ecee3211d606eff2585073…
Author: Eric Pouech <eric.pouech(a)gmail.com> Date: Tue May 10 17:11:08 2022 +0200 winedbg: Introduce struct data_model to describe the various models for base types. Detect data model to be used with current debuggee PE & ELF 32 bit => ILP32 PE 64 bit => LP64 ELF 64 bit => LLP64 Signed-off-by: Eric Pouech <eric.pouech(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/winedbg/debugger.h | 7 ++ programs/winedbg/types.c | 176 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 150 insertions(+), 33 deletions(-) diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 293de4c0aa5..de6c8b3e438 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -544,6 +544,13 @@ static inline void* dbg_heap_realloc(void* buffer, size_t size) HeapAlloc(GetProcessHeap(), 0, size); } +struct data_model +{ + unsigned base_type; + unsigned size; + const WCHAR* name; +}; + extern struct dbg_internal_var dbg_internal_vars[]; #define DBG_IVARNAME(_var) dbg_internal_var_##_var diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 50d1f1b8353..f4ee5a011d5 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -714,47 +714,157 @@ BOOL types_print_type(const struct dbg_type* type, BOOL details) return TRUE; } +static const struct data_model ilp32_data_model[] = { + {btVoid, 0, L"void"}, + {btChar, 1, L"char"}, + {btWChar, 2, L"wchar_t"}, + {btInt, 1, L"signed char"}, + {btInt, 2, L"short int"}, + {btInt, 4, L"int"}, + {btInt, 8, L"__int64"}, + {btUInt, 1, L"unsigned char"}, + {btUInt, 2, L"unsigned short int"}, + {btUInt, 4, L"unsigned int"}, + {btUInt, 8, L"unsigned __int64"}, + {btFloat, 4, L"float"}, + {btFloat, 8, L"double"}, + {btFloat, 10, L"long double"}, + {btBool, 1, L"bool"}, + {btLong, 4, L"long"}, + {btLong, 8, L"long long"}, + {btULong, 4, L"unsigned long"}, + {btULong, 8, L"unsigned long long"}, + {btHresult, 4, L"char32_t"}, + {btChar16, 2, L"char16_t"}, + {btChar32, 4, L"char32_t"}, + {btChar8, 1, L"char8_t"}, + {0, 0, NULL} +}; + +static const struct data_model llp64_data_model[] = { + {btVoid, 0, L"void"}, + {btChar, 1, L"char"}, + {btWChar, 2, L"wchar_t"}, + {btInt, 1, L"signed char"}, + {btInt, 2, L"short int"}, + {btInt, 4, L"int"}, + {btInt, 8, L"__int64"}, + {btInt, 16, L"__int128"}, + {btUInt, 1, L"unsigned char"}, + {btUInt, 2, L"unsigned short int"}, + {btUInt, 4, L"unsigned int"}, + {btUInt, 8, L"unsigned __int64"}, + {btUInt, 16, L"unsigned __int128"}, + {btFloat, 4, L"float"}, + {btFloat, 8, L"double"}, + {btFloat, 10, L"long double"}, + {btBool, 1, L"bool"}, + {btLong, 4, L"long"}, + {btLong, 8, L"long long"}, + {btULong, 4, L"unsigned long"}, + {btULong, 8, L"unsigned long long"}, + {btHresult, 4, L"char32_t"}, + {btChar16, 2, L"char16_t"}, + {btChar32, 4, L"char32_t"}, + {btChar8, 1, L"char8_t"}, + {0, 0, NULL} +}; + +static const struct data_model lp64_data_model[] = { + {btVoid, 0, L"void"}, + {btChar, 1, L"char"}, + {btWChar, 2, L"wchar_t"}, + {btInt, 1, L"signed char"}, + {btInt, 2, L"short int"}, + {btInt, 4, L"int"}, + {btInt, 8, L"__int64"}, + {btInt, 16, L"__int128"}, + {btUInt, 1, L"unsigned char"}, + {btUInt, 2, L"unsigned short int"}, + {btUInt, 4, L"unsigned int"}, + {btUInt, 8, L"unsigned __int64"}, + {btUInt, 16, L"unsigned __int128"}, + {btFloat, 4, L"float"}, + {btFloat, 8, L"double"}, + {btFloat, 10, L"long double"}, + {btBool, 1, L"bool"}, + {btLong, 4, L"int"}, /* to print at least for such a regular Windows' type */ + {btLong, 8, L"long"}, /* we can't discriminate 'long' from 'long long' */ + {btULong, 4, L"unsigned int"}, /* to print at least for such a regular Windows' type */ + {btULong, 8, L"unsigned long"}, /* we can't discriminate 'unsigned long' from 'unsigned long long' */ + {btHresult, 4, L"char32_t"}, + {btChar16, 2, L"char16_t"}, + {btChar32, 4, L"char32_t"}, + {btChar8, 1, L"char8_t"}, + {0, 0, NULL} +}; + +static const struct data_model* get_data_model(DWORD modaddr) +{ + const struct data_model *model; + + if (ADDRSIZE == 4) model = ilp32_data_model; + else + { + IMAGEHLP_MODULEW64 mi; + DWORD opt = SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES, TRUE); + + mi.SizeOfStruct = sizeof(mi); + if (SymGetModuleInfoW64(dbg_curr_process->handle, modaddr, &mi) && + (wcsstr(mi.ModuleName, L".so") || wcsstr(mi.ModuleName, L"<"))) + model = lp64_data_model; + else + model = llp64_data_model; + SymSetExtendedOption(SYMOPT_EX_WINE_NATIVE_MODULES, opt); + } + return model; +} + /* helper to typecast pInfo to its expected type (_t) */ #define X(_t) (*((_t*)pInfo)) -BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, void* pInfo) +static BOOL lookup_base_type_in_data_model(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, void* pInfo) { - if (type->id == dbg_itype_none) return FALSE; - if (type->module != 0) + DWORD tag, bt; + DWORD64 len; + const WCHAR* name = NULL; + WCHAR tmp[64]; + const struct data_model* model; + + if (ti != TI_GET_SYMNAME || + !SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, TI_GET_SYMTAG, &tag) || + tag != SymTagBaseType || + !SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, TI_GET_BASETYPE, &bt) || + !SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, TI_GET_LENGTH, &len) || + len != (DWORD)len) return FALSE; + + model = get_data_model(type->module); + for (; model->name; model++) { - DWORD ret, tag, bt; - ret = SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, ti, pInfo); - if (!ret && - ti == TI_GET_SYMNAME && - SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, TI_GET_SYMTAG, &tag) && - tag == SymTagBaseType && - SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, TI_GET_BASETYPE, &bt)) + if (bt == model->base_type && model->size == len) { - const WCHAR* name = NULL; - - switch (bt) - { - case btVoid: name = L"void"; break; - case btChar: name = L"char"; break; - case btWChar: name = L"WCHAR"; break; - case btInt: name = L"int"; break; - case btUInt: name = L"unsigned int"; break; - case btFloat: name = L"float"; break; - case btBool: name = L"bool"; break; - case btLong: name = L"long int"; break; - case btULong: name = L"unsigned long int"; break; - case btComplex: name = L"complex"; break; - default: WINE_FIXME("Unsupported basic type %lu\n", bt); return FALSE; - } - X(WCHAR*) = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name) + 1) * sizeof(WCHAR)); - if (X(WCHAR*)) - { - lstrcpyW(X(WCHAR*), name); - ret = TRUE; - } + name = model->name; + break; } - return ret; } + if (!name) /* synthetize name */ + { + WINE_FIXME("Unsupported basic type %lu %I64u\n", bt, len); + swprintf(tmp, ARRAY_SIZE(tmp), L"bt[%lu,%u]", bt, len); + name = tmp; + } + X(WCHAR*) = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(name) + 1) * sizeof(WCHAR)); + if (X(WCHAR*)) + lstrcpyW(X(WCHAR*), name); + return TRUE; +} + +BOOL types_get_info(const struct dbg_type* type, IMAGEHLP_SYMBOL_TYPE_INFO ti, void* pInfo) +{ + if (type->id == dbg_itype_none) return FALSE; + if (type->module != 0) + return lookup_base_type_in_data_model(type, ti, pInfo) || + SymGetTypeInfo(dbg_curr_process->handle, type->module, type->id, ti, pInfo); assert(type->id >= dbg_itype_first);
1
0
0
0
Rémi Bernon : ntdll: Rewrite RtlWalkHeap and enumerate large blocks.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: 074177b8b0356df2e3ddfb8534e2ee1257b37a71 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=074177b8b0356df2e3ddfb85…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Thu May 5 00:49:25 2022 +0200 ntdll: Rewrite RtlWalkHeap and enumerate large blocks. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/kernel32/tests/heap.c | 92 +-------------- dlls/kernelbase/memory.c | 57 +++++++++- dlls/ntdll/heap.c | 276 ++++++++++++++++++++++----------------------- 3 files changed, 191 insertions(+), 234 deletions(-) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=074177b8b0356df2e3dd…
1
0
0
0
Rémi Bernon : ntdll: Check subheap sizes for consistency before using them.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: 1196b46b293291b455345a06a61b8687d6911b68 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=1196b46b293291b455345a06…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Wed May 4 20:19:50 2022 +0200 ntdll: Check subheap sizes for consistency before using them. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/heap.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index ab9985a1016..a917abe39af 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -250,6 +250,12 @@ static inline struct block *next_block( const SUBHEAP *subheap, const struct blo return (struct block *)next; } +static inline BOOL check_subheap( const SUBHEAP *subheap ) +{ + const char *base = subheap->base; + return contains( base, subheap->size, base + subheap->headerSize, subheap->commitSize - subheap->headerSize ); +} + static BOOL heap_validate( HEAP *heap, BOOL quiet ); /* mark a block of memory as free for debugging purposes */ @@ -353,6 +359,7 @@ static void subheap_notify_free_all(SUBHEAP const *subheap) char const *ptr = (char const *)subheap->base + subheap->headerSize; if (!RUNNING_ON_VALGRIND) return; + if (!check_subheap( subheap )) return; while (ptr < (char const *)subheap->base + subheap->size) { @@ -454,6 +461,8 @@ static void heap_dump( const HEAP *heap ) TRACE( " %p: base %p first %p last %p end %p\n", subheap, base, first_block( subheap ), last_block( subheap ), base + subheap_size( subheap ) ); + if (!check_subheap( subheap )) return; + overhead += (char *)first_block( subheap ) - base; for (block = first_block( subheap ); block; block = next_block( subheap, block )) { @@ -614,6 +623,7 @@ static SUBHEAP *find_subheap( const HEAP *heap, const void *ptr ) LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry ) { + if (!check_subheap( subheap )) return NULL; if (contains( subheap_base( subheap ), subheap_size( subheap ), ptr, sizeof(struct block) )) return subheap; } @@ -1456,6 +1466,14 @@ static BOOL heap_validate( HEAP *heap, BOOL quiet ) LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry ) { char *ptr = (char *)subheap->base + subheap->headerSize; + + if (!check_subheap( subheap )) + { + ERR( "heap %p, subheap %p corrupted sizes\n", heap, subheap ); + if (TRACE_ON(heap)) heap_dump( heap ); + return FALSE; + } + while (ptr < (char *)subheap->base + subheap->size) { if (*(DWORD *)ptr & ARENA_FLAG_FREE) @@ -1577,6 +1595,9 @@ static void heap_set_debug_flags( HANDLE handle ) { char *ptr = (char *)subheap->base + subheap->headerSize; char *end = (char *)subheap->base + subheap->commitSize; + + if (!check_subheap( subheap )) break; + while (ptr < end) { ARENA_INUSE *arena = (ARENA_INUSE *)ptr;
1
0
0
0
Rémi Bernon : ntdll: Cleanup HEAP_FindSubHeap and rename it to find_subheap.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: 4d2dedb22b8c61918727f0d52580431275f49933 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4d2dedb22b8c61918727f0d5…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri May 13 10:10:13 2022 +0200 ntdll: Cleanup HEAP_FindSubHeap and rename it to find_subheap. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/heap.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 68f7e6edcc0..ab9985a1016 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -608,23 +608,16 @@ static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL la } -/*********************************************************************** - * HEAP_FindSubHeap - * Find the sub-heap containing a given address. - * - * RETURNS - * Pointer: Success - * NULL: Failure - */ -static SUBHEAP *HEAP_FindSubHeap( - const HEAP *heap, /* [in] Heap pointer */ - LPCVOID ptr ) /* [in] Address */ -{ - SUBHEAP *sub; - LIST_FOR_EACH_ENTRY( sub, &heap->subheap_list, SUBHEAP, entry ) - if ((ptr >= sub->base) && - ((const char *)ptr < (const char *)sub->base + sub->size - sizeof(ARENA_INUSE))) - return sub; +static SUBHEAP *find_subheap( const HEAP *heap, const void *ptr ) +{ + SUBHEAP *subheap; + + LIST_FOR_EACH_ENTRY( subheap, &heap->subheap_list, SUBHEAP, entry ) + { + if (contains( subheap_base( subheap ), subheap_size( subheap ), ptr, sizeof(struct block) )) + return subheap; + } + return NULL; } @@ -760,7 +753,7 @@ static void HEAP_MakeInUseBlockFree( SUBHEAP *subheap, ARENA_INUSE *pArena ) mark_block_free( pArena + 1, pArena->size & ARENA_SIZE_MASK, heap->flags ); if (!prev) return; pArena = prev; - subheap = HEAP_FindSubHeap( heap, pArena ); + subheap = find_subheap( heap, pArena ); } /* Check if we can merge with previous block */ @@ -1132,7 +1125,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size, sizeof(ARENA_FREE) - sizeof(ARENA_INUSE); if (arena_size >= size) { - subheap = HEAP_FindSubHeap( heap, pArena ); + subheap = find_subheap( heap, pArena ); if (!HEAP_Commit( subheap, (ARENA_INUSE *)pArena, size )) return NULL; *ppSubHeap = subheap; return pArena; @@ -1183,7 +1176,7 @@ static ARENA_FREE *HEAP_FindFreeBlock( HEAP *heap, SIZE_T size, static BOOL HEAP_IsValidArenaPtr( const HEAP *heap, const ARENA_FREE *ptr ) { unsigned int i; - const SUBHEAP *subheap = HEAP_FindSubHeap( heap, ptr ); + const SUBHEAP *subheap = find_subheap( heap, ptr ); if (!subheap) return FALSE; if ((const char *)ptr >= (const char *)subheap->base + subheap->headerSize) return TRUE; if (subheap != &heap->subheap) return FALSE; @@ -1440,7 +1433,7 @@ static BOOL heap_validate_ptr( HEAP *heap, const void *ptr ) const ARENA_LARGE *large_arena; SUBHEAP *subheap; - if (!(subheap = HEAP_FindSubHeap( heap, arena )) || + if (!(subheap = find_subheap( heap, arena )) || ((const char *)arena < (char *)subheap->base + subheap->headerSize)) { if (!(large_arena = find_large_block( heap, ptr ))) @@ -1495,7 +1488,7 @@ static BOOL validate_block_pointer( HEAP *heap, SUBHEAP **ret_subheap, const ARE SUBHEAP *subheap; BOOL ret = FALSE; - if (!(*ret_subheap = subheap = HEAP_FindSubHeap( heap, arena ))) + if (!(*ret_subheap = subheap = find_subheap( heap, arena ))) { ARENA_LARGE *large_arena = find_large_block( heap, arena + 1 );
1
0
0
0
Rémi Bernon : ntdll: Use block size helpers in heap_size.
by Alexandre Julliard
13 May '22
13 May '22
Module: wine Branch: master Commit: accaf8f29a372f6a210933ffac3e548c3194e391 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=accaf8f29a372f6a210933ff…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Tue May 3 22:59:54 2022 +0200 ntdll: Use block size helpers in heap_size. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/heap.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 424f060b719..68f7e6edcc0 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -2054,10 +2054,7 @@ static NTSTATUS heap_size( HEAP *heap, const void *ptr, SIZE_T *size ) const ARENA_LARGE *large_arena = (const ARENA_LARGE *)ptr - 1; *size = large_arena->data_size; } - else - { - *size = (block->size & ARENA_SIZE_MASK) - block->unused_bytes; - } + else *size = block_get_size( block ) - block_get_overhead( block ); return STATUS_SUCCESS; }
1
0
0
0
← Newer
1
...
51
52
53
54
55
56
57
...
91
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Results per page:
10
25
50
100
200