summaryrefslogtreecommitdiff
path: root/src/cuda-sim/ptxinfo.l
diff options
context:
space:
mode:
authorMengchi Zhang <[email protected]>2019-05-23 22:44:37 -0400
committerMengchi Zhang <[email protected]>2019-05-24 00:47:28 -0400
commitdc835911d5320008b2c227722a90240a8f6b0f3a (patch)
treef3ab9f96fb1c50541709d7e5a6ce7d1305cc1b7d /src/cuda-sim/ptxinfo.l
parent579047c1dd9fec1b69e7904aeb6a25553c8dbd69 (diff)
Fix linebuf for ptxinfo
Signed-off-by: Mengchi Zhang <[email protected]>
Diffstat (limited to 'src/cuda-sim/ptxinfo.l')
-rw-r--r--src/cuda-sim/ptxinfo.l19
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(" ");
}