From b2fc784cbb1c2e65736cea88d61509d08fddd83f Mon Sep 17 00:00:00 2001 From: ElTantawy Date: Thu, 12 May 2016 13:36:03 -0700 Subject: initial support for cuda 7.5 parsing --- libcuda/cuobjdump.l | 60 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 15 deletions(-) (limited to 'libcuda/cuobjdump.l') diff --git a/libcuda/cuobjdump.l b/libcuda/cuobjdump.l index d7086ad..c86a861 100644 --- a/libcuda/cuobjdump.l +++ b/libcuda/cuobjdump.l @@ -52,8 +52,11 @@ void cuobjdump_error(const char*); %s ptxcode %s sasscode %s elfcode -%s header +%s elfheader +%s ptxheader %s endheader +%s identifier +%s identifierF alpha [a-zA-Z] numeric [0-9] @@ -67,16 +70,20 @@ newlines {newline}+ "ptxasOptions"{notnewline}*{newline} [1-9]{numeric}* yylval.string_value = strdup(yytext); return DECIMAL; +"has debug info"{newline} + "Fatbin ptx code:"{newline} { yy_push_state(ptxcode); - yy_push_state(header); + yy_push_state(identifier); + yy_push_state(ptxheader); yylval.string_value = strdup(yytext); return PTXHEADER; } "Fatbin elf code:"{newline} { yy_push_state(elfcode); - yy_push_state(header); + yy_push_state(identifier); + yy_push_state(elfheader); yylval.string_value = strdup(yytext); return ELFHEADER; } @@ -94,22 +101,45 @@ newlines {newline}+ /*SASS code tokens*/ {notnewline}*{newline} yylval.string_value = strdup(yytext); return SASSLINE; +"identifier = " BEGIN(identifierF); return H_IDENTIFIER; +"\n" yy_pop_state(); + +{notnewline}+ yylval.string_value = strdup(yytext); yy_pop_state(); return FILENAME; + + + + /*Header tokens*/ +[[:alnum:]_]+ yylval.string_value = strdup(yytext); return IDENTIFIER; +"================" return H_SEPARATOR; +"arch = " return H_ARCH; +"code version = " return H_CODEVERSION; +\[{numeric},{numeric}\] return CODEVERSION; +"producer = " return H_PRODUCER; +"" return H_UNKNOWN; +"host = " return H_HOST; +"compile_size = " BEGIN(endheader); return H_COMPILESIZE; + + /*Header tokens*/ -
[[:alnum:]_]+ yylval.string_value = strdup(yytext); return IDENTIFIER; -
"================" return H_SEPARATOR; -
"arch = " return H_ARCH; -
"code version = " return H_CODEVERSION; -
\[{numeric},{numeric}\] return CODEVERSION; -
"producer = " return H_PRODUCER; -
"host = " return H_HOST; -
"compile_size = " return H_COMPILESIZE; -
"compressed"{newline} -
"identifier = " BEGIN(endheader); return H_IDENTIFIER; -
"has debug info"{newline} +[[:alnum:]_]+ yylval.string_value = strdup(yytext); return IDENTIFIER; +"================" return H_SEPARATOR; +"arch = " return H_ARCH; +"code version = " return H_CODEVERSION; +\[{numeric},{numeric}\] return CODEVERSION; +"producer = " return H_PRODUCER; +"host = " return H_HOST; +"compile_size = " return H_COMPILESIZE; +"compressed"{newline} yy_pop_state(); return H_COMPRESSED; + + + + + /* Looking for the identifier (filename) then the header is done */ /* [[:alnum:]_\./]+ yylval.string_value = strdup(yytext); yy_pop_state(); return FILENAME; */ -{notnewline}+ yylval.string_value = strdup(yytext); yy_pop_state(); return FILENAME; +{notnewline}+ yylval.string_value = strdup(yytext); yy_pop_state(); return IDENTIFIER; + {newline} return NEWLINE; -- cgit v1.3