[Ilugc] compiling dhvani in ubuntu 11.10

  • From: l.mohanphy@xxxxxxxxx (Mohan L)
  • Date: Tue, 17 Apr 2012 00:01:05 +0530

Thanks for the detailed steps.

I compiled successfully.

But, when called dhvani to read any text file, getting the following error.
Segmentation fault (core dumped)

How to make it working?


While posting bug in mailing list please try to give more information to
reproduce error.

I have compiled dhvani in my Ubuntu to help your previous configuration
issue. I just tried some thing like  :

$ dhvani -t "????????"
Segmentation fault

I am not sure why it is reporting the run time error: Segmentation fault. I
used strace and gdb to trace the issue.

I took strace :

$strace dhvani -t "????????"

open(NULL, O_WRONLY|O_CREAT|O_APPEND, 0666) = -1 EFAULT *(Bad address)*
fstat64(8, {st_mode=S_IFREG|0664, st_size=35818, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb27d4000
read(8,
"\21\0\31\0Q\0h\0{\0f\0Q\0T\0;\0i\0\265\0\276\0\276\0\237\0|\0z\0"...,
8192) = 8192
brk(0x9156000)                          = 0x9156000
---* SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++*
Segmentation fault

Then I used gdb to see what is the problem :


$ gdb dhvani
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /usr/local/bin/dhvani...done.


(gdb) run dhvani -t "????????"
Starting program: /usr/local/bin/dhvani dhvani -t "????????"
[Thread debugging using libthread_db enabled]
[New Thread 0xb37cbb70 (LWP 7191)]

Program received signal SIGSEGV, Segmentation fault.
0xb7e7a3e5 in fwrite () from /lib/i386-linux-gnu/libc.so.6


See the above output. It through  the SIGSEGV signal from the operating
system. This means that I am trying to access an invalid memory address.
Let's take a backtrace:

(gdb) backtrace
*#0  0xb7e7a3e5 in fwrite () from /lib/i386-linux-gnu/libc.so.6*
#1  0xb7fb34a3 in process_pitch_tempo (options=0x804c3f8,
inputfile_name=0x8071da8 "/tmp/dhvani-st7188", output_filename=0x0)
    at soundtouch_utils.c:136
#2  0xb7fb83b6 in process_sound () at synthesizer.c:1646
#3  0xb7fb8936 in speak_text (text=0xbffff4eb "????????", usr_language=-1)
at synthesizer.c:1905
#4  0xb7fb8c45 in text_to_speech (string=0xbffff4eb "????????",
dhvani_opts=0x804c3f8) at synthesizer.c:1986
#5  0xb7f9dcd3 in dhvani_say (string=0xbffff4eb "????????",
options=0x804c3f8) at dhvani_lib.c:74
#6  0x08048c6e in main (argc=4, argv=0xbffff334) at dhvani.c:198

The above output says fwrite() call in glibc reports Segmentation fault.
so I want to switch to stack frame 1 and see where the program crashed:

(gdb) frame 1
#1  0xb7fb34a3 in process_pitch_tempo (options=0x804c3f8,
inputfile_name=0x8071da8 "/tmp/dhvani-st7188", output_filename=0x0)
    at soundtouch_utils.c:136
136                    fwrite(buffer, sizeof(short), read_count, out);


the program crashed inside the call to fwrite() and also note the address
of output_filename : it is output_filename=0x0  , output_filename pointing
invalid address.

(gdb) print out
$1 = (FILE *) 0x0

the value of out is 0x0, which is the NULL pointer. This is not what we
want - out should be stdout/output file. It indicates that I have to pass
proper output file to store output.

then I tried with output file name :

$ dhvani -t "????????"  -o first.wav

Now it works for me.

Your problem may be something else. But this the way to get idea of why it
is giving Segmentation fault.


Thanks
Mohan L

Other related posts: