Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 13.77 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Segmentation-fault with PyObject_Call() in shared library for iTunes
  2. cimport libc.stdio      as stdio
  3.  
  4. cdef extern from "iTunesAPI/iTunesAPI.h":
  5.  
  6.     ctypedef int    OSType
  7.     ctypedef int    OSStatus
  8.  
  9.     ctypedef struct PluginMessageInfo:
  10.         pass
  11.  
  12.     int             unimpErr
  13.  
  14. cdef public OSStatus iTunesPluginMain( OSType               message,
  15.                                        PluginMessageInfo*   messageInfo,
  16.                                        void*                refCon ):
  17.     cdef stdio.FILE*    fl = stdio.fopen('C:/itunes_cyplugin_feedback.txt', 'wb')
  18.     return unimpErr
  19.        
  20. # ...
  21.  
  22. cdef public OSStatus iTunesPluginMain( OSType               message,
  23.                                        PluginMessageInfo*   messageInfo,
  24.                                        void*                refCon ):
  25.     object()
  26.     return unimpErr
  27.        
  28. C:Program Files (x86)iTunes>gdb iTunes.exe
  29. GNU gdb (GDB) 7.3.1
  30. Copyright (C) 2011 Free Software Foundation, Inc.
  31. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  32. This is free software: you are free to change and redistribute it.
  33. There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
  34. and "show warranty" for details.
  35. This GDB was configured as "mingw32".
  36. For bug reporting instructions, please see:
  37. <http://www.gnu.org/software/gdb/bugs/>...
  38. Reading symbols from c:program files (x86)itunesiTunes.exe...(no debugging symbols found)...done.
  39. (gdb) b write
  40. No symbol table is loaded.  Use the "file" command.
  41. Make breakpoint pending on future shared library load? (y or [n]) y
  42. Breakpoint 1 (write) pending.
  43. (gdb) r
  44. Starting program: c:program files (x86)itunesiTunes.exe
  45. [New Thread 4588.0xa20]
  46. [New Thread 4588.0x1214]
  47. [New Thread 4588.0x12f4]
  48. [New Thread 4588.0x274]
  49. [New Thread 4588.0x1070]
  50. [New Thread 4588.0xf40]
  51. [New Thread 4588.0xfb0]
  52. [New Thread 4588.0x12b0]
  53. [New Thread 4588.0xb48]
  54. [New Thread 4588.0x58c]
  55. [New Thread 4588.0xc7c]
  56. [New Thread 4588.0x1048]
  57. [New Thread 4588.0x8ac]
  58. [New Thread 4588.0x10dc]
  59. [New Thread 4588.0x190]
  60. [New Thread 4588.0x128]
  61. [New Thread 4588.0xfbc]
  62. [New Thread 4588.0xc2c]
  63. [New Thread 4588.0x1154]
  64. [New Thread 4588.0x234]
  65. [New Thread 4588.0xa70]
  66. [New Thread 4588.0x1144]
  67. [New Thread 4588.0xa48]
  68. [New Thread 4588.0xbe8]
  69. warning: ASL checking for logging parameters in environment variable "iTunes.exe.log"
  70.  
  71. warning: ASL checking for logging parameters in environment variable "asl.log"
  72.  
  73. BFD: C:WindowsSysWOW64WMVCORE.DLL: Warning: Ignoring section flag IMAGE_SCN_MEM_NOT_PAGED in section .reloc
  74.  
  75. Program received signal SIGSEGV, Segmentation fault.
  76. 0x1e0650bc in python27!PyObject_Call () from C:WindowsSysWOW64python27.dll
  77. (gdb)
  78. (gdb) bt all
  79. No symbol "all" in current context.
  80. (gdb) bt
  81. #0  0x1e0650bc in python27!PyObject_Call () from C:WindowsSysWOW64python27.dll
  82. #1  0x02eb12ae in iTunesPluginMain (__pyx_v_message=1768843636, __pyx_v_messageInfo=0x16e6b0, __pyx_v_refCon=0x0)
  83.     at pytunes.c:465
  84. #2  0x68a4d627 in iTunes!getPhaseStreamLibraryVersion () from c:program files (x86)itunesiTunes.dll
  85. #3  0x696e6974 in iTunesMainEntryPoint@24 () from c:program files (x86)itunesiTunes.dll
  86. #4  0x00000000 in ?? ()
  87. (gdb)
  88.        
  89. Unhandled exception at 0x1e0650bc in iTunes.exe: 0xC0000005
  90. Segmentation fault when reading at 0x00000004.
  91.        
  92. (gdb) thread apply all bt
  93.  
  94. Thread 24 (thread 4340.0x4e0):
  95. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  96. #1  0x76e55e6c in ntdll!ZwWriteVirtualMemory () from C:Windowssystem32ntdll.dll
  97. #2  0x7504179c in WaitForSingleObjectEx () from C:Windowssystem32KernelBase.dll
  98. #3  0x0000067c in ?? ()
  99. #4  0x00000000 in ?? ()
  100.  
  101. Thread 23 (thread 4340.0x17a0):
  102. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  103. #1  0x76178f8f in UnregisterPowerSettingNotification () from C:Windowssystem32user32.dll
  104. #2  0x59bd3485 in iTunesMobileDevice!AFCConnectionGetStatus ()
  105.    from C:Program FilesCommon FilesAppleMobile Device SupportiTunesMobileDevice.dll
  106. #3  0x06fef87c in ?? ()
  107. #4  0x00000000 in ?? ()
  108.  
  109. Thread 22 (thread 4340.0x10c4):
  110. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  111. #1  0x76e55e7c in ntdll!ZwYieldExecution () from C:Windowssystem32ntdll.dll
  112. #2  0x76e4067b in ntdll!RtlLargeIntegerShiftLeft () from C:Windowssystem32ntdll.dll
  113. #3  0x76511174 in KERNEL32!AcquireSRWLockExclusive () from C:Windowssystem32kernel32.dll
  114. #4  0x76e6b3f5 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  115. #5  0x76e6b3c8 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  116. #6  0x00000000 in ?? ()
  117.  
  118. Thread 21 (thread 4340.0x14ec):
  119. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  120. #1  0x76e55e6c in ntdll!ZwWriteVirtualMemory () from C:Windowssystem32ntdll.dll
  121. #2  0x7504179c in WaitForSingleObjectEx () from C:Windowssystem32KernelBase.dll
  122. #3  0x0000063c in ?? ()
  123. #4  0x00000001 in ?? ()
  124. #5  0x06edf8c0 in ?? ()
  125. #6  0x73ae556e in CreatePropertySheetPageA ()
  126.    from C:WindowsWinSxSx86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfcco
  127. mctl32.dll
  128. #7  0x7650f003 in WaitForSingleObjectEx () from C:Windowssystem32kernel32.dll
  129. #8  0x765d6172 in ole32!CoRevokeClassObject () from C:Windowssystem32ole32.dll
  130. #9  0x765dc80b in ole32!CoIsOle1Class () from C:Windowssystem32ole32.dll
  131. #10 0x76511174 in KERNEL32!AcquireSRWLockExclusive () from C:Windowssystem32kernel32.dll
  132. #11 0x76e6b3f5 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  133. #12 0x76e6b3c8 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  134. #13 0x00000000 in ?? ()
  135.  
  136. Thread 20 (thread 4340.0x1628):
  137. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  138. #1  0x76e55e6c in ntdll!ZwWriteVirtualMemory () from C:Windowssystem32ntdll.dll
  139. #2  0x7504179c in WaitForSingleObjectEx () from C:Windowssystem32KernelBase.dll
  140. #3  0x00000650 in ?? ()
  141. #4  0x00000001 in ?? ()
  142. #5  0x00000000 in ?? ()
  143.  
  144. Thread 19 (thread 4340.0xf04):
  145. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  146. #1  0x76e55e6c in ntdll!ZwWriteVirtualMemory () from C:Windowssystem32ntdll.dll
  147. #2  0x7504179c in WaitForSingleObjectEx () from C:Windowssystem32KernelBase.dll
  148. #3  0x000005c0 in ?? ()
  149. #4  0x00000001 in ?? ()
  150. #5  0x00000000 in ?? ()
  151.  
  152. Thread 18 (thread 4340.0x3c4):
  153. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  154. #1  0x76e55e4c in ntdll!ZwWriteRequestData () from C:Windowssystem32ntdll.dll
  155. #2  0x75046872 in KERNELBASE!GetProcessId () from C:Windowssystem32KernelBase.dll
  156. #3  0x00000001 in ?? ()
  157. #4  0x068af914 in ?? ()
  158. #5  0x00000001 in ?? ()
  159. #6  0x00000000 in ?? ()
  160.  
  161. Thread 17 (thread 4340.0x880):
  162. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  163. #1  0x76e55e4c in ntdll!ZwWriteRequestData () from C:Windowssystem32ntdll.dll
  164. #2  0x75046872 in KERNELBASE!GetProcessId () from C:Windowssystem32KernelBase.dll
  165. #3  0x00000001 in ?? ()
  166. #4  0x0665f758 in ?? ()
  167. #5  0x00000001 in ?? ()
  168. #6  0x00000001 in ?? ()
  169. #7  0x00000000 in ?? ()
  170.  
  171. Thread 16 (thread 4340.0x165c):
  172. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  173. #1  0x76e55e4c in ntdll!ZwWriteRequestData () from C:Windowssystem32ntdll.dll
  174. #2  0x75046872 in KERNELBASE!GetProcessId () from C:Windowssystem32KernelBase.dll
  175. #3  0x00000001 in ?? ()
  176. #4  0x05e2f5a8 in ?? ()
  177. #5  0x00000001 in ?? ()
  178. #6  0x00000000 in ?? ()
  179.  
  180. Thread 14 (thread 4340.0xb6c):
  181. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  182. #1  0x76e55e6c in ntdll!ZwWriteVirtualMemory () from C:Windowssystem32ntdll.dll
  183. #2  0x7504179c in WaitForSingleObjectEx () from C:Windowssystem32KernelBase.dll
  184. #3  0x00000580 in ?? ()
  185. #4  0x00000001 in ?? ()
  186. #5  0x063cfe08 in ?? ()
  187. #6  0x737f53a6 in ?? ()
  188. #7  0x5cea92e4 in ?? ()
  189. #8  0x00000580 in ?? ()
  190. #9  0x0000001e in ?? ()
  191. #10 0x00000024 in ?? ()
  192. #11 0x00000001 in ?? ()
  193. #12 0x00000000 in ?? ()
  194.  
  195. Thread 13 (thread 4340.0xc74):
  196. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  197. #1  0x76e55e6c in ntdll!ZwWriteVirtualMemory () from C:Windowssystem32ntdll.dll
  198. #2  0x7504179c in WaitForSingleObjectEx () from C:Windowssystem32KernelBase.dll
  199. #3  0x00000548 in ?? ()
  200. #4  0x00000001 in ?? ()
  201. #5  0x00000000 in ?? ()
  202.  
  203. Thread 12 (thread 4340.0x778):
  204. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  205. #1  0x76e55e7c in ntdll!ZwYieldExecution () from C:Windowssystem32ntdll.dll
  206. #2  0x76e4067b in ntdll!RtlLargeIntegerShiftLeft () from C:Windowssystem32ntdll.dll
  207. #3  0x76511174 in KERNEL32!AcquireSRWLockExclusive () from C:Windowssystem32kernel32.dll
  208. #4  0x76e6b3f5 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  209. #5  0x76e6b3c8 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  210. #6  0x00000000 in ?? ()
  211.  
  212. Thread 10 (thread 4340.0x1620):
  213. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  214. #1  0x76e54c1c in ntdll!ZwDeleteValueKey () from C:Windowssystem32ntdll.dll
  215. #2  0x75041876 in SleepEx () from C:Windowssystem32KernelBase.dll
  216. #3  0x00000000 in ?? ()
  217.  
  218. Thread 9 (thread 4340.0x10cc):
  219. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  220. #1  0x76e55e7c in ntdll!ZwYieldExecution () from C:Windowssystem32ntdll.dll
  221. #2  0x76e4067b in ntdll!RtlLargeIntegerShiftLeft () from C:Windowssystem32ntdll.dll
  222. #3  0x76511174 in KERNEL32!AcquireSRWLockExclusive () from C:Windowssystem32kernel32.dll
  223. #4  0x76e6b3f5 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  224. #5  0x76e6b3c8 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  225. #6  0x00000000 in ?? ()
  226.  
  227. Thread 8 (thread 4340.0xac4):
  228. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  229. #1  0x76e55e7c in ntdll!ZwYieldExecution () from C:Windowssystem32ntdll.dll
  230. #2  0x76e4067b in ntdll!RtlLargeIntegerShiftLeft () from C:Windowssystem32ntdll.dll
  231. #3  0x76511174 in KERNEL32!AcquireSRWLockExclusive () from C:Windowssystem32kernel32.dll
  232. #4  0x76e6b3f5 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  233. #5  0x76e6b3c8 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  234. #6  0x00000000 in ?? ()
  235.  
  236. Thread 7 (thread 4340.0xe08):
  237. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  238. #1  0x76e55e4c in ntdll!ZwWriteRequestData () from C:Windowssystem32ntdll.dll
  239. #2  0x75046872 in KERNELBASE!GetProcessId () from C:Windowssystem32KernelBase.dll
  240. #3  0x00000001 in ?? ()
  241. #4  0x057df9f0 in ?? ()
  242. #5  0x00000001 in ?? ()
  243. #6  0x00000000 in ?? ()
  244.  
  245. Thread 6 (thread 4340.0x7fc):
  246. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  247. #1  0x76e55e7c in ntdll!ZwYieldExecution () from C:Windowssystem32ntdll.dll
  248. #2  0x76e4067b in ntdll!RtlLargeIntegerShiftLeft () from C:Windowssystem32ntdll.dll
  249. #3  0x76511174 in KERNEL32!AcquireSRWLockExclusive () from C:Windowssystem32kernel32.dll
  250. #4  0x76e6b3f5 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  251. #5  0x76e6b3c8 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  252. #6  0x00000000 in ?? ()
  253.  
  254. Thread 5 (thread 4340.0x61c):
  255. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  256. #1  0x76e55e4c in ntdll!ZwWriteRequestData () from C:Windowssystem32ntdll.dll
  257. #2  0x76e3ef27 in ntdll!RtlIsValidIndexHandle () from C:Windowssystem32ntdll.dll
  258. #3  0x76511174 in KERNEL32!AcquireSRWLockExclusive () from C:Windowssystem32kernel32.dll
  259. #4  0x76e6b3f5 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  260. #5  0x76e6b3c8 in ntdll!RtlInsertElementGenericTableAvl () from C:Windowssystem32ntdll.dll
  261. #6  0x00000000 in ?? ()
  262.  
  263. Thread 4 (thread 4340.0x1794):
  264. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  265. #1  0x76e55e4c in ntdll!ZwWriteRequestData () from C:Windowssystem32ntdll.dll
  266. #2  0x75046872 in KERNELBASE!GetProcessId () from C:Windowssystem32KernelBase.dll
  267. #3  0x00000002 in ?? ()
  268. #4  0x04e8f9e8 in ?? ()
  269. #5  0x00000001 in ?? ()
  270. #6  0x00000000 in ?? ()
  271.  
  272. Thread 2 (thread 4340.0x51c):
  273. #0  0x76e564f4 in ntdll!LdrFindResourceEx_U () from C:Windowssystem32ntdll.dll
  274. #1  0x76e55e6c in ntdll!ZwWriteVirtualMemory () from C:Windowssystem32ntdll.dll
  275. #2  0x7504179c in WaitForSingleObjectEx () from C:Windowssystem32KernelBase.dll
  276. #3  0x00000218 in ?? ()
  277. #4  0x00000000 in ?? ()
  278.  
  279. Thread 1 (thread 4340.0x17b4):
  280. #0  0x1e0650bc in python27!PyObject_Call () from C:Windowssystem32python27.dll
  281. #1  0x69781232 in iTunesPluginMain (__pyx_v_message=1768843636, __pyx_v_msgInfo=0x13e680, __pyx_v_refCon=0x0)
  282.     at pytunes.c:467
  283. #2  0x5bc1d217 in iTunes!getPhaseStreamLibraryVersion () from C:Program FilesiTunesiTunes.dll
  284. #3  0x696e6974 in ?? ()
  285. #4  0x0013e680 in ?? ()
  286. #5  0x00000000 in ?? ()
  287. (gdb)
  288.        
  289. #include "iTunesAPI/iTunesAPI.h"
  290. #include <Python.h>
  291.  
  292. __declspec(dllexport) OSStatus iTunesPluginMain(OSType              message,
  293.                                                 PluginMessageInfo*  msgInfo,
  294.                                                 void*               refCon) {
  295.     Py_Initialize();
  296.     PyObject* op = Py_BuildValue("i", 123);
  297.     Py_Finalize();
  298.     return unimpErr;
  299. }
  300.        
  301. #include <Python.h>
  302. #include "../iTunesAPI/iTunesAPI.h"
  303. #include "pytunes.c"
  304.  
  305. __declspec(dllexport) OSStatus iTunesPluginMain( OSType             message,
  306.                                                  PluginMessageInfo* msgInfo,
  307.                                                  void*              refCon ) {
  308.     Py_Initialize();
  309.     PyEval_InitThreads();
  310.     initpytunes();
  311.     return PyTunes_main(message, msgInfo, refCon);
  312. }
  313.        
  314. cdef extern from "../iTunesAPI/iTunesAPI.h":
  315.  
  316.     ctypedef int        OSType
  317.     ctypedef int        OSStatus
  318.  
  319.     ctypedef struct PluginMessageInfo:
  320.         pass
  321.  
  322.     int unimpErr
  323.  
  324. cdef public int PyTunes_main(   OSType               message,
  325.                                 PluginMessageInfo*   msgInfo,
  326.                                 void*                refCon ):
  327.     object()
  328.     return 0