http://bugs.winehq.org/show_bug.cgi?id=29888
Bug #: 29888 Summary: MPLAB 8 Logic Analyzer doesn't work Product: Wine Version: 1.4-rc3 Platform: x86-64 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: oleaut32 AssignedTo: wine-bugs@winehq.org ReportedBy: alexhenrie24@gmail.com Classification: Unclassified
Created attachment 38866 --> http://bugs.winehq.org/attachment.cgi?id=38866 Screenshot
The Logic Analyzer in MPLAB 8 doesn't work. To reproduce:
1. Open MPLAB IDE. 2. Click Debugger, Select Tool, MPLAB SIM. 3. Click Debugger, Settings, Trace All, OK. 4. Click View, Simulator Logic Analyzer. 5. Click Channels, Add (it doesn't matter which channel you add), OK.
The Logic Analyzer window goes black and displays either "Access violation at address X. Read of address Y" or "Out of memory".
Installing oleaut32.dll from Windows 98SE fixes the problem.
stderr shows the following:
fixme:ole:TLB_ReadTypeLib Header type magic 0x00905a4d not supported. err:ole:TLB_ReadTypeLib Loading of typelib L"C:\Program Files\Microchip\MPLAB IDE\Simulator\MPLogicDisplay.dll" failed with error 0
But I don't think this is the problem because ReadTypeLib is called by LoadTypeLibEx, which returns TYPE_E_CANTLOADLIBRARY both with and without the native oleaut32.dll.
http://bugs.winehq.org/show_bug.cgi?id=29888
--- Comment #1 from Vitaliy Margolen vitaliy-bugzilla@kievinfo.com 2012-02-14 08:49:55 CST --- Please attach complete terminal output when using builtin oleaut32.dll. Make sure you have Wine debug symbols installed.
http://bugs.winehq.org/show_bug.cgi?id=29888
--- Comment #2 from Alex Henrie alexhenrie24@gmail.com 2012-02-14 10:06:01 CST --- Created attachment 38871 --> http://bugs.winehq.org/attachment.cgi?id=38871 Terminal output
By the way, MPLAB 8 can be downloaded for free from http://www.microchip.com/mplab/
http://bugs.winehq.org/show_bug.cgi?id=29888
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download URL| |http://www.microchip.com/mp | |lab/
http://bugs.winehq.org/show_bug.cgi?id=29888
--- Comment #3 from Alex Henrie alexhenrie24@gmail.com 2012-02-17 02:21:26 CST --- Created attachment 38923 --> http://bugs.winehq.org/attachment.cgi?id=38923 Hack to prevent crash
Well, I made a little progress. Turns out that this bug is present at least as far back as Wine 1.0. And commenting this line out of DispCallFunc in oleaut32/typelib.c prevents the crash:
call_method( func, argspos - 1, args + 1, &stack_offset );
Of course, the Logic Analyzer doesn't actually do anything without that line, but it at least doesn't go to the black screen of death.
I saw that call_method is implemented as 33 lines of inline assembly. Could there be a bug somewhere in these 33 lines?
http://bugs.winehq.org/show_bug.cgi?id=29888
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #38923|0 |1 is obsolete| |
--- Comment #4 from Alex Henrie alexhenrie24@gmail.com 2012-02-20 23:01:24 CST --- Created attachment 39001 --> http://bugs.winehq.org/attachment.cgi?id=39001 Patch that fixes MPLAB but probably breaks something else
The problem has something to do with the VT_BSTR|VT_BYREF variant type. Currently parameters of this type are treated like a simple pointer (32-bit integer), but if we change DispCallFunc to pass call_method a pointer to the pointer instead, MPLAB's Logic Analyzer works and doesn't crash. Oddly, even though this works for MPLAB, I couldn't come up with any test case that confirms this behavior.
Help figuring this out would be appreciated--I'm out of ideas.
http://bugs.winehq.org/show_bug.cgi?id=29888
--- Comment #5 from Nikolay Sivov bunglehead@gmail.com 2012-02-21 01:32:43 CST --- (In reply to comment #4)
Created attachment 39001 [details] Patch that fixes MPLAB but probably breaks something else
The problem has something to do with the VT_BSTR|VT_BYREF variant type. Currently parameters of this type are treated like a simple pointer (32-bit integer), but if we change DispCallFunc to pass call_method a pointer to the pointer instead, MPLAB's Logic Analyzer works and doesn't crash. Oddly, even though this works for MPLAB, I couldn't come up with any test case that confirms this behavior.
Help figuring this out would be appreciated--I'm out of ideas.
You need V_BSTRREF here, tests should be added to test_DispCallFunc(). Also don't forget to fix 64 bit part as well.
http://bugs.winehq.org/show_bug.cgi?id=29888
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |bunglehead@gmail.com Version|1.4-rc3 |1.4-rc5
http://bugs.winehq.org/show_bug.cgi?id=29888
--- Comment #6 from Alex Henrie alexhenrie24@gmail.com 2012-02-26 01:24:03 CST --- Created attachment 39084 --> http://bugs.winehq.org/attachment.cgi?id=39084 Test that demonstrates that the patch is incorrect
(In reply to comment #5)
You need V_BSTRREF here, tests should be added to test_DispCallFunc().
That's the trouble: Even though this patch works for MPLAB, I don't have any test that verifies it. In fact, I made a test that shows that this patch does NOT match Windows. So why does it work?
http://bugs.winehq.org/show_bug.cgi?id=29888
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC|bunglehead@gmail.com | Version|1.4-rc5 |1.4-rc3
http://bugs.winehq.org/show_bug.cgi?id=29888
--- Comment #7 from Nikolay Sivov bunglehead@gmail.com 2012-02-26 02:58:33 CST --- (In reply to comment #6)
Created attachment 39084 [details] Test that demonstrates that the patch is incorrect
(In reply to comment #5)
You need V_BSTRREF here, tests should be added to test_DispCallFunc().
That's the trouble: Even though this patch works for MPLAB, I don't have any test that verifies it. In fact, I made a test that shows that this patch does NOT match Windows. So why does it work?
If it doesn't crash with a patch it doesn't mean it works as it supposed to. And patch is wrong obviously - you don't need another indirection level for BYREF argument, V_BSTRREF() is already a pointer. That means default case for V_UI4() should work just fine and you don't really need special case for VT_BSTR|VT_BYREF.
So I guess you need to debug it more. Also patch correctness discussions should use wine-devel probably, so more people could comment.
http://bugs.winehq.org/show_bug.cgi?id=29888
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch CC| |adys.wh@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=29888
Alex Henrie alexhenrie24@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |d53bdeca62b42b881347f7faf58 | |932377635b3ed Status|UNCONFIRMED |RESOLVED CC| |alexhenrie24@gmail.com, | |jacek@codeweavers.com Resolution| |FIXED
--- Comment #8 from Alex Henrie alexhenrie24@gmail.com 2012-05-24 11:25:16 CDT --- This bug appears to have been fixed by "oleaut32: Added BSTR cache implementation." Thanks!
http://source.winehq.org/git/wine.git/commit/d53bdeca62b42b881347f7faf589323...
http://bugs.winehq.org/show_bug.cgi?id=29888
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #9 from Alexandre Julliard julliard@winehq.org 2012-05-25 13:41:34 CDT --- Closing bugs fixed in 1.5.5.