GDB: pass a file containing the arguments to the gsb

0

How can I do in GDB when I call an executable <fichero? where file contains the arguments of the executable?

My program without using GDB works correctly, it's like this:

c:\Users\usuario\workspace\tema1\Sales_item>  c:\Users\usuario\workspace\tema1\Sales_item/Sales_item.exe < sales_item_in.txt
0-201-12345-X 9 183 20.3333
0-202-12345-X 2 51 25.5
0-203-12345-X 9 105 11.6667
0-204-12345-X 1 40 40
0-205-12345-X 14 39 2.78571
0-206-12345-X 3 72 24

My file sales_item_in.txt:

0-201-12345-X 3 20.00
0-201-12345-X 4 20.00
0-201-12345-X 2 21.50
0-202-12345-X 2 25.50
0-203-12345-X 4 10.00
0-203-12345-X 5 13.00
0-204-12345-X 1 40.00
0-205-12345-X 6 2.00
0-205-12345-X 3 4.00
0-205-12345-X 5 3.00
0-206-12345-X 3 24.00

I've tried making the next call to GDB. It seems that he is taking it but the gdb is hanging.

c:\Users\usuario\workspace\tema1\Sales_item>gdb Sales_item
Reading symbols from     
c:\Users\usuario\workspace\tema1\Sales_item\Sales_item.exe...done.
(gdb) r <sales_item_in.txt
Starting program:     
 c:\Users\usuario\workspace\tema1\Sales_item/Sales_item.exe     <sales_item_in.txt
[New Thread 6072.0xa48]
**Aquí se queda colgado**

I also tried:

c:\Users\usuario\workspace\tema1\Sales_item>gdb --args Sales_item.exe  <sales_item_in.txt
c:\Users\usuario\workspace\tema1\Sales_item\Sales_item.exe...done.
(gdb) Undefined command: "0-201-12345-X".  Try "help".
(gdb) Undefined command: "0-201-12345-X".  Try "help".
(gdb) Undefined command: "0-201-12345-X".  Try "help".
(gdb) Undefined command: "0-202-12345-X".  Try "help".
(gdb) Undefined command: "0-203-12345-X".  Try "help".
(gdb) Undefined command: "0-203-12345-X".  Try "help".
(gdb) Undefined command: "0-204-12345-X".  Try "help".
(gdb) Undefined command: "0-205-12345-X".  Try "help".
(gdb) Undefined command: "0-205-12345-X".  Try "help".
(gdb) Undefined command: "0-205-12345-X".  Try "help".
(gdb) Undefined command: "0-206-12345-X".  Try "help".
(gdb) quit

 c:\Users\usuario\workspace\tema1\Sales_item>
    
asked by Jcpardo 13.06.2018 в 21:10
source

0 answers