User forums > Using Code::Blocks
Howto debug applications which needs piped input on stdin?
Lambertus:
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.codeblocks.org/index.php/topic,5056.0.html
Thanks in advance.
oBFusCATed:
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.
Lambertus:
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?
oBFusCATed:
You can try a nightly build
Jenna:
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).
Navigation
[0] Message Index
[#] Next page
Go to full version