I discovered with strace an gdb.
The file test.jpg is opening. Return value is positive(3).
I is also reading from the file.
read(3,
"\377\330\377\340\0\20JFIF\0\1\1\1\0H\0H\0\0\377\341\0\26Exif\0\0MM"...,
4096) = 412
But what is the problem?
Strace Output:
...
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xfffffffff7dc6000
set_thread_area(0xffb8fa28) = 0
open("/dev/urandom", O_RDONLY) = 3
read(3, "\374n\366g", 4) = 4
close(3) = 0
mprotect(0xf7f04000, 8192, PROT_READ) = 0
mprotect(0xf7f1c000, 4096, PROT_READ) = 0
mprotect(0xf7f42000, 4096, PROT_READ) = 0
mprotect(0xf7f46000, 4096, PROT_READ) = 0
mprotect(0x80bd000, 4096, PROT_READ) = 0
mprotect(0xf7f8f000, 4096, PROT_READ) = 0
munmap(0xf7f49000, 172334) = 0
brk(0) = 0x80c2000
brk(0x80e3000) = 0x80e3000
sigaltstack({ss_sp=0x80be480, ss_flags=0x2000 /* SS_??? */, ss_size=0},
NULL) = 0
rt_sigaction(SIGSEGV, {0x880000040808a6c2, [], 0}, {SIG_DFL}, 8) = 0
mmap2(NULL, 131072, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xfffffffff7f54000
mmap2(0xf7f72000, 8192, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xfffffffff7f72000
open("test.jpg", O_RDONLY) = 3
fstat64(0x3, 0xffb8f910) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0xfffffffff7f53000
read(3,
"\377\330\377\340\0\20JFIF\0\1\1\1\0H\0H\0\0\377\341\0\26Exif\0\0MM"...,
4096) = 412
write(2, "./tb_read", 9./tb_read) = 9
write(2, ":internal error: ", 17:internal error: ) = 17
write(2, "file: IO error", 14file: IO error) = 14
write(2, "\n", 1
) = 1
exit_group(1) = ?
gdb tb_read
GNU gdb 6.8
Copyright (C) 2008 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 "x86_64-suse-linux"...
(gdb) break __ghdl_fatal
Breakpoint 1 at 0x807a6f9: file
/home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-er
rors.adb, line 54.
(gdb) help
List of classes of commands:
aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands
Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb) s
The program is not being run.
(gdb) run
Starting program: /home/red/fpga/VHDL/tb_lesen/tb_read
/home/red/fpga/VHDL/tb_lesen/tb_read:internal error: file: IO error
Breakpoint 1, <__ghdl_fatal> ()
at /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb:54
54 /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb: No
such file o r directory.
in /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/red/fpga/VHDL/tb_lesen/tb_read
/home/red/fpga/VHDL/tb_lesen/tb_read:internal error: file: IO error
Breakpoint 1, <__ghdl_fatal> ()
at /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb:54
54 in /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb
(gdb) s
__ghdl_maybe_return_via_longjump (val=-1)
at ../../../gcc-4.3.4/gcc/vhdl/grt/config/linux.c:300
300 ../../../gcc-4.3.4/gcc/vhdl/grt/config/linux.c: No such file or
directory.
in ../../../gcc-4.3.4/gcc/vhdl/grt/config/linux.c
Current language: auto; currently c
(gdb) quit
The program is running. Exit anyway? (y or n) y
r...@x1-6-00-1d-92-05-7d-7a:~/fpga/VHDL/tb_lesen> gdb tb_read
GNU gdb 6.8
Copyright (C) 2008 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 "x86_64-suse-linux"...
(gdb) break __ghdl_fatal
Breakpoint 1 at 0x807a6f9: file
/home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb, line 54.
(gdb) s
The program is not being run.
(gdb) run
Starting program: /home/red/fpga/VHDL/tb_lesen/tb_read
/home/red/fpga/VHDL/tb_lesen/tb_read:internal error: file: IO error
Breakpoint 1, <__ghdl_fatal> () at
/home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb:54
54 /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb: No
such file or directory.
in /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb
(gdb) s
__ghdl_maybe_return_via_longjump (val=-1) at
../../../gcc-4.3.4/gcc/vhdl/grt/config/linux.c:300
300 ../../../gcc-4.3.4/gcc/vhdl/grt/config/linux.c: No such file or
directory.
in ../../../gcc-4.3.4/gcc/vhdl/grt/config/linux.c
Current language: auto; currently c
(gdb) s
302 in ../../../gcc-4.3.4/gcc/vhdl/grt/config/linux.c
(gdb) s
<__ghdl_fatal> () at
/home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb:55
55 /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb: No
such file or directory.
in /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb
Current language: auto; currently ada
(gdb) s
58 in /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb
(gdb) s
grt.errors.ghdl_exit (code=1) at
/home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb:38
38 in /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb
(gdb) s
42 in /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb
(gdb) s
45 in /home/gingold/dist/gcc-4.3.4/gcc/vhdl/grt/grt-errors.adb
(gdb) s
s
Program exited with code 01.
(gdb) s
The program is not being run.
(gdb)
R.Doss schrieb:
> I want to read the file test.jpg. This are 8bit hex-values. My first
> try is to put it out on standard output.
> Just the output is uncommanded. The error must com from read part.
>
>
> red>ghdl -a -Wa,--32 tb_lesen2.vhd
> red> ghdl -e -Wa,--32 -Wl,-m32 tb_read
> red> ghdl -r tb_read --stop-time=3000ns
> ./tb_read:internal error: file: IO error
> ghdl: compilation error
>
>
> Rene
> -----------------------------------------------------------------
> LIBRARY ieee;
> USE ieee.std_logic_1164.ALL;
> --USE ieee.std_logic_unsigned.all;
> USE ieee.numeric_std.ALL;
>
> use STD.textio.all; -- basic I/O
>
>
> ENTITY tb_read IS
> END tb_read;
>
> ARCHITECTURE behavior OF tb_read IS
>
> subtype by_te is bit_vector(7 downto 0);
>
> type f_byte is file of by_te;
> BEGIN
>
> process
> file in_file: f_byte open read_mode is "test.jpg";
>
> variable in_line,out_line: line;
> variable good:boolean;
> variable a:by_te;
>
> begin
> while not endfile(in_file) loop
> read(in_file,a);
> --write(out_line,a);
> end loop;
> --writeline(output,out_line);
>
> wait;
> end process;
>
> END;
>
>
> _______________________________________________
> Ghdl-discuss mailing list
> [email protected]
> https://mail.gna.org/listinfo/ghdl-discuss
>
>
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss