This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/20038] list command displays wrong source at startup


https://sourceware.org/bugzilla/show_bug.cgi?id=20038

--- Comment #1 from Dennis Dumont <ddumont at securestate dot com> ---
(Actual source code from same section)
int main(int argc, char *argv[] ) {
/* Create socket pair for communication with server, and fork/exec the server
code */
  int ret;
  int fd[2];
  int clientfd[MAX_CLIENTS+1];
  int children[MAX_CLIENTS+1];
  int myChildren=0;
  char hostname[HOST_NAME_MAX];

  if( gethostname( hostname, HOST_NAME_MAX ) ) {
    fprintf(stderr, "Unable to retrieve hostname\n");
    return -1; 
  }
  get_hostid( hostname );

  pid_t pid;
  ret = socketpair( AF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK, 0, fd );
  if( ret < 0 ) {
    perror( "Unable to create initial socketpair for qrServer" );
    return -1;
  }
  pid = fork();
  if (pid == 0) {
    char arg[4];
    printf("Hit a key please: ");
    while( read(0,arg,1) < 1);
    bzero( arg, 4 );
    close(fd[1]);
    sprintf( arg, "%d", fd[0] );
    execl( "qrServer", "qrServer", arg, (char *)0);
  }
  children[0] = pid;
  close(fd[0]);
  clientfd[0] = fd[1];

/* Get current set of routes */
  int num_routes;
  num_routes = get_routes();

  if( argc > 1 ) {
    int i;
    for( i=2; i<=argc; ++i ) {
      char* serverIP = argv[i-1];
      int myClient[2];
      ret = socketpair( AF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK, 0, myClient );
      clientfd[i-1] = myClient[1];
      pid = fork();
      if (pid == 0) {
        char arg[4];
        bzero( arg, 4 );
        close(fd[1]);
        sprintf( arg, "%d", myClient[0] );
        execl( "qrClient", "qrClient", serverIP, arg, (char *)0);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]