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@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2020-07-09 21:10:42 -07:00
parent 2f171ddeec
commit 0d4ce8d739

View file

@ -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);