st_parse.c (178546) | st_parse.c (210767) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 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/* | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 5 unchanged lines hidden (view full) --- 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. | 22 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
24 */ 25 | 23 */ 24 |
26#pragma ident "%Z%%M% %I% %E% SMI" 27 | |
28/* 29 * This file is a sewer. 30 */ 31 32#include <limits.h> 33#include <stdarg.h> 34#include <stdio.h> 35#include <assert.h> --- 440 unchanged lines hidden (view full) --- 476 return (NULL); 477} 478 479static char * 480whitesp(char *cp) 481{ 482 char c; 483 | 25/* 26 * This file is a sewer. 27 */ 28 29#include <limits.h> 30#include <stdarg.h> 31#include <stdio.h> 32#include <assert.h> --- 440 unchanged lines hidden (view full) --- 473 return (NULL); 474} 475 476static char * 477whitesp(char *cp) 478{ 479 char c; 480 |
484 for (c = *cp++; isspace(c); c = *cp++); | 481 for (c = *cp++; isspace(c); c = *cp++) 482 ; |
485 --cp; 486 return (cp); 487} 488 489static char * 490name(char *cp, char **w) 491{ 492 char *new, *orig, c; 493 int len; 494 495 orig = cp; 496 c = *cp++; 497 if (c == ':') 498 *w = NULL; | 483 --cp; 484 return (cp); 485} 486 487static char * 488name(char *cp, char **w) 489{ 490 char *new, *orig, c; 491 int len; 492 493 orig = cp; 494 c = *cp++; 495 if (c == ':') 496 *w = NULL; |
499 else if (isalpha(c) || strchr("_.$", c)) { 500 for (c = *cp++; isalnum(c) || strchr(" _.$", c); c = *cp++) | 497 else if (isalpha(c) || strchr("_.$#", c)) { 498 for (c = *cp++; isalnum(c) || strchr(" _.$#", c); c = *cp++) |
501 ; 502 if (c != ':') 503 reset(); 504 len = cp - orig; 505 new = xmalloc(len); 506 while (orig < cp - 1) 507 *new++ = *orig++; 508 *new = '\0'; --- 476 unchanged lines hidden (view full) --- 985 (*rtdp)->t_ardef = xcalloc(sizeof (ardef_t)); 986 (*rtdp)->t_ardef->ad_idxtype = lookup(h); 987 988 cp = number(cp, &start); /* lower */ 989 if (*cp++ != ';') 990 expected("arraydef/2", ";", cp - 1); 991 992 if (*cp == 'S') { | 499 ; 500 if (c != ':') 501 reset(); 502 len = cp - orig; 503 new = xmalloc(len); 504 while (orig < cp - 1) 505 *new++ = *orig++; 506 *new = '\0'; --- 476 unchanged lines hidden (view full) --- 983 (*rtdp)->t_ardef = xcalloc(sizeof (ardef_t)); 984 (*rtdp)->t_ardef->ad_idxtype = lookup(h); 985 986 cp = number(cp, &start); /* lower */ 987 if (*cp++ != ';') 988 expected("arraydef/2", ";", cp - 1); 989 990 if (*cp == 'S') { |
993 /* variable length array - treat as null dimensioned */ | 991 /* 992 * variable length array - treat as null dimensioned 993 * 994 * For VLA variables on sparc, SS12 generated stab entry 995 * looks as follows: 996 * .stabs "buf:(0,28)=zr(0,4);0;S-12;(0,1)", 0x80, 0, 0, -16 997 * Whereas SS12u1 generated stab entry looks like this: 998 * .stabs "buf:(0,28)=zr(0,4);0;S0;(0,1)", 0x80, 0, 0, 0 999 * On x86, both versions generate the first type of entry. 1000 * We should be able to parse both. 1001 */ |
994 cp++; | 1002 cp++; |
995 if (*cp++ != '-') 996 expected("arraydef/fpoff-sep", "-", cp - 1); | 1003 if (*cp == '-') 1004 cp++; |
997 cp = number(cp, &end); 998 end = start; 999 } else { | 1005 cp = number(cp, &end); 1006 end = start; 1007 } else { |
1000 /* normal fixed-dimension array */ | 1008 /* 1009 * normal fixed-dimension array 1010 * Stab entry for this looks as follows : 1011 * .stabs "x:(0,28)=ar(0,4);0;9;(0,3)", 0x80, 0, 40, 0 1012 */ |
1001 cp = number(cp, &end); /* upper */ 1002 } 1003 1004 if (*cp++ != ';') 1005 expected("arraydef/3", ";", cp - 1); 1006 (*rtdp)->t_ardef->ad_nelems = end - start + 1; 1007 cp = tdefdecl(cp, h, &((*rtdp)->t_ardef->ad_contents)); 1008 --- 190 unchanged lines hidden --- | 1013 cp = number(cp, &end); /* upper */ 1014 } 1015 1016 if (*cp++ != ';') 1017 expected("arraydef/3", ";", cp - 1); 1018 (*rtdp)->t_ardef->ad_nelems = end - start + 1; 1019 cp = tdefdecl(cp, h, &((*rtdp)->t_ardef->ad_contents)); 1020 --- 190 unchanged lines hidden --- |