debugging - Use GDB to debug a C++ program called from a shell script -


i have extremely complicated shell script, within calls c++ program want debug via gdb. extremely hard separate c++ program shell since has lot of branches , lot of environmental variables setting.

is there way invoke gdb on shell script? looks gdb requires me call on c++ program directly.

there 2 options can do:

  1. invoke gdb directly within shell script. imply don't have standard in , standard out redirected.

  2. run shell script , attach debugger running c++ process so: gdb progname 1234 1234 process id of running c++ process.

if need things before program starts running option 1 better choice, otherwise option 2 cleaner way.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -