diff options
| author | Mengchi Zhang <[email protected]> | 2019-05-24 11:02:45 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-05-24 11:02:45 -0400 |
| commit | 112e85e32c08e9fa0a34bb0ec262d8e95df61e6b (patch) | |
| tree | d989c1dc4f701171e92d45bda507d953c311554f /src/cuda-sim/ptxinfo.l | |
| parent | ab1221c14fa548404d4012f30399cb23a892f30c (diff) | |
| parent | dc835911d5320008b2c227722a90240a8f6b0f3a (diff) | |
Merge pull request #4 from echoedit/dev
Fix linebuf for ptxinfo
Diffstat (limited to 'src/cuda-sim/ptxinfo.l')
| -rw-r--r-- | src/cuda-sim/ptxinfo.l | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/cuda-sim/ptxinfo.l b/src/cuda-sim/ptxinfo.l index a190e6d..92f7a30 100644 --- a/src/cuda-sim/ptxinfo.l +++ b/src/cuda-sim/ptxinfo.l @@ -36,14 +36,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %option reentrant %{ +#include "ptx_loader.h" #include "ptxinfo.tab.h" #include <string.h> #define LINEBUF_SIZE 1024 -#define TC if( (yylineno == 1) && (yylval->col + strlen(yytext) < LINEBUF_SIZE) ) { \ - strncpy(yylval->linebuf+yylval->col,yytext,strlen(yytext)); \ +#define TC if( (yylineno == 1) && (ptxinfo->col + strlen(yytext) < LINEBUF_SIZE) ) { \ + strncpy(ptxinfo->linebuf+ptxinfo->col,yytext,strlen(yytext)); \ } \ - yylval->col+=strlen(yytext); + ptxinfo->col+=strlen(yytext); +#define YY_DECL int ptxinfo_lex \ + (YYSTYPE * yylval_param , yyscan_t yyscanner, ptxinfo_data* ptxinfo) %} %% @@ -80,7 +83,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. " " TC; "\t" TC; -\n.* yylval->col=0; strncpy(yylval->linebuf, yytext + 1, 1024); yyless( 1 ); +\n.* ptxinfo->col=0; strncpy(ptxinfo->linebuf, yytext + 1, 1024); yyless( 1 ); %% @@ -88,7 +91,7 @@ extern int g_ptxinfo_error_detected; extern const char *g_filename; extern const char *g_ptxinfo_filename; -int ptxinfo_error(yyscan_t yyscanner, const char* msg) +int ptxinfo_error(yyscan_t yyscanner, ptxinfo_data* ptxinfo, const char* msg) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; int i; @@ -97,10 +100,10 @@ int ptxinfo_error(yyscan_t yyscanner, const char* msg) printf("GPGPU-Sim: ERROR while parsing output of ptxas (used to capture resource usage information)\n"); if( msg != NULL ) printf("GPGPU-Sim: %s (%s:%u) Syntax error:\n\n", g_filename, g_ptxinfo_filename, yylineno ); - printf(" %s\n", yylval->linebuf ); + printf(" %s\n", ptxinfo->linebuf ); printf(" "); - for( i=0; i < yylval->col-1; i++ ) { - if( yylval->linebuf[i] == '\t' ) printf("\t"); + for( i=0; i < ptxinfo->col-1; i++ ) { + if( ptxinfo->linebuf[i] == '\t' ) printf("\t"); else printf(" "); } |
