(2014-03-23, 20:16)pvagner Wrote: ruuk, do you have some ideas on how we might be able to detect where crashes occur?
For me when XBMC crashes it just exits without doing something usefull and the log includes no helpfull hints. I have tried storing library handle into the settings and loading second instance using that handle but this will not help with eSpeak ctypes implementation also.
I think with the gnu debugger GDB installed and debug logging enabeled, a crash will generate a stack trace in the crash log. My system puts a crashlog into my home directory.
I don't really know how to read a stack trace, so this is rarely useful for me
As you can see from the commented out code in espeak.py, I tried unloading the library. This crashes XBMC as well.
Just now I ran the following code in XBMC:
Code:
import ctypes
import ctypes.util
import os
class espeak_VOICE(ctypes.Structure):
_fields_=[
('name',ctypes.c_char_p),
('languages',ctypes.c_char_p),
('identifier',ctypes.c_char_p),
('gender',ctypes.c_byte),
('age',ctypes.c_byte),
('variant',ctypes.c_byte),
('xx1',ctypes.c_byte),
('score',ctypes.c_int),
('spare',ctypes.c_void_p),
]
libname = ctypes.util.find_library('espeak')
eSpeak = ctypes.cdll.LoadLibrary(libname)
eSpeak.espeak_Initialize(0,0,None,0)
voices=eSpeak.espeak_ListVoices(None)
aespeak_VOICE=ctypes.POINTER(ctypes.POINTER(espeak_VOICE))
pvoices=ctypes.cast(voices,aespeak_VOICE)
print '1'
index=0
voiceList = []
while pvoices[index]:
print '2'
voiceList.append(os.path.basename(pvoices[index].contents.identifier))
index+=1
print voiceList
And it printed the '1' but not the '2' so it was crashing on pvoices[index], so it doesn't only crash on a second load of the library.
Code:
libname = ctypes.util.find_library('espeak')
print '1'
eSpeak = ctypes.cdll.LoadLibrary(libname)
eSpeak.espeak_Initialize(0,0,None,0)
print '2'
eSpeak2 = ctypes.cdll.LoadLibrary(libname)
eSpeak2.espeak_Initialize(0,0,None,0)
print '3'
eSpeak3 = ctypes.cdll.LoadLibrary(libname)
eSpeak3.espeak_Initialize(0,0,None,0)
print '4'
Printed all the way through 4 and didn't crash
Code:
libname = ctypes.util.find_library('espeak')
print '1'
eSpeak = ctypes.cdll.LoadLibrary(libname)
eSpeak.espeak_Initialize(0,0,None,0)
eSpeak.espeak_Synth('test',4,0,0,0,0x1000,None,None)
print '2'
eSpeak2 = ctypes.cdll.LoadLibrary(libname)
eSpeak2.espeak_Initialize(0,0,None,0)
eSpeak2.espeak_Synth('test',4,0,0,0,0x1000,None,None)
print '3'
eSpeak3 = ctypes.cdll.LoadLibrary(libname)
eSpeak3.espeak_Initialize(0,0,None,0)
eSpeak3.espeak_Synth('test',4,0,0,0,0x1000,None,None)
print '4'
Printed all the way through 4 and then crashed
I don't know if that's helpful or not. I'm about ready to give up on ctypes with espeak, unless you have any ideas.
By the way, is there a special way to start speech-dispatcher to get it to work with the addon. I tried with it running and not running and it fails to show up. Raising the exception in the available() method's try clause says something about the client and server expecting different paths.