Is it possible to debug an application that needs piped input on stdin using CB? If so, how?
Example: I would like to debug the application Gosmore using the following commandline in CB:
bzcat europe.osm.bz2 | ./gosmore rebuild
I've searched the forum and wiki but could only find the following topic from 2007: http://forums.next.codeblocks.org/index.php/topic,5056.0.html
Thanks in advance.
The only way I know is to attach to the program after it has started. (Debug -> Attach to process)
You can put a sleep in the beginning of the program, so attaching would be easier.
Thanks for your tip. Attaching to the process seems to work but continuing the debugger always kills the process resulting in something like this:
Build succeeded
Starting debugger:
done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Reading symbols from /usr/lib/libxml2.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/libstdc++.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/libgcc_s.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/libdl.so.2...(no debugging symbols found)...done.
Reading symbols from /lib/libz.so.1...(no debugging symbols found)...done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
In read () (/lib/libc.so.6)
Debugger name and version: GNU gdb (GDB) 7.1-ubuntu
Continuing...
Program exited with code 010.
Debugger finished with status 0
This happens all the time (CB 8.02) when I use 'Continue' no matter at which part of the code these options are used and even if there is a breakpoint at the next line of code. The option 'Run to cursor' seems to work a little bit better (but only sometimes and only for a few lines of code) while on the other hand, just stepping through the code with 'next line', 'step-into' and 'step-out' seems to work OK.
As this applications processes a lot of data, just stepping through is not an option, I would really like to use breakpoints. Any ideas on howto fix this?
You can try a nightly build
There is a possible workaround:
In postbuild-step add bzcat europe.osm.bz2 > europe.osm,
and add < europe.osm as program argument in "Project -> Set programs's arguments..." for the used target.
This should work if europe.osm.bz2 is in the Execution working dir of the target, otherwise you have to fix the path(s).
Quote from: jens on May 01, 2010, 01:12:33 PM
There is a possible workaround:
In postbuild-step add bzcat europe.osm.bz2 > europe.osm,
and add < europe.osm as program argument in "Project -> Set programs's arguments..." for the used target.
This should work if europe.osm.bz2 is in the Execution working dir of the target, otherwise you have to fix the path(s).
Thanks, the "<" bit was very useful, I didn't think of it earlier. So actually its even simpler: unpack the europe.osm.bz2 outside CB just once and just add
rebuild < europe.osmto the program's arguments...
Thanks a lot!