summaryrefslogtreecommitdiff
path: root/output/codeview.c
diff options
context:
space:
mode:
authorFabian Giesen <fabiang@radgametools.com>2016-04-28 13:48:16 -0700
committerCyrill Gorcunov <gorcunov@gmail.com>2016-04-30 16:01:30 +0300
commit6503051dcc360172c49311d586f2b9cf4ab2ea81 (patch)
tree4defd8799b668483d3361214f3a85f8f1d270ddf /output/codeview.c
parent5b838ef981ba49349ac05656bff335ac5feaba15 (diff)
downloadnasm-6503051dcc360172c49311d586f2b9cf4ab2ea81.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>
Diffstat (limited to 'output/codeview.c')
-rw-r--r--output/codeview.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/output/codeview.c b/output/codeview.c
index 0a382685..cfdd825f 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;