Find the answer to your Linux question:
Results 1 to 2 of 2
I want to spawn a GDB session from bash script and keep it working to interact it from outside. But when I start it in background (with '&' sigil) Code: ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Apr 2010
    Location
    Novosibirsk, Russia
    Posts
    145

    Question Gdb terminates when spawned from shell


    I want to spawn a GDB session from bash script and keep it working to interact it from outside. But when I start it in background (with '&' sigil)

    Code:
    gdb -x gdb_script.txt ./a.out < gdb_pipe.fifo &
    It executes passed script and terminates by itself (I do not pass any data or signals to it)

    Code:
    Breakpoint 33, main (argc=1, argv=0xbffff0f4) at main.c:53
    ---Type <return> to continue, or q <return> to quit---53          read_main_config();
    (gdb) quit
    A debugging session is active.
    
            Inferior 1 [process 5957] will be killed.
    
    Quit anyway? (y or n) [answered Y; input not from terminal]
    What can I do to make it alive?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,598
    GDB has to run in the foreground, unless you redirect stdin, stdout, and stderr.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •