From: paulbarker Date: Sun, 9 Sep 2007 11:51:08 +0000 (-0000) Subject: Changed gas parser to only pass the first cpp line marker onto the debugging module. X-Git-Tag: v0.6.2~5^2~4^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ac75ded37955b0a571d8577092db8eff4639e3ba;p=yasm Changed gas parser to only pass the first cpp line marker onto the debugging module. svn path=/branches/multiarch/; revision=1935 --- diff --git a/modules/parsers/gas/gas-parse.c b/modules/parsers/gas/gas-parse.c index 027de7db..2c402f15 100644 --- a/modules/parsers/gas/gas-parse.c +++ b/modules/parsers/gas/gas-parse.c @@ -86,7 +86,7 @@ get_peek_token(yasm_parser_gas *parser_gas) { char savech = parser_gas->tokch; if (parser_gas->peek_token != NONE) - yasm_internal_error(N_("only can have one token of lookahead")); + yasm_internal_error(N_("can only have one token of lookahead")); parser_gas->peek_token = gas_parser_lex(&parser_gas->peek_tokval, parser_gas); parser_gas->peek_tokch = parser_gas->tokch; @@ -324,14 +324,22 @@ cpp_line_marker(yasm_parser_gas *parser_gas) /* Set linemap. */ yasm_linemap_set(parser_gas->linemap, filename, line, 1); - /* Pass change along to debug format */ - yasm_vps_initialize(&vps); - vp = yasm_vp_create_string(NULL, filename); - yasm_vps_append(&vps, vp); + /* + The first line marker in the file (which should be on the first line + of the file) will give us the name of the source file. This information + needs to be passed on to the debug format module. + */ + if (parser_gas->seen_line_marker == 0) { + parser_gas->seen_line_marker = 1; - yasm_object_directive(p_object, ".file", "gas", &vps, NULL, cur_line); + yasm_vps_initialize(&vps); + vp = yasm_vp_create_string(NULL, filename); + yasm_vps_append(&vps, vp); - yasm_vps_delete(&vps); + yasm_object_directive(p_object, ".file", "gas", &vps, NULL, cur_line); + + yasm_vps_delete(&vps); + } /* Skip flags. */ while (1) { diff --git a/modules/parsers/gas/gas-parser.c b/modules/parsers/gas/gas-parser.c index 6d8aa998..521851cd 100644 --- a/modules/parsers/gas/gas-parser.c +++ b/modules/parsers/gas/gas-parser.c @@ -52,6 +52,7 @@ gas_parser_do_parse(yasm_object *object, yasm_preproc *pp, parser_gas.dir_fileline = 0; parser_gas.dir_file = NULL; parser_gas.dir_line = 0; + parser_gas.seen_line_marker = 0; parser_gas.preproc = pp; parser_gas.errwarns = errwarns; diff --git a/modules/parsers/gas/gas-parser.h b/modules/parsers/gas/gas-parser.h index bfae0a9d..eece2a23 100644 --- a/modules/parsers/gas/gas-parser.h +++ b/modules/parsers/gas/gas-parser.h @@ -107,6 +107,9 @@ typedef struct yasm_parser_gas { /*@null@*/ char *dir_file; unsigned long dir_line; + /* Have we seen a line marker? */ + int seen_line_marker; + /*@dependent@*/ yasm_preproc *preproc; /*@dependent@*/ yasm_errwarns *errwarns;