Print this page
11238 librtld_db demos should work with gcc 7


 152                         break;
 153                 }
 154 
 155         if (error || (optind == argc)) {
 156                 (void) printf("usage: %s [-f file] executable "
 157                     "[executable arguments ...]\n", command);
 158                 (void) printf("\t-f     command file\n");
 159                 exit(1);
 160         }
 161 
 162         /*
 163          * set up for tracing the child.
 164          */
 165         init_proc();
 166 
 167         /*
 168          * create a child to fork and exec from.
 169          */
 170         if ((cpid = fork()) == 0) {
 171                 (void) execv(argv[optind], &argv[optind]);
 172                 perr(argv[1]);
 173         }
 174 
 175         if (cpid == -1) /* fork() failure */
 176                 perr(command);
 177 
 178         /*
 179          * initialize libelf
 180          */
 181         if (elf_version(EV_CURRENT) == EV_NONE) {
 182                 (void) fprintf(stderr, "elf_version() failed: %s\n",
 183                     elf_errmsg(0));
 184                 exit(1);
 185         }
 186 
 187         /*
 188          * initialize librtld_db
 189          */
 190         if (rd_init(RD_VERSION) != RD_OK) {
 191                 (void) fprintf(stderr, "librtld_db::rd_init() failed: version "
 192                     "submitted: %d\n", RD_VERSION);




 152                         break;
 153                 }
 154 
 155         if (error || (optind == argc)) {
 156                 (void) printf("usage: %s [-f file] executable "
 157                     "[executable arguments ...]\n", command);
 158                 (void) printf("\t-f     command file\n");
 159                 exit(1);
 160         }
 161 
 162         /*
 163          * set up for tracing the child.
 164          */
 165         init_proc();
 166 
 167         /*
 168          * create a child to fork and exec from.
 169          */
 170         if ((cpid = fork()) == 0) {
 171                 (void) execv(argv[optind], &argv[optind]);
 172                 perr(argv[optind]);
 173         }
 174 
 175         if (cpid == -1) /* fork() failure */
 176                 perr(command);
 177 
 178         /*
 179          * initialize libelf
 180          */
 181         if (elf_version(EV_CURRENT) == EV_NONE) {
 182                 (void) fprintf(stderr, "elf_version() failed: %s\n",
 183                     elf_errmsg(0));
 184                 exit(1);
 185         }
 186 
 187         /*
 188          * initialize librtld_db
 189          */
 190         if (rd_init(RD_VERSION) != RD_OK) {
 191                 (void) fprintf(stderr, "librtld_db::rd_init() failed: version "
 192                     "submitted: %d\n", RD_VERSION);