[nasm:debug-macros] debug: don't call dfmt->linenum without a filename
nasm-bot for H. Peter Anvin (Intel)
hpa at zytor.com
Thu Jul 9 21:15:03 PDT 2020
Commit-ID: 0d4ce8d7395e2a0850d21248b31f248834ad701a
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=0d4ce8d7395e2a0850d21248b31f248834ad701a
Author: H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Thu, 9 Jul 2020 21:10:42 -0700
Committer: H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Thu, 9 Jul 2020 21:10:42 -0700
debug: don't call dfmt->linenum without a filename
With -Lb, it is possible that we don't have a filename for the current
code expansion. In that case, suppress calling dfmt->linenum as some
debug backends *really* aren't equipped to handle that case.
Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>
---
asm/assemble.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/asm/assemble.c b/asm/assemble.c
index 270262ae..2c47ba58 100644
--- a/asm/assemble.c
+++ b/asm/assemble.c
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2019 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2020 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -401,11 +401,14 @@ static void out(struct out_data *data)
/*
* If the source location or output segment has changed,
- * let the debug backend know.
+ * let the debug backend know. Some backends really don't
+ * like being given a NULL filename as can happen if we
+ * use -Lb and expand a macro, so filter out that case.
*/
data->where = src_where();
- if (!src_location_same(data->where, dbg.where) |
- (data->segment != dbg.segment)) {
+ if (data->where.filename &&
+ (!src_location_same(data->where, dbg.where) |
+ (data->segment != dbg.segment))) {
dbg.where = data->where;
dbg.segment = data->segment;
dfmt->linenum(dbg.where.filename, dbg.where.lineno, data->segment);
More information about the Nasm-commits
mailing list