Print this page
10075 make usr/src/tools smatch clean


   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*




  27  * Routines used to read stabs data from a file, and to build a tdata structure
  28  * based on the interesting parts of that data.
  29  */
  30 
  31 #include <stdio.h>
  32 #include <stdlib.h>
  33 #include <fcntl.h>
  34 #include <unistd.h>
  35 #include <assert.h>
  36 #include <string.h>
  37 #include <libgen.h>
  38 #include <errno.h>
  39 #include <sys/types.h>
  40 #include <sys/param.h>
  41 
  42 #include "ctftools.h"
  43 #include "list.h"
  44 #include "stack.h"
  45 #include "memory.h"
  46 #include "traverse.h"


 311 
 312                 iidescp = NULL;
 313 
 314                 if ((rc = parse_stab(stab, fstr, &iidescp)) < 0) {
 315                         terminate("%s: Couldn't parse stab \"%s\" "
 316                             "(source file %s)\n", file, str, curhdr);
 317                 }
 318 
 319                 if (rc == 0)
 320                         goto parse_loop_end;
 321 
 322                 /* Make sure the scope tracking is working correctly */
 323                 assert(stab->n_type != N_FUN || (iidescp->ii_type != II_GFUN &&
 324                     iidescp->ii_type != II_SFUN) || scope == 0);
 325 
 326                 /*
 327                  * The only things we care about that are in local scope are
 328                  * the N_PSYM stabs.
 329                  */
 330                 if (scope && stab->n_type != N_PSYM) {
 331                         if (iidescp)
 332                                 iidesc_free(iidescp);
 333                         goto parse_loop_end;
 334                 }
 335 
 336                 switch (iidescp->ii_type) {
 337                 case II_SFUN:
 338                         iidescp->ii_owner = xstrdup(curfile);
 339                         /*FALLTHROUGH*/
 340                 case II_GFUN:
 341                         curfun = iidescp;
 342                         fnarg_free(iidescp);
 343                         iidesc_add(td->td_iihash, iidescp);
 344                         break;
 345 
 346                 case II_SVAR:
 347                         iidescp->ii_owner = xstrdup(curfile);
 348                         /*FALLTHROUGH*/
 349                 case II_GVAR:
 350                 case II_TYPE:
 351                 case II_SOU:




   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  * Copyright (c) 2018, Joyent, Inc.
  28  */
  29 
  30 /*
  31  * Routines used to read stabs data from a file, and to build a tdata structure
  32  * based on the interesting parts of that data.
  33  */
  34 
  35 #include <stdio.h>
  36 #include <stdlib.h>
  37 #include <fcntl.h>
  38 #include <unistd.h>
  39 #include <assert.h>
  40 #include <string.h>
  41 #include <libgen.h>
  42 #include <errno.h>
  43 #include <sys/types.h>
  44 #include <sys/param.h>
  45 
  46 #include "ctftools.h"
  47 #include "list.h"
  48 #include "stack.h"
  49 #include "memory.h"
  50 #include "traverse.h"


 315 
 316                 iidescp = NULL;
 317 
 318                 if ((rc = parse_stab(stab, fstr, &iidescp)) < 0) {
 319                         terminate("%s: Couldn't parse stab \"%s\" "
 320                             "(source file %s)\n", file, str, curhdr);
 321                 }
 322 
 323                 if (rc == 0)
 324                         goto parse_loop_end;
 325 
 326                 /* Make sure the scope tracking is working correctly */
 327                 assert(stab->n_type != N_FUN || (iidescp->ii_type != II_GFUN &&
 328                     iidescp->ii_type != II_SFUN) || scope == 0);
 329 
 330                 /*
 331                  * The only things we care about that are in local scope are
 332                  * the N_PSYM stabs.
 333                  */
 334                 if (scope && stab->n_type != N_PSYM) {

 335                         iidesc_free(iidescp);
 336                         goto parse_loop_end;
 337                 }
 338 
 339                 switch (iidescp->ii_type) {
 340                 case II_SFUN:
 341                         iidescp->ii_owner = xstrdup(curfile);
 342                         /*FALLTHROUGH*/
 343                 case II_GFUN:
 344                         curfun = iidescp;
 345                         fnarg_free(iidescp);
 346                         iidesc_add(td->td_iihash, iidescp);
 347                         break;
 348 
 349                 case II_SVAR:
 350                         iidescp->ii_owner = xstrdup(curfile);
 351                         /*FALLTHROUGH*/
 352                 case II_GVAR:
 353                 case II_TYPE:
 354                 case II_SOU: