summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Giesen <fabiang@radgametools.com>2016-04-28 13:48:16 -0700
committerCyrill Gorcunov <gorcunov@gmail.com>2016-05-10 12:01:32 +0300
commitc74a70988520bb25d5fbde22881f43c4e2b06603 (patch)
treeb689b88829c30ef79047b3567528b1bf4a848b39
parent142285ddd8e8d2cb08003198d7186db9d3286ac1 (diff)
downloadnasm-c74a70988520bb25d5fbde22881f43c4e2b06603.tar.gz
codeview: Call register_file only when producing line numbers
Previously, debug info would refer to the first file seen, even when it did not actually generate line numbers (e.g. segto=-1). Fix it so we only lock in the file name the first time we actually produce a line number record. Not as good as proper support for debug info referencing multiple source files but much more useful than the current behavior. Signed-off-by: Fabian Giesen <fabiang@radgametools.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--output/codeview.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/output/codeview.c b/output/codeview.c
index 56c46f2c..616f574b 100644
--- a/output/codeview.c
+++ b/output/codeview.c
@@ -169,9 +169,6 @@ static void cv8_linenum(const char *filename, int32_t linenumber,
struct coff_Section *s;
struct linepair *li;
- if (cv8_state.source_file.name == NULL)
- register_file(filename);
-
s = find_section(segto);
if (s == NULL)
return;
@@ -179,6 +176,9 @@ static void cv8_linenum(const char *filename, int32_t linenumber,
if ((s->flags & IMAGE_SCN_MEM_EXECUTE) == 0)
return;
+ if (cv8_state.source_file.name == NULL)
+ register_file(filename);
+
li = saa_wstruct(cv8_state.lines);
li->file_offset = cv8_state.text_offset;
li->linenumber = linenumber;