> Hmm.  Could you send me a disassembly of the thunk as it is actually
> generated?  

Ok, here you are, directly from Wine's debugger :

Wine-dbg>bt
bt
Backtrace:
=>0 0x4967487e (wine_glGetString) (ebp=4eb610a0)
Wine-dbg>disas 0x4967487e
disas 0x4967487e
0x4967487e (wine_glGetString): movl     0x0(%esp),%eax
0x49674881 (wine_glGetString+0x3): leal 0x4(%esp),%edx
0x49674885 (.wine_glGetString [opengl_norm.c]): movl    0x0(%edx),%ecx
0x49674887 (.wine_glGetString+0x2 [opengl_norm.c]): movl        %eax,0x0(%edx)
0x49674889 (.wine_glGetString+0x4 [opengl_norm.c]): movl        %ecx,%eax
0x4967488b (.wine_glGetString+0x6 [opengl_norm.c]): subl        $4,%edx
0x4967488e (.wine_glGetString+0x9 [opengl_norm.c]): leal        0x0(%esp),%ecx
0x49674891 (.wine_glGetString+0xc [opengl_norm.c]): cmpl        %ecx,%edx
0x49674893 (.wine_glGetString+0xe [opengl_norm.c]): jnl 0x49674885 (.wine_glGetString 
[opengl_norm.c])
0x49674895 (.wine_glGetString+0x10 [opengl_norm.c]): call       0x4967489a 
(.wine_glGetString.getgot.enter [opengl_norm.c])
0x4967489a (.wine_glGetString.getgot.enter [opengl_norm.c]): popl       %ebx
0x4967489b (.wine_glGetString.getgot.enter+0x1 [opengl_norm.c]): addl   $0x14d32,%ebx
0x496748a1 (.wine_glGetString.getgot.enter+0x7 [opengl_norm.c]): pushl  0x6e4(%ebx)
0x496748a7 (.wine_glGetString.getgot.enter+0xd [opengl_norm.c]): call   0x4966fd98 
(_init+0xa74)
0x496748ac (.wine_glGetString.getgot.enter+0x12 [opengl_norm.c]): call  0x496706f8 
(_init+0x13d4)
0x496748b1 (.wine_glGetString.getgot.enter+0x17 [opengl_norm.c]): call  0x496748b6 
(.wine_glGetString.getgot.leave [opengl_norm.c])
0x496748b6 (.wine_glGetString.getgot.leave [opengl_norm.c]): popl       %ebx
0x496748b7 (.wine_glGetString.getgot.leave+0x1 [opengl_norm.c]): addl   $0x14d16,%ebx
0x496748bd (.wine_glGetString.getgot.leave+0x7 [opengl_norm.c]): pushl  0x6e4(%ebx)
0x496748c3 (.wine_glGetString.getgot.leave+0xd [opengl_norm.c]): call   0x49670738 
(_init+0x1414)
0x496748c8 (.wine_glGetString.getgot.leave+0x12 [opengl_norm.c]): addl  $4,%esp
0x496748cb (.wine_glGetString.getgot.leave+0x15 [opengl_norm.c]): ret   


> Also helpful would be to get a stack dump at the point
> when the thunk is initially called, and another one at the point the
> called real glGetString routine has returned ...

At the breakpoint, the stack looks like this (at least I hope it's
where the stack should be :-) ) :

Wine-dbg>x /32x $esp
0x49646948 (_end+0x1798b8):  0041b6e2 00001f03 00000000 4eb610a0
0x49646958 (_end+0x1798c8):  4ea44bc8 00000000 4017b388 00000000
0x49646968 (_end+0x1798d8):  081e0e80 49646980 407d8073 00000001
0x49646978 (_end+0x1798e8):  081e0e80 496469ac 40180cd7 00000021
0x49646988 (_end+0x1798f8):  407d8d3f 496895cc 40180c96 4024f658
0x49646998 (_end+0x179908):  00000034 4024d330 00000000 00000b78
0x496469a8 (_end+0x179918):  00000001 496469dc 4017c249 00000034
0x496469b8 (_end+0x179928):  00000001 00000000 4017c1ba 496895cc

0x1F03 must be the argument to the glGetString function (it's the
GL_EXTENSIONS enumerant).

Now, the the stack before the call to the real glGetString is hard to
get because of the entering of the X11 crit. section (VERY annoying,
this).

So, here I start again, but in setting '$critical_section' to '0' in
Patrik's script :

Wine-dbg>bt
Backtrace:
=>0 0x4967417c (wine_glGetString) (ebp=4eb610a0)
Wine-dbg>disas
disas
0x4967417c (wine_glGetString): movl     0x0(%esp),%eax
0x4967417f (wine_glGetString+0x3): leal 0x4(%esp),%edx
0x49674183 (.wine_glGetString [opengl_norm.c]): movl    0x0(%edx),%ecx
0x49674185 (.wine_glGetString+0x2 [opengl_norm.c]): movl        %eax,0x0(%edx)
0x49674187 (.wine_glGetString+0x4 [opengl_norm.c]): movl        %ecx,%eax
0x49674189 (.wine_glGetString+0x6 [opengl_norm.c]): subl        $4,%edx
0x4967418c (.wine_glGetString+0x9 [opengl_norm.c]): leal        0x0(%esp),%ecx
0x4967418f (.wine_glGetString+0xc [opengl_norm.c]): cmpl        %ecx,%edx
0x49674191 (.wine_glGetString+0xe [opengl_norm.c]): jnl 0x49674183 (.wine_glGetString 
[opengl_norm.c])
0x49674193 (.wine_glGetString+0x10 [opengl_norm.c]): call       0x496706f8 
(_init+0x13d4)
0x49674198 (.wine_glGetString+0x15 [opengl_norm.c]): addl       $4,%esp
0x4967419b (.wine_glGetString+0x18 [opengl_norm.c]): ret        
Wine-dbg>x /32x $esp
x /32x $esp
0x49646948 (_end+0x1798b8):  0041b6e2 00001f03 00000000 4eb610a0
0x49646958 (_end+0x1798c8):  4ea44bc8 00000000 407db616 00000000
0x49646968 (_end+0x1798d8):  081e17a8 49646980 407d8073 00000001
0x49646978 (_end+0x1798e8):  081e17a8 080b3c58 496469cc 496469cc
0x49646988 (_end+0x1798f8):  407d8d3f 49684c6c 4040bb20 4024d330
0x49646998 (_end+0x179908):  080b42c4 496469ac 00000000 00000d48
0x496469a8 (_end+0x179918):  8e42c4de 10f40001 00000000 00000001
0x496469b8 (_end+0x179928):  0220042f 081d1d6c 4017c1ba 49684c6c
(...)
Wine-dbg>ni
0x49674193 (.wine_glGetString+0x10 [opengl_norm.c]):  call      0x496706f8 
(_init+0x13d4)
Wine-dbg>x /32x $esp
x /32x $esp
0x49646948 (_end+0x1798b8):  00001f03 0041b6e2 00000000 4eb610a0
0x49646958 (_end+0x1798c8):  4ea44bc8 00000000 407db616 00000000
0x49646968 (_end+0x1798d8):  081e17a8 49646980 407d8073 00000001
0x49646978 (_end+0x1798e8):  081e17a8 080b3c58 496469cc 496469cc
0x49646988 (_end+0x1798f8):  407d8d3f 49684c6c 4040bb20 4024d330
0x49646998 (_end+0x179908):  080b42c4 496469ac 00000000 00000d48
0x496469a8 (_end+0x179918):  8e42c4de 10f40001 00000000 00000001
0x496469b8 (_end+0x179928):  0220042f 081d1d6c 4017c1ba 49684c6c
0x496469c8 (_end+0x179938): 
Wine-dbg>ni
First chance exception: page fault on read access to 0x000004f0
 in 32-bit code (0x496706f8).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0257 GS:0000
 EIP:496706f8 ESP:49646944 EBP:4eb610a0 EFLAGS:00010297(  R- 00  I S -A-P1C)
 EAX:0041b6e2 EBX:00000000 ECX:49646948 EDX:49646944
 ESI:4eb610a0 EDI:00000000
Stack dump:
0x49646944 (_end+0x1798b4):  49674198 00001f03 0041b6e2 00000000
0x49646954 (_end+0x1798c4):  4eb610a0 4ea44bc8 00000000 407db616
0x49646964 (_end+0x1798d4):  00000000 081e17a8 49646980 407d8073
0x49646974 (_end+0x1798e4):  00000001 081e17a8 080b3c58 496469cc
0x49646984 (_end+0x1798f4):  496469cc 407d8d3f 49684c6c 4040bb20
0x49646994 (_end+0x179904):  4024d330 080b42c4 496469ac 00000000
0x496469a4 (_end+0x179914): 

004a: sel=0257 base=49657000 limit=00000fff 32-bit rw-
Backtrace:
=>0 0x496706f8 (_init+0x13d4) (ebp=4eb610a0)

0x496706f8 (_init+0x13d4):  jmp *0x4f0(%ebx)

Hope this helps....

          Lionel

PS: if one knows how to debug what happens inside the X11 critical
    section, feel free to tell me (I cannot attach easily the debugger
    to the process because it crashes directly at program start).

-- 
               Lionel Ulmer   -   [EMAIL PROTECTED]
    My Advogato Wine diary : http://www.advogato.org/person/bbrox/

Reply via email to