Bug 16953 - New inferior for each rerun of a simple fork/exec of hello, where hello binary is missing.
Summary: New inferior for each rerun of a simple fork/exec of hello, where hello binar...
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-16 17:48 UTC by dje
Modified: 2014-05-16 17:48 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dje 2014-05-16 17:48:33 UTC
fork-exec-hello.c:

#include <stdlib.h>
#include <unistd.h>
#include <wait.h>

const char hello[] = "./hello.x64";

int
main ()
{
  int child;
  int status;

  child = fork ();
  if (child < 0)
    {
      perror ("fork");
      exit (1);
    }

  if (child == 0)
    {
      execl (hello, hello, NULL);
      perror ("execl");
    }
  else
    {
      waitpid (child, &status, 0);
    }

  return 0;
}

hello.c:

well, you know ...

With hello.x64 binary missing:

(gdb) set follow-fork child
(gdb) r
Starting program: /home/dje/src/play/fork-exec-hello.x64
[New process 6671]
execl: No such file or directory
[Inferior 2 (process 6671) exited normally]
(gdb) i inf
  Num  Description       Executable
* 2    <null>            /home/dje/src/play/fork-exec-hello.x64
  1    <null>            /home/dje/src/play/fork-exec-hello.x64
(gdb) r
Starting program: /home/dje/src/play/fork-exec-hello.x64
[New process 6674]
execl: No such file or directory
[Inferior 3 (process 6674) exited normally]
(gdb) i inf
  Num  Description       Executable
* 3    <null>            /home/dje/src/play/fork-exec-hello.x64
  2    <null>            /home/dje/src/play/fork-exec-hello.x64
  1    <null>            /home/dje/src/play/fork-exec-hello.x64
(gdb) r
Starting program: /home/dje/src/play/fork-exec-hello.x64
[New process 6677]
execl: No such file or directory
[Inferior 4 (process 6677) exited normally]
(gdb) i inf
  Num  Description       Executable
* 4    <null>            /home/dje/src/play/fork-exec-hello.x64
  3    <null>            /home/dje/src/play/fork-exec-hello.x64
  2    <null>            /home/dje/src/play/fork-exec-hello.x64
  1    <null>            /home/dje/src/play/fork-exec-hello.x64
(gdb)